Shift + Enter newline ignored in Zed integrated terminal
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?
- On Windows, open Zed editor.
- Open the Zed integrated terminal.
- Run
codex. - Type some text.
- 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.
10 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Thank you. But I believe this issue is not the same, even if it is adjacent.
#20501 is about
Alt+Enternot being included as a newline alias.This issue is about
Shift+Enterin Zed being reported as LF /U+000A, which corresponds toCtrl+Jin C0 control-code terms.Ctrl+Jis already included in the defaulteditor.insert_newlinebindings, butU+000Ais not normalized toCtrl+Jinkey_hint.rs, so the existing binding does not match.I can take a small pass at this. The current C0 control-char normalization in
codex-rs/tui/src/key_hint.rsdoes not map LF (\u{000a}) to Ctrl+J, whileinsert_newlinealready binds Ctrl+J. I’ll add that mapping with a focused unit test unless maintainers prefer a different normalization layer.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?
Me too. I think it's a bug cuzz I can see
ctrl-j, ctrl-m, enter, shift-enterwhen I use/keymapand selectInsert Newlinein codex-cli.Add this to your
~/.codex/config.tomlas a workaround for Zed on Windows users:Zed registers Shift+Enter as Ctrl+Enter.
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 suggestedCtrl+J/tui.keymap.editor.insert_newlineworkaround.In Zed, none of them worked for me.
So from my side, this looks like:
In other words,
0.130.0appears to have improved terminal compatibility, but it does not fully fix the Zed integrated terminal case yet.Additional environment detail:
1.1.7c17f25cd782edffab64b7c4167abfa44f865b125codex-cli 0.130.0So the currently reproducible failing combination on my side is:
1.1.7codex-cli 0.130.0@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.
Using
/keymap debugyou should be able to confirm thatshift-enteris being interpreted asctrl-enter.So the workaround I'm using at the moment is to just use
/keymapto addctrl-enteras an additional binding forinsert newline.