Skip to content

Terminal: send Shift+Tab, Delete, Ctrl+Alt and Ctrl+digit keys as xterm does - #3067

Open
insjang wants to merge 1 commit into
eclipse-platform:masterfrom
insjang:xterm-keys
Open

insjang wants to merge 1 commit into
eclipse-platform:masterfrom
insjang:xterm-keys

Conversation

@insjang

@insjang insjang commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Keys that Claude Code, Codex and other terminal programs use, checked key by key against xterm:

  • Shift+Tab sends back tab (CSI Z), as xterm and Windows Terminal do, and no longer moves the focus out of the terminal; Claude Code switches modes with it.
  • Ctrl, Shift and Alt with Delete carry the modifier (CSI 3 ; 5 ~ and so on); every Delete used to arrive as a plain Delete.
  • A real Ctrl+Alt keeps its Alt: ESC before the control character, as in xterm (Ctrl+Alt+V pastes an image in Codex on WSL). AltGr, which SWT reports as Ctrl+Alt with the character it types, types that character as before.
  • Ctrl+2 to Ctrl+8 send NUL, ESC, FS, GS, RS, US and DEL; on Windows they sent the digits.
  • On the alternate screen Alt and Ctrl with the arrows go to the full screen program even where Eclipse has a binding for them (Alt+Up edits a queued message in Codex); at the shell prompt Alt+Up still maximizes the view.

How to test, in a bash terminal: run od -c, press the key, then Enter, and Ctrl+D to end.

  • Shift+Tab shows 033 [ Z, and the focus stays in the terminal.
  • Ctrl+Delete shows 033 [ 3 ; 5 ~ (Shift: ; 2, Alt: ; 3).
  • Ctrl+Alt+V shows 033 026; on a German keyboard AltGr+Q still types @.
  • Ctrl+6 shows 036.
  • In vim (alternate screen) Alt+Up is not taken by Eclipse; at the prompt Alt+Up still maximizes the view.

Tests: new cases in VT100EmulatorTest for Ctrl with the digits, Alt with ESC (AltGr included), Delete with modifiers and the alternate screen flag.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

    54 files  ±0      54 suites  ±0   38m 28s ⏱️ +39s
 5 025 tests +3   5 003 ✅ +3   22 💤 ±0  0 ❌ ±0 
12 966 runs  +9  12 812 ✅ +9  154 💤 ±0  0 ❌ ±0 

Results for commit b765599. ± Comparison against base commit 30dafa8.

♻️ This comment has been updated with latest results.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Native SWT keyboard behavior needs Windows/Linux and AltGr-layout validation because helper tests do not cover Shift+Tab traversal or characters delivered for Ctrl+Alt chords.

No open issues 🎉

What changed in this PR

Aligns Eclipse Terminal’s keyboard handling with xterm so terminal applications receive expected key sequences while preserving AltGr input and shell-prompt shortcuts.

Changes:

  • Adds Shift+Tab handling, modified Delete sequences, Ctrl+digit mappings, and ESC prefixes for control-character Ctrl+Alt combinations.
  • Routes modified arrows to terminal applications on the alternate screen, even when Eclipse has matching bindings.
  • Adds tests for character mappings, AltGr handling, modified Delete, and alternate-screen state.
File Description
terminal/​tests/​org.eclipse.terminal.test/​src/​org/​eclipse/​terminal/​internal/​emulator/​VT100EmulatorTest.java Tests key mappings, Alt handling, and alternate-screen reporting.
terminal/​bundles/​org.eclipse.terminal.control/​src/​org/​eclipse/​terminal/​internal/​emulator/​VT100TerminalControl.java Updates key encoding, Shift+Tab focus handling, and alternate-screen arrow routing.
terminal/​bundles/​org.eclipse.terminal.control/​src/​org/​eclipse/​terminal/​internal/​emulator/​VT100Emulator.java Exposes alternate-screen state and makes it visible across threads.

Review effort: Balanced

…rm does

Keys that Claude Code, Codex and other terminal programs use, checked
key by key against xterm:

- Shift+Tab sends back tab (CSI Z), as xterm and Windows Terminal do,
  and no longer moves the focus out of the terminal; Claude Code
  switches modes with it.
- Ctrl, Shift and Alt with Delete carry the modifier (CSI 3 ; 5 ~ and
  so on); every Delete used to arrive as a plain Delete.
- A real Ctrl+Alt on a letter keeps its Alt: ESC before the control
  character, as in xterm (Ctrl+Alt+V pastes an image in Codex on WSL).
  AltGr, which SWT reports as Ctrl+Alt with the character it types,
  types that character as before, and Backspace, Enter, Tab and Esc
  with AltGr still held send what they did. Ctrl+Alt with a digit or
  Space is left as it was, since on Windows it cannot be told from
  AltGr: xterm's ESC with the control character would turn AltGr+Space
  into ESC NUL.
- Ctrl+2 to Ctrl+8 send NUL, ESC, FS, GS, RS, US and DEL; on Windows
  they sent the digits.
- On the alternate screen Alt and Ctrl with the arrows go to the full
  screen program even where Eclipse has a binding for them (Alt+Up
  edits a queued message in Codex); at the shell prompt Alt+Up still
  maximizes the view.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants