From 45103cc9581eb50d8abf652bd7a7fa908be374d1 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 5 May 2022 11:05:03 -0400 Subject: [PATCH] fix(StatusSeedPhraseInput): fix pasting word with spaces in them This makes it possible to paste a word with a space in it. It will insert it correctly --- .../src/StatusQ/Controls/StatusSeedPhraseInput.qml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ui/StatusQ/src/StatusQ/Controls/StatusSeedPhraseInput.qml b/ui/StatusQ/src/StatusQ/Controls/StatusSeedPhraseInput.qml index 34aee7508f..ea6c8103a9 100644 --- a/ui/StatusQ/src/StatusQ/Controls/StatusSeedPhraseInput.qml +++ b/ui/StatusQ/src/StatusQ/Controls/StatusSeedPhraseInput.qml @@ -131,19 +131,20 @@ Item { return } filteredList.clear(); - if (text !== "") { + let textToCheck = text.trim() + if (textToCheck !== "") { for (var i = 0; i < inputList.count; i++) { - if (inputList.get(i).seedWord.startsWith(text)) { + if (inputList.get(i).seedWord.startsWith(textToCheck)) { filteredList.insert(filteredList.count, {"seedWord": inputList.get(i).seedWord}); } } seedSuggestionsList.model = filteredList; if (filteredList.count === 1 && input.edit.keyEvent !== Qt.Key_Backspace && input.edit.keyEvent !== Qt.Key_Delete - && filteredList.get(0).seedWord.trim() === seedWordInput.text) { - seedWordInput.input.edit.cursorPosition = seedWordInput.text.length; + && filteredList.get(0).seedWord.trim() === textToCheck) { + seedWordInput.input.edit.cursorPosition = textToCheck.length; seedSuggestionsList.model = 0; - root.doneInsertingWord(seedWordInput.text); + root.doneInsertingWord(textToCheck); } } else { seedSuggestionsList.model = 0; @@ -211,6 +212,7 @@ Item { function completeWordFill(seedWord) { seedWordInput.input.edit.text = seedWord.trim(); + // Changing the text of the input triggers the onTextChanged, thus signalling doneInsertingWord if the condition passes seedWordInput.input.edit.cursorPosition = seedWordInput.text.length; }