mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 20:07:32 +00:00
FULLY fixed phantom trailing line bug (Backspace logic was adding an extra index)
This commit is contained in:
1 parent
b4fb4765f5
commit
16f894baca
1 file changed
+2
-2
@@ -1174,13 +1174,13 @@ public class GuiScriptTextArea extends GuiNpcTextField {
|
||||
// intuitive on blank/indented lines outside any recognized scope.
|
||||
LineData currCheck = selection.findCurrentLine(container.lines);
|
||||
if (currCheck != null && currCheck.text.trim().length() == 0) {
|
||||
int removeEnd = text.indexOf('\n', currCheck.start);
|
||||
int removeEnd = text.indexOf('\n', currCheck.start-1);
|
||||
if (removeEnd == -1) {
|
||||
removeEnd = text.length();
|
||||
} else {
|
||||
removeEnd = removeEnd + 1; // include the newline
|
||||
}
|
||||
String before = text.substring(0, currCheck.start);
|
||||
String before = text.substring(0, currCheck.start-1);
|
||||
String after = removeEnd <= text.length() ? text.substring(removeEnd) : "";
|
||||
setText(before + after);
|
||||
int newCursor = Math.max(0, currCheck.start - 1);
|
||||
|
||||
Reference in new issue
Block a user