diff --git a/choose/command.go b/choose/command.go index ca39855..6dd6b99 100644 --- a/choose/command.go +++ b/choose/command.go @@ -29,7 +29,7 @@ func (o Options) Run() error { if input == "" { return errors.New("no options provided, see `gum choose --help`") } - o.Options = strings.Split(strings.TrimSpace(input), "\n") + o.Options = strings.Split(strings.TrimSuffix(input, "\n"), "\n") } // We don't need to display prefixes if we are only picking one option. diff --git a/filter/command.go b/filter/command.go index 5cb3cfd..7f12e30 100644 --- a/filter/command.go +++ b/filter/command.go @@ -33,7 +33,7 @@ func (o Options) Run() error { var choices []string if input, _ := stdin.Read(); input != "" { - input = strings.TrimSpace(input) + input = strings.TrimSuffix(input, "\n") if input != "" { choices = strings.Split(input, "\n") }