mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-58625 Exception on paste
Incremental update of soft wraps cache is corrected
This commit is contained in:
+14
-3
@@ -392,10 +392,21 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
|
||||
//System.out.println("text length: " + text.length() + ", soft wraps: " + myStorage.getSoftWraps());
|
||||
//for (int i = 0; i < myCache.size(); i++) {
|
||||
// CacheEntry entry = myCache.get(i);
|
||||
// System.out.printf("line %d. %d-%d: '%s'%n", i, entry.startOffset, entry.endOffset,
|
||||
// text.subSequence(entry.startOffset,Math.min(entry.endOffset, text.length())));
|
||||
// // TODO den unwrap
|
||||
// try {
|
||||
// System.out.printf("line %d. %d-%d: '%s'%n", i, entry.startOffset, entry.endOffset,
|
||||
// text.subSequence(entry.startOffset,Math.min(entry.endOffset, text.length())));
|
||||
// }
|
||||
// catch (Throwable e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//if (!myCache.isEmpty() && myCache.get(myCache.size() - 1).endOffset < text.length() - 1) {
|
||||
// System.out.printf("Incomplete re-parsing detected! Document length is %d but last processed offset is %s%n", text.length(),
|
||||
// myCache.get(myCache.size() - 1).endOffset);
|
||||
//}
|
||||
|
||||
|
||||
//for (CacheEntry cacheEntry : myCache) {
|
||||
// if (cacheEntry.startOffset > 0) {
|
||||
// if (text.charAt(cacheEntry.startOffset - 1) != '\n' && myStorage.getSoftWrap(cacheEntry.startOffset) == null) {
|
||||
|
||||
+9
-3
@@ -128,7 +128,9 @@ public class SoftWrapApplianceManager implements FoldingListener, DocumentListen
|
||||
}
|
||||
|
||||
private void recalculateSoftWraps(DirtyRegion region) {
|
||||
notifyListenersOnRangeRecalculation(region, true);
|
||||
if (region.notifyAboutRecalculationStart) {
|
||||
notifyListenersOnRangeRecalculation(region, true);
|
||||
}
|
||||
myStorage.removeInRange(region.startRange.getStartOffset(), region.startRange.getEndOffset());
|
||||
try {
|
||||
region.beforeRecalculation();
|
||||
@@ -535,7 +537,9 @@ public class SoftWrapApplianceManager implements FoldingListener, DocumentListen
|
||||
|
||||
@Override
|
||||
public void beforeDocumentChange(DocumentEvent event) {
|
||||
myDirtyRegions.add(new DirtyRegion(event));
|
||||
DirtyRegion region = new DirtyRegion(event);
|
||||
myDirtyRegions.add(region);
|
||||
notifyListenersOnRangeRecalculation(region, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -548,11 +552,13 @@ public class SoftWrapApplianceManager implements FoldingListener, DocumentListen
|
||||
|
||||
public TextRange startRange;
|
||||
public TextRange endRange;
|
||||
public boolean notifyAboutRecalculationStart;
|
||||
private boolean myRecalculateEnd;
|
||||
|
||||
DirtyRegion(int startOffset, int endOffset) {
|
||||
startRange = new TextRange(startOffset, endOffset);
|
||||
endRange = new TextRange(startOffset, endOffset);
|
||||
notifyAboutRecalculationStart = true;
|
||||
}
|
||||
|
||||
DirtyRegion(DocumentEvent event) {
|
||||
@@ -596,7 +602,7 @@ public class SoftWrapApplianceManager implements FoldingListener, DocumentListen
|
||||
case ' ': indentInColumns += 1; indentInPixels += spaceWidth; break;
|
||||
case '\t':
|
||||
int x = EditorUtil.nextTabStop(indentInPixels, editor);
|
||||
indentInColumns = calculateWidthInColumns(x - indentInPixels, spaceWidth);
|
||||
indentInColumns += calculateWidthInColumns(x - indentInPixels, spaceWidth);
|
||||
indentInPixels = x;
|
||||
break;
|
||||
default: myNonWhiteSpaceSymbolOffset = i; return;
|
||||
|
||||
Reference in New Issue
Block a user