1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2026-06-20 01:19:23 +02:00

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] <support@github.com>
This commit is contained in:
dependabot[bot]
2026-06-17 00:03:26 +00:00
committed by GitHub
parent 69004ce208
commit 2b9cd0e470
4 changed files with 36 additions and 6 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ require (
github.com/mgutz/str v1.2.0 github.com/mgutz/str v1.2.0
github.com/mitchellh/go-ps v1.0.0 github.com/mitchellh/go-ps v1.0.0
github.com/rivo/uniseg v0.4.7 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/samber/lo v1.53.0
github.com/sanity-io/litter v1.5.8 github.com/sanity-io/litter v1.5.8
github.com/sasha-s/go-deadlock v0.3.9 github.com/sasha-s/go-deadlock v0.3.9
+2 -2
View File
@@ -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.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 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= 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.3 h1:juByESSS32nVD81vr6tHmKmA/8zde7gE+x5CLxrzXPU=
github.com/sahilm/fuzzy v0.1.2/go.mod h1:au6//VbVSqu6DFrkL2CfjlJ5iURpNCPeE+1GwY3XsT8= 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 h1:t975lj2py4kJPQ6haz1QMgtId2gtmfktACxIXArw3HM=
github.com/samber/lo v1.53.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0= 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= github.com/sanity-io/litter v1.5.8 h1:uM/2lKrWdGbRXDrIq08Lh9XtVYoeGtcQxk9rtQ7+rYg=
+32 -2
View File
@@ -6,6 +6,7 @@ VSCode, IntelliJ IDEA et al.
package fuzzy package fuzzy
import ( import (
"iter"
"sort" "sort"
"strings" "strings"
"unicode" "unicode"
@@ -60,6 +61,16 @@ func (ss stringSource) String(i int) string {
func (ss stringSource) Len() int { return len(ss) } 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 Find looks up pattern in data and returns matches
in descending order of match quality. Match quality 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. not sort results in the end.
*/ */
func FindFromNoSort(pattern string, data Source) Matches { 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 { if len(pattern) == 0 {
return nil return nil
} }
runes := []rune(pattern) runes := []rune(pattern)
var matches Matches var matches Matches
var matchedIndexes []int var matchedIndexes []int
for i := 0; i < data.Len(); i++ { var i int
for matchStr := range it {
var match Match var match Match
matchStr := data.String(i)
match.Str = matchStr match.Str = matchStr
// Limit matching to the first NUL rune, if any. We could maybe replace it // 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 // 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] cleanMatchStr = cleanMatchStr[:nullI]
} }
match.Index = i match.Index = i
i++
if matchedIndexes != nil { if matchedIndexes != nil {
match.MatchedIndexes = matchedIndexes match.MatchedIndexes = matchedIndexes
} else { } else {
+1 -1
View File
@@ -130,7 +130,7 @@ github.com/pmezard/go-difflib/difflib
github.com/rivo/uniseg github.com/rivo/uniseg
# github.com/rogpeppe/go-internal v1.14.1 # github.com/rogpeppe/go-internal v1.14.1
## explicit; go 1.23 ## explicit; go 1.23
# github.com/sahilm/fuzzy v0.1.2 # github.com/sahilm/fuzzy v0.1.3
## explicit; go 1.24.5 ## explicit; go 1.24.5
github.com/sahilm/fuzzy github.com/sahilm/fuzzy
# github.com/samber/lo v1.53.0 # github.com/samber/lo v1.53.0