summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2023-11-02 21:00:07 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2023-11-02 21:00:07 +0900
commitd0466fa77714cccae6875facafb4a7d49e3f958e (patch)
tree6f46912b1be2fbefeaae713aed54e257df15c249 /src
parent21ab64e96213ec99cf3f6f207690ffe710713fcc (diff)
downloadfzf-d0466fa77714cccae6875facafb4a7d49e3f958e.tar.gz
Fix regression where tcell renderer not clearing the preview window
Diffstat (limited to 'src')
-rw-r--r--src/terminal.go11
-rw-r--r--src/tui/light.go4
-rw-r--r--src/tui/tcell.go5
-rw-r--r--src/tui/tui.go1
4 files changed, 18 insertions, 3 deletions
diff --git a/src/terminal.go b/src/terminal.go
index 878e3d9a..a8a607f4 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -1942,9 +1942,14 @@ func (t *Terminal) renderPreviewArea(unchanged bool) {
t.pwindow.MoveAndClear(0, 0) // Clear scroll offset display
} else {
t.previewed.filled = false
- // We don't erase the window here to avoid flickering during scroll
- t.pwindow.DrawBorder()
- t.pwindow.Move(0, 0)
+ // We don't erase the window here to avoid flickering during scroll.
+ // However, tcell renderer uses double-buffering technique and there's no
+ // flickering. So we just erase the window and make the rest of the code
+ // simpler.
+ if !t.pwindow.EraseMaybe() {
+ t.pwindow.DrawBorder()
+ t.pwindow.Move(0, 0)
+ }
}
height := t.pwindow.Height()
diff --git a/src/tui/light.go b/src/tui/light.go
index d26a48f6..e5950cde 100644
--- a/src/tui/light.go
+++ b/src/tui/light.go
@@ -1109,3 +1109,7 @@ func (w *LightWindow) Erase() {
w.FinishFill()
w.Move(0, 0)
}
+
+func (w *LightWindow) EraseMaybe() bool {
+ return false
+}
diff --git a/src/tui/tcell.go b/src/tui/tcell.go
index d0a710a3..38641f7a 100644
--- a/src/tui/tcell.go
+++ b/src/tui/tcell.go
@@ -555,6 +555,11 @@ func (w *TcellWindow) Erase() {
fill(w.left-1, w.top, w.width+1, w.height-1, w.normal, ' ')
}
+func (w *TcellWindow) EraseMaybe() bool {
+ w.Erase()
+ return true
+}
+
func (w *TcellWindow) Enclose(y int, x int) bool {
return x >= w.left && x < (w.left+w.width) &&
y >= w.top && y < (w.top+w.height)
diff --git a/src/tui/tui.go b/src/tui/tui.go
index 7ba437aa..5a5e18d6 100644
--- a/src/tui/tui.go
+++ b/src/tui/tui.go
@@ -526,6 +526,7 @@ type Window interface {
Fill(text string) FillReturn
CFill(fg Color, bg Color, attr Attr, text string) FillReturn
Erase()
+ EraseMaybe() bool
}
type FullscreenRenderer struct {