fix caret blinking

This commit is contained in:
Dmitry Batrak
2015-05-26 17:27:48 +03:00
parent 7159ed3501
commit a2e46d274f
3 changed files with 8 additions and 8 deletions
@@ -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) {
@@ -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) {
@@ -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;