Skip to content

Commit

Permalink
Correction of text formatter.
Browse files Browse the repository at this point in the history
  • Loading branch information
balthaB committed May 8, 2024
1 parent 8282190 commit d26a4d5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ch/epfl/chacun/gui/ActionsUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ public static Node create(ObservableValue<List<String>> actionsO, Consumer<Strin
actionField.setId("action-field");

actionField.setTextFormatter(new TextFormatter<>(change -> {
change.setText(change.getText().replaceAll(change.getText()
.chars().filter(c -> !Base32.isValid(String.valueOf(c))).toString(), ""));
change.setText(change.getText().toUpperCase());
change.getText().chars().forEach(i -> {
String c = String.valueOf((char) i);
if (!Base32.isValid(String.valueOf(c)))
change.setText(change.getText().replace(c, ""));
});
return change;
}));

Expand Down

0 comments on commit d26a4d5

Please sign in to comment.