hermes - 💡(How to fix) Fix UP/DOWN should navigate visual lines on wrapped input, deferring history cycling to first/last visual line [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

In the TUI TextInput, pressing <Up> or <Down> on a single-line prompt that wraps across multiple terminal rows always cycles prompt history. Expected behavior: <Up>/<Down> should navigate the cursor to the adjacent visual line (like GNU Readline or any terminal shell), only deferring to history cycling when the cursor is on the first or last visual line.

Root Cause

In the TUI TextInput, pressing <Up> or <Down> on a single-line prompt that wraps across multiple terminal rows always cycles prompt history. Expected behavior: <Up>/<Down> should navigate the cursor to the adjacent visual line (like GNU Readline or any terminal shell), only deferring to history cycling when the cursor is on the first or last visual line.

Fix Action

Fixed

RAW_BUFFERClick to expand / collapse

Summary

In the TUI TextInput, pressing <Up> or <Down> on a single-line prompt that wraps across multiple terminal rows always cycles prompt history. Expected behavior: <Up>/<Down> should navigate the cursor to the adjacent visual line (like GNU Readline or any terminal shell), only deferring to history cycling when the cursor is on the first or last visual line.

Expected Behavior

  • <Up> on a wrapped line (cursor not on first visual line): move cursor up one visual line, anchoring the same column position (clamped to the line's length)
  • <Up> on the first visual line: cycle backward through prompt history (current behavior)
  • <Down> on a wrapped line (cursor not on last visual line): move cursor down one visual line, anchored column position
  • <Down> on the last visual line: cycle forward or clear prompt (current behavior)

Affected Code

Two locations:

  1. lineNav() in ui-tui/src/components/textInput.tsx (~line 153): currently traverses \n delimiters only. Needs visual-line awareness via visualLines() and cursorLayout() from inputMetrics.ts.

  2. useInputHandlers.ts (~line 381): global <Up> handler checks lastIndexOf(n, ...) to decide whether to cycle history. For wrapped (no-\n) input, this always returns -1, so history is cycled even when the cursor is on a middle visual line. This check needs to account for visual lines.

Bonus: Ctrl+PgUp / Ctrl+PgDn

Currently PgUp/PgDn scroll the chat transcript, but Ctrl+PgUp (scroll to top of transcript) and Ctrl+PgDn (scroll to bottom of transcript) are unmapped. Worth considering as part of this input navigation pass.

Related

  • #22008 (HOME/END visual line navigation)
  • #18228 (Shift+Enter newline)
  • #18394 (backspace on newlines)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix UP/DOWN should navigate visual lines on wrapped input, deferring history cycling to first/last visual line [1 pull requests]