From 394d8cfd18819281f237f736ce60586df359541d Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 5 Dec 2019 22:25:43 +0900 Subject: [PATCH] Remove immediate flickering on reload action --- CHANGELOG.md | 4 ++++ src/core.go | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4754dd2..91ff961 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ CHANGELOG 0.19.1 (WIP) ------ +- Removed the immediate flicking of the screen on `reload` action. + ```sh + : | fzf --bind 'change:reload:seq {q}' --phony + ``` - It is now possible to split a composite bind action over multiple `--bind` expressions by prefixing the later ones with `+`. ```sh diff --git a/src/core.go b/src/core.go index 9d118a4..37513f5 100644 --- a/src/core.go +++ b/src/core.go @@ -224,10 +224,12 @@ func Run(opts *Options, revision string) { // Event coordination reading := true + clearCache := false ticks := 0 var nextCommand *string restart := func(command string) { reading = true + clearCache = true chunkList.Clear() header = make([]string, 0, opts.HeaderLines) go reader.restart(command) @@ -250,11 +252,10 @@ func Run(opts *Options, revision string) { switch evt { case EvtReadNew, EvtReadFin: - clearCache := false if evt == EvtReadFin && nextCommand != nil { - clearCache = true restart(*nextCommand) nextCommand = nil + break } else { reading = reading && evt == EvtReadNew } @@ -264,6 +265,7 @@ func Run(opts *Options, revision string) { terminal.UpdateList(PassMerger(&snapshot, opts.Tac)) } matcher.Reset(snapshot, input(), false, !reading, sort, clearCache) + clearCache = false case EvtSearchNew: var command *string @@ -279,9 +281,11 @@ func Run(opts *Options, revision string) { } else { restart(*command) } + break } snapshot, _ := chunkList.Snapshot() - matcher.Reset(snapshot, input(), true, !reading, sort, command != nil) + matcher.Reset(snapshot, input(), true, !reading, sort, clearCache) + clearCache = false delay = false case EvtSearchProgress: