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>
This commit is contained in:
Lukas Fleischer 2014-07-18 09:14:09 +02:00
parent e9d4d3c505
commit 8d9e4c6102

View File

@ -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)