mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
1. Reverted incorrect commit;
2. Checking if target offset belongs to document range;
This commit is contained in:
+2
-2
@@ -59,7 +59,7 @@ public class GenericLineWrapPositionStrategy implements LineWrapPositionStrategy
|
||||
maxPreferredOffsetToUse = maxPreferredOffsetToUse < startOffset ? startOffset : maxPreferredOffsetToUse;
|
||||
|
||||
// Try to find out wrap position before preferred offset.
|
||||
for (int i = maxPreferredOffsetToUse; i > startOffset; i--) {
|
||||
for (int i = Math.min(maxPreferredOffsetToUse, text.length() - 1); i > startOffset; i--) {
|
||||
char c = text.charAt(i);
|
||||
if (c == '\n') {
|
||||
return i + 1;
|
||||
@@ -99,7 +99,7 @@ public class GenericLineWrapPositionStrategy implements LineWrapPositionStrategy
|
||||
|
||||
// Try to find target offset that is beyond preferred offset.
|
||||
// Note that we don't consider symbol weights here and just break on the first appropriate position.
|
||||
if (!allowToBeyondMaxPreferredOffset) {
|
||||
if (!allowToBeyondMaxPreferredOffset || maxPreferredOffset >= text.length() - 1) {
|
||||
return maxPreferredOffset;
|
||||
}
|
||||
for (int i = maxPreferredOffsetToUse + 1; i < endOffset; i++) {
|
||||
|
||||
+1
-2
@@ -472,8 +472,7 @@ public class SoftWrapApplianceManager implements FoldingListener, DocumentListen
|
||||
return i;
|
||||
}
|
||||
}
|
||||
assert end > 0;
|
||||
return end - 1;
|
||||
return end;
|
||||
}
|
||||
|
||||
private static int calculateWidthInColumns(char c, int widthInPixels, int spaceWithInPixels) {
|
||||
|
||||
Reference in New Issue
Block a user