Skip to content

fix(terminal): support Shift+Tab and Shift+Enter on Windows for CLI tools#1560

Open
wuaman wants to merge 1 commit into
TermoraDev:2.xfrom
wuaman:feat/shift-tab-enter-key-bindings
Open

fix(terminal): support Shift+Tab and Shift+Enter on Windows for CLI tools#1560
wuaman wants to merge 1 commit into
TermoraDev:2.xfrom
wuaman:feat/shift-tab-enter-key-bindings

Conversation

@wuaman

@wuaman wuaman commented Jun 29, 2026

Copy link
Copy Markdown

Summary

Fixes missing Shift+Tab and Shift+Enter key mappings on Windows, which prevented these shortcuts from working in interactive CLI tools such as Claude Code.

Previously, Termora did not encode these modifier combinations into the escape sequences that TUI/CLI applications expect. As a result:

  • Shift+Tab could not be used for mode switching / reverse tab navigation
  • Shift+Enter could not be used to insert a newline within a session input

This change adds explicit mappings in KeyEncoderImpl:

Key Sequence Purpose
Shift+Tab ESC [ Z CBT (Cursor Backward Tabulation)
Shift+Enter ESC [ 13;2u CSI-u modified Enter

Problem

On Windows, when using Termora with interactive CLI tools (e.g. Claude Code):

  1. Pressing Shift+Tab did not trigger mode switching or backward tab behavior
  2. Pressing Shift+Enter did not insert a newline in the input area

These tools rely on specific terminal escape sequences for modified keys. Without proper encoding, the key events were not delivered correctly to the running process.

Solution

Add missing key bindings in KeyEncoderImpl.kt so that Shift+Tab and Shift+Enter are translated into the standard sequences expected by modern shell and TUI applications.

Test plan

  • On Windows, open a terminal session in Termora
  • In Claude Code (or similar TUI CLI):
    • Verify Shift+Tab triggers mode switching / reverse tab
    • Verify Shift+Enter inserts a newline in the input area
  • Confirm normal Tab and Enter behavior is unchanged
  • (Optional) Smoke test on macOS/Linux to ensure no regression

Map Shift+Tab to CBT (ESC [ Z) and Shift+Enter to CSI-u modified Enter
(ESC [ 13;2u) for better shell and TUI compatibility.
@hstyi

hstyi commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

该代码在所有操作系统上生效,macOS 和 Linux 是否会有问题呢?这两个快捷键需要限定在 Windows 系统上吗?

@wuaman

wuaman commented Jun 29, 2026

Copy link
Copy Markdown
Author

关于修改该代码在macOS 和 Linux上是否会产生问题,我没有测试过。我主要在Windows上使用,所以打包后也只在Windows上进行了测试。

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