Skip to content

feat: bookmark lines and navigate them with Tab (#208) - #225

Merged
matheuswhite merged 2 commits into
mainfrom
feat/208-bookmarks
Jul 23, 2026
Merged

feat: bookmark lines and navigate them with Tab (#208)#225
matheuswhite merged 2 commits into
mainfrom
feat/208-bookmarks

Conversation

@matheuswhite

Copy link
Copy Markdown
Owner

Summary

Closes #208.

Adds line bookmarks so jumping to a specific line in a long history no longer means scrolling and reading line by line.

  • Right-click a line to toggle a bookmark (right-click again removes it).
  • A bookmarked line is shown with a yellow timestamp (black text), taking priority over the transient selection highlight.
  • Tab jumps to the next bookmark, Shift+Tab to the previous one — centering the view and wrapping around the ends, mirroring search navigation. In the command bar, Tab still completes a @tag while the autocomplete pop-up is up (issue Navigation through command tags #177 behavior preserved).

Design: stable per-line identity

Bookmarks pin to a new monotonic BufferLine::id rather than a positional index, so they follow their line through:

  • scrollback rotation — capacity drop re-indexes line, but id never changes;
  • filter changes — a bookmark hidden by a filter reappears once the line is shown again.

A current_bookmark cursor (also keyed by id) keeps Tab/Shift+Tab robust even when a jump is clamped near the buffer ends. Bookmark state and navigation live in graphics/screen.rs; Ctrl+L clears bookmarks along with the screen.

Tests

  • 11 new unit tests in graphics/screen.rs covering toggle, off-content clicks, current-bookmark tracking, clear, the pure next_bookmark_index selection logic (anchor / step / wrap / fallback / empty), and end-to-end navigation cycling by id.
  • Full suite green: cargo test --bin scope (204) and cargo test --test tui_e2e (12, 1 ignored). Build clean under #![deny(warnings)].
  • Manually verified in the real TUI (virtual serial + tmux): right-click toggles the yellow timestamp, and Tab/Shift+Tab center and cycle through bookmarks with the viewport scrolling correctly.

🤖 Generated with Claude Code

Right-click a line to toggle a bookmark; a bookmarked line shows a yellow
timestamp. Tab jumps to the next bookmark and Shift+Tab to the previous one,
centering the view and wrapping around the ends (mirroring search navigation).
Tab still completes a @tag while the autocomplete pop-up is up.

Bookmarks pin to a new stable per-line BufferLine::id (a monotonic counter)
instead of a positional index, so they follow their line across scrollback
rotation and filter changes: a bookmark hidden by a filter reappears once the
line is shown again. State and navigation live in graphics/screen.rs.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Every bookmark shared the same yellow-background timestamp, so
Tab/Shift+Tab navigation gave no cue which one you'd landed on. Split the
styling in two: the current bookmark keeps the full yellow-background
highlight, while every other bookmark drops to a subtler yellow foreground
on the normal background — so all bookmarks stay visible and the focused one
stands out. Threads the existing `current_bookmark` through the render path
(`to_lines` -> `to_normal_line`/`to_search_line`) into `timestamp_line`.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@matheuswhite
matheuswhite merged commit 6bbe8df into main Jul 23, 2026
8 checks passed
@matheuswhite
matheuswhite deleted the feat/208-bookmarks branch July 23, 2026 22:08
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.

Bookmarks

1 participant