Repository navigation
Commit ec63a6c
committed
fix(ui): ignore key release events so keys do not fire twice on Windows
On Windows crossterm reports both a Press and a Release event for a single
physical keypress ("Add key release event for windows", crossterm 0.26.0+).
handle_event dispatched every Event::Key without checking KeyEventKind, so
each tap ran its action twice: pressing Space paused and then immediately
resumed playback, making manual playback control unusable. Every other key
was affected the same way (h/l stepped two lines, q quit twice, etc.).
Filter on the press at the single dispatch point, which covers all keys.
Linux and macOS are unaffected because they do not emit release events.
Verified on Windows 10 25H2 by driving a real ConPTY session: one physical
'p' keypress produced both a Press and a Release event. A differential test
that sends a single Space and measures output for the following second shows
32,803 bytes of animation continuing without the fix vs 126 bytes (staying
paused) with it.
Fixes #2501 parent e756f0e commit ec63a6c
1 file changed
Lines changed: 70 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
565 | 565 | | |
566 | 566 | | |
567 | 567 | | |
568 | | - | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
569 | 575 | | |
570 | 576 | | |
571 | 577 | | |
| |||
1266 | 1272 | | |
1267 | 1273 | | |
1268 | 1274 | | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
1269 | 1338 | | |
1270 | 1339 | | |
1271 | 1340 | | |
| |||
0 commit comments