2
0
mirror of https://github.com/junegunn/fzf synced 2024-11-10 13:10:44 +00:00

Fix incorrect cache reference in --exact mode (#547)

When we prepend a single quote to our query in --exact mode, we are not
supposed to limit the scope of the new search to the previous
exact-match result.
This commit is contained in:
Junegunn Choi 2016-04-24 03:30:51 +09:00
parent 4bde8de63f
commit 85ef3263fc
2 changed files with 11 additions and 1 deletions

View File

@ -227,7 +227,7 @@ func (p *Pattern) CacheKey() string {
}
cacheableTerms := []string{}
for _, termSet := range p.termSets {
if len(termSet) == 1 && !termSet[0].inv {
if len(termSet) == 1 && !termSet[0].inv && (p.fuzzy || termSet[0].typ == termExact) {
cacheableTerms = append(cacheableTerms, string(termSet[0].origText))
}
}

View File

@ -1157,6 +1157,16 @@ class TestGoFZF < TestBase
end
end
def test_partial_caching
tmux.send_keys 'seq 1000 | fzf -e', :Enter
tmux.until { |lines| lines[-2] == ' 1000/1000' }
tmux.send_keys 11
tmux.until { |lines| lines[-2] == ' 19/1000' }
tmux.send_keys 'C-a', "'"
tmux.until { |lines| lines[-2] == ' 28/1000' }
tmux.send_keys :Enter
end
private
def writelines path, lines
File.unlink path while File.exists? path