summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2018-12-13 10:58:57 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2018-12-13 10:58:57 +0900
commitca42e5e00a6ce53cf91aa2cbe946f437052b5fd1 (patch)
tree10475cc72f7368cc91ea53921185710f583b48ab
parent61feee690c25487aab7613771cd75166d404273a (diff)
Avoid unnecessary redraw of preview window
Close #1455
-rw-r--r--src/terminal.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/terminal.go b/src/terminal.go
index d0b2971e..b99b952f 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -1532,7 +1532,7 @@ func (t *Terminal) Loop() {
}
go func() {
- var focused *Item
+ var focusedIndex int32 = minItem.Index()
var version int64 = -1
for {
t.reqBox.Wait(func(events *util.Events) {
@@ -1549,10 +1549,14 @@ func (t *Terminal) Loop() {
t.printInfo()
case reqList:
t.printList()
- currentFocus := t.currentItem()
- if currentFocus != focused || version != t.version {
+ var currentIndex int32 = minItem.Index()
+ currentItem := t.currentItem()
+ if currentItem != nil {
+ currentIndex = currentItem.Index()
+ }
+ if focusedIndex != currentIndex || version != t.version {
version = t.version
- focused = currentFocus
+ focusedIndex = currentIndex
if t.isPreviewEnabled() {
_, list := t.buildPlusList(t.preview.command, false)
t.cancelPreview()