You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
After remapping tab and shift+tab in vscodevim's normal mode, opening VSCode's built-in find and replace functionality (ordinarily mapped to ctrl+h) and tabbing from the 'find' text box to the 'replace' text box will also run whatever Vim command that tab is mapped to into the editor that called find/replace.
To Reproduce
As an example, I had the following remaps in my settings.json:
...
"vim.leader": " ",
"vim.normalModeKeyBindingsNonRecursive": [
// Find and replace
{ "before": ["<leader>", "r"], "commands": ["editor.action.startFindReplaceAction"] }
// Handle tab key indentation in VSCode as terminals treat ctrl-i and tab the same
{ "before": ["<tab>"], "commands": [">", ">"] },
{ "before": ["<S-tab>"], "after": ["<", "<"] }
...
With this in place, in normal mode I can press the tab key to indent immediately. But when I then open up the find and replace window, search a 'find' term and hit tab (at this point focus still on the find and replace window), the find/replace window does tab through to the 'replace' text box as expected, but a side effect is that the actual tab command (in my case, indentation via >>) is also called in the editor. Consistently tabbing through the find and replace menu will then keep indenting the line in the editor that I was last on.
This also appears to happen when calling find and replace from visual mode, if tab is remapped there too:
In visual mode with the above settings, the visual selection is indented when tabbing through the find and replace menu.
Expected behavior
When focus is on the search/find and replace windows build into VSCode, hitting tab should cycle through the window's options without also running the command that tab is mapped to.
Note that this bug is not present for other built-in VSCode windows such as the quick open menu, the command palette or the tasks menu.
Environment
Extension (VsCodeVim) version: v1.21.6
VSCode version: 1.59.0, x64
OS: Kubuntu Linux
Other notes
It may or may not be relevant that there's a VSCode keybinding when: condition that exists to validate focus on the find menu - findInputFocussed.
The text was updated successfully, but these errors were encountered:
dominicpalmer
changed the title
Tabbing through VSCode's built-in find and replace menu also runs whatever command is mapped to tab
Tabbing through VSCode's built-in find and replace menu also runs whatever command is mapped to tab in the editor
Aug 16, 2021
I've been running into this bug for years and just assumed it was within VSCode itself.
To take this down to a minimal-reproducible test case, it looks like this happens regardless of any of your settings in vim.normalModeKeyBindingsNonRecursive.
It looks like it's just a matter of the when clauses on the extensions.vim_tab and extensions.vim_shift+tab keybindings using the editorFocus context instead of editorTextFocus. In fact, every other keybinding that uses one of these two uses editorTextFocus; extensions.vim_tab and extensions.vim_shift+tab are the only two that uses editorFocus
The extensions.vim_tab keybinding was added in 3b25cca (no PR).
The extensions.vim_shift+tab keybinding was later added in #4089.
Updating the when clause in each of those to use editorTextFocus instead of editorFocus appears to fix the issue without affecting command-mode autocomplete.
devrelm
added a commit
to devrelm/VSCodeVim
that referenced
this issue
Jul 19, 2023
Describe the bug
After remapping
tab
andshift+tab
in vscodevim's normal mode, opening VSCode's built-in find and replace functionality (ordinarily mapped toctrl+h
) and tabbing from the 'find' text box to the 'replace' text box will also run whatever Vim command thattab
is mapped to into the editor that called find/replace.To Reproduce
As an example, I had the following remaps in my
settings.json
:With this in place, in normal mode I can press the
tab
key to indent immediately. But when I then open up the find and replace window, search a 'find' term and hit tab (at this point focus still on the find and replace window), the find/replace window does tab through to the 'replace' text box as expected, but a side effect is that the actual tab command (in my case, indentation via>>
) is also called in the editor. Consistently tabbing through the find and replace menu will then keep indenting the line in the editor that I was last on.This also appears to happen when calling find and replace from visual mode, if
tab
is remapped there too:In visual mode with the above settings, the visual selection is indented when tabbing through the find and replace menu.
Expected behavior
When focus is on the search/find and replace windows build into VSCode, hitting tab should cycle through the window's options without also running the command that tab is mapped to.
Note that this bug is not present for other built-in VSCode windows such as the quick open menu, the command palette or the tasks menu.
Environment
Other notes
It may or may not be relevant that there's a VSCode keybinding
when:
condition that exists to validate focus on the find menu -findInputFocussed
.The text was updated successfully, but these errors were encountered: