From 8d2fcd3518d3e2fdfa9f3e0a62004cf57f94108c Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Fri, 29 Mar 2019 15:12:46 +0900 Subject: [PATCH] Avoid unnecessary redraw of the preview window --- src/terminal.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/terminal.go b/src/terminal.go index ca811c4..3175aaa 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -1652,9 +1652,12 @@ func (t *Terminal) Loop() { } } scrollPreview := func(amount int) { - t.previewer.offset = util.Constrain( + newOffset := util.Constrain( t.previewer.offset+amount, 0, t.previewer.lines-1) - req(reqPreviewRefresh) + if t.previewer.offset != newOffset { + t.previewer.offset = newOffset + req(reqPreviewRefresh) + } } for key, ret := range t.expect { if keyMatch(key, event) {