Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mindolph committed Oct 22, 2023
1 parent 7385c23 commit 70ae5fc
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ private void bindInputHelperContextMenu() {
if (!StringUtils.equals(oldValue, newValue)) inputHelpSource.push(newValue);
});

// stop helping when paragraph is changed by like mouse click.
this.currentParagraphProperty().addListener((observable, oldValue, newValue) -> {
inputHelperManager.consume(InputHelperManager.UNKNOWN_INPUT, null);
});
Expand All @@ -160,7 +161,10 @@ private void bindInputHelperContextMenu() {
});

inputHelperManager.onSelected((selection) -> {
this.insertText(this.getCaretPosition(), StringUtils.substringAfter(selection.selected(), selection.input()));
if (StringUtils.startsWithIgnoreCase(selection.selected(), selection.input())) {
int start = selection.input().length();
this.insertText(this.getCaretPosition(), StringUtils.substring(selection.selected(), start));
}
});
this.setOnKeyReleased(event -> {
if (!isInputMethod) {
Expand Down

0 comments on commit 70ae5fc

Please sign in to comment.