From 8edf09f215cc0cf2f407276c055c6cd8eb0b5d06 Mon Sep 17 00:00:00 2001 From: bigguy345 Date: Fri, 19 Dec 2025 01:08:36 +0200 Subject: [PATCH] Fixed cursor double/triple click starting selection from after the cursor --- .../noppes/npcs/client/gui/util/GuiScriptTextArea.java | 7 +++++++ 1 file changed, 7 insertions(+) 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 0986b6add..81effc8b1 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java @@ -1195,10 +1195,17 @@ public class GuiScriptTextArea extends GuiNpcTextField { // Double-click: select the word under the caret using the container's word regex this.doubleClicked = true; selection.selectWordAtCursor(this.text, this.container.regexWord); + // Prevent subsequent mouse-drag handling in the render loop from + // treating this double-click as a normal click-drag which would + // immediately reset and extend the selection. Clearing `clicked` + // keeps the double-click selection stable. + this.clicked = false; } else if (this.clickCount >= 3) { // Triple-click: select the entire logical line that contains the caret this.tripleClicked = true; selection.selectLineAtCursor(container.lines); + // Same as double-click: clear `clicked` to avoid accidental drag-extension + this.clicked = false; this.clickCount = 0; } }