Skip to content

Commit 9479e09

Browse files
authored
Clear input state if applicable before hopping out of normal mode to jupyter command mode (#82)
For example if I press `d` then `<Esc>` in normal mode (i.e. about to delete something but changed my mind), I expect to be still in normal mode instead of jupyter command mode.
1 parent 4e6361d commit 9479e09

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/labCommands.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,13 @@ export function addNotebookCommands(
175175
const vim = cm.state.vim;
176176

177177
// Get the current editor state
178-
if (vim.insertMode || vim.visualMode) {
178+
if (
179+
vim.insertMode ||
180+
vim.visualMode ||
181+
vim.inputState.operator !== null ||
182+
vim.inputState.motion !== null ||
183+
vim.inputState.keyBuffer.length !== 0
184+
) {
179185
Vim.handleKey(cm, '<Esc>');
180186
} else {
181187
commands.execute('notebook:enter-command-mode');

0 commit comments

Comments
 (0)