diff --git a/internal/ui/dialog/models_list.go b/internal/ui/dialog/models_list.go index cd2f2a9570d8676ded81384a0720325c52e6e232..cec75c8e882c2db635a50ac3aa8839caa9a17601 100644 --- a/internal/ui/dialog/models_list.go +++ b/internal/ui/dialog/models_list.go @@ -216,8 +216,10 @@ func (f *ModelsList) VisibleItems() []list.Item { } matches := fuzzy.Find(query, names) + + // Sort by original index to preserve order within the group sort.SliceStable(matches, func(i, j int) bool { - return matches[i].Score > matches[j].Score + return matches[i].Index < matches[j].Index }) for _, match := range matches {