From 42f53ca4c4de84b7c79b1b73af318deb5fecb177 Mon Sep 17 00:00:00 2001 From: andrey zaytsev Date: Mon, 25 Apr 2011 15:05:54 +0400 Subject: [PATCH] IDEA-68100 Escape does not close the incremental search when using emacs keymaps --- .../find/editorHeaderActions/CloseOnESCAction.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/CloseOnESCAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/CloseOnESCAction.java index 92372da4aef1..33a409ffffd3 100644 --- a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/CloseOnESCAction.java +++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/CloseOnESCAction.java @@ -8,6 +8,8 @@ import com.intellij.openapi.actionSystem.Shortcut; import com.intellij.openapi.keymap.KeymapUtil; import javax.swing.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.util.ArrayList; @@ -17,9 +19,15 @@ public class CloseOnESCAction extends EditorHeaderAction { super(editorSearchComponent); ArrayList shortcuts = new ArrayList(); - shortcuts.add(new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), null)); if (KeymapUtil.isEmacsKeymap()) { shortcuts.add(new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_G, InputEvent.CTRL_MASK), null)); + textField.registerKeyboardAction(new ActionListener() { + public void actionPerformed(final ActionEvent e) { + CloseOnESCAction.this.actionPerformed(null); + } + }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_FOCUSED); + } else { + shortcuts.add(new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), null)); } registerCustomShortcutSet(new CustomShortcutSet(shortcuts.toArray(new Shortcut[shortcuts.size()])), textField);