fix: always clear modifiers after ANY key press

Modifiers should be cleared regardless of whether the key came from:
- Physical keyboard (Ctrl+letter combinations)
- Soft keyboard (letters via input event)
- Special keys (Enter/Backspace/Delete via beforeinput)
- Navigation keys (arrows, Tab, Escape via keydown)
- Keybar buttons

Previously, some code paths had conditional clearing (deactivate flag)
or early returns without clearing. Now ALL key presses unconditionally
call deactivateModifiers() to ensure modifiers never stay sticky.
This commit is contained in:
GitHub Copilot
2026-01-29 20:43:47 +00:00
parent d4b292e636
commit 6bdc5b69ca
2 changed files with 9 additions and 13 deletions
File diff suppressed because one or more lines are too long
+3 -7
View File
@@ -695,16 +695,15 @@ class WebTerminal {
if (code >= 65 && code <= 90) {
e.preventDefault();
this.send(["stdin", String.fromCharCode(code - 64)]); // Ctrl+A=0x01, Ctrl+C=0x03, etc.
this.deactivateModifiers(); // Clear modifiers after physical Ctrl+letter
return;
}
}
let seq: string | null = null;
let deactivate = false;
switch (e.key) {
case "Escape":
seq = "\x1b";
deactivate = true;
break;
case "ArrowUp":
case "ArrowDown":
@@ -720,7 +719,6 @@ class WebTerminal {
} else {
seq = `\x1b[${dir}`;
}
deactivate = true;
break;
}
case "Tab":
@@ -730,15 +728,13 @@ class WebTerminal {
seq = "\t";
}
e.preventDefault();
deactivate = true;
break;
}
if (seq) {
e.preventDefault();
this.send(["stdin", seq]);
if (deactivate) {
this.deactivateModifiers();
}
// Always clear modifiers after any key
this.deactivateModifiers();
}
});