Fix preselection
The preselected item is not searched for if the range of days is changed (day_changed = 1). The patch is meant to future-proof the selected-item-algorithm and is backwards compatible. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
parent
71c34ac7f9
commit
852e363271
@ -49,11 +49,12 @@ int count, reg;
|
|||||||
*/
|
*/
|
||||||
static void do_storage(int day_changed)
|
static void do_storage(int day_changed)
|
||||||
{
|
{
|
||||||
|
int pre_sel;
|
||||||
/*
|
/*
|
||||||
* Save the selected item before rebuilding the day vector -
|
* Save the selected item before rebuilding the day vector -
|
||||||
* unless already set.
|
* unless a preselection is already set.
|
||||||
*/
|
*/
|
||||||
if (!day_check_sel_data())
|
if (!(pre_sel = day_check_sel_data()))
|
||||||
day_set_sel_data(ui_day_get_sel());
|
day_set_sel_data(ui_day_get_sel());
|
||||||
|
|
||||||
if (!day_changed)
|
if (!day_changed)
|
||||||
@ -64,7 +65,7 @@ static void do_storage(int day_changed)
|
|||||||
/* The APP listbox. */
|
/* The APP listbox. */
|
||||||
ui_day_load_items();
|
ui_day_load_items();
|
||||||
|
|
||||||
if (day_changed)
|
if (day_changed && !pre_sel)
|
||||||
ui_day_sel_reset();
|
ui_day_sel_reset();
|
||||||
else
|
else
|
||||||
ui_day_find_sel();
|
ui_day_find_sel();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user