summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2014-07-18 09:14:09 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2014-07-18 09:16:45 +0200
commit8d9e4c61021fdbcf9fdfeb559e52bf03c1978971 (patch)
tree67dbbbd0d5cc4b6ae9bb6258f6caa9ecd5e49d24 /src
parente9d4d3c505114114366cc0102ee92ce2e0d779dc (diff)
downloadcalcurse-8d9e4c61021fdbcf9fdfeb559e52bf03c1978971.zip
Always fix selection in listbox_load_items()
Since commit 80a7267 (Fix selection in listbox_load_items(), 2014-07-18), listbox_fix_sel() is called if the selection is out of range after loading the new set of items. However, we should *always* fix the selection to make sure the selection doesn't move to a caption row when reloading items. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src')
-rw-r--r--src/listbox.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/listbox.c b/src/listbox.c
index a109b7f..98c1ee6 100644
--- a/src/listbox.c
+++ b/src/listbox.c
@@ -108,13 +108,11 @@ void listbox_load_items(struct listbox *lb, int item_count)
wins_scrollwin_set_linecount(&(lb->sw), ch);
- if (item_count > 0 && lb->item_sel < 0) {
+ if (item_count > 0 && lb->item_sel < 0)
lb->item_sel = 0;
- listbox_fix_sel(lb, 1);
- } else if (lb->item_sel >= item_count) {
+ else if (lb->item_sel >= item_count)
lb->item_sel = item_count - 1;
- listbox_fix_sel(lb, -1);
- }
+ listbox_fix_sel(lb, 1);
}
void listbox_draw_deco(struct listbox *lb, int hilt)