#1217 PCode window not in same position as AS window: better fix (works when string contains only \r or \n characters, or any wrong combination, for example \n\r\n or \r\r\n)

This commit is contained in:
honfika@gmail.com
2016-04-13 18:55:21 +02:00
parent 32b4834881
commit 22906c9fed

View File

@@ -340,11 +340,23 @@ public class HighlightedTextWriter extends GraphTextWriter {
}
private void fixNewLineCount(String str) {
int nl = 0;
int rn = 0;
char prevChar = 0;
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) == '\r') {
newLineCount++;
char ch = str.charAt(i);
if (ch == '\r' || ch == '\n') {
rn++;
}
if (ch == '\r' || (prevChar != '\r' && ch == '\n')) {
nl++;
}
prevChar = ch;
}
newLineCount += rn - nl;
}
private void appendIndent() {