From ab37d661af6d79ad12482b2157d52eb02c4ad302 Mon Sep 17 00:00:00 2001 From: 4h9fbZ <176179231+4h9fbZ@users.noreply.github.com> Date: Fri, 30 Jan 2026 02:42:24 +0100 Subject: [PATCH] feat(tui): jump to line start/end when pressing up/down at boundaries (#1050) When cursor is on the first visual line and up is pressed, jump to start of line instead of doing nothing. When cursor is on the last visual line and down is pressed, jump to end of line instead of doing nothing. This matches standard behavior in most native text inputs. --- packages/tui/src/components/editor.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/tui/src/components/editor.ts b/packages/tui/src/components/editor.ts index dc6cd710..a72a5499 100644 --- a/packages/tui/src/components/editor.ts +++ b/packages/tui/src/components/editor.ts @@ -669,6 +669,9 @@ export class Editor implements Component, Focusable { this.navigateHistory(-1); } else if (this.historyIndex > -1 && this.isOnFirstVisualLine()) { this.navigateHistory(-1); + } else if (this.isOnFirstVisualLine()) { + // Already at top - jump to start of line + this.moveToLineStart(); } else { this.moveCursor(-1, 0); } @@ -677,6 +680,9 @@ export class Editor implements Component, Focusable { if (kb.matches(data, "cursorDown")) { if (this.historyIndex > -1 && this.isOnLastVisualLine()) { this.navigateHistory(1); + } else if (this.isOnLastVisualLine()) { + // Already at bottom - jump to end of line + this.moveToLineEnd(); } else { this.moveCursor(1, 0); }