From 24ffaeffb0a255adb85d3abaf5c83047fc58a696 Mon Sep 17 00:00:00 2001 From: Denis Fokin Date: Tue, 26 Sep 2017 12:41:03 +0300 Subject: [PATCH] Esc should not move focus from Terminal to Editor --- .../src/com/intellij/openapi/wm/impl/Windows.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/Windows.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/Windows.java index fd98a073b00a..7f56a0e43418 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/Windows.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/Windows.java @@ -116,6 +116,7 @@ public class Windows { // FocusEvent // for now we are interested in focus lost events + String id = ToolWindowManager.getActiveId(); if (event.getID() == FocusEvent.FOCUS_LOST) { // let's check that it is a toolwindow who loses the focus @@ -126,17 +127,17 @@ public class Windows { // A toolwindow lost focus if (!focusEvent.isTemporary() && ToolWindowManager.getActiveToolWindow() != null && ToolWindowManager.getActiveToolWindow().isAutoHide()) { - pinnedWindowFocusLostHandler.accept(ToolWindowManager.getActiveId()); + pinnedWindowFocusLostHandler.accept(id); } } } - if (event.getID() == KeyEvent.KEY_PRESSED && !isHeavyWeightPopup(event)) + if (event.getID() == KeyEvent.KEY_PRESSED && !isHeavyWeightPopup(event) && !("Terminal").equals(id)) { if (Arrays.stream(findShortcuts("EditorEscape")) .anyMatch(shortcut -> shortcut.equals(new KeyboardShortcut(KeyStroke.getKeyStrokeForEvent((KeyEvent)event), null)))) { - deactivationShortcutHandler.accept(ToolWindowManager.getActiveId()); + deactivationShortcutHandler.accept(id); } } }