From a2e46d274f81021e35bb35e92e70bc8969bf2c46 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Tue, 26 May 2015 17:26:35 +0300 Subject: [PATCH] fix caret blinking --- .../com/intellij/openapi/editor/impl/EditorImpl.java | 10 +++++----- .../openapi/editor/impl/view/EditorPainter.java | 4 ++-- .../commandInterface/console/ArgumentHintLayer.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java index 3070ec362c2a..05ea12671ce8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java @@ -3202,8 +3202,8 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi } @Nullable - public CaretRectangle[] getCaretLocations() { - return myCaretCursor.getCaretLocations(); + public CaretRectangle[] getCaretLocations(boolean onlyIfShown) { + return myCaretCursor.getCaretLocations(onlyIfShown); } private void paintLineMarkersSeparators(@NotNull final Graphics g, @@ -4761,13 +4761,13 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi } @Nullable - private CaretRectangle[] getCaretLocations() { - if (!isEnabled() || !myIsShown || isRendererMode() || !IJSwingUtilities.hasFocus(getContentComponent())) return null; + private CaretRectangle[] getCaretLocations(boolean onlyIfShown) { + if (onlyIfShown && (!isEnabled() || !myIsShown || isRendererMode() || !IJSwingUtilities.hasFocus(getContentComponent()))) return null; return myLocations; } private void paint(@NotNull Graphics g) { - CaretRectangle[] locations = getCaretLocations(); + CaretRectangle[] locations = getCaretLocations(true); if (locations == null) return; for (CaretRectangle location : myLocations) { diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorPainter.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorPainter.java index e3b6dbd2fe90..331f2a472027 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorPainter.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorPainter.java @@ -638,7 +638,7 @@ class EditorPainter { } private void paintCaret(Graphics2D g_) { - EditorImpl.CaretRectangle[] locations = myEditor.getCaretLocations(); + EditorImpl.CaretRectangle[] locations = myEditor.getCaretLocations(true); if (locations == null) return; Graphics2D g = IdeBackgroundUtil.getOriginalGraphics(g_); @@ -689,7 +689,7 @@ class EditorPainter { } void repaintCarets() { - EditorImpl.CaretRectangle[] locations = myEditor.getCaretLocations(); + EditorImpl.CaretRectangle[] locations = myEditor.getCaretLocations(false); if (locations == null) return; int lineHeight = myView.getLineHeight(); for (EditorImpl.CaretRectangle location : locations) { diff --git a/python/src/com/jetbrains/commandInterface/console/ArgumentHintLayer.java b/python/src/com/jetbrains/commandInterface/console/ArgumentHintLayer.java index 68c1a7e6f083..e4e68101a6b1 100644 --- a/python/src/com/jetbrains/commandInterface/console/ArgumentHintLayer.java +++ b/python/src/com/jetbrains/commandInterface/console/ArgumentHintLayer.java @@ -172,7 +172,7 @@ final class ArgumentHintLayer extends JPanel implements Listener, Runnable { // : argumentText); // Update caret position (if known) - final CaretRectangle[] locations = consoleEditor.getCaretLocations(); + final CaretRectangle[] locations = consoleEditor.getCaretLocations(true); if (locations != null) { final CaretRectangle rectangle = locations[0]; myCaretPositionPx = rectangle.myPoint.x;