Fixed console history scrolling if there is no focus on editor (PY-2910).
authorDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Mon, 28 Mar 2011 16:21:54 +0000 (20:21 +0400)
committerDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Mon, 28 Mar 2011 16:55:36 +0000 (20:55 +0400)
platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java

index 13a991ea9ab231dcc7be23c05f828b1d5d454ada..645a4615b2e514420386189f59bdec89193fec0a 100644 (file)
@@ -44,6 +44,7 @@ import com.intellij.openapi.wm.IdeFocusManager;
 import com.intellij.openapi.wm.ToolWindow;
 import com.intellij.openapi.wm.ToolWindowManager;
 import com.intellij.ui.SideBorder;
+import com.intellij.util.IJSwingUtilities;
 import com.intellij.util.NotNullFunction;
 import com.intellij.util.PairProcessor;
 import com.intellij.util.ui.UIUtil;
@@ -324,6 +325,10 @@ public abstract class AbstractConsoleRunnerWithHistory {
       public Boolean compute() {
         final Document document = consoleEditor.getDocument();
         final CaretModel caretModel = consoleEditor.getCaretModel();
+        // Check if we have focus
+        if (!IJSwingUtilities.hasFocus(consoleEditor.getComponent())) {
+          return true;
+        }
         // Check if we have active lookup or if we can move in editor
         return LookupManager.getActiveLookup(consoleEditor) != null || document.getLineNumber(caretModel.getOffset()) > 0;
       }