diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2015-01-11 23:49:12 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-01-11 23:49:12 +0900 |
commit | 9dbf6b02d24b52ae43e36905bbb1e83087e1dfe9 (patch) | |
tree | 37e627f5bb4a3037ea769aad1033593baec4eb00 /src/pattern.go | |
parent | 1db68a3976cfb10ed7d6ab88d7b468bb1b93ee34 (diff) |
Fix race conditions
- Wait for completions of goroutines when cancelling a search
- Remove shared access to rank field of Item
Diffstat (limited to 'src/pattern.go')
-rw-r--r-- | src/pattern.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pattern.go b/src/pattern.go index 31ba8137..2e7d6f91 100644 --- a/src/pattern.go +++ b/src/pattern.go @@ -2,6 +2,7 @@ package fzf import ( "regexp" + "sort" "strings" ) @@ -225,12 +226,14 @@ Loop: } func dupItem(item *Item, offsets []Offset) *Item { + sort.Sort(ByOrder(offsets)) return &Item{ text: item.text, origText: item.origText, transformed: item.transformed, + index: item.index, offsets: offsets, - rank: Rank{0, 0, item.rank.index}} + rank: Rank{0, 0, item.index}} } func (p *Pattern) fuzzyMatch(chunk *Chunk) []*Item { |