-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Describe the bug
Currently when vscode creates a selection (like when using the "Find" widget) we go to visual mode. If the user then presses escape on the widget or closes the widget we are still in visual mode and if we press escape or use an operator everything works fine. However if the user clicks somewhere to get out of the widget instead of pressing escape or closing the widget, then the handleSelectionChange
function changes the mode to normal, however since there was no action executed the RecordedState
doesn't change and if we were on insert mode when calling the "Find" widget, the RecordedState
will still have the action that was used to go to insert mode on the actionsRun
.
This was mentioned by @ElvenSpellmaker here #3372 (comment).
To Reproduce
Steps to reproduce the behavior:
- Go to insert mode by pressing
i
ora
- Press
<C-f>
or call the "Find" widget from the command pallete - Write a word to search (this step is probably not needed)
- Click somewhere to get the focus out of the "Find" widget (I usually press escape, that's why I never noticed this... 😄 )
- It goes into normal mode
- Press
i
ora
to go to insert mode again and it fails...
Expected behavior
The recorded state should be cleared when we change to normal mode after a mouse click.
Additional Context
@J-Fields We could simply clear the vimState.recordedState
when changing mode after the click or we could add that logic to the VimState.setMode
function. Which one do you think it's better?