mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 19:05:11 +00:00
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.
This commit is contained in:
parent
4058346a64
commit
ab37d661af
1 changed files with 6 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue