Skip to content

Shift + Enter newline ignored in Zed integrated terminal #20555

@therealmarrakesh

Description

@therealmarrakesh

What version of Codex CLI is running?

codex-cli 0.128.0

What subscription do you have?

Plus

Which model were you using?

gpt-5.5

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What terminal emulator and version are you using (if applicable)?

Zed integrated terminal, Zed 1.0.0, PowerShell 5.1

What issue are you seeing?

After upgrading to Codex CLI 0.128.0, pressing Shift+Enter no longer inserts a newline in the Codex TUI when running inside the Zed integrated terminal. Instead, pressing Shift+Enter does nothing at all.

Pressing Shift+Enter properly inserted newlines in 0.125.0. Downgrading to 0.125.0 restores the expected behavior.

What steps can reproduce the bug?

  1. On Windows, open Zed editor.
  2. Open the Zed integrated terminal.
  3. Run codex.
  4. Type some text.
  5. Press Shift+Enter.

What is the expected behavior?

Shift+Enter should insert a newline.

Additional information

In the Zed integrated terminal, Shift+Enter is reported as LF / U+000A, which corresponds to Ctrl+J in C0 control-code terms:

PowerShell `[Console]::ReadKey($true)` output:
Shift+Enter:
KeyCharCode : U+000A / decimal 10
Key                 : Enter
Modifiers       : Control

In previous version 0.125.0, this was directly handled in textarea.rs here:

KeyEvent {
                code: KeyCode::Char('j' | 'm'),
                modifiers: KeyModifiers::CONTROL,
                ..
            }
            | KeyEvent {
                code: KeyCode::Enter,
                ..
            } => self.insert_str("\n"),

But now newline handling goes through this keymap path in 0.128.0:

if keymap.insert_newline.is_pressed(event) {
    self.insert_str("\n");
    return;
}

Ctrl+J is bound to insert_newline:

editor: EditorKeymap {
                insert_newline: default_bindings![
                    ctrl(KeyCode::Char('j')),
                    ctrl(KeyCode::Char('m')),
                    plain(KeyCode::Enter),
                    shift(KeyCode::Enter)
                ],

But U+000A is not normalized to Ctrl+J in key_hint.rs:

fn c0_control_char_to_ctrl_char(ch: char) -> Option<char> {
    match ch {
        '\u{0002}' => Some('b'),
        '\u{0006}' => Some('f'),
        '\u{000e}' => Some('n'),
        '\u{0010}' => Some('p'),
        '\u{0012}' => Some('r'),
        '\u{0013}' => Some('s'),
        _ => None,
    }
}

Suggested Fix:

fn c0_control_char_to_ctrl_char(ch: char) -> Option<char> {
    match ch {
        '\u{0002}' => Some('b'),
        '\u{0006}' => Some('f'),
        '\u{000a}' => Some('j'),
        '\u{000e}' => Some('n'),
        '\u{0010}' => Some('p'),
        '\u{0012}' => Some('r'),
        '\u{0013}' => Some('s'),
        _ => None,
    }
}

This new match arm should normalize U+000A to logical Ctrl+J, which should then match the existing insert_newline binding in EditorKeymap in keymap.rs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displaybugSomething isn't workingregressionBehaviors that worked in previous versions but were broken due to an update

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions