Reset selection of search bar when unfocusing

This commit is contained in:
bigguy345 committed 2025-12-20 03:11:17 +02:00
1 parent ec40a1c580
commit 762d52f658
2 files changed
+6 -1

No files matched your search

@@ -154,7 +154,7 @@ public class GuiScriptTextArea extends GuiNpcTextField {
@Override
public void focusMainEditor() {
active = true;
selection.markActivity();
searchBar.resetSelection();
}
@Override
@@ -596,6 +596,10 @@ public class SearchReplaceBar {
return mouseX >= bx && mouseX < bx + bw && mouseY >= by && mouseY < by + bh;
}
public void resetSelection() {
searchSelectionStart = searchSelectionEnd = searchCursor;
replaceSelectionStart = replaceSelectionEnd = replaceCursor;
}
// ==================== MOUSE INPUT ====================
/**
@@ -609,6 +613,7 @@ public class SearchReplaceBar {
int totalHeight = getTotalHeight();
// If click is outside the bar, don't consume it (let main editor handle)
if (mouseX < x || mouseX > x + width || mouseY < y || mouseY > y + totalHeight) {
resetSelection();
return false;
}