From 10f5576ecfc8562adbe8b1f2c943b22ba609ba16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ed=C3=AAnis=20Freindorfer=20Azevedo?= Date: Fri, 13 Sep 2019 14:18:04 -0300 Subject: [PATCH] Fix config file when removing system accels. We assign the `NOOP` id for every command disabled by the user, but not the command name (just `NOOP`). When updating the configuration file, any command with `NOOP` id is valid, even if the label does not match `NOOP`. Hence this weird issue. - Fix #502. --- src/wx/opts.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wx/opts.cpp b/src/wx/opts.cpp index 55744c7e..6849791f 100644 --- a/src/wx/opts.cpp +++ b/src/wx/opts.cpp @@ -803,6 +803,11 @@ void update_opts() if (cmdtab[cmd].cmd_id == cmd_id) break; + // NOOP overwrittes commands removed by the user + wxString command = cmdtab[cmd].cmd; + if (cmdtab[cmd].cmd_id == XRCID("NOOP")) + command = wxT("NOOP"); + wxAcceleratorEntry_v::iterator j; for (j = i + 1; j < gopts.accels.end(); ++j) @@ -812,8 +817,8 @@ void update_opts() wxAcceleratorEntry_v nv(i, j); wxString nvs = wxKeyTextCtrl::ToString(nv); - if (nvs != cfg->Read(cmdtab[cmd].cmd)) - cfg->Write(cmdtab[cmd].cmd, nvs); + if (nvs != cfg->Read(command)) + cfg->Write(command, nvs); } cfg->SetPath(wxT("/"));