Files
magpie/internal
ggbdpq 05107bf03e tui: the library page keeps the row picked in view, however many section heads the window holds
What changed: viewLibrary sized its window from the row picked down in
rows (`start = lrow - visible + 3`), but the loop it feeds spends the
same budget in lines: every section head it crosses takes a line and
the blank before it, two the row count never paid for. With two or
more heads between the window's start and the row picked (servers,
then skills, then those found in the agents — a handful of each on a
terminal some thirty lines tall), the loop stopped above the row
picked: the highlight vanished, and j and down did nothing the screen
could see until the row count brought it back. The window now starts
where the lines to the row picked still fit, counted the way the loop
spends them.

Run: go test -tags nogui -count=1 ./internal/tui/ (the new
TestLibraryViewKeepsTheRowPicked is red without the change, watched on
a36319d6); gofmt -l internal/tui; go vet ./internal/tui/

Review (yetone, #2220): read line by line and kept as written. The
window's start is now counted in the lines the render loop spends, a
head and its blank line included, so it can't stop above the row
picked.

Run at the reviewed head, on origin/main 2a99e7a42, and
again on 91b9065a5 for vet, gui, provider, tui, gateway, agent and
the tests named here:
TestLibraryViewKeepsTheRowPicked is red with main's library.go ("row
21 (skill-10) picked, but the view stops short of it") and green with
the patch; go test -tags nogui ./internal/tui/ ok; gofmt -l, go vet on
three OSes, go test -tags nogui -count=1 -p 4 ./... at a machine load
of 100-150: 50 packages ok; internal/agent and internal/gateway ran past the 10m
default under that load and pass with -timeout 40m (674s, 798s);
internal/gui's TestSetAnswersWhileDevinAndProvidersHang failed once
(a state took 10.4s; open as #1375) and the package passes rerun.
Not tried: a real terminal; the test renders viewLibrary at 30 lines.
2026-10-15 01:56:35 +08:00
..
…
…