Help on every panel, task filter, unblock key, mouse zones, safe add-only rebuild

This commit is contained in:
Sam
2026-11-10 15:59:42 +11:00
parent 972d4c0184
commit 09e32da046
13 changed files with 587 additions and 16 deletions

View File

@@ -272,3 +272,20 @@ func wrap(s string, w int) []string {
}
return lines
}
// helpOverlay draws the keys for the panel that asked for it, centred over the
// screen. It replaces the whole view rather than floating over it, so nothing
// behind it can be misread as still active.
func helpOverlay(title string, entries [][2]string, w, h int) string {
boxW := min(64, max(30, w-8))
boxH := min(len(entries)+4, max(8, h-4))
lines := []string{""}
for _, e := range entries {
key := lipgloss.NewStyle().Foreground(lipgloss.Color(active.Accent)).Bold(true).
Width(16).Render(e[0])
lines = append(lines, " "+key+lipgloss.NewStyle().Foreground(lipgloss.Color(active.Text)).Render(e[1]))
}
lines = append(lines, "", dimStyle().Render(" esc or ? closes this"))
p := panel{title: title, width: boxW, height: boxH, focused: true}
return lipgloss.Place(w, h, lipgloss.Center, lipgloss.Center, p.render(lines))
}