mirror of
https://github.com/charmbracelet/gum
synced 2026-03-14 21:55:45 +01:00
fix: if sort, sort options alphabetically first
This commit is contained in:
parent
bc64a68142
commit
86e8fc0a5b
1 changed files with 5 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/charmbracelet/bubbles/textinput"
|
||||
|
|
@ -54,6 +55,10 @@ func (o Options) Run() error {
|
|||
options = append(options, tea.WithAltScreen())
|
||||
}
|
||||
|
||||
if o.Sort {
|
||||
slices.SortStableFunc(o.Options, strings.Compare)
|
||||
}
|
||||
|
||||
var matches []fuzzy.Match
|
||||
if o.Value != "" {
|
||||
i.SetValue(o.Value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue