CommandCodeAI / CommandCodeAI/command-code

Shift+Enter can't insert a newline

Open Beginner friendly
#841 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
4k
Forks
350
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the Ink render call and inspect how the terminal input lifecycle is handled; the issue identifies kittyKeyboard activation and the existing isNewlineShortcutKey parser as the relevant entry points. Enable the kitty keyboard protocol, preserve Ctrl+J and Enter behavior, and handle protocol cleanup on exit and signals. Verify with cmd in a kitty-protocol terminal using AAA, Shift+Enter, BBB, Enter, and confirm Ctrl+J still inserts a newline.

Written by the indexing model from the issue text.

Assessment

Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.