From 2b9cd0e4703b433ca9cd97f7bffd146fe9c6c527 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jun 2026 00:03:26 +0000 Subject: [PATCH] Bump github.com/sahilm/fuzzy from 0.1.2 to 0.1.3 Bumps [github.com/sahilm/fuzzy](https://github.com/sahilm/fuzzy) from 0.1.2 to 0.1.3. - [Release notes](https://github.com/sahilm/fuzzy/releases) - [Commits](https://github.com/sahilm/fuzzy/compare/v0.1.2...v0.1.3) --- updated-dependencies: - dependency-name: github.com/sahilm/fuzzy dependency-version: 0.1.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +-- vendor/github.com/sahilm/fuzzy/fuzzy.go | 34 +++++++++++++++++++++++-- vendor/modules.txt | 2 +- 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 52e7da2d525..5f53947bf72 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/mgutz/str v1.2.0 github.com/mitchellh/go-ps v1.0.0 github.com/rivo/uniseg v0.4.7 - github.com/sahilm/fuzzy v0.1.2 + github.com/sahilm/fuzzy v0.1.3 github.com/samber/lo v1.53.0 github.com/sanity-io/litter v1.5.8 github.com/sasha-s/go-deadlock v0.3.9 diff --git a/go.sum b/go.sum index e92e532e23f..194e0d540ad 100644 --- a/go.sum +++ b/go.sum @@ -107,8 +107,8 @@ github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/sahilm/fuzzy v0.1.2 h1:kdSkz23lx1meNjEl+SLJULeSbjTI4Dn14K/YxdGrIww= -github.com/sahilm/fuzzy v0.1.2/go.mod h1:au6//VbVSqu6DFrkL2CfjlJ5iURpNCPeE+1GwY3XsT8= +github.com/sahilm/fuzzy v0.1.3 h1:juByESSS32nVD81vr6tHmKmA/8zde7gE+x5CLxrzXPU= +github.com/sahilm/fuzzy v0.1.3/go.mod h1:au6//VbVSqu6DFrkL2CfjlJ5iURpNCPeE+1GwY3XsT8= github.com/samber/lo v1.53.0 h1:t975lj2py4kJPQ6haz1QMgtId2gtmfktACxIXArw3HM= github.com/samber/lo v1.53.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0= github.com/sanity-io/litter v1.5.8 h1:uM/2lKrWdGbRXDrIq08Lh9XtVYoeGtcQxk9rtQ7+rYg= diff --git a/vendor/github.com/sahilm/fuzzy/fuzzy.go b/vendor/github.com/sahilm/fuzzy/fuzzy.go index 54eb98fb267..38853103a6a 100644 --- a/vendor/github.com/sahilm/fuzzy/fuzzy.go +++ b/vendor/github.com/sahilm/fuzzy/fuzzy.go @@ -6,6 +6,7 @@ VSCode, IntelliJ IDEA et al. package fuzzy import ( + "iter" "sort" "strings" "unicode" @@ -60,6 +61,16 @@ func (ss stringSource) String(i int) string { func (ss stringSource) Len() int { return len(ss) } +func iterFromSource(s Source) iter.Seq[string] { + return func(yield func(string) bool) { + for i := 0; i < s.Len(); i++ { + if !yield(s.String(i)) { + return + } + } + } +} + /* Find looks up pattern in data and returns matches in descending order of match quality. Match quality @@ -107,15 +118,33 @@ FindFromNoSort is an alternative FindFrom implementation that does not sort results in the end. */ func FindFromNoSort(pattern string, data Source) Matches { + return FindFromIterNoSort(pattern, iterFromSource(data)) +} + +/* +FindFromIter is an alternative implementation of FindFrom that uses an iterator +instead of Source. +*/ +func FindFromIter(pattern string, it iter.Seq[string]) Matches { + matches := FindFromIterNoSort(pattern, it) + sort.Stable(matches) + return matches +} + +/* +FindFromIterNoSort is an alternative implementation of FindFromIter that does +not sort results in the end. +*/ +func FindFromIterNoSort(pattern string, it iter.Seq[string]) Matches { if len(pattern) == 0 { return nil } runes := []rune(pattern) var matches Matches var matchedIndexes []int - for i := 0; i < data.Len(); i++ { + var i int + for matchStr := range it { var match Match - matchStr := data.String(i) match.Str = matchStr // Limit matching to the first NUL rune, if any. We could maybe replace it // with whitespace, but this way doesn't allocate so much, and the presence @@ -125,6 +154,7 @@ func FindFromNoSort(pattern string, data Source) Matches { cleanMatchStr = cleanMatchStr[:nullI] } match.Index = i + i++ if matchedIndexes != nil { match.MatchedIndexes = matchedIndexes } else { diff --git a/vendor/modules.txt b/vendor/modules.txt index 6a21d6d976d..cd2570c2b91 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -130,7 +130,7 @@ github.com/pmezard/go-difflib/difflib github.com/rivo/uniseg # github.com/rogpeppe/go-internal v1.14.1 ## explicit; go 1.23 -# github.com/sahilm/fuzzy v0.1.2 +# github.com/sahilm/fuzzy v0.1.3 ## explicit; go 1.24.5 github.com/sahilm/fuzzy # github.com/samber/lo v1.53.0