investigate test blinking

This commit is contained in:
Dmitry Batrak
2015-12-08 17:48:35 +03:00
parent e05de62b40
commit bb1129067a
6 changed files with 64 additions and 5 deletions
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.editor.impl;
import com.intellij.diagnostic.Dumpable;
import com.intellij.diagnostic.LogMessageEx;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.application.ApplicationManager;
@@ -47,7 +48,7 @@ import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.util.List;
public class CaretImpl extends UserDataHolderBase implements Caret {
public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.impl.CaretImpl");
private final EditorImpl myEditor;
@@ -1484,6 +1485,33 @@ public class CaretImpl extends UserDataHolderBase implements Caret {
return myEditor.myUseNewRendering && myEditor.myView.isAtBidiRunBoundary(myVisibleCaret);
}
@NotNull
@Override
public String dumpState() {
return "{valid: " + isValid +
", offset: " + myOffset +
", logical pos: " + myLogicalCaret +
", visual pos: " + myVisibleCaret +
", visual line start: " + myVisualLineStart +
", visual line end: " + myVisualLineEnd +
", savedBeforeBulkCaretMarker: " + savedBeforeBulkCaretMarker +
", skip change requests: " + mySkipChangeRequests +
", desired selection start column: " + myDesiredSelectionStartColumn +
", desired selection end column: " + myDesiredSelectionEndColumn +
", report caret moves: " + myReportCaretMoves +
", desired x: " + myDesiredX +
", selection marker: " + mySelectionMarker +
", rangeMarker start position: " + myRangeMarkerStartPosition +
", rangeMarker end position: " + myRangeMarkerEndPosition +
", rangeMarker end position is lead: " + myRangeMarkerEndPositionIsLead +
", selection start before change: " + startBefore +
", selection end after change: " + endBefore +
", unknown direction: " + myUnknownDirection +
", virtual space offset: " + myVirtualSpaceOffset +
", virtual selection start offset: " + myStartVirtualOffset +
", virtual selection end offset: " + myEndVirtualOffset + '}';
}
/**
* Encapsulates information about target vertical range info - its <code>'y'</code> coordinate and height in pixels.
*/
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
*/
package com.intellij.openapi.editor.impl;
import com.intellij.diagnostic.Dumpable;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.*;
@@ -36,12 +37,14 @@ import com.intellij.openapi.editor.impl.event.DocumentEventImpl;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.util.Disposer;
import com.intellij.util.EventDispatcher;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener, Disposable {
public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener, Disposable, Dumpable {
private final EditorImpl myEditor;
private final EventDispatcher<CaretListener> myCaretListeners = EventDispatcher.create(CaretListener.class);
@@ -512,6 +515,21 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
myCaretListeners.getMulticaster().caretRemoved(new CaretEvent(myEditor, caret, caret.getLogicalPosition(), caret.getLogicalPosition()));
}
@NotNull
@Override
public String dumpState() {
return "[in update: " + myIsInUpdate +
", document changed: " + isDocumentChanged +
", perform caret merging: " + myPerformCaretMergingAfterCurrentOperation +
", current caret: " + myCurrentCaret +
", all carets: " + ContainerUtil.map(myCarets, new Function<CaretImpl, String>() {
@Override
public String fun(CaretImpl caret) {
return caret.dumpState();
}
}) + "]";
}
private static class VisualPositionComparator implements Comparator<VisualPosition> {
private static final VisualPositionComparator INSTANCE = new VisualPositionComparator();
@@ -3149,6 +3149,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
+ "', allow caret inside tab: " + mySettings.isCaretInsideTabs()
+ ", allow caret after line end: " + mySettings.isVirtualSpace()
+ ", soft wraps: " + (mySoftWrapModel.isSoftWrappingEnabled() ? "on" : "off")
+ ", caret model: " + getCaretModel().dumpState()
+ ", soft wraps data: " + getSoftWrapModel().dumpState()
+ "\n\nfolding data: " + getFoldingModel().dumpState()
+ (myDocument instanceof DocumentImpl ? "\n\ndocument info: " + ((DocumentImpl)myDocument).dumpState() : "")
@@ -362,6 +362,8 @@ class EditorSizeManager implements PrioritizedDocumentListener, Disposable, Fold
@NotNull
@Override
public String dumpState() {
return "[line widths: " + myLineWidths + "]";
return "[cached width: " + myWidthInPixels +
", max line with extension width: " + myMaxLineWithExtensionWidth +
", line widths: " + myLineWidths + "]";
}
}
@@ -469,6 +469,14 @@ public class EditorView implements TextDrawingCallback, Disposable, Dumpable {
@NotNull
@Override
public String dumpState() {
return "[Size manager: " + mySizeManager.dumpState() + "]";
return "[prefix text: " + myPrefixText +
", prefix attributes: " + myPrefixAttributes +
", space width: " + myPlainSpaceWidth +
", line height: " + myLineHeight +
", descent: " + myDescent +
", char height: " + myCharHeight +
", max char width: " + myMaxCharWidth +
", tab size: " + myTabSize +
" ,size manager: " + mySizeManager.dumpState() + "]";
}
}
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.editor;
import com.intellij.diagnostic.Dumpable;
import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.event.DocumentEvent;
@@ -52,6 +53,7 @@ public class EditorPaintingTest extends AbstractEditorTest {
public void testWholeLineHighlighterAtDocumentEnd() throws Exception {
initText("foo");
addLineHighlighter(0, 3, HighlighterLayer.WARNING, null, Color.red);
System.out.println(((Dumpable)myEditor).dumpState()); // temporary code to find the cause of blinking
checkResult();
}