EA-30952 - assert: EditorUtil.calcColumnNumber

Debug info is added
This commit is contained in:
Denis.Zhdanov
2011-10-28 15:30:43 +04:00
parent 470a8ff0f7
commit 514850e10f
3 changed files with 21 additions and 11 deletions
@@ -795,6 +795,21 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
return myRangeMarkers.processOverlappingWith(start, end, processor);
}
@NotNull
public String dumpState() {
StringBuilder result = new StringBuilder();
result.append("deferred mode: ").append(myText.isDeferredChangeMode() ? "on" : "off");
result.append(", intervals:\n");
for (int line = 0; line < getLineCount(); line++) {
result.append(line).append(": ").append(getLineStartOffset(line)).append("-")
.append(getLineEndOffset(line)).append(", ");
}
if (result.length() > 0) {
result.setLength(result.length() - 1);
}
return result.toString();
}
private static class MyCharArray extends CharArray {
public MyCharArray() {
super(0);
@@ -389,8 +389,10 @@ public class EditorUtil {
char c = text.charAt(i);
if (c == '\n' || c == '\r') {
String editorInfo = editor instanceof EditorImpl ? ". Editor info: " + ((EditorImpl)editor).dumpState() : "";
LOG.error(String.format("Symbol: '%c', its index: %d, given start: %d, given offset: %d, given tab size: %d%s",
c, i, start, offset, tabSize, editorInfo));
LOG.error(String.format(
"Symbol: '%c', its index: %d, given start: %d, given offset: %d, given tab size: %d. Text holder class: %s%s",
c, i, start, offset, tabSize, text.getClass(), editorInfo
));
}
if (c == '\t') {
shift += getTabLength(i + shift - start, tabSize) - 1;
@@ -2468,15 +2468,8 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
}
public CharSequence dumpState() {
StringBuilder documentInfo = new StringBuilder();
for (int line = 0; line < myDocument.getLineCount(); line++) {
documentInfo.append(line).append(": ").append(myDocument.getLineStartOffset(line)).append("-")
.append(myDocument.getLineEndOffset(line)).append(", ");
}
if (documentInfo.length() > 0) {
documentInfo.setLength(documentInfo.length() - 1);
}
return "soft wraps data: " + getSoftWrapModel() + ", folding data: " + getFoldingModel() + ", document info: " + documentInfo;
return "use soft wraps: " + (mySoftWrapModel.isSoftWrappingEnabled() ? "on" : "off") + ", soft wraps data: " + getSoftWrapModel()
+ ", folding data: " + getFoldingModel() + ", document info: " + myDocument.dumpState();
}
private class CachedFontContent {