summaryrefslogtreecommitdiff
path: root/launcher/components/Spell.qml
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-08-07 16:40:04 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-08-07 17:27:46 +0800
commitb0a018f4b6831d3289d8cb3604af2c9d9d12e4e8 (patch)
tree65f5f9933380b8513cd78f01cc1d0817134ce5ec /launcher/components/Spell.qml
parentdd16e11c67411929e4167fe5d97f1810ad7012d6 (diff)
chore: standardize more Component functions
fix(Spell): not found if its correct
Diffstat (limited to 'launcher/components/Spell.qml')
-rw-r--r--launcher/components/Spell.qml21
1 files changed, 12 insertions, 9 deletions
diff --git a/launcher/components/Spell.qml b/launcher/components/Spell.qml
index 5d45e0b..61de03f 100644
--- a/launcher/components/Spell.qml
+++ b/launcher/components/Spell.qml
@@ -11,7 +11,6 @@ IComponent {
id: root
property list<string> aspell
- property string word: input.slice(prefix.length)
property int selectedIndex: -1
name: "Spell"
@@ -58,17 +57,19 @@ IComponent {
}
process: function () {
- proc.running = true;
+ Qt.callLater(() => {
+ proc.running = true;
+ });
const isValid = selectedIndex >= 0 && aspell.length > 0;
- const selected = isValid ? aspell[selectedIndex] : "n";
- const answer = selected === "*" ? word : selected;
+ const selected = isValid ? aspell[selectedIndex] : "";
+ const answer = selected === "*" ? input : selected;
return {
valid: isValid,
priority: isValid,
answer: isValid ? answer : "",
- predictiveCompletion: isValid ? answer.slice(word.length) : ""
+ predictiveCompletion: isValid ? answer.slice(input.length) : ""
};
}
@@ -116,7 +117,7 @@ IComponent {
if (aspell[selectedIndex] !== "*")
Clip.copy(aspell[selectedIndex]);
else
- Clip.copy(word);
+ Clip.copy(input);
}
function syncSelectionState() {
@@ -215,15 +216,17 @@ IComponent {
Process {
id: proc
- command: ["sh", "-c", "echo " + word + " | aspell -a"]
+ command: ["sh", "-c", "echo " + input + " | aspell -a"]
property bool found: false
stdout: SplitParser {
onRead: data => {
if (data.startsWith("&")) {
proc.found = true;
- aspell = data.split(/\W+/).filter(word => /^[A-Za-z]+$/.test(word)).slice(1);
- } else if (data.startsWith("*"))
+ aspell = data.split(/\W+/).filter(input => /^[A-Za-z]+$/.test(input)).slice(1);
+ } else if (data.startsWith("*")) {
+ proc.found = true;
aspell = ["*"];
+ }
}
}
onStarted: {