diff options
author | Morgan Seltzer <MorganSeltzer000@gmail.com> | 2021-06-28 16:49:00 -0400 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2022-04-03 12:24:55 -0400 |
commit | a1d2faab2635db144e0dfc0654be54bff6d159c0 (patch) | |
tree | 3406c92d7d6131b06b6437185f6e0fc09c57a1d1 /src/day.c | |
parent | ec38714bbc81c765990bcab2f6c3772e54eb2c75 (diff) | |
download | calcurse-a1d2faab2635db144e0dfc0654be54bff6d159c0.tar.gz calcurse-a1d2faab2635db144e0dfc0654be54bff6d159c0.zip |
Layout change recognizes changed appointment space
Before a layout change did not update the maximum number of appointments
visible, until the config menu was exited. Now the maximum number of
appointments are visible immediately after the layout screen is exited.
Addresses GitHub issue #381
Signed-off-by: Morgan Seltzer <MorganSeltzer000@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/day.c')
-rw-r--r-- | src/day.c | 34 |
1 files changed, 33 insertions, 1 deletions
@@ -58,7 +58,7 @@ static struct day_item sel_data = { 0, 0, 0, {NULL}}; /* * Save the item to become the selected APP item. - * Public function used to override the setting in do_storage(). + * Public function used to override the setting in day_do_storage(). */ int day_set_sel_data(struct day_item *d) { @@ -578,6 +578,38 @@ void day_write_stdout(time_t date, const char *fmt_apt, const char *fmt_rapt, } } +/* + * Store events and appointments for a range of days in the day vector - + * beginning with the selected day - and load them into the APP listbox. If no + * day-change occurs, reset the selected APP item and with it the selected day, + * thereby storing and loading the same range of days. + */ +void day_do_storage(int day_changed) +{ + int pre_sel; + /* + * Save the selected item before rebuilding the day vector - + * unless a preselection is already set. + */ + if(!(pre_sel = day_check_sel_data())) + day_set_sel_data(ui_day_get_sel()); + + if (!day_changed) + ui_day_sel_reset(); + + /* The day_items vector. */ + day_store_items(get_slctd_day(), 1, day_get_days()); + /* The APP listbox. */ + ui_day_load_items(); + + if (day_changed && !pre_sel) + ui_day_sel_reset(); + else + ui_day_find_sel(); + + day_set_sel_data(&empty_day); +} + /* Display an item inside a popup window. */ void day_popup_item(struct day_item *day) { |