Skip to content

Windows Terminal: Shift+Enter inserts literal [13;2u instead of a newline #48680

Closed

Description

@qyte

What version of Codex CLI is running?

codex-cli 0.157.1 (native Windows executable).

What platform is your computer?

Windows 11 Pro x64, build 26200.

What terminal emulator and version are you using?

Windows Terminal 1.24.11911.0, running PowerShell 7.6.6.

What issue are you seeing?

Pressing Shift+Enter inserts literal [13;2u into the composer instead of a newline. Repeated presses produce repeated fragments:

[13;2u[13;2u[13;2u

The reproduction depends on an explicit Windows Terminal sendInput mapping. Ctrl+J successfully inserts a newline on the same installation.

What steps can reproduce the bug?

The relevant Windows Terminal settings.json entries are:

{
  "actions": [
    {
      "command": {
        "action": "sendInput",
        "input": "\u001b[13;2u"
      },
      "id": "User.sendInput.ShiftEnterCustom"
    }
  ],
  "keybindings": [
    {
      "keys": "shift+enter",
      "id": "User.sendInput.ShiftEnterCustom"
    }
  ]
}

These are excerpts to merge into the existing arrays, not a replacement for the whole settings file.

  1. Use the Shift+Enter mapping above in Windows Terminal.
  2. Start native Windows codex.
  3. Type first line, then press Shift+Enter several times.
  4. Observe [13;2u fragments instead of line breaks.
  5. Press Ctrl+J and observe that it correctly inserts a newline.

The mapping was inspected locally, and both the Shift+Enter failure and Ctrl+J success were manually confirmed. The failure occurs while composing a message, before submission.

What is the expected behavior?

The mapped Shift+Enter sequence should insert a newline without submitting the message or inserting protocol text. Ordinary Enter submission and literal pasted text should remain intact.

Additional information

This configuration matches OpenCode's documented Windows Terminal mapping. OpenCode CLI 2.0.15 handles Shift+Enter successfully with the same terminal configuration in my normal use.

Related history: #4401 described the same literal output but is closed. This report isolates the explicit CSI-u mapping on current native Windows Codex. Please include that mapping when reproducing; unmodified native Shift+Enter exercises a different input route.

Separately, Ctrl+Enter briefly pauses the blinking cursor. That pause has not been timed or traced. Ctrl+J and Ctrl+Alt+V both work, so this observation does not establish a general Ctrl-key failure.

Version-pinned source observations

Codex already defines Shift+Enter as a newline binding in the 0.157.1 keymap.

The terminal mapping emits a CSI-u escape sequence. Codex's Windows input setup clears ENABLE_VIRTUAL_TERMINAL_INPUT, and its event source reasserts console input-record mode.

The pinned Crossterm fork's Windows event source reads individual console input records. Its Windows key parser maps virtual keys/characters; this path does not assemble a CSI-u sequence into a modified Enter event.

These observations are consistent with the failure. No native event trace or automated input replay has been captured, so the exact console translation of every input character is not established. The two Codex input-mode files were also unchanged at inspected main commit 67a709665ac7b50311b93e32612c9a8281684787.

A fix should handle the sequence at the input boundary and preserve standalone Escape, ordinary native key events, fragmented input, and pasted literal text containing [13;2u.

Activity

  1. added
    bug
    CLI
    windows-os
    TUI
    on Sep 27, 2026
  2. etraut-openai commented on Oct 2, 2026

    @etraut-openai
    Contributor

    (response from codex)

    Confirmed. Windows Terminal emits the configured CSI-u sequence as Win32 input records, but the Crossterm Windows parser drops the VK-zero Escape record. Codex therefore receives only [13;2u as printable input.

    This is an upstream Crossterm issue. Handling the bare suffix in Codex would risk corrupting legitimate pasted text, so we do not plan to work around it here. Revisit if Crossterm preserves the Escape record or Codex updates its Windows input backend.

  3. etraut-openai commented on Oct 12, 2026

    @etraut-openai
    Contributor

    (response from codex)

    Closing as fixed by #50720, included in CLI v0.162.1. Windows Terminal's mapped Shift+Enter sequence is now decoded as a modified Enter instead of inserting [13;2u text, so the newline binding works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLITUIbugwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions