Skip to content

fix(tui): keep palette highlight on the selected row when scrolled - #35

Merged
jkyberneees merged 1 commit into
mainfrom
fix/palette-highlight
Aug 22, 2026
Merged

fix(tui): keep palette highlight on the selected row when scrolled#35
jkyberneees merged 1 commit into
mainfrom
fix/palette-highlight

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Summary

  • Up/Down in the ^K palette moved the selection, but the popup highlighted rows by comparing the window-relative index against the absolute selection index.
  • Symptom: past row 8 the highlight vanished entirely (arrows look dead); while scrolled it landed on the wrong row.
  • Fix: windowEntries now returns the window start offset; the highlight compares start+i == m.pal.sel.

Test plan

  • New regression test TestPaletteSelectionTracksScroll: walks selection past the 8-row window and asserts exactly one highlighted row tracking pal.sel, then walks back to top. Failed before the fix (got 0 highlighted rows), passes after.
  • make fmt / make vet / make lint (0 issues) / make test (-race, all packages green)

The ^K popup renders a scrolling window of maxPalRows entries but compared
the window-relative index against the absolute selection, so the highlight
vanished past row 8 and drifted onto the wrong row while scrolled.
windowEntries now returns the window offset and the highlight compares
absolute indices.
@jkyberneees
jkyberneees merged commit 0210572 into main Aug 22, 2026
5 checks passed
@jkyberneees
jkyberneees deleted the fix/palette-highlight branch August 22, 2026 08:54
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.

1 participant