Skip to content

Commit

Permalink
Merge branch 'main' into horizontal-btns
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbunni committed Nov 27, 2024
2 parents d5e3f5e + aad810d commit ea9b9ee
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
11 changes: 9 additions & 2 deletions accessibility/accessibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ func parseBool(s string) (bool, error) {
}
}

for _, n := range []string{"n", "no"} {
// As a special case, we default to "" to no since the usage of this
// function suggests N is the default.
for _, n := range []string{"", "n", "no"} {
if n == s {
return false, nil
}
Expand Down Expand Up @@ -78,7 +80,12 @@ func PromptString(prompt string, validator func(input string) error) string {

for !valid {
fmt.Print(prompt)
_ = scanner.Scan()
if !scanner.Scan() {
// no way to bubble up errors or signal cancellation
// but the program is probably not continuing if
// stdin sent EOF
break
}
input = scanner.Text()

err := validator(input)
Expand Down
2 changes: 1 addition & 1 deletion examples/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22

require (
github.com/charmbracelet/bubbles v0.20.0
github.com/charmbracelet/bubbletea v1.2.3
github.com/charmbracelet/bubbletea v1.2.4
github.com/charmbracelet/glamour v0.8.0
github.com/charmbracelet/huh v0.0.0-00010101000000-000000000000
github.com/charmbracelet/huh/spinner v0.0.0-00010101000000-000000000000
Expand Down
4 changes: 2 additions & 2 deletions examples/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ github.com/catppuccin/go v0.2.0 h1:ktBeIrIP42b/8FGiScP9sgrWOss3lw0Z5SktRoithGA=
github.com/catppuccin/go v0.2.0/go.mod h1:8IHJuMGaUUjQM82qBrGNBv7LFq6JI3NnQCF6MOlZjpc=
github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE=
github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU=
github.com/charmbracelet/bubbletea v1.2.3 h1:d9MdMsANIYZB5pE1KkRqaUV6GfsiWm+/9z4fTuGVm9I=
github.com/charmbracelet/bubbletea v1.2.3/go.mod h1:Qr6fVQw+wX7JkWWkVyXYk/ZUQ92a6XNekLXa3rR18MM=
github.com/charmbracelet/bubbletea v1.2.4 h1:KN8aCViA0eps9SCOThb2/XPIlea3ANJLUkv3KnQRNCE=
github.com/charmbracelet/bubbletea v1.2.4/go.mod h1:Qr6fVQw+wX7JkWWkVyXYk/ZUQ92a6XNekLXa3rR18MM=
github.com/charmbracelet/glamour v0.8.0 h1:tPrjL3aRcQbn++7t18wOpgLyl8wrOHUEDS7IZ68QtZs=
github.com/charmbracelet/glamour v0.8.0/go.mod h1:ViRgmKkf3u5S7uakt2czJ272WSg2ZenlYEZXT2x7Bjw=
github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ=
Expand Down
5 changes: 0 additions & 5 deletions field_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,6 @@ func (i *Input) Update(msg tea.Msg) (tea.Model, tea.Cmd) {

switch {
case key.Matches(msg, i.keymap.Prev):
value := i.textinput.Value()
i.err = i.validate(value)
if i.err != nil {
return i, nil
}
cmds = append(cmds, PrevField)
case key.Matches(msg, i.keymap.Next, i.keymap.Submit):
value := i.textinput.Value()
Expand Down

0 comments on commit ea9b9ee

Please sign in to comment.