Add shared live run graphs, debugging, editor choice and draft cleanup
This commit is contained in:
+16
-13
@@ -177,38 +177,41 @@ func (m Model) graphLines() []string {
|
||||
}
|
||||
|
||||
func (m Model) graphPanel(width, height int) string {
|
||||
label := "Graph"
|
||||
if !m.stageFocus {
|
||||
label = "▸ " + label
|
||||
}
|
||||
return graphViewport(label, m.graphLines(), width, height, m.pipelineTop, m.graphPan, !m.stageFocus, "Tab pane · r runs · * fallback error")
|
||||
}
|
||||
|
||||
// Shared graph viewport for definitions and executed run paths.
|
||||
func graphViewport(label string, lines []string, width, height, scrollTop, pan int, focused bool, footer string) string {
|
||||
if width <= 0 || height <= 0 {
|
||||
return ""
|
||||
}
|
||||
inner := max(1, width-4)
|
||||
rows := max(0, height-5)
|
||||
lines := m.graphLines()
|
||||
top := max(0, min(m.pipelineTop, max(0, len(lines)-rows)))
|
||||
top := max(0, min(scrollTop, max(0, len(lines)-rows)))
|
||||
end := min(len(lines), top+rows)
|
||||
body := make([]string, 0, end-top)
|
||||
for _, line := range lines[top:end] {
|
||||
body = append(body, ansi.Cut(line, m.graphPan, m.graphPan+inner))
|
||||
body = append(body, ansi.Cut(line, pan, pan+inner))
|
||||
}
|
||||
graphWidth := 0
|
||||
for _, line := range lines {
|
||||
graphWidth = max(graphWidth, ansi.StringWidth(line))
|
||||
}
|
||||
label := "Graph"
|
||||
if !m.stageFocus {
|
||||
label = "▸ " + label
|
||||
}
|
||||
if m.graphPan > 0 {
|
||||
if pan > 0 {
|
||||
label = "← " + label
|
||||
}
|
||||
if m.graphPan+inner < graphWidth {
|
||||
if pan+inner < graphWidth {
|
||||
label += " →"
|
||||
}
|
||||
headers := []string{bar(label, fmt.Sprintf("%d–%d / %d", min(top+1, len(lines)), end, len(lines)), inner, !m.stageFocus), lipgloss.NewStyle().Foreground(themeMuted).Render(strings.Repeat("─", inner))}
|
||||
footer := "Tab pane · r runs · * fallback error"
|
||||
headers := []string{bar(label, fmt.Sprintf("%d–%d / %d", min(top+1, len(lines)), end, len(lines)), inner, focused), lipgloss.NewStyle().Foreground(themeMuted).Render(strings.Repeat("─", inner))}
|
||||
if graphWidth > inner {
|
||||
footer = "←/→ pan · Tab pane · * fallback error"
|
||||
footer = "←/→ pan · " + footer
|
||||
}
|
||||
return panel(width, height, headers, body, footer, !m.stageFocus)
|
||||
return panel(width, height, headers, body, footer, focused)
|
||||
}
|
||||
|
||||
func (m Model) stageTabs(width int) string {
|
||||
|
||||
Reference in New Issue
Block a user