Context
Once mouse events are parsed (foundation issue), clicks need to be mapped to a specific row and column so the right action can be triggered — matching what the user currently does with keyboard shortcuts for fold and select.
Part of #166. Depends on the mouse tracking foundation sub-issue.
Solution
- Add a pure hit-testing function that, given the current
Row[] (from buildRows()), scrollOffset, and a clicked (x, y), returns which Row was clicked and the local column offset — reusing the same cumulative-height logic as rowTerminalLines() (src/render/rows.ts) and renderGroups() (src/render.ts).
- Column-based dispatch, matching current fixed column offsets in
src/render.ts:
- Click on the
▸/▾ arrow column (repo rows only) → toggle group.folded.
- Click on the
✓ checkbox column (repo or extract rows) → toggle repoSelected / extractSelected[ei].
- Click anywhere else on a row → move
cursor to that row (no toggle).
- Wire the resulting action into the existing state-mutation +
redraw() flow in tui.ts, reusing the same code paths as the corresponding keyboard shortcuts (no duplicated toggle logic).
Acceptance Criteria
Definition of Done
Context
Once mouse events are parsed (foundation issue), clicks need to be mapped to a specific row and column so the right action can be triggered — matching what the user currently does with keyboard shortcuts for fold and select.
Part of #166. Depends on the mouse tracking foundation sub-issue.
Solution
Row[](frombuildRows()),scrollOffset, and a clicked(x, y), returns whichRowwas clicked and the local column offset — reusing the same cumulative-height logic asrowTerminalLines()(src/render/rows.ts) andrenderGroups()(src/render.ts).src/render.ts:▸/▾arrow column (repo rows only) → togglegroup.folded.✓checkbox column (repo or extract rows) → togglerepoSelected/extractSelected[ei].cursorto that row (no toggle).redraw()flow intui.ts, reusing the same code paths as the corresponding keyboard shortcuts (no duplicated toggle logic).Acceptance Criteria
scrollOffset(i.e., clicking a visible row after scrolling down targets the correct logical row, not an offset one).Definition of Done
bun testpasses, including a new companion*.test.tsfor the hit-testing function covering: click on an arrow, click on a checkbox, click elsewhere, click with non-zeroscrollOffset, click below the last row, click on a section row.bun run lintpasses.bun run format:checkpasses.bun run knippasses (no unused exports/imports).bun run build.tscompiles successfully.