mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-15 04:05:48 -07:00
Fix race conditions
- Wait for completions of goroutines when cancelling a search - Remove shared access to rank field of Item
This commit is contained in:
@@ -64,7 +64,10 @@ func Run(options *Options) {
|
||||
var chunkList *ChunkList
|
||||
if len(opts.WithNth) == 0 {
|
||||
chunkList = NewChunkList(func(data *string, index int) *Item {
|
||||
return &Item{text: data, rank: Rank{0, 0, uint32(index)}}
|
||||
return &Item{
|
||||
text: data,
|
||||
index: uint32(index),
|
||||
rank: Rank{0, 0, uint32(index)}}
|
||||
})
|
||||
} else {
|
||||
chunkList = NewChunkList(func(data *string, index int) *Item {
|
||||
@@ -72,6 +75,7 @@ func Run(options *Options) {
|
||||
item := Item{
|
||||
text: Transform(tokens, opts.WithNth).whole,
|
||||
origText: data,
|
||||
index: uint32(index),
|
||||
rank: Rank{0, 0, uint32(index)}}
|
||||
return &item
|
||||
})
|
||||
|
Reference in New Issue
Block a user