Summary
In the TUI TextInput, pressing moves cursor to position 0 (start of the entire input) and to v.length (end of the entire input). For a single long prompt that wraps across multiple terminal lines, this ignores the visual line the cursor is on.
Expected Behavior
- First <Home>: snap cursor to start of the current visual line (the line as it appears on screen)
- Second <Home> (press again): snap to logical start (
position 0)
- First <End>: snap cursor to end of the current visual line
- Second <End> (press again): snap to logical end (
v.length)
- Ctrl+Home: always go to logical start (absolute position 0)
- Ctrl+End: always go to logical end (absolute
v.length)
Technical Notes
The infrastructure already exists:
cursorLayout() in ui-tui/src/lib/inputMetrics.ts computes the current visual line given terminal width
visualLines() returns start/end boundaries of each visual line
- The fix lives in
ui-tui/src/components/textInput.tsx (~lines 796-808 currently)
A similar approach is used by GNU Readline and most modern TUIs (e.g., Textual, Bubble Tea).
Related
Summary
In the TUI TextInput, pressing moves cursor to
position 0(start of the entire input) and tov.length(end of the entire input). For a single long prompt that wraps across multiple terminal lines, this ignores the visual line the cursor is on.Expected Behavior
position 0)v.length)v.length)Technical Notes
The infrastructure already exists:
cursorLayout()inui-tui/src/lib/inputMetrics.tscomputes the current visual line given terminal widthvisualLines()returns start/end boundaries of each visual lineui-tui/src/components/textInput.tsx(~lines 796-808 currently)A similar approach is used by GNU Readline and most modern TUIs (e.g., Textual, Bubble Tea).
Related