Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Alt+<printable key> sends the bare key with no ESC prefix (readline/emacs/tmux meta bindings lost)

Abierto Apto para principiantes
#203 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de coder/ghostty-web

Todos los issues de coder/ghostty-web

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.