Skip to content

Commit

Permalink
fix(text): block on field while invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
maaslalani committed Dec 13, 2023
1 parent 6297f12 commit d91e9ae
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions field_text.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,18 @@ func (t *Text) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return updateValueMsg(content)
}))
case key.Matches(msg, t.keymap.Next):
value := t.textarea.Value()
t.err = t.validate(value)
if t.err != nil {
return t, nil
}
cmds = append(cmds, nextField)
case key.Matches(msg, t.keymap.Prev):
value := t.textarea.Value()
t.err = t.validate(value)
if t.err != nil {
return t, nil
}
cmds = append(cmds, prevField)
}
}
Expand Down

0 comments on commit d91e9ae

Please sign in to comment.