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
This commit is contained in:
parent
906a472f9e
commit
45103cc958
|
@ -131,19 +131,20 @@ Item {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
filteredList.clear();
|
filteredList.clear();
|
||||||
if (text !== "") {
|
let textToCheck = text.trim()
|
||||||
|
if (textToCheck !== "") {
|
||||||
for (var i = 0; i < inputList.count; i++) {
|
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});
|
filteredList.insert(filteredList.count, {"seedWord": inputList.get(i).seedWord});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
seedSuggestionsList.model = filteredList;
|
seedSuggestionsList.model = filteredList;
|
||||||
if (filteredList.count === 1 && input.edit.keyEvent !== Qt.Key_Backspace
|
if (filteredList.count === 1 && input.edit.keyEvent !== Qt.Key_Backspace
|
||||||
&& input.edit.keyEvent !== Qt.Key_Delete
|
&& input.edit.keyEvent !== Qt.Key_Delete
|
||||||
&& filteredList.get(0).seedWord.trim() === seedWordInput.text) {
|
&& filteredList.get(0).seedWord.trim() === textToCheck) {
|
||||||
seedWordInput.input.edit.cursorPosition = seedWordInput.text.length;
|
seedWordInput.input.edit.cursorPosition = textToCheck.length;
|
||||||
seedSuggestionsList.model = 0;
|
seedSuggestionsList.model = 0;
|
||||||
root.doneInsertingWord(seedWordInput.text);
|
root.doneInsertingWord(textToCheck);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
seedSuggestionsList.model = 0;
|
seedSuggestionsList.model = 0;
|
||||||
|
@ -211,6 +212,7 @@ Item {
|
||||||
|
|
||||||
function completeWordFill(seedWord) {
|
function completeWordFill(seedWord) {
|
||||||
seedWordInput.input.edit.text = seedWord.trim();
|
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;
|
seedWordInput.input.edit.cursorPosition = seedWordInput.text.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue