Author Topic: Shift-TAB does not work  (Read 8943 times)

Offline chameleon

  • Multiple posting newcomer
  • *
  • Posts: 39
Shift-TAB does not work
« on: November 22, 2021, 06:59:23 pm »
I use nightly 11/11/2021 on windows 10.

TAB indents a block of code.

Shift-TAB do not un-indents a block of code.
Instead, it jumps to next opened file. If no other opened file, do nothing.

For now, I un-indent code blocks with Alt-Select to remove a column of tabs.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: Shift-TAB does not work
« Reply #1 on: November 23, 2021, 03:13:14 am »
It works for me on my latest local build and in the official 20.03 release. I think the keystroke may be assigned to something non standard, but it could also be a bug in the version you are using.

I am not familiar with this area of C::B, but I would check the following:
1) "Settings->Editor->Keyboard Shortcuts" and check the "View->Switch tabs" setting (5th from the bottom) and check it's still Ctrl-TAB.
2) In your C:\users\<name>AppData\Roaming\Codeblocks\default.cbKeyBinder20.conf file check following entry (Search for Shift-TAB) as this may be set to something non standard. This is my entry.
    }, {
   "description": "<global><unbound>",
   "accelerator": "Shift-TAB",
   "resourceID": "798",
   "parentMenu": ""
  }, {

sdfkljsa

  • Guest
Re: Shift-TAB does not work
« Reply #2 on: December 01, 2021, 02:10:35 am »
In SVN 12538, removing all "current shortcuts" (only ctrl-tab for me) from View->Switch Tabs, in Settings->Editor->Keyboard Shortcuts fixes this.

Before removing it, ctrl-tab would open a menu of all the open files, and shift-tab would cycle through the open files right-to-left.
After removing it, ctrl-tab will cycle through the open files left-to-right and shift-tab will un-indent things again.

I don't why this solves the issue, but this thread is the first result searching for "codebocks shift tab", so I hope this helps some people.

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: Shift-TAB does not work
« Reply #3 on: December 01, 2021, 08:34:42 am »
In SVN 12538, removing all "current shortcuts" (only ctrl-tab for me) from View->Switch Tabs, in Settings->Editor->Keyboard Shortcuts fixes this.

Thank you! I had this problem in SVN 12537 (Nightly Build) under Win10 and this fixed it!

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5905
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Shift-TAB does not work
« Reply #4 on: December 02, 2021, 01:14:45 am »
I also meet this issue, thanks for sharing the information.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5905
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Shift-TAB does not work
« Reply #5 on: December 02, 2021, 02:34:25 am »
It works for me on my latest local build and in the official 20.03 release. I think the keystroke may be assigned to something non standard, but it could also be a bug in the version you are using.

I am not familiar with this area of C::B, but I would check the following:
1) "Settings->Editor->Keyboard Shortcuts" and check the "View->Switch tabs" setting (5th from the bottom) and check it's still Ctrl-TAB.
2) In your C:\users\<name>AppData\Roaming\Codeblocks\default.cbKeyBinder20.conf file check following entry (Search for Shift-TAB) as this may be set to something non standard. This is my entry.
    }, {
   "description": "<global><unbound>",
   "accelerator": "Shift-TAB",
   "resourceID": "798",
   "parentMenu": ""
  }, {


The interesting thing is I just removed the "CTRL-TAB" in the Keyboard Shortcuts plugin, which is assigned to "View->Switch tabs".
And now the "SHIFT-TAB" works.

So, it looks like  "CTRL-TAB" and "SHIFT-TAB" are the same?  :)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Shift-TAB does not work
« Reply #6 on: December 06, 2021, 01:34:07 am »
I have a other issue with switch tabs:
Normally alt+ arrow key should activate the browsetracker switch editor, but for me it activates the switch tab dialog?

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: Shift-TAB does not work
« Reply #7 on: December 06, 2021, 07:29:26 am »
I have a other issue with switch tabs:
Normally alt+ arrow key should activate the browsetracker switch editor, but for me it activates the switch tab dialog?

My guess: that these keys are being switched around because different versions of CB are being used with the same personality.

KeyBinder resets a key to the default menu assignment if a  user assigned key is no longer in the menu.

For example, if I've assigned Alt-left to a BrowserTracker menu item, then load a CB that does not enable BrowserTracker, the Alt-left gets lost in the personality=default keybinder .conf file.

If a previous assignment of ctrl-tab was assigned to say HexEditor, then I load a CB which has no HexEditor plugin, then the ctrl-tab will default back to the core CB assignment (switch tabs).

The only way around this is to use personality=<whatever> so key assignments don't get lost.

I have a personality=cb315 and a personality=cb30 etc.
I use a .bat file to set the personality for it's associated CB.

Just my guess.
 

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Shift-TAB does not work
« Reply #8 on: December 06, 2021, 09:00:24 am »
Can be... This happened after updating c::b but all version should have installed the plugin...
Anyway, my next question is, where is the binding for switch tabs/open documents? i have not found it...

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: Shift-TAB does not work
« Reply #9 on: December 06, 2021, 09:23:59 pm »
Can be... This happened after updating c::b but all version should have installed the plugin...
Anyway, my next question is, where is the binding for switch tabs/open documents? i have not found it...

main.cpp line 763
Code
    // New: Allow drag and drop of files into the editor
    SetDropTarget(new cbFileDropTarget(this));

    // Accelerator table
    m_AccelCount = 8;
    m_pAccelEntries.reset(new wxAcceleratorEntry[m_AccelCount]);
    m_pAccelEntries[0].Set(wxACCEL_CTRL | wxACCEL_SHIFT,  (int) 'W', idFileCloseAll);
    m_pAccelEntries[1].Set(wxACCEL_CTRL | wxACCEL_SHIFT,  WXK_F4,    idFileCloseAll);
    m_pAccelEntries[2].Set(wxACCEL_CTRL,                  (int) 'W', idFileClose);
    m_pAccelEntries[3].Set(wxACCEL_CTRL,                  WXK_F4,    idFileClose);
    m_pAccelEntries[4].Set(wxACCEL_CTRL,                  WXK_F6,    idFileNext);
    m_pAccelEntries[5].Set(wxACCEL_CTRL | wxACCEL_SHIFT,  WXK_F6,    idFilePrev);
    m_pAccelEntries[6].Set(wxACCEL_SHIFT,                 WXK_TAB,   idShiftTab);
    m_pAccelEntries[7].Set(wxACCEL_CTRL | wxACCEL_ALT,    WXK_TAB,   idCtrlAltTab);
    m_pAccel.reset(new wxAcceleratorTable(m_AccelCount, m_pAccelEntries.get()));

    SetAcceleratorTable(*m_pAccel);

Here's another possibility.
Let's say a user has an old (personality=default) and the Alt-Left key had an id=1234 in the old menu id.

The user then loads a new CB (personality=default also) which has Alt-Left key id=5678.

Keybinder will do it's best to resolve the conflict. But if another key, say Ctrl-A, has id=1234 Keybinder has to honor the Ctrl-A and drop the Alt-Left.

In general, Keybinder resolves assignments by:
1) Assign all keys in the .conf file the menu id.
2) If multiple .conf keys have the same menu id, the menu wins.

In both cases, a key could get switched around because the old menu id and the .conf menu id did not match, the .conf key was missing in the menu, or two keys in the .conf had the same menu id.

The best way around all these problems is to use separate personalities for each CB version you load.

Also watch out that when debugging, the personality might default to "debug". It'll overwrite debug.cbKeyBinder20.conf every time you close the debug session. Or if you don't set a personality, the debug session will overwrite the default.cbKeyBinder20.conf.
« Last Edit: December 06, 2021, 10:08:22 pm by Pecan »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5905
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Shift-TAB does not work
« Reply #10 on: March 20, 2022, 10:52:42 am »
I just see this issue again.

I open the file: msys2.cbKeyBinder20.conf, and found something here:

Code
  }, {
   "description": "Show/hide start page",
   "accelerator": "",
   "resourceID": "-31743",
   "parentMenu": "&View::Start Page"
  }, {
   "description": "Show/hide status bar",
   "accelerator": "",
   "resourceID": "-31742",
   "parentMenu": "&View::Status bar"
  }, {
   "description": "Switch between open editor tabs",
   "accelerator": "Ctrl-TAB",
   "resourceID": "-31736",
   "parentMenu": "&View::Switch tabs"
  },

String, the Ctrl-TAB appears again.

BTW, what does the -31736 mean?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: Shift-TAB does not work
« Reply #11 on: March 21, 2022, 08:56:07 pm »
I just see this issue again.

I open the file: msys2.cbKeyBinder20.conf, and found something here:

Code
  }, {
   "description": "Show/hide start page",
   "accelerator": "",
   "resourceID": "-31743",
   "parentMenu": "&View::Start Page"
  }, {
   "description": "Show/hide status bar",
   "accelerator": "",
   "resourceID": "-31742",
   "parentMenu": "&View::Status bar"
  }, {
   "description": "Switch between open editor tabs",
   "accelerator": "Ctrl-TAB",
   "resourceID": "-31736",
   "parentMenu": "&View::Switch tabs"
  },

String, the Ctrl-TAB appears again.

BTW, what does the -31736 mean?

View/Switch-TAB is hard coded into CB from day one.
I've documented this in previous replies.

The -31736 integer is the wxNewId() that was assigned to the hard coded key when CodeBlocks initialized.

KeyBinder simply copies the hard-coded key binding(s) whenever you create a new profile. That allows you to over-ride it later.

The Switch-tab and the BrowseTracker "Backward/Forward Editor" look alike because I copied the "Switch-Tab" code into BrowseTracker as a convenience.

I cannot reproduce the "Shift-Tab" not back-tabbing. It works as expected for me.
« Last Edit: March 21, 2022, 09:03:41 pm by Pecan »