Skip to content

Commit

Permalink
Fixes issue where clicking outside a SuggestionTextBox caused suggest…
Browse files Browse the repository at this point in the history
…ions to no longer appear until the GUI was reopened
  • Loading branch information
Zailer43 committed Sep 10, 2024
1 parent 45192ff commit ad93e20
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ private void closeContextMenu() {

private boolean contextMenuIsOpen() {
return this.suggestionsContextMenu != null &&
this.suggestionsContextMenu.hasParent() &&
this.suggestionsContainer != null &&
this.suggestionsLayout != null;
}
Expand Down Expand Up @@ -136,6 +137,7 @@ private void updateSuggestions(String newMessage) {
this.openContextMenu();
return;
}
assert this.suggestionsLayout != null;
this.suggestionsLayout.clearChildren();

String newMessageToLowerCase = newMessage.toLowerCase();
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit ad93e20

Please sign in to comment.