From d655031a8f01bb0cb609efd816d48c90d5b4f42e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ed=C3=AAnis=20Freindorfer=20Azevedo?= Date: Mon, 10 Jun 2019 21:40:41 -0300 Subject: [PATCH] Fix removing multiple system keys shortcuts. Whenever users try to remove the system keys shortcuts, the configuration file is overwritten and only records the last erase. For example, if we wish to remove all the auto{A,B,L,R} keys at once, we get the following writes on the configuration file: NOOP=ALT+1,ALT+2,ALT+3,ALT+4 NOOP=ALT+2,ALT+3,ALT+4 NOOP=ALT+3,ALT+4 NOOP=ALT+4 Only `NOOP=ALT+4` stays for the following execution. --- src/wx/opts.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wx/opts.cpp b/src/wx/opts.cpp index 2713614e..42387b6c 100644 --- a/src/wx/opts.cpp +++ b/src/wx/opts.cpp @@ -762,9 +762,11 @@ void update_opts() if (gopts.accels.size()) cfg->SetPath(wxT("/Keyboard")); + int cmd_id = -1; for (wxAcceleratorEntry_v::iterator i = gopts.accels.begin(); i < gopts.accels.end(); ++i) { - int cmd_id = i->GetCommand(); + if (cmd_id == i->GetCommand()) continue; + cmd_id = i->GetCommand(); int cmd; for (cmd = 0; cmd < ncmds; cmd++)