aboutsummaryrefslogtreecommitdiffstats
path: root/src/calcurse.c
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2018-09-11 18:16:02 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2018-10-21 20:02:57 +0200
commit2339d78cbd562319473a34a36390378df64ade00 (patch)
treebd037647db17b9b71f45d839b7f3e1250e38e6e1 /src/calcurse.c
parentc95dd0e68581db4550beb5748511f9e4ef79b54e (diff)
downloadcalcurse-2339d78cbd562319473a34a36390378df64ade00.tar.gz
calcurse-2339d78cbd562319473a34a36390378df64ade00.zip
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>
Diffstat (limited to 'src/calcurse.c')
-rw-r--r--src/calcurse.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index 16d979f..0f6b69a 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -509,7 +509,11 @@ static inline void key_generic_scroll_down(void)
static inline void key_generic_quit(void)
{
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)
note_gc();
@@ -544,7 +548,12 @@ static inline void key_generic_cmd(void)
if (!strcmp(cmd_name, "write") || !strcmp(cmd_name, "w") ||
!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;
}
if (!strcmp(cmd_name, "quit") || !strcmp(cmd_name, "q") ||