Draw the counter reset as a labelled rule across the table

This commit is contained in:
flamingcow
2026-07-25 19:31:03 -07:00
parent 269199366d
commit 16416bc1b0
2 changed files with 26 additions and 1 deletions
+25
View File
@@ -111,6 +111,31 @@ func (t *streamTable) headerLines() []string {
}
}
func (t *streamTable) width() int {
w := 0
for i, c := range t.cols {
w += c.width
if i > 0 {
w++
}
}
return w
}
// A labelled horizontal rule spanning the table, for marking a break in the
// stream of rows.
func (t *streamTable) rule(label string) string {
const lead = 3
text := " " + label + " "
trail := t.width() - lead - visWidth(text)
if trail < 0 {
trail = 0
}
return paint(strings.Repeat("─", lead), cGrey) +
paint(text, cDim) +
paint(strings.Repeat("─", trail), cGrey)
}
func (t *streamTable) emit(cells []string) []string {
var out []string
if t.sinceHeader == 0 || (t.headerEvery > 0 && t.sinceHeader >= t.headerEvery) {