Skip to content

fix(tui): distinguish LF from Return in key parser - #21079

Closed
zengzheqing wants to merge 1 commit into
NousResearch:mainfrom
zengzheqing:fix/tui-lf-newline-ghostty
Closed

fix(tui): distinguish LF from Return in key parser#21079
zengzheqing wants to merge 1 commit into
NousResearch:mainfrom
zengzheqing:fix/tui-lf-newline-ghostty

Conversation

@zengzheqing

Copy link
Copy Markdown

Summary

Fix Hermes TUI handling of raw LF input from terminals such as Ghostty.

Ghostty users can configure Shift+Enter / Ctrl+Enter as:

keybind = shift+enter=text:\n
keybind = ctrl+enter=text:\n

Codex and Hermes classic CLI treat raw LF (\n) as newline intent. Hermes TUI previously collapsed raw LF into ordinary Return semantics, causing Shift+Enter to submit instead of inserting a newline.

This change preserves the distinction:

  • raw LF (\n) maps to Ctrl+Return / newline intent
  • raw CR (\r) maps to ordinary Return / submit intent

Test Plan

  • npm test -- packages/hermes-ink/src/ink/events/cmd-shortcuts.test.ts
  • npm run type-check
  • npm run build

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels May 7, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This PR appears to duplicate #18229 which also fixes the LF/CR distinction in parse-keypress.ts for Shift+Enter (fixes #18228). The approach is slightly different (this one sets key.ctrl = true for LF rather than preserving key.raw), but both target the same root cause.

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

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants