From 36c2326466cd54a96e77ba615879f4e5275da40d Mon Sep 17 00:00:00 2001 From: bigguy345 Date: Thu, 5 Mar 2026 02:36:19 +0200 Subject: [PATCH] Fixed the accursed backspace/enter tab multiplication bug --- .../noppes/npcs/client/gui/util/GuiScriptTextArea.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java b/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java index 349460728..218a7a1ed 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java @@ -2305,14 +2305,8 @@ 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 - 1); - if (removeEnd == -1) { - removeEnd = text.length(); - } else { - removeEnd = removeEnd + 1; // include the newline - } String before = text.substring(0, ValueUtil.clamp(currCheck.start - 1, 0, text.length())); - String after = removeEnd <= text.length() ? text.substring(removeEnd) : ""; + String after = text.substring(Math.min(currCheck.end, text.length())); setText(before + after, true); // Use atomic undo int newCursor = Math.max(0, currCheck.start - 1); selection.reset(newCursor);