0

I try to modify keybindings in VSCode and came across a problem when I try to modify cursor related commands for search input box. Following keybinding ctrl+b works well when focus is in the editor text and cursor moves to left as expected.

{
    "key": "ctrl+b",
    "command": "cursorLeft",
    "when": "editorTextFocus || searchInputBoxFocus || inSearchEditor || searchViewletFocus"
},

However when the cursor is in the search input box, keybinding doesn't have any effect, I still have to press left arrow key.

search input box

Are there any other command or specific when condition to move cursor in search input box?

Additional information for first comment:

In keyboard shortcuts troubleshooting when I press left arrow key in text editor, cursor moves left and I get following output which tells cursorLeft command is invoked:

[KeybindingService]: / Received  keydown event - modifiers: [], code: ArrowLeft, keyCode: 37, key: ArrowLeft
[KeybindingService]: | Converted keydown event - modifiers: [], code: ArrowLeft, keyCode: 15 ('LeftArrow')
[KeybindingService]: | Resolving [ArrowLeft]
[KeybindingService]: \ From 10 keybinding entries, matched cursorLeft, when: textInputFocus, source: built-in.
[KeybindingService]: + Invoking command cursorLeft.

In keyboard shortcuts troubleshooting when I press left arrow key in search input box, cursor moves left and I get following output, which does not give any associated command name:

[KeybindingService]: / Received  keydown event - modifiers: [], code: ArrowLeft, keyCode: 37, key: ArrowLeft
[KeybindingService]: | Converted keydown event - modifiers: [], code: ArrowLeft, keyCode: 15 ('LeftArrow')
[KeybindingService]: | Resolving [ArrowLeft]
[KeybindingService]: \ From 9 keybinding entries, no when clauses matched the context.
zenprogrammer
  • 623
  • 1
  • 7
  • 20
  • with keyboard debug find the command executed when you press `left` in input box – rioV8 Jun 05 '23 at 16:37
  • @rioV8 interestingly keyboard shortcut troubleshooter doesn't give any associated command name for left key press for search input box. please see my additional information which I added to the question. – zenprogrammer Jun 05 '23 at 18:14
  • what happens if you define a key binding for `ctrl+alt+shift+F3` with `when` context `searchInputBoxFocus` and command `cursorLeft`, does the key bind get recognized and executed – rioV8 Jun 05 '23 at 18:47
  • I get `Resolving ctrl+shift+alt+[F3]`, `From 1 keybinding entries, matched cursorLeft, when: searchInputBoxFocus, source: user.` and `+ Invoking command cursorLeft` but cursor doesn't move. – zenprogrammer Jun 05 '23 at 18:59
  • looks like they use the Widget Framework of the GUI for the search Input box, that handles the cursor left – rioV8 Jun 05 '23 at 19:14

1 Answers1

0

I think you have this issue: Keybindings don't respect editorTextFocus in the find widget.

It looks like some basic commands were hard-coded (at least for the FInd Widget but that probably applies to the Search Inputs as well) and so can't be modified by a user:

I think I added that code initially, maybe more than 10 years ago :). Forwarding to you for your consideration. The ask here is to remove the hard-coded keybinding from findWidget.ts and create a command which would have the keybinding ctrl+down. That would allow users to rebind the behavior of ctrl+down.

Also see more generally, including search input Allow to configure cursor keys for input fields.

So the vscode team is aware of the issue and it is on the backlog - you could upvote those issues in the meantime.

Mark
  • 143,421
  • 24
  • 428
  • 436