Files
magpie/internal/tui
yetoneandggbdpq 1d227a7eb9 tui: a group's page keeps the row picked and its header in view (#2452)
What changed
- viewGroup drew every member and every rule and left the rest to the
  terminal. A group with more of them than the terminal has rows (a
  whole provider's thirty models at 80x24) scrolled the header and the
  highlight off the top, and j/k moved a pick no one could see. The
  library page (#2220) and the agents page (#2428, fed24aa1d) had the
  same disease; this was the last page with a cursor and no window.
- groupWindow draws the rows around the pick, as ggbdpq's patch does: a
  pick among the models keeps the first rules below it, a pick among the
  rules keeps the models' tail above it, a short group is drawn whole.
- groupRows counts every other line the page draws, including the
  pattern lines, the classifier line and the "none" line, which the
  patch's flat h-10 left out. With h-10 the page still ran three lines
  past the terminal and its header scrolled away.

Run
- New TestGroupViewKeepsTheRowPicked: thirty models; one model with 24
  rules; both, with three patterns and an intent rule's classifier.
  Every pick at 24 and 40 rows must draw no more lines than a short
  group's page, keep "◉ magpie" on screen, and mark the pick's own
  numbered row. A tall terminal draws the whole group.
- Broken by hand: old routing.go goes red (pick 0 draws 41 lines,
  22 fit), the patch's h-10 goes red (25 lines), and leaving the
  patterns uncounted goes red (23). With the fix it's green.
- Other cursor pages were audited (agents, providers, groups, library,
  sessions, pickers). All are windowed; only the group page had none.
- gofmt -l clean; go vet -tags nogui for darwin, linux and windows.
- Full suite: go test -timeout 45m ./... at f1c91a99c: 65 packages ok, internal/gui red only in TestPanelJoinsFullScreenSpaces ("the panel shown doesn't take the keyboard"), the macOS 26.2 red filed as #2450 and red on main without this change.

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-10-16 06:32:59 +08:00
..