Repository navigation
Commit 52ab86f
committed
Fix(themes): typing in the Themes picker never applies a theme you did not pick
Found while recording the 2.78.0 diagram clip: from Gruvbox Hard dark,
Cmd+Shift+P, Themes, then typing l switched the app to Nord Light with
no row highlighted, and the next keystroke kept it there. Each new
filter runs two effects in one commit: one re-syncs the highlight onto
the current theme, which lands on the next render, and the preview one
read `active` in the same commit, still an index into the previous
list. It previewed whatever sat at that index in the new list, and the
next re-sync found that theme current and locked onto it. Choosing
Themes from the recent commands, with an empty query, could do the same
with an index from the command list.
The preview now remembers the mode and the list it last saw and skips
the commit in which either changed (and the first render), so it only
follows an `active` that was set against the list it indexes. Arrows,
the pointer and Enter preview and keep exactly as before, and Escape
still reverts.
The same take showed the theme search could not find "apple light" or
"gruvbox dark hard": rankItems scores each field alone and the query
spans two. rankThemes (lib/themes.ts) adds the row read as one phrase,
family, mode, flavor, label, below the label's weight, so typing a
label still ranks it first.
Tests: rankThemes (family plus mode or flavor, a label first, every
theme for an empty query). In the built app over CDP with isolated
stores, from Gruvbox Hard dark: typing "light" leaves the theme alone,
ArrowDown previews Apple Light and Escape reverts, "apple light" lists
Apple Light first, and Themes from the recents keeps the theme; six
runs passed. One earlier run read the theme 500 ms after ArrowDown
before it repainted, with the machine at a load average of about 38.1 parent e6bf83f commit 52ab86f
3 files changed
Lines changed: 47 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 107 | + | |
116 | 108 | | |
117 | 109 | | |
118 | 110 | | |
| |||
208 | 200 | | |
209 | 201 | | |
210 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
211 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
212 | 216 | | |
213 | 217 | | |
214 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
0 commit comments