Skip to content

fix: shift enter newline - #568

Closed
tomascupr wants to merge 5 commits into
openai:mainfrom
tomascupr:fix/shift-enter-newline
Closed

tomascupr wants to merge 5 commits into
openai:mainfrom
tomascupr:fix/shift-enter-newline

Conversation

@tomascupr

Copy link
Copy Markdown
Contributor

Fix: Shift + Enter inserts a newline

Summary

Restores the expected “new line vs send” behavior in the multiline editor.

Key points

  • multiline‑editor.tsx

  • Handles CSI‑u (ESC [13;mod u) and legacy (ESC [27;mod;13~) Shift/Ctrl‑Enter sequences, with or without the leading ESC.

  • Shift+Enter → newline; Ctrl+Enter or plain Enter → submit.

  • ESLint‑clean; no formatting changes elsewhere.

@tomascupr tomascupr mentioned this pull request Apr 23, 2025
@tibo-openai

tibo-openai commented Apr 23, 2025 •

Copy link
Copy Markdown
Collaborator

Thanks! Could you add a test as part of this that ensures we don't regress and that things are generally working as expected?

@tomascupr

Copy link
Copy Markdown
Contributor Author

They really don't work as expected :) But sure!

@tomascupr

Copy link
Copy Markdown
Contributor Author

Fixing this #545. Annoying.

Comment thread codex-cli/src/utils/config.ts Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks unrelated, could you revert this together with the associated test?

@tibo-openai tibo-openai changed the title Fix/shift enter newline fix: shift enter newline Apr 23, 2025
@benny123tw

Copy link
Copy Markdown
Contributor

I created an upstream PR to resolve the issue where the shift key is always set to true when the input is \r. vadimdemedes/ink#712

@tomascupr
tomascupr force-pushed the fix/shift-enter-newline branch from 51c2086 to 0dbcd4e Compare April 23, 2025 07:35
@tomascupr

Copy link
Copy Markdown
Contributor Author

@tibo-openai sorry for my poor branch work. I am actually using codex in two terminals and sometimes things get messed up. I will split the envs.

@fouad-openai

Copy link
Copy Markdown
Contributor

I tested this branch using both Ghostty + iTerm 2 and it seems to keep sending when I press 'shift+enter' - is there something I'm missing?

@codex-maintainers

Copy link
Copy Markdown

Thanks for the contribution! We're primarily focused on the native/Rust implementation of Codex CLI and would love to see if this is still an issue on the latest version. If it is, we're happy to take a look at a PR to the codex-rs/ implementation.

@github-actions github-actions Bot locked and limited conversation to collaborators Aug 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants