diff --git a/cmd/status/main.go b/cmd/status/main.go index b8f7aeb..e1e2d77 100644 --- a/cmd/status/main.go +++ b/cmd/status/main.go @@ -142,7 +142,7 @@ func (m model) View() string { header := renderHeader(m.metrics, m.errMessage, m.animFrame, m.width, m.catHidden) cardWidth := 0 if m.width > 80 { - cardWidth = maxInt(24, m.width/2-4) + cardWidth = max(24, m.width/2-4) } cards := buildCards(m.metrics, cardWidth) diff --git a/cmd/status/view.go b/cmd/status/view.go index b66befd..f64df1d 100644 --- a/cmd/status/view.go +++ b/cmd/status/view.go @@ -763,7 +763,7 @@ func renderTwoColumns(cards []cardData, width int) string { if i+1 < len(cards) { right = renderCard(cards[i+1], cw, 0) } - targetHeight := maxInt(lipgloss.Height(left), lipgloss.Height(right)) + targetHeight := max(lipgloss.Height(left), lipgloss.Height(right)) left = renderCard(cards[i], cw, targetHeight) if right != "" { right = renderCard(cards[i+1], cw, targetHeight) @@ -782,10 +782,3 @@ func renderTwoColumns(cards []cardData, width int) string { } return lipgloss.JoinVertical(lipgloss.Left, spacedRows...) } - -func maxInt(a, b int) int { - if a > b { - return a - } - return b -} diff --git a/cmd/status/view_test.go b/cmd/status/view_test.go index ba67327..8aa2a35 100644 --- a/cmd/status/view_test.go +++ b/cmd/status/view_test.go @@ -822,32 +822,6 @@ func TestGetScoreStyle(t *testing.T) { } } -func TestMaxInt(t *testing.T) { - tests := []struct { - name string - a int - b int - want int - }{ - {"a greater", 10, 5, 10}, - {"b greater", 3, 8, 8}, - {"equal", 7, 7, 7}, - {"negative a greater", -5, -10, -5}, - {"negative b greater", -10, -5, -5}, - {"zero vs positive", 0, 5, 5}, - {"zero vs negative", 0, -5, 0}, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got := maxInt(tt.a, tt.b) - if got != tt.want { - t.Errorf("maxInt(%d, %d) = %d, want %d", tt.a, tt.b, got, tt.want) - } - }) - } -} - func TestSparkline(t *testing.T) { tests := []struct { name string