summaryrefslogtreecommitdiff
path: root/xC.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-08-26 04:59:25 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-08-27 09:15:38 +0200
commit03d8ea4c5ae9d33fc0bb06040b66bae02bd9eae6 (patch)
tree6094d7859ba8e443448645e3e929acdecfc959d4 /xC.c
parentdc002a2db47bb8e9c513ea834c52ebc72441eca9 (diff)
downloadxK-03d8ea4c5ae9d33fc0bb06040b66bae02bd9eae6.tar.gz
xK-03d8ea4c5ae9d33fc0bb06040b66bae02bd9eae6.tar.xz
xK-03d8ea4c5ae9d33fc0bb06040b66bae02bd9eae6.zip
xC: general.save_on_quit -> general.autosave
Power outages and similar situations make the former unreliable, so get rid of any false promise it might seem to give.
Diffstat (limited to 'xC.c')
-rw-r--r--xC.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/xC.c b/xC.c
index d4efc2a..535fbd9 100644
--- a/xC.c
+++ b/xC.c
@@ -2422,8 +2422,8 @@ static struct config_schema g_config_server[] =
static struct config_schema g_config_general[] =
{
- { .name = "save_on_quit",
- .comment = "Save configuration before quitting",
+ { .name = "autosave",
+ .comment = "Save configuration automatically after each change",
.type = CONFIG_ITEM_BOOLEAN,
.default_ = "on" },
{ .name = "debug_mode",
@@ -11363,6 +11363,8 @@ static bool
handle_command_set_assign
(struct app_context *ctx, struct strv *all, char *arguments)
{
+ hard_assert (all->len > 0);
+
char *op = cut_word (&arguments);
bool add = false;
bool remove = false;
@@ -11397,6 +11399,9 @@ handle_command_set_assign
free (key);
}
config_item_destroy (new_);
+
+ if (get_config_boolean (ctx->config.root, "general.autosave"))
+ save_configuration (ctx);
return true;
}
@@ -14748,9 +14753,6 @@ main (int argc, char *argv[])
CALL (ctx.input, stop);
- if (get_config_boolean (ctx.config.root, "general.save_on_quit"))
- save_configuration (&ctx);
-
app_context_free (&ctx);
toggle_bracketed_paste (false);
free_terminal ();