Skip to content

feat: Home/End jump to line start/end in multiline composer#1749

Closed
aboimpinto wants to merge 2 commits into
Hmbown:mainfrom
aboimpinto:feat/multiline-home-end-navigation
Closed

feat: Home/End jump to line start/end in multiline composer#1749
aboimpinto wants to merge 2 commits into
Hmbown:mainfrom
aboimpinto:feat/multiline-home-end-navigation

Conversation

@aboimpinto

Copy link
Copy Markdown
Contributor

Closes #1748

Plain Home and End now navigate within the current line instead of
jumping to the absolute start/end of the entire input. Ctrl+A and
Ctrl+E remain as absolute start/end shortcuts.

  • move_cursor_line_start() -- scans backward for \n, positions after it
  • move_cursor_line_end() -- scans forward for \n, positions before it;
    if cursor sits on \n, skips to the next line's end
  • On single-line input: identical to absolute versions (no change)
  • 14 tests covering multiline, singleline, and edge cases

Plain Home and End now navigate within the current line instead of
jumping to the absolute start/end of the entire input.  Ctrl+A and
Ctrl+E remain as absolute start/end shortcuts.

- Add move_cursor_line_start() / move_cursor_line_end() to App
- Wire Home -> move_cursor_line_start(), End -> move_cursor_line_end()
- On single-line input the new methods behave identically to the
  absolute versions (no behaviour change)
- End on a newline character skips to the end of the next line
- 14 tests covering multiline, singleline, and edge cases

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces move_cursor_line_start and move_cursor_line_end methods to the TUI application to support line-based navigation in multiline inputs, updating the Home and End key bindings accordingly. Feedback focuses on the move_cursor_line_end implementation, which currently skips to the next line if the cursor is already on a newline character. The reviewer recommends removing this non-standard behavior to ensure the End key is idempotent on the current line, and suggests updating the associated test cases to align with this change.

Comment thread crates/tui/src/tui/app.rs Outdated
Comment thread crates/tui/src/tui/app.rs Outdated
Comment thread crates/tui/src/tui/ui/tests.rs
Per gemini-code-assist review on Hmbown#1749: End on a newline character
should stay at the end of the current line (idempotent), not skip
to the next line.  Removes the non-standard skip-past-newline logic
and updates the associated tests.
@aboimpinto

Copy link
Copy Markdown
Contributor Author

All three recommendations addressed in 80baf0b:

  • Removed the skip-past-newline logic from move_cursor_line_end() — End on \n now stays at end of current line (idempotent)
  • Updated unit test: move_cursor_line_end_at_newline_stays_at_line_end
  • Updated integration test: end_at_newline_stays_at_line_end

Thanks for the review.

@Hmbown Hmbown mentioned this pull request May 20, 2026
11 tasks
@Hmbown

Hmbown commented May 21, 2026

Copy link
Copy Markdown
Owner

Thanks for the Home/End composer navigation patch. This was harvested into v0.8.40 release PR #1823 as commit f77a07e, and #1823 is now CI-green. Closing as superseded by the release branch; thank you for the focused editing improvement.

@Hmbown Hmbown closed this May 21, 2026
getong pushed a commit to getong/CodeWhale that referenced this pull request May 21, 2026
Per gemini-code-assist review on Hmbown#1749: End on a newline character
should stay at the end of the current line (idempotent), not skip
to the next line.  Removes the non-standard skip-past-newline logic
and updates the associated tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Home/End should jump to line start/end in multiline composer

2 participants