Skip to content

feat: multi-select in References preview#67

Merged
gavin-jeong merged 1 commit into
masterfrom
feat/refs-preview-multiselect
Jul 14, 2026
Merged

feat: multi-select in References preview#67
gavin-jeong merged 1 commit into
masterfrom
feat/refs-preview-multiselect

Conversation

@gavin-jeong

Copy link
Copy Markdown
Collaborator

Summary

  • Adds URL-menu-style multi-selection to the References preview (the PR/Jira panel opened via refs/8):
    • Space toggles the ref under the cursor into a selection set and advances the cursor.
    • Enter/o opens every selected ref's URL in the browser, falling back to the ref under the cursor when nothing is selected.
    • y copies the selected ref URL(s) to the clipboard, newline-joined.
  • Selection state is cleared when the session changes, when leaving refs mode (esc, tab-cycle, or re-toggling the mode key), and is folded into the render cache key so a toggle actually repaints the pane.
  • Title hint and bottom-of-list N selected count added, matching the existing URL menu's UX.

Bug found while manually driving the app

toggleRefSelection originally only cleared sessRefsCacheKey without calling updateSessionRefsPreview to actually repaint sessSplit.Preview's content. Unit tests passed because they call the render function directly, but running the built binary in tmux showed the selection mark never appeared on screen even though the underlying state was correct (confirmed via y's "Copied N reference(s)" message and clipboard contents). Fixed by having toggleRefSelection return the tea.Cmd from updateSessionRefsPreview, same pattern already used by cursor-move handling.

Test plan

  • go build ./..., go vet ./..., go test ./... all pass.
  • Added tests: space toggles selection, enter opens all selected (not just cursor), y copies selected (falls back to cursor item), selection clears when leaving refs preview.
  • Manually drove the built binary in tmux: verified selection marks render, "N selected" counter updates, y copies the right URLs (checked via pbpaste), and selection clears on esc + re-entry.

Adds URL-menu-style multi-selection to the References preview (space
to toggle, y to copy, enter to open):

- Space toggles the ref under the cursor into a selection set and
  advances the cursor, mirroring the URL menu's space-select.
- Enter/o opens every selected ref's URL, falling back to the ref
  under the cursor when nothing is selected.
- y copies the selected ref URL(s), newline-joined.
- Selection is cleared on session change, leaving refs mode (esc,
  tab-cycle, or re-toggling the mode), and is reflected in the render
  cache key so toggling actually repaints the pane.

toggleRefSelection now returns the tea.Cmd from
updateSessionRefsPreview instead of only invalidating the cache key —
without it the pane's viewport content never got repainted after a
toggle, so the selection mark silently never appeared even though the
underlying state (and y/enter actions) were correct. Found by driving
the built binary in tmux rather than relying on unit tests alone.
@Kairo-Kim Kairo-Kim added the auto-review/approved Auto-approved by the Slack auto-reviewer bot label Jul 14, 2026
@gavin-jeong
gavin-jeong merged commit 81aa619 into master Jul 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-review/approved Auto-approved by the Slack auto-reviewer bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants