mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 13:25:10 +00:00
Can now click empty lines in Script Editor
(accounted for empty trailing lines)
This commit is contained in:
1 parent
31ea784998
commit
c062c1340b
2 files changed
+9
-3
No files matched your search
@@ -249,7 +249,13 @@ public class GuiScriptTextArea extends GuiNpcTextField {
|
||||
lineWidth = w;
|
||||
}
|
||||
|
||||
return data.end - 1;
|
||||
// Place cursor after the last visible character of the line.
|
||||
// `data.end - 1` previously pointed at the newline for non-last lines
|
||||
// which made clicks land on the newline rather than after the text.
|
||||
// Use data.start + chars.length to return the position directly
|
||||
// after the line's characters, clamped to the total text length.
|
||||
int posAfterChars = data.start + chars.length;
|
||||
return Math.min(posAfterChars, text.length());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ public class JavaTextContainer extends TextContainer {
|
||||
lineHeight = ClientProxy.Font.height();
|
||||
if (lineHeight == 0)
|
||||
lineHeight = 12;
|
||||
String[] split = text.split("\n");
|
||||
|
||||
|
||||
String[] split = text.split("\\n", -1); // -1 preserves empty lines ""
|
||||
int totalChars = 0;
|
||||
for (String l : split) {
|
||||
StringBuilder line = new StringBuilder();
|
||||
|
||||
Reference in new issue
Block a user