Quit, autosave and interactive save

Quitting calcurse with auto_save on may lead to an interactive conflict
resolution for the save operation. When the result is a cancellation of the
save, the quit command is also cancelled.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen 2018-09-11 18:16:02 +02:00 committed by Lukas Fleischer
parent c95dd0e685
commit 2339d78cbd

View File

@ -509,7 +509,11 @@ static inline void key_generic_scroll_down(void)
static inline void key_generic_quit(void) static inline void key_generic_quit(void)
{ {
if (conf.auto_save) if (conf.auto_save)
io_save_cal(interactive); if (io_save_cal(interactive) == IO_SAVE_CANCEL) {
/* Cancel quit as well. */
wins_update(FLAG_STA);
return;
}
if (conf.auto_gc) if (conf.auto_gc)
note_gc(); note_gc();
@ -544,7 +548,12 @@ static inline void key_generic_cmd(void)
if (!strcmp(cmd_name, "write") || !strcmp(cmd_name, "w") || if (!strcmp(cmd_name, "write") || !strcmp(cmd_name, "w") ||
!strcmp(cmd_name, "wq")) { !strcmp(cmd_name, "wq")) {
io_save_cal(interactive); if (io_save_cal(interactive) == IO_SAVE_CANCEL &&
strcmp(cmd_name, "wq") == 0) {
/* Cancel quit as well. */
wins_update(FLAG_STA);
return;
}
valid = 1; valid = 1;
} }
if (!strcmp(cmd_name, "quit") || !strcmp(cmd_name, "q") || if (!strcmp(cmd_name, "quit") || !strcmp(cmd_name, "q") ||