Skip to content

fix(ui): keep space-marked rows selected across a replace refresh - #158

Merged
noamsto merged 1 commit into
mainfrom
feat/157-fix-ui-keep-space-marked-rows-selected-a
Sep 30, 2026
Merged

noamsto merged 1 commit into
mainfrom
feat/157-fix-ui-keep-space-marked-rows-selected-a

Conversation

@noamsto

@noamsto noamsto commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Closes #157

Summary

Rows marked with space lost their marks whenever a replace refresh landed. That covers ctrl+r, and the live fetch that follows a filter/tab switch painted from warm cache. So marking cached rows right after a switch was undone the moment the real result arrived.

All four paint functions (paintPRs, paintIssues, paintSections, paintIssueSections) captured the selection and then threw it away on replace (selNums, wasHeld = nil, nil). That line is gone. restoreSelection already re-selects by PR/issue number and skips numbers no longer shown, so:

  • a mark stays on every row the replace still shows;
  • a mark on a row the replace dropped (e.g. a held/departed row, or a PR that left the view) goes, and the "N selected" count follows.

The explicit clears are untouched: switchToFilter's own sel.clear() (no leak across presets), esc, draft toggle, query edits, and batch actions.

The existing TestReplaceClearsTheSelection asserted the old clear-on-replace behaviour. I rewrote it on purpose as TestReplaceKeepsTheSelectionOnShownRows: the still-shown #28 keeps its mark, and the held #29 that the replace clears loses its mark.

Plan: task doc (provided)

Testing

  • New tests in internal/ui/select_test.go were red on the old code (selected = [], want [28 30] etc.) and are green after the fix. Each one checks the selected set, the painted selection bar per row, the marked-row count and the header's "N selected".
  • nix build .#checks.x86_64-linux.golangci-lint .#checks.x86_64-linux.nilaway .#checks.x86_64-linux.go-test-race: all three built successfully.
Agent ledger

Acceptance

  • AC1 pass: TestMarksSurviveAReplaceOnTheFlatPRBoard (red before, green after)
  • AC2 pass: TestMarksSurviveAReplaceOnTheSectionsBoard (red before, green after)
  • AC3 pass: TestReplaceDropsOnlyTheMarkOfADepartedRow (checks the header count too), plus the rewritten TestReplaceKeepsTheSelectionOnShownRows
  • AC4 pass: TestMarksOnCachedRowsSurviveTheSwitchFetch (red before, green after)
  • AC5 pass: TestMarksSurviveAReplaceOnTheIssueBoards/{flat,sections} (red before, green after)
  • AC6 pass: nix checks golangci-lint, nilaway and go-test-race all built

Review (base a607872, head fa42c63, round 1, review_mode full)

  • go-reviewer: Approve, no findings (includes the approach-sanity check)
  • charm-tui-reviewer: Approve, no findings
  • targeted test-runner: 21/21 pass, go vet clean
  • recurrence_escalation: unused

@noamsto noamsto self-assigned this Sep 30, 2026
@noamsto
noamsto merged commit d6e3be2 into main Sep 30, 2026
1 check passed
@noamsto
noamsto deleted the feat/157-fix-ui-keep-space-marked-rows-selected-a branch September 30, 2026 08:26
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.

fix(ui): keep space-marked rows selected across a replace refresh

1 participant