From 84b485c6bc0c4b1e7dac9529d407c8f69826a31c Mon Sep 17 00:00:00 2001 From: Alex Plate <aleksei.plate@jetbrains.com> Date: Tue, 11 Mar 2025 17:41:51 +0200 Subject: [PATCH] Use the proper context component when firing an action --- .../java/com/maddyhome/idea/vim/helper/IjActionExecutor.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/maddyhome/idea/vim/helper/IjActionExecutor.kt b/src/main/java/com/maddyhome/idea/vim/helper/IjActionExecutor.kt index 26b665046..9916564c8 100644 --- a/src/main/java/com/maddyhome/idea/vim/helper/IjActionExecutor.kt +++ b/src/main/java/com/maddyhome/idea/vim/helper/IjActionExecutor.kt @@ -87,10 +87,9 @@ internal class IjActionExecutor : VimActionExecutor { } else { try { isRunningActionFromVim = true - // DataContext is build on the context component. - // However, it should be null as in this case the data context is taken from the context and the - // PlatformDataKeys.EDITOR is properly set. - val contextComponent: Component? = null + // The context component should be editor. This is especially important when running the `:action` commands + // because at the moment of execution, the focused component is Ex Field, not editor. + val contextComponent = editor?.ij?.contentComponent val res = ActionManager.getInstance().tryToExecute(ijAction, null, contextComponent, "IdeaVim", true) res.waitFor(5_000) return res.isDone