mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-68100 Escape does not close the incremental search when using emacs keymaps
This commit is contained in:
@@ -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<Shortcut> shortcuts = new ArrayList<Shortcut>();
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user