Fix a bug where text inputs with no char limit couldn't take input

This commit is contained in:
Christian Rocha 2020-04-23 12:10:53 -04:00
parent bf2d13df66
commit 7ef18ab69e
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018

View File

@ -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++
}