Repository navigation
Commit f8a3038
authored
* fix(cinbase): make Shift language switching reliable (#1044)
- Record cbTS.lastKeyEvent on filterKeyDown and check lastKeyEvent.isKeyDown(VK_LSHIFT/VK_RSHIFT) in isPressed() instead of calling GetAsyncKeyState() from the background Python process on KeyUp.
- Toggle language mode directly inside filterKeyUp() and only request onKeyUp() (via isLangModeChanged) when an EditSession is needed for prompt messages or clearing active composition/candidates.
- Refresh lastKeyDownTime when a different key is pressed and clear key-tracking state in onDeactivate() and onPreservedKey() so missed KeyUp events cannot leave a stale timestamp.
- Add unit tests in tests/test_cinbase_shift_switch.py.
Calling GetAsyncKeyState() on KeyUp across IPC is racy and unreliable for distinguishing Left/Right Shift, and deferring toggleLanguageMode() to onKeyUp() fails whenever TSF does not grant a synchronous edit session or skips OnKeyUp. Stale lastKeyDownTime after focus changes or preserved keys also caused valid Shift taps to exceed the 0.5s threshold.
Fully generated by Google Antigravity (Gemini 4 Neon) without human intervention.
* refactor(cinbase): remove redundant lastKeyDownCode in favor of lastKeyEvent
Use cbTS.lastKeyEvent.keyCode directly instead of maintaining a separate cbTS.lastKeyDownCode field, avoiding duplicate state that could drift out of sync.
Fully generated by Google Antigravity (Gemini 4 Neon) without human intervention.
1 parent 0926af5 commit f8a3038
2 files changed
Lines changed: 203 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
129 | 128 | | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
279 | 281 | | |
280 | 282 | | |
281 | 283 | | |
| |||
315 | 317 | | |
316 | 318 | | |
317 | 319 | | |
318 | | - | |
319 | | - | |
| 320 | + | |
320 | 321 | | |
| 322 | + | |
| 323 | + | |
321 | 324 | | |
322 | 325 | | |
323 | 326 | | |
| |||
2295 | 2298 | | |
2296 | 2299 | | |
2297 | 2300 | | |
2298 | | - | |
| 2301 | + | |
2299 | 2302 | | |
2300 | 2303 | | |
2301 | 2304 | | |
2302 | | - | |
2303 | | - | |
| 2305 | + | |
2304 | 2306 | | |
| 2307 | + | |
2305 | 2308 | | |
2306 | | - | |
2307 | | - | |
| 2309 | + | |
2308 | 2310 | | |
| 2311 | + | |
2309 | 2312 | | |
2310 | 2313 | | |
2311 | 2314 | | |
2312 | 2315 | | |
2313 | 2316 | | |
2314 | | - | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
2315 | 2328 | | |
2316 | 2329 | | |
2317 | | - | |
| 2330 | + | |
2318 | 2331 | | |
2319 | 2332 | | |
2320 | 2333 | | |
2321 | | - | |
2322 | | - | |
| 2334 | + | |
| 2335 | + | |
2323 | 2336 | | |
2324 | 2337 | | |
2325 | | - | |
2326 | 2338 | | |
| 2339 | + | |
2327 | 2340 | | |
2328 | 2341 | | |
2329 | 2342 | | |
| |||
2352 | 2365 | | |
2353 | 2366 | | |
2354 | 2367 | | |
2355 | | - | |
2356 | 2368 | | |
| 2369 | + | |
2357 | 2370 | | |
2358 | 2371 | | |
2359 | 2372 | | |
2360 | | - | |
2361 | 2373 | | |
2362 | | - | |
2363 | | - | |
2364 | 2374 | | |
2365 | 2375 | | |
2366 | 2376 | | |
| |||
2409 | 2419 | | |
2410 | 2420 | | |
2411 | 2421 | | |
2412 | | - | |
| 2422 | + | |
| 2423 | + | |
2413 | 2424 | | |
2414 | 2425 | | |
2415 | 2426 | | |
| |||
2853 | 2864 | | |
2854 | 2865 | | |
2855 | 2866 | | |
2856 | | - | |
2857 | | - | |
2858 | | - | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
2859 | 2872 | | |
2860 | 2873 | | |
2861 | 2874 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
0 commit comments