From 7ef18ab69e571f904a82f34b415b3686eaa5f3b0 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Thu, 23 Apr 2020 12:10:53 -0400 Subject: [PATCH] Fix a bug where text inputs with no char limit couldn't take input --- textinput/textinput.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textinput/textinput.go b/textinput/textinput.go index fd92eb5..90e27b0 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -151,7 +151,7 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) { m.pos = 0 return m, nil case tea.KeyRune: // input a regular character - if m.CharLimit > 0 && len(m.Value) < m.CharLimit { + if m.CharLimit <= 0 || len(m.Value) < m.CharLimit { m.Value = m.Value[:m.pos] + string(msg.Rune) + m.Value[m.pos:] m.pos++ }