Hitting ESC in insert mode with a search selection does not exit insert mode
jleclanche opened this issue · comments
Reproduce in a file by entering /foo
, then entering insert mode, then hitting ESC to attempt exiting insert mode.
you can use another key binding to map command
like:
{
"key": "ctrl+j",
"command": "amVim.escape"
},
{
"key": "escape",
"command": "amVim.escape",
"when": "!parameterHintsVisible && !suggestWidgetVisible && !editorHasMultipleSelections && !findWidgetVisible && !renameInputVisible"
},
This can be solved with the override:
{
"key": "escape",
"command": "amVim.escape",
"when": "amVim.mode == 'INSERT' && editorFocus && findWidgetVisible && !isComposing"
},
I feel like this perhaps should be the standard behavior, so I will add it to the list of stuff to do for the next release.
For reference: in 96cb3f5 we started redeclaring the default escape keybindings in our own package.json
, to avoid the amVim escape from hijacking built-in escape behavior. Since that commit dozens of new escape keybindings have been added, so it's not really going to be sustainable to keep copying them all into package.json
. In most cases, amVim seems to do the right thing anyway, either because the binding isn't something that happens inside the editor window, or because of the change in 57048be which explicitly closes some of the expected things when you press escape.
Perhaps we should remove all the overrides from package.json
that don't appear to conflict with the default escape and then slowly add back only the ones that have an unexpected behavior. In case of find widget, it makes sense for the first escape to switch to normal mode, and only then the second escape closes the widget (if it's open).