Implemented closeOnEsc supplier for ScriptTextArea

This commit is contained in:
bigguy345 committed 2025-12-20 11:53:26 +02:00
1 parent 7e62dbc3fa
commit 4715e2ffbf
6 files changed
+12 -1

No files matched your search

@@ -105,6 +105,7 @@ public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCall
textArea.init(guiLeft + 74, guiTop + 4, 239, 208, container == null ? "" : container.script);
textArea.enableCodeHighlighting();
textArea.setListener(this);
this.closeOnEsc(textArea::closeOnEsc);
this.addTextField(textArea);
addButton(new GuiNpcButton(102, guiLeft + 315, guiTop + 4, 50, 20, "gui.clear"));
@@ -118,7 +118,9 @@ public class GuiScriptEffect extends GuiNPCInterface implements GuiYesNoCallback
textArea.init(this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int) ((double) this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
textArea.enableCodeHighlighting();
textArea.setListener(this);
this.closeOnEsc(textArea::closeOnEsc);
this.addTextField(textArea);
int left1 = this.guiLeft + this.xSize - 104;
this.addButton(new GuiNpcButton(102, left1, this.guiTop + yoffset, 60, 20, "gui.clear"));
this.addButton(new GuiNpcButton(101, left1 + 61, this.guiTop + yoffset, 60, 20, "gui.paste"));
@@ -119,7 +119,7 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
textArea.enableCodeHighlighting();
textArea.setListener(this);
this.closeOnEsc(textArea::closeOnEsc);
this.addTextField(textArea);
int left1 = this.guiLeft + this.xSize - 104;
@@ -129,7 +129,9 @@ public class GuiScriptLinkedItem extends GuiNPCInterface implements GuiYesNoCall
textArea.init(this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int) ((double) this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
textArea.enableCodeHighlighting();
textArea.setListener(this);
this.closeOnEsc(textArea::closeOnEsc);
this.addTextField(textArea);
int left1 = this.guiLeft + this.xSize - 104;
this.addButton(new GuiNpcButton(102, left1, this.guiTop + yoffset, 60, 20, "gui.clear"));
this.addButton(new GuiNpcButton(101, left1 + 61, this.guiTop + yoffset, 60, 20, "gui.paste"));
@@ -137,7 +137,9 @@ public class GuiScriptRecipe extends GuiNPCInterface implements GuiYesNoCallback
textArea.init(this.guiLeft + 1 + yoffset, this.guiTop + yoffset, this.xSize - 108 - yoffset, (int) ((double) this.ySize * 0.96) - yoffset * 2, container == null ? "" : container.script);
textArea.enableCodeHighlighting();
textArea.setListener(this);
this.closeOnEsc(textArea::closeOnEsc);
this.addTextField(textArea);
int left1 = this.guiLeft + this.xSize - 104;
this.addButton(new GuiNpcButton(102, left1, this.guiTop + yoffset, 60, 20, "gui.clear"));
this.addButton(new GuiNpcButton(101, left1 + 61, this.guiTop + yoffset, 60, 20, "gui.paste"));
@@ -1470,6 +1470,10 @@ public class GuiScriptTextArea extends GuiNpcTextField {
setCursor(result.newCursorPosition, false);
}
public boolean closeOnEsc(){
return !searchBar.isVisible() && !goToLineDialog.isVisible();
}
// ==================== KEYBOARD MODIFIERS ====================
private boolean isAltKeyDown() {