diff options
author | Lars Henriksen <LarsHenriksen@get2net.dk> | 2020-02-07 20:10:49 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2020-04-28 07:32:44 -0400 |
commit | 852e36327112d804db62fdc5d2a34fd5eb21f88e (patch) | |
tree | 23343ede38726fcd26dead9de04908af4c692547 /src | |
parent | 71c34ac7f9670a9c4cc2e9e38e3b231e6b855d4e (diff) | |
download | calcurse-852e36327112d804db62fdc5d2a34fd5eb21f88e.tar.gz calcurse-852e36327112d804db62fdc5d2a34fd5eb21f88e.zip |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/calcurse.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/calcurse.c b/src/calcurse.c index 1f0696d..3d8905f 100644 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -49,11 +49,12 @@ int count, reg; */ static void do_storage(int day_changed) { + int pre_sel; /* * 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()); if (!day_changed) @@ -64,7 +65,7 @@ static void do_storage(int day_changed) /* The APP listbox. */ ui_day_load_items(); - if (day_changed) + if (day_changed && !pre_sel) ui_day_sel_reset(); else ui_day_find_sel(); |