From 38259d0382eba18b66c03d62e35089ec10c24698 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 3 Aug 2022 22:18:26 +0900 Subject: Fix incorrect ordering of `--tiebreak=chunk` --- src/pattern.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/pattern.go') diff --git a/src/pattern.go b/src/pattern.go index 4a7a87a6..95f23556 100644 --- a/src/pattern.go +++ b/src/pattern.go @@ -51,6 +51,7 @@ type Pattern struct { caseSensitive bool normalize bool forward bool + withPos bool text []rune termSets []termSet sortable bool @@ -85,7 +86,7 @@ func clearChunkCache() { // BuildPattern builds Pattern object from the given arguments func BuildPattern(fuzzy bool, fuzzyAlgo algo.Algo, extended bool, caseMode Case, normalize bool, forward bool, - cacheable bool, nth []Range, delimiter Delimiter, runes []rune) *Pattern { + withPos bool, cacheable bool, nth []Range, delimiter Delimiter, runes []rune) *Pattern { var asString string if extended { @@ -145,6 +146,7 @@ func BuildPattern(fuzzy bool, fuzzyAlgo algo.Algo, extended bool, caseMode Case, caseSensitive: caseSensitive, normalize: normalize, forward: forward, + withPos: withPos, text: []rune(asString), termSets: termSets, sortable: sortable, @@ -302,13 +304,13 @@ func (p *Pattern) matchChunk(chunk *Chunk, space []Result, slab *util.Slab) []Re if space == nil { for idx := 0; idx < chunk.count; idx++ { - if match, _, _ := p.MatchItem(&chunk.items[idx], false, slab); match != nil { + if match, _, _ := p.MatchItem(&chunk.items[idx], p.withPos, slab); match != nil { matches = append(matches, *match) } } } else { for _, result := range space { - if match, _, _ := p.MatchItem(result.item, false, slab); match != nil { + if match, _, _ := p.MatchItem(result.item, p.withPos, slab); match != nil { matches = append(matches, *match) } } -- cgit v1.2.3