Support the mouse in the branch popup

A click on a branch switches to it, the wheel moves the selection, a click
outside closes the popup. The popup is hit-tested by its own position, as it
is drawn after zone.Scan.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 14:38:14 +02:00
co-authored by Claude Sonnet 5.5
parent 2b6b781826
commit 648e1fd46c
11 changed files with 179 additions and 28 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ import (
func TestOverlayCentersThePopup(t *testing.T) {
bg := strings.Repeat(strings.Repeat(".", 10)+"\n", 4) + strings.Repeat(".", 10)
got := strings.Split(ansi.Strip(overlay(bg, "ab\ncd", 10, 5, lipgloss.NewStyle())), "\n")
got := strings.Split(ansi.Strip(overlay(bg, "ab\ncd", 4, 1, lipgloss.NewStyle())), "\n")
want := []string{"..........", "....ab....", "....cd....", "..........", ".........."}
if len(got) != len(want) {
t.Fatalf("got %d lines", len(got))
@@ -26,7 +26,7 @@ func TestOverlayCentersThePopup(t *testing.T) {
func TestOverlayDimsTheBackdrop(t *testing.T) {
bg := "\x1b[31mredredred\x1b[0m"
dim := lipgloss.NewStyle().Foreground(lipgloss.Color("8"))
got := overlay(bg, "X", 9, 1, dim)
got := overlay(bg, "X", 4, 0, dim)
if ansi.StringWidth(got) != 9 || ansi.Strip(got) != "redrXdred" {
t.Errorf("got %q", ansi.Strip(got))
}