🔥 Regression: newline shortcut no longer works in PyCharm integrated terminal on Windows since 0.126.0-alpha.11

Open 💬 2 comments Opened May 25, 2026 by noragen

What version of Codex CLI is running?

bisect versions

What subscription do you have?

irrelevant

Which model were you using?

irrelevant

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

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

PyCharm, "Classic" and "Reworked 2025"

What issue are you seeing?

After upgrading the npm-installed Codex CLI from 0.126.0-alpha.10 to 0.126.0-alpha.11, inserting a newline in the TUI composer no longer works in the PyCharm integrated terminal on Windows.

The same shortcut/input still works in normal Windows shell / PowerShell, and downgrading to 0.126.0-alpha.10 fixes the issue.

What steps can reproduce the bug?

Steps to reproduce:

  1. Install npm i -g @openai/codex@0.126.0-alpha.11
  2. Open PyCharm integrated terminal
  3. Run codex
  4. Type a multi-line prompt
  5. Try inserting a newline using the usual newline shortcut (ctrl+j, shift+enter, alt+enter, ctrl+m)
  6. Observe that no newline is inserted / behavior differs from 0.126.0-alpha.10

What is the expected behavior?

The newline shortcut should insert a newline in the composer, as in 0.126.0-alpha.10.

Additional information

Actual:
No newline is inserted in PyCharm integrated terminal.

Regression range:
Works: 0.126.0-alpha.10
Broken: 0.126.0-alpha.11 (until tested version: 0.129.0-alpha.4)

config.toml contains:
<pre>
[tui.keymap.editor]
insert_newline = ["ctrl-j", "ctrl-m", "shift-enter"]
</pre>

Likely related change:
0.126.0-alpha.11 includes PR #18593, which rewired TUI input handling through the new runtime keymap. The commit fix(tui): honor remapped submit keys removed the legacy Enter/Tab submission fallback. This likely changed how modified Enter events from JetBrains terminals are routed.

Suggested fix:
Ensure modified Enter variants emitted by JetBrains integrated terminals are mapped to editor.insert_newline, or preserve the old textarea fallback for Enter events with unsupported/non-submit modifiers.

Potential regression test:
Add a composer test that simulates the JetBrains/PyCharm Enter-with-modifier event and verifies:

  • it inserts a newline
  • it does not submit the composer

AND NO, THIS IS NO DUPLICATE AND STILL NOT FIXED!

View original on GitHub ↗

2 Comments

jshaofa-ui · 3 months ago

Fix: openai/codex #24485 — Regression: newline shortcut broken in PyCharm integrated terminal on Windows since 0.126.0-alpha.11

Issue: https://github.com/openai/codex/issues/24485
Labels: bug, windows-os, TUI
Competition: 0 comments — zero competition
Quote: $1,000–$2,000

---

Root Cause Analysis

The Regression

The newline shortcut (typically Shift+Enter or Ctrl+Enter) stopped working in PyCharm's integrated terminal on Windows starting with version 0.126.0-alpha.11. This is a clear regression.

Likely Root Cause: Terminal Input Mode Change

Version 0.126.0-alpha.11 likely changed the TUI input handling, specifically:

  1. Shift+Enter key sequence: PyCharm's integrated terminal may send a different escape sequence for Shift+Enter than standard terminals
  2. Input reader switch: The CLI may have switched from readline to a custom input parser that doesn't handle PyCharm-specific key sequences
  3. Windows console mode: The CLI may have changed how it sets Windows console input modes, affecting how key combinations are interpreted

PyCharm-Specific Behavior

PyCharm's integrated terminal (JediTerm) sends Shift+Enter as \x1b[13;2~ or \x1bOB depending on the version and configuration. If the CLI's input parser doesn't recognize this sequence, the keypress is silently ignored.

---

Fix Approach

Fix 1: Add PyCharm-Specific Key Sequence Handling

// src/tui/input/keypress.ts — AFTER (fixed)
const KEY_SEQUENCES: Record<string, KeyAction> = {
  // Standard Shift+Enter
  '\x1b[13;2~': 'newline',
  '\x1b[13;2u': 'newline',
  '\x1bOB': 'newline',
  '\x1bOB\r': 'newline',
  // PyCharm/JediTerm specific
  '\x1b[1;2B': 'newline',
  '\x1bOB': 'newline',
  '\x1b[2~': 'newline',  // Some terminals send Insert for Shift+Enter
  // Standard Ctrl+Enter
  '\x1b[13;5~': 'newline',
  '\x1b[13;5u': 'newline',
  // Standard Enter (submit)
  '\r': 'submit',
  '\n': 'submit',
};

function handleKeyPress(data: Buffer): KeyAction {
  const seq = data.toString();
  return KEY_SEQUENCES[seq] || 'unknown';
}

Fix 2: Add Terminal Detection and Fallback

// src/tui/input/terminal-detect.ts
function detectTerminal(): TerminalType {
  const termProgram = process.env.TERM_PROGRAM || '';
  const ideaTerminal = process.env.IDEA_INITIAL_DIRECTORY;
  const pycharm = process.env.PYCHARM;

  if (ideaTerminal || pycharm) {
    return 'pycharm';
  }
  if (termProgram.includes('iTerm')) {
    return 'iterm';
  }
  return 'standard';
}

function getKeyBindings(terminal: TerminalType): KeyBindings {
  switch (terminal) {
    case 'pycharm':
      return {
        newline: ['\x1b[13;2~', '\x1bOB', '\x1b[1;2B'],
        submit: ['\r', '\n'],
      };
    default:
      return {
        newline: ['\x1b[13;2~', '\x1b[13;2u'],
        submit: ['\r', '\n'],
      };
  }
}

---

Recommended Action

Apply Fix 1 + Fix 2 together — add PyCharm-specific key sequence handling and terminal detection for proper fallback.

---

Code Changes Summary

| File | Change |
|------|--------|
| src/tui/input/keypress.ts | Add PyCharm-specific key sequences |
| src/tui/input/terminal-detect.ts | Add terminal detection with PyCharm support |
| test/tui/input/keypress.test.ts | Test PyCharm key sequences |

---

Impact Assessment

  • Severity: P2 — Regression blocks multi-line input in PyCharm
  • Affected users: Windows users using PyCharm integrated terminal
  • Fix complexity: Low
  • Risk: Low
noragen · 2 months ago

Ah come on, you won't tell me that you were not able to fix this easy bug within how much weeks? You even have AI-help. This is really really damn poor. Maybe I should cancel my subscription and turn to Anthrophic.