Ghostty Shift+Enter (CSI 27;2;13~) is inserted as text and jumps to buffer start

Abierto
#4,292 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
52/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
go
Área
cli, tooling

Línea de trabajo

Start by reading the input parser and internal/action/defaults_other.go, where the issue says the Alt-[ binding causes the cursor jump. Trace how terminal key sequences become key events, then check the parser's tests for similar CSI sequences. Done means CSI 27;<modifier>;<keycode>~ is decoded into the corresponding key and modifiers, with Shift+Enter handled without inserting sequence text or moving the cursor to the buffer start.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug dependencies tcell

Description

Pressing Shift+Enter in micro under Ghostty inserts the literal text 27;2;13~ and jumps the cursor to the beginning of the buffer.

Environment

  • micro 2.0.15 (6a62575b), latest release
  • Ghostty 1.3.1 (Arch ghostty 1.3.1-arch2.1), Linux/Wayland, TERM_PROGRAM=ghostty
  • tcell github.com/micro-editor/tcell/v2 v2.0.13 (from go.mod)

Steps to reproduce

  1. Open micro in Ghostty.
  2. Press Shift+Enter.

Actual: the cursor jumps to the start of the buffer and 27;2;13~ is inserted as text.

Expected: a newline is inserted, or the key is ignored.

Root cause

Ghostty encodes Shift+Enter with the xterm modifyOtherKeys sequence:

CSI 27 ; 2 ; 13 ~      ->      \x1b[27;2;13~

tcell does not decode CSI 27;…~, so ESC [ matches the Alt-[ binding (DiffPrevious|CursorStart in internal/action/defaults_other.go) and moves the cursor to the top of the buffer; the rest of the sequence (27;2;13~) is inserted as runes.

I reproduced this through a pty with micro 2.0.15:

input result
\r (CR) inserts a newline
\n (LF) treated as Ctrl-J → PlayMacro, no visible effect
\x1b[27;2;13~ cursor jumps to start, 27;2;13~ inserted

Workarounds

  • Ghostty: keybind = shift+enter=text:\r sends CR, which micro treats as Enter.
  • micro: add "Ctrl-J": "InsertNewline" to bindings.json and let Ghostty keep sending text:\n.

Suggested fix

Decode xterm modifyOtherKeys (CSI 27 ; <modifier> ; <keycode> ~) in the input parser and map it to the corresponding key plus modifiers, so Shift+Enter can be bound normally (or defaults to InsertNewline). Other TUI projects have had to add the same handling for Ghostty.

Lenguaje dominante
Go
Estrellas
29.8k
Forks
1.4k
Merge medio
1 d 12 h
PR fusionados (30 d)
2

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 micro-editor/micro

Todos los issues de micro-editor/micro

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.