From d8a021c6625ec3a961ec35dc4f3275b3ffbd7ab9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Droz?= Date: Thu, 18 Apr 2013 17:03:24 +0200 Subject: [PATCH] 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. --- list.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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; -- 2.39.2