From f719cc8cb1cc40caa3a06f397cd92aab942b9ec7 Mon Sep 17 00:00:00 2001 From: Kiyon Date: Tue, 9 Mar 2021 10:59:49 +0800 Subject: [PATCH] Reset cursor in SetValue when initial pos is 0 --- textinput/textinput.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textinput/textinput.go b/textinput/textinput.go index 1d0a6fe..8fb9e70 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -139,7 +139,7 @@ func (m *Model) SetValue(s string) { } else { m.value = runes } - if m.pos > len(m.value) { + if m.pos == 0 || m.pos > len(m.value) { m.SetCursor(len(m.value)) } m.handleOverflow()