Scroll to the match a label resolves to #5

Open
opened 2026-09-19 16:33:41 +09:00 by natsukium · 0 comments
Owner

Summary

Scroll the viewport to the match a label resolves to, so a pick never lands on something the user
cannot see.

Why

The content can be much taller than the screen — main::grid_rows sizes the grid to hold all of
stdin, and picker::pick starts the viewport at the tail. Scrolling keys and a scroll indicator
exist, so off-screen matches are reachable by hand.

But labels are assigned to every match, while draw skips any whose row is outside the viewport
(src/picker.rs). The key loop resolves a typed label by searching labels with no viewport
check at all, so typing a label for an off-screen match picks it blind: the user sees no label,
gets no feedback as the prefix narrows, and the action runs on a value never shown.

docs/research.md "Edge-case handling" already says the only competitor that lets you reach
off-screen matches is wezterm, which searches scrollback and scrolls to the picked match, and
records this as an open v1 decision ("clamp to the tail or scrollable hinting").

Sketch

  • As typed narrows, if the candidates are all outside the viewport, scroll to the first one so
    the user sees the labels they are choosing among.
  • On resolution, ensure the picked match is on screen before running the action (matters most in
    --multi, where a toggled selection off-screen is invisible).
  • Decide and document what "screen order" means for --reverse and for label assignment when
    content is taller than the viewport.
## Summary Scroll the viewport to the match a label resolves to, so a pick never lands on something the user cannot see. ## Why The content can be much taller than the screen — `main::grid_rows` sizes the grid to hold all of stdin, and `picker::pick` starts the viewport at the tail. Scrolling keys and a scroll indicator exist, so off-screen matches are reachable *by hand*. But labels are assigned to every match, while `draw` skips any whose row is outside the viewport (`src/picker.rs`). The key loop resolves a typed label by searching `labels` with no viewport check at all, so typing a label for an off-screen match picks it blind: the user sees no label, gets no feedback as the prefix narrows, and the action runs on a value never shown. `docs/research.md` "Edge-case handling" already says the only competitor that lets you reach off-screen matches is wezterm, which searches scrollback and *scrolls to the picked match*, and records this as an open v1 decision ("clamp to the tail or scrollable hinting"). ## Sketch - As `typed` narrows, if the candidates are all outside the viewport, scroll to the first one so the user sees the labels they are choosing among. - On resolution, ensure the picked match is on screen before running the action (matters most in `--multi`, where a toggled selection off-screen is invisible). - Decide and document what "screen order" means for `--reverse` and for label assignment when content is taller than the viewport.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
natsukium/spoor#5
No description provided.