diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-21 10:33:48 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-21 10:33:48 +0200 |
| commit | e3cbb769f63813a2a2e90aa9607dcc7359a18903 (patch) | |
| tree | 84619c2d4c420ea02c8f8a3457e7cc8797eb494f | |
| parent | 77952289f8176703eef7134262c6fd6d0d835dd6 (diff) | |
| download | quickshell-e3cbb769f63813a2a2e90aa9607dcc7359a18903.tar.gz quickshell-e3cbb769f63813a2a2e90aa9607dcc7359a18903.zip | |
settings: a keyword hit stays out when a row matches too
Searching "zoom" listed Mail twice: once for the module keyword, which
opens the page at the top, and once for the Message zoom row, which
scrolls to it and flashes it. The keyword hit looked like a reveal that
failed. It now shows only when none of the page's rows match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rw-r--r-- | desktop/Settings.qml | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/desktop/Settings.qml b/desktop/Settings.qml index 607d6a3..e73445c 100644 --- a/desktop/Settings.qml +++ b/desktop/Settings.qml @@ -54,16 +54,17 @@ Scope { const q = root.query.trim().toLowerCase(); const out = []; for (const m of root.pages) { + // ponytail: the first perPage rows per page; a narrower query finds the rest. + const rows = q === "" ? [] : m.searchItems.filter(it => it.text.toLowerCase().includes(q)).slice(0, root.perPage); if (q === "" || m.label.toLowerCase().includes(q) || m.name.includes(q)) out.push({ mod: m, hit: "", key: "" }); - else { + else if (rows.length === 0) { + // A keyword that a row also matches would only repeat that + // row as a hit that opens at the top, so it shows alone. const k = Array.from(m.keywords).find(w => w.toLowerCase().includes(q)); if (k !== undefined) out.push({ mod: m, hit: k, key: "" }); } - if (q === "") continue; - // ponytail: the first perPage rows per page; a narrower query finds the rest. - for (const it of m.searchItems.filter(it => it.text.toLowerCase().includes(q)).slice(0, root.perPage)) - out.push({ mod: m, hit: it.text, key: it.key }); + for (const it of rows) out.push({ mod: m, hit: it.text, key: it.key }); } return out; } |
