Parcourir la source

fixed autocompletion for pasting text

Sebastian Stenzel il y a 5 ans
Parent
commit
e14fc56b37

+ 3 - 4
main/ui/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyRecoverController.java

@@ -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 */