Sublime Forum

Command "next_view_in_stack" does behave differently for mouse and keyboard

#1

In “Default (Windows).sublime-mousemap” I added the following:

[
    { "button": "scroll_down", "modifiers": ["button2"], "command": "next_view_in_stack" },
    { "button": "scroll_up", "modifiers": ["button2"], "command": "prev_view_in_stack" },
]

This reflects the default config of in the key bindings:

{ "keys": ["ctrl+tab"], "command": "next_view_in_stack" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view_in_stack" },

But the behavior is not the same.

To reproduce this open 3 tabs in Sublime.

  • Starting in the first tab: If you now press CTRL+Tab, you will switch to the previous opened tab. If you now press CTRL+Tab again, you will go back to the first tab. Fast way to switch between two tabs (like alt+tab)
  • Starting in the first tab: If you now press RightMouseButton+ScrollDown, you will switch to the previous opened tab. If you now press RightMouseButton+ScrollDown again, you will go the the third tab. But I want to the first tab, because it was the last one open.

Using Version 3.0 Build 3143

0 Likes

#2

next_view_in_stack has special behavior, and won’t work as expected unless its key binding uses the ctrl key, as it does by default. The stack updating semantics require the stack to only be updated when ctrl is released, and Sublime Text doesn’t have an expressive enough key binding system to capture this, so there’s harded coded logic instead.

3 Likes