mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-17 13:33:49 -07:00
Fix race condition in asynchronous -1 and -0
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
type MatchRequest struct {
|
||||
chunks []*Chunk
|
||||
pattern *Pattern
|
||||
final bool
|
||||
}
|
||||
|
||||
// Matcher is responsible for performing search
|
||||
@@ -91,6 +92,7 @@ func (m *Matcher) Loop() {
|
||||
|
||||
if !cancelled {
|
||||
m.mergerCache[patternString] = merger
|
||||
merger.final = request.final
|
||||
m.eventBox.Set(EvtSearchFin, merger)
|
||||
}
|
||||
}
|
||||
@@ -197,7 +199,7 @@ func (m *Matcher) scan(request MatchRequest) (*Merger, bool) {
|
||||
}
|
||||
|
||||
// Reset is called to interrupt/signal the ongoing search
|
||||
func (m *Matcher) Reset(chunks []*Chunk, patternRunes []rune, cancel bool) {
|
||||
func (m *Matcher) Reset(chunks []*Chunk, patternRunes []rune, cancel bool, final bool) {
|
||||
pattern := m.patternBuilder(patternRunes)
|
||||
|
||||
var event util.EventType
|
||||
@@ -206,5 +208,5 @@ func (m *Matcher) Reset(chunks []*Chunk, patternRunes []rune, cancel bool) {
|
||||
} else {
|
||||
event = reqRetry
|
||||
}
|
||||
m.reqBox.Set(event, MatchRequest{chunks, pattern})
|
||||
m.reqBox.Set(event, MatchRequest{chunks, pattern, final})
|
||||
}
|
||||
|
Reference in New Issue
Block a user