From 746834a7cec7c630eadfa8f848b4134c4adb1e6c Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Wed, 19 Jan 2022 20:54:44 -0500 Subject: [PATCH] Add safety check in textinput's clamp --- textinput/textinput.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/textinput/textinput.go b/textinput/textinput.go index 49631e8..21f352b 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -800,6 +800,9 @@ func Paste() tea.Msg { } func clamp(v, low, high int) int { + if high < low { + low, high = high, low + } return min(high, max(low, v)) }