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>
This commit is contained in:
Morgan Seltzer
2021-06-28 16:49:00 -04:00
committed by Lukas Fleischer
parent ec38714bbc
commit a1d2faab26
4 changed files with 72 additions and 66 deletions

View File

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