diff --git a/ui.go b/ui.go index 01e115b..341b016 100644 --- a/ui.go +++ b/ui.go @@ -161,20 +161,22 @@ func (d *display) layout(w, h int) error { for _, r := range panelRows { labelW = max(labelW, len(r)*d.text.cellW) } + // Horizons narrow left to right — since reset, the last 90 s, this + // instant — so the NOW column sits where the timeline's own "now" lands. d.labelX = uiMargin d.nowW = 5 * d.textB.cellW d.resetW = 5 * d.textB.cellW - d.nowX = d.labelX + labelW + uiColGap - d.resetX = w - uiMargin - d.resetW + d.resetX = d.labelX + labelW + uiColGap + d.nowX = w - uiMargin - d.nowW - cellsX := d.nowX + d.nowW + uiColGap - cellsW := d.resetX - uiColGap - cellsX + cellsX := d.resetX + d.resetW + uiColGap + cellsW := d.nowX - uiColGap - cellsX d.cellW = (cellsW - (histSlots-1)*cellGapX) / histSlots if d.cellW < 6 { return fmt.Errorf("heat cells would be %dpx wide", d.cellW) } d.cellsW = histSlots*d.cellW + (histSlots-1)*cellGapX - // The leftover from rounding sits between the cells and the reset column. + // The leftover from rounding sits between the cells and the now column. d.cellsX = cellsX d.headerH = headerTop + ringD + 24 @@ -414,11 +416,11 @@ func (d *display) drawHeader(phy phyDisplay, hv histView, measuring bool, func (d *display) drawColHeaders() { y := d.headerH + 8 - d.textRightAt(d.small, d.nowX+d.nowW, y, "NOW", uiMuted) + d.textRightAt(d.small, d.resetX+d.resetW, y, "RESET", uiMuted) hdr := "LAST 90 S" hw := len([]rune(hdr)) * d.small.cellW d.small.draw(d.fb, d.cellsX+(d.cellsW-hw)/2, y-d.small.capTop, hdr, uiMuted) - d.textRightAt(d.small, d.resetX+d.resetW, y, "RESET", uiMuted) + d.textRightAt(d.small, d.nowX+d.nowW, y, "NOW", uiMuted) d.hairline(d.rowYs[0] - 1) } diff --git a/ui_test.go b/ui_test.go index 9f664b0..de5a22f 100644 --- a/ui_test.go +++ b/ui_test.go @@ -33,8 +33,8 @@ func TestPanelFitsScreen(t *testing.T) { if d.cellW < 6 { t.Errorf("heat cells %dpx wide, want at least 6", d.cellW) } - if end := d.cellsX + d.cellsW; end > d.resetX { - t.Errorf("heat cells run to %d, past the reset column at %d", end, d.resetX) + if end := d.cellsX + d.cellsW; end > d.nowX { + t.Errorf("heat cells run to %d, past the now column at %d", end, d.nowX) } if last := d.rowYs[len(d.rowYs)-1] + d.rowH; last > d.resetBtn.y { t.Errorf("rows end at %d, past the footer at %d", last, d.resetBtn.y)