-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Two keyboard handling issues:
1. Shift+Tab doesn't send backtab sequence
Shift+Tab should send ESC[Z (backtab), but ghostty-web doesn't handle this case.
Proposed fix - add Shift+Tab handling in handleKeyDown:
if (event.shiftKey && event.key === "Tab") {
this.onDataCallback("\x1B[Z");
event.preventDefault();
return;
}2. Alt+key on macOS produces wrong characters
On macOS, Alt+letter produces transformed Unicode characters (e.g., Alt+T → †, Alt+D → ∂). The terminal should send ESC+letter sequences instead.
The issue: event.key is already transformed by macOS, but isPrintableCharacter uses it directly. The encoder then receives garbled input.
Proposed fix - intercept Alt+letter on macOS and use event.code:
if (isMac && event.altKey && !event.metaKey && !event.ctrlKey) {
const match = event.code.match(/^Key([A-Z])$/);
if (match) {
const baseKey = event.shiftKey ? match[1] : match[1].toLowerCase();
this.onDataCallback(`\x1B${baseKey}`);
event.preventDefault();
return;
}
}Note: These fixes were developed during an AI-assisted session and are currently used in our application's keyboard handler. Due to time constraints we're unable to submit a proper PR, but wanted to share the findings.