mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-18 19:48:06 +00:00
#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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user