Bug #19075 2013-08-01 09:45

sorinev

Keyboard Shortcuts, added combinations do not persist

Settings -> Editor -> Keyboard Shortcuts -> File -> Close File

The default is ctrl + w. When adding a second combination - ctrl + f4 for example - the combination persists through the current session. Once codeblocks is closed and then restarted however, the new combination no longer functions and is missing from the Keyboard Shortcut listing.

More info:

http://forums.codeblocks.org/index.php/topic,18189.0.html

Category
Application::Editor
Group
Platform:Windows
Status
Open
Close date
 
Assigned to
 
trivia21 2013-10-20 15:27

I had the same problem. I've found the solution as well.

When the KeyBinder plugin loads shortcuts from the configuration file, it fails to load the ones with negative IDs, because the separator character is "-" as well.

I'm not sure how to create patches for svn, please forgive me for giving the required modifications at revision 9413 here:

File: /trunk/src/plugins/contrib/keybinder/keybinder.cpp

Line: 1556 (after if (str.StartsWith(wxCMD_CONFIG_PREFIX)))

There are 4 lines that extract the Id and Type:

wxString id(str.BeforeFirst(wxT('-')));

wxString type(str.AfterFirst(wxT('-')));

id = id.Right(id.Len()-wxString(wxCMD_CONFIG_PREFIX).Len());

type = type.Right(type.Len()-wxString(wxT("type")).Len());

Replace them with something like this:

const wxString CMDPREF = wxString(wxCMD_CONFIG_PREFIX);

const wxString TYPEPREF = L"-type";

size_t typestart = str.find(TYPEPREF);

wxString id(str.substr(CMDPREF.length(), typestart - CMDPREF.length()));

wxString type(str.substr(typestart + TYPEPREF.length(), wxString::npos));

And thats it!