From d7777ed44e085ee809688379aef96dc05883b2fa Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Sat, 25 Aug 2018 19:29:12 +0200 Subject: A save refinement: no action if everything is unchanged A reload action will do nothing if in-memory data as well as data files are unchanged. This commit accomplishes the equivalent for a save action. Because saving of configuration data and key bindings are mixed up with saving of data files, any changes in those will only be saved if data files also have changed. Hence, configuration data and key bindings are also saved upon exit from the configuration menu. Signed-off-by: Lars Henriksen Signed-off-by: Lukas Fleischer --- src/io.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/io.c') diff --git a/src/io.c b/src/io.c index d21b1fc..1ca2c2f 100644 --- a/src/io.c +++ b/src/io.c @@ -586,8 +586,12 @@ int io_save_cal(enum save_display display) if (read_only) return IO_SAVE_CANCEL; - if (new_data() && (ret = resolve_save_conflict())) - return ret; + if (new_data()) { + if ((ret = resolve_save_conflict())) + return ret; + } else + if (!io_get_modified()) + return IO_SAVE_CANCEL; run_hook("pre-save"); io_mutex_lock(); -- cgit v1.2.3-54-g00ecf