mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-26971 - assert: CaretModelImpl.moveToOffset
1. Debug info is added; 2. Green code policy is applied;
This commit is contained in:
@@ -182,7 +182,10 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
|
||||
validateCallContext();
|
||||
moveToLogicalPosition(myEditor.offsetToLogicalPosition(offset), locateBeforeSoftWrap);
|
||||
if (!myEditor.offsetToLogicalPosition(myOffset).equals(myEditor.offsetToLogicalPosition(offset))) {
|
||||
LOG.error("caret moved to wrong offset. Requested:" + offset + " but actual:" + myOffset);
|
||||
LOG.error(
|
||||
"caret moved to wrong offset. Requested:" + offset + " but actual:" + myOffset
|
||||
+ ". Soft wraps data: " + myEditor.getSoftWrapModel() + ", folding data: " + myEditor.getFoldingModel()
|
||||
+ ", document:\n" + myEditor.getDocument().getText());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.intellij.openapi.editor.ex.PrioritizedDocumentListener;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
@@ -219,6 +220,7 @@ public class FoldingModelImpl implements FoldingModelEx, PrioritizedDocumentList
|
||||
return myFoldTree.fetchAllRegions();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FoldRegion getCollapsedRegionAtOffset(int offset) {
|
||||
return myFoldTree.fetchOutermost(offset);
|
||||
}
|
||||
@@ -227,6 +229,7 @@ public class FoldingModelImpl implements FoldingModelEx, PrioritizedDocumentList
|
||||
return myFoldTree.getLastTopLevelIndexBefore(offset);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FoldRegion getFoldingPlaceholderAt(Point p) {
|
||||
assertReadAccess();
|
||||
LogicalPosition pos = myEditor.xyToLogicalPosition(p);
|
||||
@@ -410,10 +413,12 @@ public class FoldingModelImpl implements FoldingModelEx, PrioritizedDocumentList
|
||||
return myFoldTree.getFoldedLinesCountBefore(offset);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FoldRegion[] fetchTopLevel() {
|
||||
return myFoldTree.fetchTopLevel();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FoldRegion fetchOutermost(int offset) {
|
||||
return myFoldTree.fetchOutermost(offset);
|
||||
}
|
||||
@@ -478,4 +483,9 @@ public class FoldingModelImpl implements FoldingModelEx, PrioritizedDocumentList
|
||||
listener.onFoldRegionStateChange(foldRegion);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Arrays.toString(myFoldTree.fetchTopLevel());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -654,6 +654,11 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return myDataMapper.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines generic interface for the command that may be proceeded in both <code>'soft wraps aware'</code> and
|
||||
* <code>'soft wraps unaware'</code> modes.
|
||||
|
||||
Reference in New Issue
Block a user