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:
File diff suppressed because one or more lines are too long
@@ -695,16 +695,15 @@ class WebTerminal {
|
|||||||
if (code >= 65 && code <= 90) {
|
if (code >= 65 && code <= 90) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.send(["stdin", String.fromCharCode(code - 64)]); // Ctrl+A=0x01, Ctrl+C=0x03, etc.
|
this.send(["stdin", String.fromCharCode(code - 64)]); // Ctrl+A=0x01, Ctrl+C=0x03, etc.
|
||||||
|
this.deactivateModifiers(); // Clear modifiers after physical Ctrl+letter
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let seq: string | null = null;
|
let seq: string | null = null;
|
||||||
let deactivate = false;
|
|
||||||
switch (e.key) {
|
switch (e.key) {
|
||||||
case "Escape":
|
case "Escape":
|
||||||
seq = "\x1b";
|
seq = "\x1b";
|
||||||
deactivate = true;
|
|
||||||
break;
|
break;
|
||||||
case "ArrowUp":
|
case "ArrowUp":
|
||||||
case "ArrowDown":
|
case "ArrowDown":
|
||||||
@@ -720,7 +719,6 @@ class WebTerminal {
|
|||||||
} else {
|
} else {
|
||||||
seq = `\x1b[${dir}`;
|
seq = `\x1b[${dir}`;
|
||||||
}
|
}
|
||||||
deactivate = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "Tab":
|
case "Tab":
|
||||||
@@ -730,16 +728,14 @@ class WebTerminal {
|
|||||||
seq = "\t";
|
seq = "\t";
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
deactivate = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (seq) {
|
if (seq) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.send(["stdin", seq]);
|
this.send(["stdin", seq]);
|
||||||
if (deactivate) {
|
// Always clear modifiers after any key
|
||||||
this.deactivateModifiers();
|
this.deactivateModifiers();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Focus textarea on touch/click to show mobile keyboard
|
// Focus textarea on touch/click to show mobile keyboard
|
||||||
|
|||||||
Reference in New Issue
Block a user