Skip to content

feat: remember each view's selection and scroll position across navigation #71

Description

@Bccorb

Problem

selected_row and scroll_offset are a single shared pair, and on_view_enter resets both to the top on every view switch. Navigating away from a list and back always drops the operator at row one, losing their place. On a long EC2 or Secrets list that is a real cost when pivoting between views during triage.

Context

#31 closed the correctness half of this (no view can hold an out-of-bounds selection) by centralizing the clamp in the shared list helper from #30. It deliberately did not add persistence, because the acceptance there was about out-of-bounds selection and on_view_enter resetting to the top meant there was no cross-view bleed to fix.

Proposed fix

Keep per-view selection state, for example a map from ActiveView to its (selected_row, scroll_offset), restored on view enter and cleared alongside the inventory on a profile or region change (the same point where clear_service_data runs, so a restored cursor can never point into another account's data).

ui::views::list_table::render_list_table already takes the selection as &mut borrows, so views would pass the per-view entry instead of the shared fields with no change to the helper.

Acceptance

  • Leaving a view and returning restores the previous selection and scroll position
  • Selection state is cleared on a profile or region change
  • A restored selection is still clamped when the underlying list shrank

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priority / backlogenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions