CommandCodeAI / CommandCodeAI/command-code

Shift+Enter can't insert a newline

Aperta Adatta ai principianti
#841 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Nessun dato sulla lingua
Stelle
4k
Fork
350
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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
  1. Run  cmd  in a kitty-protocol terminal (WezTerm here; it needs  enable_kitty_keyboard = true ).
  2. Type  AAA , press Shift+Enter, type  BBB , press Enter.
  3. 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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Individua la chiamata di rendering di Ink e analizza come viene gestito il ciclo di vita dell’input del terminale; l’issue identifica l’attivazione di kittyKeyboard e il parser esistente isNewlineShortcutKey come punti di ingresso rilevanti. Abilita il protocollo della tastiera kitty, preserva il comportamento di Ctrl+J e Enter e gestisci la pulizia del protocollo all’uscita e in caso di segnali. Verifica con cmd in un terminale con protocollo kitty usando AAA, Shift+Enter, BBB e Enter e conferma che Ctrl+J inserisca ancora una nuova riga.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Ambito
cli
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Attiva
Chiarezza
Specificata chiaramente
Idoneità per principianti
78/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.