From ad93e20d587ba154069894ecd085b3417bec222e Mon Sep 17 00:00:00 2001 From: Zailer43 Date: Tue, 10 Sep 2024 15:33:59 -0300 Subject: [PATCH] Fixes issue where clicking outside a SuggestionTextBox caused suggestions to no longer appear until the GUI was reopened --- .../zailer/me/client/gui/components/SuggestionTextBox.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/fzmm/zailer/me/client/gui/components/SuggestionTextBox.java b/src/main/java/fzmm/zailer/me/client/gui/components/SuggestionTextBox.java index 2e803f1f..ad4c1c91 100644 --- a/src/main/java/fzmm/zailer/me/client/gui/components/SuggestionTextBox.java +++ b/src/main/java/fzmm/zailer/me/client/gui/components/SuggestionTextBox.java @@ -94,6 +94,7 @@ private void closeContextMenu() { private boolean contextMenuIsOpen() { return this.suggestionsContextMenu != null && + this.suggestionsContextMenu.hasParent() && this.suggestionsContainer != null && this.suggestionsLayout != null; } @@ -136,6 +137,7 @@ private void updateSuggestions(String newMessage) { this.openContextMenu(); return; } + assert this.suggestionsLayout != null; this.suggestionsLayout.clearChildren(); String newMessageToLowerCase = newMessage.toLowerCase(); @@ -294,6 +296,7 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { this.openContextMenu(); yield true; } + assert this.suggestionsLayout != null; if (this.suggestionsLayout.children().isEmpty()) { this.updateSuggestions(this.getText()); yield !this.suggestionsLayout.children().isEmpty();