Author Topic: Keyboard Shortcuts  (Read 6380 times)

Offline sorinev

  • Multiple posting newcomer
  • *
  • Posts: 61
Keyboard Shortcuts
« on: July 24, 2013, 10:27:49 am »
I've experienced this for quite a while now (at the very least since 2011), but I can't find any information about it, so it makes me think that I'm just doing something wrong.

When I go to Settings -> Editor -> Keyboard Shortcuts (nice icon btw), and add a new shortcut to the Close File entry, it doesn't persist through closing and then reopening CodeBlocks. The default is ctrl+w. It's weird that ctrl+f4 is not the default, and in fact, is not even there (standard shortcut for closing the current file in most windows programs). So, I add ctrl+f4 as an alternate to ctrl+w. It works fine until I close CodeBlocks and then reopen it. At that point, the ctrl+f4 entry has disappeared and I have to reassign it. Since ctrl+f4 is a years-long ingrained habit, I forget about it every single time and find myself pressing it and not having anything happen (requiring me to reassign it).

Am I supposed to hit some kind of save option elsewhere in the IDE or tick some setting somewhere for new keyboard shortcut assignments to stick?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Keyboard Shortcuts
« Reply #1 on: July 24, 2013, 12:29:11 pm »
ctrl-f4 is quite unergonomic shortcut. Also almost all linux softwares use ctrl-w, which is easier to press. So this won't change in the future.

About the reassigning it. Does it fail every time or it works for a while and then fails?
Does it work if you make an assignment for another command.
Does it work if you try to make ctrl-f4 an exclusive shortcut key?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline sorinev

  • Multiple posting newcomer
  • *
  • Posts: 61
Re: Keyboard Shortcuts
« Reply #2 on: July 24, 2013, 10:58:06 pm »
About the reassigning it. Does it fail every time or it works for a while and then fails?

It always persists throughout the current session, but when CodeBlocks is closed and reopened, the new shortcut is always gone.

Does it work if you make an assignment for another command.

No, trying another sequence, it still disappears upon restart.

Does it work if you try to make ctrl-f4 an exclusive shortcut key?

Making a sequence the only shortcut works. It appears having two doesn't fly, with the second one always dropping after restart.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2784
Re: Keyboard Shortcuts
« Reply #3 on: July 30, 2013, 01:56:01 am »
Some keys belong to an accelerator table defined from the very inception of CB. They're there in case KeyBinder is never loaded.

But... because the accelerators are loaded before the plugins, I suspect they wipe out user re-definitions. I'll check on it.

Code
    // Accelerator table as of 2012/08/30. The first four can be removed and added
    // to the app menu system. The others have no equivalent menu id's.
    // We remove the entries duplicated by the menu system so that the user
    // may redefine them. The non-menu entries are re-registered.
    //wxAcceleratorEntry entries[8];
    //entries[0].Set(wxACCEL_CTRL | wxACCEL_SHIFT,  (int) 'W', idFileCloseAll);
    //entries[1].Set(wxACCEL_CTRL | wxACCEL_SHIFT,  WXK_F4,    idFileCloseAll);
    //entries[2].Set(wxACCEL_CTRL,                  (int) 'W', idFileClose);
    //entries[3].Set(wxACCEL_CTRL,                  WXK_F4,    idFileClose);
    //entries[4].Set(wxACCEL_CTRL,                  WXK_F6,    idFileNext);
    //entries[5].Set(wxACCEL_CTRL | wxACCEL_SHIFT,  WXK_F6,    idFilePrev);
    //entries[6].Set(wxACCEL_SHIFT,                 WXK_TAB,   idShiftTab);
    //entries[7].Set(wxACCEL_CTRL | wxACCEL_ALT,    WXK_TAB,   idCtrlAltTab);
« Last Edit: July 30, 2013, 01:59:49 am by Pecan »