From: Raphaƫl Droz Date: Thu, 18 Apr 2013 15:03:24 +0000 (+0200) Subject: mouse: improve to new scrolling method implemented in 775cf2c X-Git-Tag: upstream/0.6.1~2^2~18 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=d8a021c6625ec3a961ec35dc4f3275b3ffbd7ab9;p=pkg%2Fabook.git mouse: improve to new scrolling method implemented in 775cf2c If the viewport reaches the top/bottom list limit, then further scroll makes the cursor to move instead of the viewport. --- diff --git a/list.c b/list.c index 7357467..1f0af79 100644 --- a/list.c +++ b/list.c @@ -357,8 +357,13 @@ scroll_down() void scroll_list_up() { - if(first_list_item <= 0) + if(first_list_item <= 0) { + if(curitem != 0) { + curitem--; + refresh_list(); + } return; + } first_list_item -= scroll_speed; if(first_list_item < 0) { @@ -374,12 +379,17 @@ scroll_list_up() void scroll_list_down() { - if(first_list_item > db_n_items() - 2) + if(LAST_LIST_ITEM > db_n_items() - 2) { + if(curitem < LAST_LIST_ITEM) { + curitem++; + refresh_list(); + } return; + } first_list_item += scroll_speed; - if(first_list_item >= db_n_items()) { - first_list_item = db_n_items() - 1; + if(LAST_LIST_ITEM > db_n_items() - 1) { + first_list_item = db_n_items() - LIST_LINES; } if(curitem < first_list_item) { curitem = first_list_item;