fixed autocompletion for pasting text

This commit is contained in:
Sebastian Stenzel
2020-02-20 14:09:32 +01:00
parent 0d29e56948
commit e14fc56b37

View File

@@ -62,9 +62,9 @@ public class RecoveryKeyRecoverController implements FxController {
String currentWord = text.substring(beginOfWord, caretPos);
Optional<String> suggestion = autoCompleter.autocomplete(currentWord);
if (suggestion.isPresent()) {
String completion = suggestion.get().substring(currentWord.length() - 1);
change.setText(completion);
change.setAnchor(caretPos + completion.length() - 1);
String completion = suggestion.get().substring(currentWord.length());
change.setText(change.getText() + completion);
change.setAnchor(caretPos + completion.length());
}
}
return change;
@@ -86,7 +86,6 @@ public class RecoveryKeyRecoverController implements FxController {
@FXML
public void recover() {
recoveryKeyFactory.validateRecoveryKey(textarea.getText());
}
/* Getter/Setter */