Alt+<printable key> sends the bare key with no ESC prefix (readline/emacs/tmux meta bindings lost)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- frontend
Línea de trabajo
Empieza en lib/input-handler.ts, donde isPrintableCharacter rechaza las teclas modificadas con Alt y handleKeyDown las pasa al codificador de teclas. Comprueba si KeyEncoderOption.ALT_ESC_PREFIX llega a establecerse alguna vez. Se considera terminado cuando un Alt+b despachado produce la cadena "\u001bb", Alt+ArrowLeft y Alt+Backspace siguen codificándose como antes, y el cambio funciona en Linux sin romper la ruta de macOS referenciada en #109.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
Alt+<printable key> sends the bare key with no ESC prefix. Terminal applications rely on the meta prefix (readline Alt-b/Alt-f/Alt-d, emacs M-x, tmux/vim meta mappings), so all of them silently lose their Alt bindings. This is the Linux/Windows case of what #109 describes for macOS: isPrintableCharacter() correctly refuses Alt-modified keys, but they then reach the Ghostty key encoder without KeyEncoderOption.ALT_ESC_PREFIX ever being set, so the encoder emits just the character.
Seen on [email protected] (Chromium 14x on Linux). The same code path is unchanged on main (lib/input-handler.ts: isPrintableCharacter returns false for Alt, nothing sets ALT_ESC_PREFIX). (Shift+Tab from #109 is fixed on main but not in the published 0.4.0 -- see #137.)
Minimal reproduction
<div id="t"></div>
<script type="module">
import { init, Terminal } from 'ghostty-web';
await init();
const term = new Terminal();
term.open(document.getElementById('t'));
term.onData((d) => console.log(JSON.stringify(d)));
term.focus();
// Press Alt+B, or dispatch it:
term.element.dispatchEvent(new KeyboardEvent('keydown', { key: 'b', code: 'KeyB', altKey: true, bubbles: true, cancelable: true }));
</script>
Actual: "b". Expected (xterm.js, every native terminal, Ghostty itself with macos-option-as-alt/Linux defaults): "\u001bb".
Alt+ArrowLeft ("\u001b[1;3D") and Alt+Backspace ("\u001b\u007f") are fine, so the encoder path itself works; only the printable-key case loses the prefix.
Suggested fix
Either set KeyEncoderOption.ALT_ESC_PREFIX on the encoder (it is already a defined option) and let Alt+printable go through it, or handle altKey && !ctrlKey && !metaKey && event.key.length === 1 in handleKeyDown by emitting '\x1b' + event.key (on macOS, derive the letter from event.code as proposed in #109, since event.key is the composed character there).
Found while evaluating ghostty-web as a PTY renderer for https://github.com/erisera-code/clawser; the host currently works around it with attachCustomKeyEventHandler.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.9k
- Forks
- 182
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de coder/ghostty-web
-
buffer translateToString()/getChars() return '' for empty cells, collapsing cursor-positioned textAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
coder/ghostty-web#205 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
coder/ghostty-web#204 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
coder/ghostty-web#199 ·
-
Public buffer getChars and translateToString truncate multi-codepoint graphemesPosiblemente ocupada @schickling-assistant la tomó hace 11 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 76/100
coder/ghostty-web#200 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
coder/ghostty-web#198 ·
Todos los issues de coder/ghostty-web
Issues similares
-
bug help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
agent-task risk:low
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
guyellis/http-status-check#512 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
microsoft/playwright#43327 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/TypeScript#64758 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
opensearch-project/OpenSearch-Dashboards#12937 ·
Los mantenedores suelen responder en 2 días