Skip to content

Apply hide and favorite to all multi-selected sessions #196

Description

@jongio

Summary

Space-selection already lets you mark several sessions and launch them all at once with L. Make the hide (h) and favorite (*) actions honor that same selection so you can hide or star a batch in one keystroke instead of one session at a time.

Problem

handleHideSession and handleToggleFavorite operate only on the cursor session returned by sessionList.Selected(). When you have marked ten sessions with Space, pressing h or * still affects just the highlighted row. Cleaning up a long list (hiding a burst of throwaway sessions, or starring a related group) means repeating the keystroke and re-navigating each time. Other list-driven terminal tools apply bulk operations across the whole marked set, and dispatch already has the selection model in place for launching.

Proposed solution

When a multi-selection is active, route h and * through the marked set instead of the cursor:

  • If one or more sessions are selected (the same set used by L), apply the toggle to every selected session.
  • Choose a single target state for the batch so the action is predictable. For hide: if any selected session is currently visible, hide the whole set; otherwise unhide the whole set. For favorite: if any selected session is not a favorite, favorite the whole set; otherwise unfavorite it.
  • Keep the existing rule that hiding a favorited session also removes it from favorites, applied per session.
  • When no sessions are selected, behavior is unchanged (act on the cursor session).
  • Persist the updated hidden and favorite sets to config once per batch, not once per session.
  • After a bulk hide, clear the selection and reload the list so hidden rows drop out.

Acceptance criteria

  • With multiple sessions selected, h hides (or unhides) all of them and writes config once.
  • With multiple sessions selected, * favorites (or unfavorites) all of them and writes config once.
  • Bulk hide removes any of those sessions from favorites, matching the current single-session rule.
  • With no selection, h and * still act on the cursor session exactly as before.
  • The batch target state is derived deterministically (see solution) so a mixed selection resolves to one action.
  • Unit tests cover: mixed-visibility hide, mixed-favorite toggle, favorite-then-hide interaction, and the no-selection fallback.

Technical notes

  • Handlers live in internal/tui/model.go (handleHideSession, handleToggleFavorite); the selection set is managed by internal/tui/components/sessionlist.go.
  • Config persistence uses HiddenSessions and FavoriteSessions in internal/config/config.go.
  • go build ./..., go test ./... -count=1, go vet ./..., then mage preflight.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions