diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-11-18 22:03:18 +0100 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-11-18 22:48:34 +0100 |
commit | 2cd7d7e175f01b5f3c148265062d377a92a6f960 (patch) | |
tree | 9f8c29945b93b7f702eebdfa41f56c3fa28cbdf7 /src/calcurse.c | |
parent | 8fd6640caf1961c71c66a9c559f340d86cf17893 (diff) | |
download | calcurse-2cd7d7e175f01b5f3c148265062d377a92a6f960.zip |
calcurse.c: Pull out key_generic_goto_today()
Split out key_generic_goto_today() into a separate function. This
simplifies the control flow and supersedes the "key" parameter in
key_generic_goto().
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/calcurse.c')
-rw-r--r-- | src/calcurse.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/calcurse.c b/src/calcurse.c index b3b9098..6a91e74 100644 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -89,10 +89,16 @@ static inline void key_generic_goto(int key) { wins_erase_status_bar(); calendar_set_current_date(); - if (key == KEY_GENERIC_GOTO_TODAY) - calendar_goto_today(); - else - calendar_change_day(conf.input_datefmt); + calendar_change_day(conf.input_datefmt); + inday = do_storage(1); + wins_update(FLAG_CAL | FLAG_APP | FLAG_STA); +} + +static inline void key_generic_goto_today(int key) +{ + wins_erase_status_bar(); + calendar_set_current_date(); + calendar_goto_today(); inday = do_storage(1); wins_update(FLAG_CAL | FLAG_APP | FLAG_STA); } @@ -565,7 +571,7 @@ int main(int argc, char **argv) HANDLE_KEY(KEY_GENERIC_CHANGE_VIEW, key_generic_change_view); HANDLE_KEY(KEY_GENERIC_OTHER_CMD, key_generic_other_cmd); HANDLE_KEY(KEY_GENERIC_GOTO, key_generic_goto); - HANDLE_KEY(KEY_GENERIC_GOTO_TODAY, key_generic_goto); + HANDLE_KEY(KEY_GENERIC_GOTO_TODAY, key_generic_goto_today); HANDLE_KEY(KEY_VIEW_ITEM, key_view_item); HANDLE_KEY(KEY_GENERIC_CONFIG_MENU, key_generic_config_menu); HANDLE_KEY(KEY_GENERIC_ADD_APPT, key_generic_add_appt); |