Repository navigation
fix(ui): keep space-marked rows selected across a replace refresh - #158
Merged
Merged
Conversation
noamsto
deleted the
feat/157-fix-ui-keep-space-marked-rows-selected-a
branch
September 30, 2026 08:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.restoreSelectionalready re-selects by PR/issue number and skips numbers no longer shown, so:The explicit clears are untouched:
switchToFilter's ownsel.clear()(no leak across presets), esc, draft toggle, query edits, and batch actions.The existing
TestReplaceClearsTheSelectionasserted the old clear-on-replace behaviour. I rewrote it on purpose asTestReplaceKeepsTheSelectionOnShownRows: the still-shown #28 keeps its mark, and the held #29 that the replace clears loses its mark.Plan: task doc (provided)
Testing
internal/ui/select_test.gowere 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
TestMarksSurviveAReplaceOnTheFlatPRBoard(red before, green after)TestMarksSurviveAReplaceOnTheSectionsBoard(red before, green after)TestReplaceDropsOnlyTheMarkOfADepartedRow(checks the header count too), plus the rewrittenTestReplaceKeepsTheSelectionOnShownRowsTestMarksOnCachedRowsSurviveTheSwitchFetch(red before, green after)TestMarksSurviveAReplaceOnTheIssueBoards/{flat,sections}(red before, green after)Review (base a607872, head fa42c63, round 1, review_mode full)
go vetclean