CommandCodeAI / CommandCodeAI/command-code
Shift+Enter can't insert a newline
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Sin datos de lenguaje
- Estrellas
- 4k
- Forks
- 350
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Summary
Shift+Enter submits the prompt instead of inserting a newline, so multi-line prompts are impossible without knowing the undocumented Ctrl+J fallback. The input parser already accepts the enhanced Shift+Enter sequences; the app never activates the kitty keyboard protocol, so capable terminals keep sending a bare CR.
Expected Behavior
Enter submits, Shift+Enter inserts a newline — as the help panel states: "Shift+Enter / Alt+Enter → Insert a newline". tui.input.newLine already defaults to ["shift+enter","ctrl+j"] .
Actual Behavior
Shift+Enter behaves exactly like Enter: the prompt submits immediately. Only Ctrl+J inserts a newline.
Cause: the build bundles ink 7.1.0 but never sets kittyKeyboard , and contains no protocol push ( \x1b[>1u ). The parser does accept the encoded sequence ( isNewlineShortcutKey handles \x1b[13;2u , \x1b[27;2;13~ and peers), so only the activation is missing.
Steps to reproduce the issue
- Run cmd in a kitty-protocol terminal (WezTerm here; it needs enable_kitty_keyboard = true ).
- Type AAA , press Shift+Enter, type BBB , press Enter.
- Observed: submits on Shift+Enter, only AAA is sent. Expected: two lines.
Pushing \x1b[>1u around the binary from a zsh wrapper makes Shift+Enter send \x1b[13;2u and work correctly, which confirms the terminal and parser are fine.
Command Code Version
1.53.1
Operating System
Arch Linux 7.2.4-arch1-2 / Hyprland 0.56.2 (Wayland)
Terminal/IDE
WezTerm 20260716-195552-76b606ec
Shell
zsh 5.9.2
Session file (optional)
No response
Fix prompt (optional)
Enable the kitty keyboard protocol in the Ink render call — Ink supports it since 6.7.0:
render(<App />, { kittyKeyboard: { mode: 'enabled' } });
Use 'enabled' , not 'auto' (auto-detection fails under tmux). Pop with \x1b[<u on exit and in signal handlers. The parser already handles the sequences, so no parser change is needed. Keep Ctrl+J as the universal fallback and document that WezTerm needs enable_kitty_keyboard = true .
Check: cmd → AAA → Shift+Enter → BBB → Enter must show two lines; Ctrl+J must still insert a newline and Enter must still submit.
Additional context
No response
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
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.
Línea de trabajo
Localiza la llamada de renderizado de Ink e inspecciona cómo se gestiona el ciclo de vida de la entrada del terminal; el issue identifica la activación de kittyKeyboard y el parser existente isNewlineShortcutKey como los puntos de entrada relevantes. Habilita el protocolo de teclado de kitty, conserva el comportamiento de Ctrl+J y Enter, y gestiona la limpieza del protocolo al salir y ante señales. Verifícalo con cmd en un terminal con protocolo de kitty usando AAA, Shift+Enter, BBB y Enter, y confirma que Ctrl+J sigue insertando un salto de línea.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Área
- cli
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Activo
- Claridad
- Bien especificado
- Aptitud para principiantes
- 78/100