From c280dd546834d6f54c74ea0484c49fc0c5920caf Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Mon, 5 Jan 2026 16:13:09 -0500 Subject: [PATCH] feat(ui): models dialog: improve group filtering by ignoring spaces Related: 861db845 --- internal/ui/dialog/models_list.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/ui/dialog/models_list.go b/internal/ui/dialog/models_list.go index e7a7303536e701424d29aa049af91cf977e8318a..6903804e0868128953e2ab1a63b7b5963ec69ff7 100644 --- a/internal/ui/dialog/models_list.go +++ b/internal/ui/dialog/models_list.go @@ -167,7 +167,9 @@ func (f *ModelsList) IsSelectedLast() bool { // VisibleItems returns the visible items after filtering. func (f *ModelsList) VisibleItems() []list.Item { - if f.query == "" { + query := strings.ToLower(strings.ReplaceAll(f.query, " ", "")) + + if query == "" { // No filter, return all items with group headers items := []list.Item{} for _, g := range f.groups { @@ -199,7 +201,7 @@ func (f *ModelsList) VisibleItems() []list.Item { names[i] = filterValue(ms) } - matches := fuzzy.Find(f.query, names) + matches := fuzzy.Find(query, names) sort.SliceStable(matches, func(i, j int) bool { return matches[i].Score > matches[j].Score })