Shift + Enter newline ignored in Zed integrated terminal

Resolved 💬 10 comments Opened May 1, 2026 by therealmarrakesh Closed May 1, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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.

View original on GitHub ↗

10 Comments

github-actions[bot] contributor · 2 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #20501

Powered by Codex Action

therealmarrakesh · 2 months ago
Potential duplicates detected. Please review them and close your issue if it is a duplicate. * Regression: Alt+Enter no longer inserts newline in VS Code WSL terminal #20501 _Powered by Codex Action_

Thank you. But I believe this issue is not the same, even if it is adjacent.

#20501 is about Alt+Enter not being included as a newline alias.

This issue is about Shift+Enter in Zed being reported as LF / U+000A, which corresponds to Ctrl+J in C0 control-code terms. Ctrl+J is already included in the default editor.insert_newline bindings, but U+000A is not normalized to Ctrl+J in key_hint.rs, so the existing binding does not match.

misrtjakub · 2 months ago

I can take a small pass at this. The current C0 control-char normalization in codex-rs/tui/src/key_hint.rs does not map LF (\u{000a}) to Ctrl+J, while insert_newline already binds Ctrl+J. I’ll add that mapping with a focused unit test unless maintainers prefer a different normalization layer.

misrtjakub · 2 months ago

Follow-up: I have a small patch ready, but GitHub is currently showing that PR creation is limited to repository collaborators:

https://github.com/openai/codex/compare/main...misrtjakub:fix/codex-shift-enter-newline?expand=1

Could a maintainer confirm the preferred way for external contributors to submit this?

WodenJay · 2 months ago

Me too. I think it's a bug cuzz I can see ctrl-j, ctrl-m, enter, shift-enter when I use /keymap and select Insert Newline in codex-cli.

fcoury-oai contributor · 2 months ago

Add this to your ~/.codex/config.toml as a workaround for Zed on Windows users:

[tui.keymap.editor]
insert_newline = ["ctrl-j", "ctrl-m", "enter", "shift-enter", "alt-enter", "ctrl-enter"]

Zed registers Shift+Enter as Ctrl+Enter.

lgc653 · 2 months ago

I can confirm this is still not fully fixed for Zed on Windows.

What I tested:

  • codex-cli 0.128.0: newline shortcuts were broken in both VSCode integrated terminal and Zed integrated terminal.
  • codex-cli 0.130.0: the same shortcuts now work in VSCode integrated terminal, but still do not work in Zed integrated terminal.

I tested Shift+Enter, Alt+Enter, and the suggested Ctrl+J / tui.keymap.editor.insert_newline workaround.
In Zed, none of them worked for me.

So from my side, this looks like:

  • the VSCode-related path was fixed,
  • but Zed is still not delivering a key event / normalized input that Codex can actually match for newline insertion.

In other words, 0.130.0 appears to have improved terminal compatibility, but it does not fully fix the Zed integrated terminal case yet.

lgc653 · 2 months ago

Additional environment detail:

  • Zed version: 1.1.7
  • Zed commit: c17f25cd782edffab64b7c4167abfa44f865b125
  • Windows
  • codex-cli 0.130.0

So the currently reproducible failing combination on my side is:

  • Zed 1.1.7
  • Windows
  • codex-cli 0.130.0
  • integrated terminal
etraut-openai contributor · 2 months ago

@lgc653, this issue was already resolved. If you're seeing a similar issue, please open a new bug report and fill out all of the requested details in the bug report template.

therealmarrakesh · 2 months ago
Additional environment detail: Zed version: 1.1.7 Zed commit: c17f25cd782edffab64b7c4167abfa44f865b125 Windows codex-cli 0.130.0 So the currently reproducible failing combination on my side is: Zed 1.1.7 Windows codex-cli 0.130.0 integrated terminal

Using /keymap debug you should be able to confirm that shift-enter is being interpreted as ctrl-enter.

So the workaround I'm using at the moment is to just use /keymap to add ctrl-enter as an additional binding for insert newline.