chore: use min()/max() builtins (Go 1.21+)
All checks were successful
Security Scan / security (pull_request) Successful in 23s
All checks were successful
Security Scan / security (pull_request) Successful in 23s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
63a73a9852
commit
0941ba865f
2 changed files with 3 additions and 12 deletions
|
|
@ -266,10 +266,7 @@ func (f *Frame) viewLocked() string {
|
|||
footerH = 1
|
||||
}
|
||||
}
|
||||
middleH := h - headerH - footerH
|
||||
if middleH < 1 {
|
||||
middleH = 1
|
||||
}
|
||||
middleH := max(h-headerH-footerH, 1)
|
||||
|
||||
// Render each region
|
||||
header := f.renderRegionLocked(RegionHeader, w, headerH)
|
||||
|
|
@ -287,10 +284,7 @@ func (f *Frame) viewLocked() string {
|
|||
rightW = w / 4
|
||||
}
|
||||
}
|
||||
contentW := w - leftW - rightW
|
||||
if contentW < 1 {
|
||||
contentW = 1
|
||||
}
|
||||
contentW := max(w-leftW-rightW, 1)
|
||||
|
||||
left := f.renderRegionLocked(RegionLeft, leftW, middleH)
|
||||
right := f.renderRegionLocked(RegionRight, rightW, middleH)
|
||||
|
|
|
|||
|
|
@ -288,10 +288,7 @@ func (t *Table) constrainWidths(widths []int) {
|
|||
}
|
||||
|
||||
// Shrink widest columns first until we fit.
|
||||
budget := t.maxWidth - overhead
|
||||
if budget < cols {
|
||||
budget = cols
|
||||
}
|
||||
budget := max(t.maxWidth-overhead, cols)
|
||||
for total-overhead > budget {
|
||||
maxIdx, maxW := 0, 0
|
||||
for i, w := range widths {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue