diff --git a/filepicker/filepicker.go b/filepicker/filepicker.go index 113c6c9..ec96e3d 100644 --- a/filepicker/filepicker.go +++ b/filepicker/filepicker.go @@ -188,10 +188,10 @@ func newStack() stack { } } -func (m *Model) pushView(selected, min, max int) { +func (m *Model) pushView(selected, minimum, maximum int) { m.selectedStack.Push(selected) - m.minStack.Push(min) - m.maxStack.Push(max) + m.minStack.Push(minimum) + m.maxStack.Push(maximum) } func (m *Model) popView() (int, int, int) { @@ -507,10 +507,3 @@ func (m Model) canSelect(file string) bool { } return false } - -func max(a, b int) int { - if a > b { - return a - } - return b -} diff --git a/list/list.go b/list/list.go index 6808142..9e3cd03 100644 --- a/list/list.go +++ b/list/list.go @@ -1326,10 +1326,3 @@ func countEnabledBindings(groups [][]key.Binding) (agg int) { } return agg } - -func max(a, b int) int { - if a > b { - return a - } - return b -} diff --git a/paginator/paginator.go b/paginator/paginator.go index 961b4e5..12e4e93 100644 --- a/paginator/paginator.go +++ b/paginator/paginator.go @@ -212,10 +212,3 @@ func (m Model) dotsView() string { func (m Model) arabicView() string { return fmt.Sprintf(m.ArabicFormat, m.Page+1, m.TotalPages) } - -func min(a, b int) int { - if a < b { - return a - } - return b -} diff --git a/progress/progress.go b/progress/progress.go index cfd18cb..b5d9f34 100644 --- a/progress/progress.go +++ b/progress/progress.go @@ -357,22 +357,8 @@ func (m Model) color(c string) termenv.Color { return m.colorProfile.Color(c) } -func max(a, b int) int { - if a > b { - return a - } - return b -} - // IsAnimating returns false if the progress bar reached equilibrium and is no longer animating. func (m *Model) IsAnimating() bool { dist := math.Abs(m.percentShown - m.targetPercent) return !(dist < 0.001 && m.velocity < 0.01) } - -func min(a, b int) int { - if a < b { - return a - } - return b -} diff --git a/table/table.go b/table/table.go index d68b626..86151f6 100644 --- a/table/table.go +++ b/table/table.go @@ -438,22 +438,6 @@ func (m *Model) renderRow(r int) string { return row } -func max(a, b int) int { - if a > b { - return a - } - - return b -} - -func min(a, b int) int { - if a < b { - return a - } - - return b -} - func clamp(v, low, high int) int { return min(max(v, low), high) } diff --git a/textarea/textarea.go b/textarea/textarea.go index 8a2071f..88bc979 100644 --- a/textarea/textarea.go +++ b/textarea/textarea.go @@ -853,13 +853,13 @@ func (m Model) LineInfo() LineInfo { // repositionView repositions the view of the viewport based on the defined // scrolling behavior. func (m *Model) repositionView() { - min := m.viewport.YOffset - max := min + m.viewport.Height - 1 + minimum := m.viewport.YOffset + maximum := minimum + m.viewport.Height - 1 - if row := m.cursorLineNumber(); row < min { - m.viewport.LineUp(min - row) - } else if row > max { - m.viewport.LineDown(row - max) + if row := m.cursorLineNumber(); row < minimum { + m.viewport.LineUp(minimum - row) + } else if row > maximum { + m.viewport.LineDown(row - maximum) } } @@ -1466,17 +1466,3 @@ func clamp(v, low, high int) int { } return min(high, max(low, v)) } - -func min(a, b int) int { - if a < b { - return a - } - return b -} - -func max(a, b int) int { - if a > b { - return a - } - return b -} diff --git a/textinput/textinput.go b/textinput/textinput.go index 1b44ab2..4c5c10d 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -758,20 +758,6 @@ func clamp(v, low, high int) int { return min(high, max(low, v)) } -func min(a, b int) int { - if a < b { - return a - } - return b -} - -func max(a, b int) int { - if a > b { - return a - } - return b -} - // Deprecated. // Deprecated: use cursor.Mode. diff --git a/viewport/viewport.go b/viewport/viewport.go index 11c6da7..0a818c0 100644 --- a/viewport/viewport.go +++ b/viewport/viewport.go @@ -484,20 +484,6 @@ func clamp(v, low, high int) int { return min(high, max(low, v)) } -func min(a, b int) int { - if a < b { - return a - } - return b -} - -func max(a, b int) int { - if a > b { - return a - } - return b -} - func findLongestLineWidth(lines []string) int { w := 0 for _, l := range lines {