Improve table resizing, add terminal workaround, and expose last check.

This commit is contained in:
Overlord committed 2026-10-14 12:37:27 +02:00
1 parent a19e6fa711
commit f2ea1297e8
6 files changed
+43 -5

No files matched your search

+9 -2
View File
@@ -40,8 +40,8 @@ var columns = []struct {
{"STATUS", 9, 9},
{"PRICE", 5, 16},
{"SELLER", 6, 11},
{"LAST", 4, 9},
{"NEXT", 4, 10},
{"LAST", 10, 10},
{"NEXT", 9, 9},
}
// layout sizes the table and the log pane to the window.
@@ -96,6 +96,13 @@ func (m *Model) table() string {
for j, c := range cells[i] { widths[j] = max(widths[j], min(ansi.StringWidth(c), columns[j].max)) }
}
// Columns only grow, so they do not shift every time a price or a time
// gets shorter.
if len(m.widths) == len(widths) {
for i := range widths { widths[i] = max(widths[i], m.widths[i]) }
}
m.widths = append(m.widths[:0], widths...)
// The ITEM column gives way first when the window is narrow.
total := 2
for _, w := range widths { total += w + 2 }