diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2015-01-11 01:15:44 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-01-11 01:30:17 +0900 |
commit | 4f4031443365659de357ad4da15af8b5e3245137 (patch) | |
tree | be1535a7c4ebd6a5e3e0e0898c06aa4d1c5190dd /src/pattern.go | |
parent | f670f4f076867d6876bcbc832a9b464bbe4f8f68 (diff) |
Fix --with-nth option when query is non-empty
Diffstat (limited to 'src/pattern.go')
-rw-r--r-- | src/pattern.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/pattern.go b/src/pattern.go index 7b294253..93dbaf99 100644 --- a/src/pattern.go +++ b/src/pattern.go @@ -235,9 +235,10 @@ func (p *Pattern) fuzzyMatch(chunk *Chunk) []*Item { input := p.prepareInput(item) if sidx, eidx := p.iter(FuzzyMatch, input, p.text); sidx >= 0 { matches = append(matches, &Item{ - text: item.text, - offsets: []Offset{Offset{int32(sidx), int32(eidx)}}, - rank: Rank{0, 0, item.rank.index}}) + text: item.text, + origText: item.origText, + offsets: []Offset{Offset{int32(sidx), int32(eidx)}}, + rank: Rank{0, 0, item.rank.index}}) } } return matches @@ -262,9 +263,10 @@ func (p *Pattern) extendedMatch(chunk *Chunk) []*Item { } if len(offsets) == len(p.terms) { matches = append(matches, &Item{ - text: item.text, - offsets: offsets, - rank: Rank{0, 0, item.rank.index}}) + text: item.text, + origText: item.origText, + offsets: offsets, + rank: Rank{0, 0, item.rank.index}}) } } return matches |