diff --git a/src/config.c b/src/config.c index 0de69de70..98923d9cf 100644 --- a/src/config.c +++ b/src/config.c @@ -1774,9 +1774,12 @@ load_keybinds(void) /* Now load values from config */ for (int x = 0; x < NUM_ACCELS; x++) { - p = ini_section_get_string(cat, acc_keys[x].name, "none"); + p = ini_section_get_string(cat, acc_keys[x].name, "default"); + /* Check if the binding was marked as cleared */ + if (strcmp(p, "none") == 0) + acc_keys[x].seq[0] = '\0'; /* If there's no binding in the file, leave it alone. */ - if (strcmp(p, "none") != 0) { + else if (strcmp(p, "default") != 0) { /* It would be ideal to validate whether the user entered a valid combo at this point, but the Qt method for testing that is @@ -2527,6 +2530,9 @@ save_keybinds(void) /* Has accelerator been changed from default? */ if (strcmp(def_acc_keys[x].seq, acc_keys[x].seq) == 0) ini_section_delete_var(cat, acc_keys[x].name); + /* Check for a cleared binding to avoid saving it as an empty string */ + else if (acc_keys[x].seq[0] == '\0') + ini_section_set_string(cat, acc_keys[x].name, "none"); else ini_section_set_string(cat, acc_keys[x].name, acc_keys[x].seq); }