Wrap overlay text instead of cutting it; the project check is a regression check, renamed check.sh; concrete Headroom steps; Mouse-1 measured
This commit is contained in:
44
tui/frame.go
44
tui/frame.go
@@ -278,15 +278,47 @@ func wrap(s string, w int) []string {
|
||||
// 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{""}
|
||||
// The box is as wide as the screen allows, and every line of text is wrapped
|
||||
// inside it. Cutting a sentence in half hides the reason a key exists.
|
||||
boxW := min(92, max(40, w-6))
|
||||
if boxW > w {
|
||||
boxW = w
|
||||
}
|
||||
keyCol := 16
|
||||
inner := boxW - 4 - keyCol
|
||||
if inner < 20 {
|
||||
keyCol = 8
|
||||
inner = boxW - 4 - keyCol
|
||||
}
|
||||
|
||||
var lines []string
|
||||
lines = append(lines, "")
|
||||
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]))
|
||||
key := e[0]
|
||||
if key == "" {
|
||||
for _, cont := range wrap(e[1], max(12, inner)) {
|
||||
lines = append(lines, " "+strings.Repeat(" ", keyCol)+
|
||||
lipgloss.NewStyle().Foreground(lipgloss.Color(active.Text)).Render(cont))
|
||||
}
|
||||
continue
|
||||
}
|
||||
wrapped := wrap(e[1], max(12, inner))
|
||||
styled := lipgloss.NewStyle().Foreground(lipgloss.Color(active.Accent)).Bold(true).
|
||||
Render(padTo(key, keyCol))
|
||||
text := lipgloss.NewStyle().Foreground(lipgloss.Color(active.Text)).Render(wrapped[0])
|
||||
lines = append(lines, " "+styled+text)
|
||||
for _, cont := range wrapped[1:] {
|
||||
lines = append(lines, " "+strings.Repeat(" ", keyCol)+
|
||||
lipgloss.NewStyle().Foreground(lipgloss.Color(active.Text)).Render(cont))
|
||||
}
|
||||
}
|
||||
lines = append(lines, "", dimStyle().Render(" esc or ? closes this"))
|
||||
|
||||
boxH := len(lines) + 2
|
||||
if boxH > h-2 {
|
||||
boxH = h - 2
|
||||
lines = lines[:max(1, boxH-2)]
|
||||
}
|
||||
p := panel{title: title, width: boxW, height: boxH, focused: true}
|
||||
return lipgloss.Place(w, h, lipgloss.Center, lipgloss.Center, p.render(lines))
|
||||
}
|
||||
|
||||
@@ -467,9 +467,9 @@ func (m workModel) View() string {
|
||||
}
|
||||
|
||||
if m.confirm {
|
||||
verify := "no verify command: the review decides"
|
||||
check := "no project check: the review decides"
|
||||
if cmd := verifyFromDescription(m.task.Description); cmd != "" {
|
||||
verify = "verify command: " + cmd
|
||||
check = "project check: " + cmd
|
||||
}
|
||||
branch := "(no branch yet)"
|
||||
if m.task.Workspace != nil && m.task.Workspace.Branch != "" {
|
||||
@@ -478,7 +478,7 @@ func (m workModel) View() string {
|
||||
return helpOverlay("merge "+m.task.Identifier+" into main?", [][2]string{
|
||||
{"what is merged", branch + " → " + baseRefOf(m.task)},
|
||||
{"what happens", "rebase the branch onto the base, then merge it"},
|
||||
{"", verify},
|
||||
{"", check},
|
||||
{"", "ocr reviews the change; a critical finding refuses the merge"},
|
||||
{"", "merge, then re-run the checks on the base branch"},
|
||||
{"y", "do it"},
|
||||
|
||||
Reference in New Issue
Block a user