Skip to content

Commit

Permalink
Use the correct context after executing the ex command
Browse files Browse the repository at this point in the history
With the incorrect context the action EditorSelectWord didn't make any effect because it worked on the ex-entry panel editor
  • Loading branch information
AlexPl292 committed Apr 26, 2024
1 parent eeb5939 commit 9d0b68b
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -36,7 +36,12 @@ internal class ExShortcutKeyAction(private val exEntryPanel: ExEntryPanel) : Dum
if (keyStroke != null) {
val editor = exEntryPanel.entry.editor
val keyHandler = KeyHandler.getInstance()
keyHandler.handleKey(editor.vim, keyStroke, e.dataContext.vim, keyHandler.keyHandlerState)

// About the context: we use the context of the main editor to execute actions on it.
// e.dataContext will refer to the ex-entry editor and commands will be executed on it,
// thus it should not be used. For example, `:action EditorSelectWord` will not work with this context
val mainEditorContext = exEntryPanel.entry.context.vim
keyHandler.handleKey(editor.vim, keyStroke, mainEditorContext, keyHandler.keyHandlerState)
}
}

Expand Down

0 comments on commit 9d0b68b

Please sign in to comment.