mirror of
https://github.com/junegunn/fzf
synced 2024-11-10 13:10:44 +00:00
Fix regression where tcell renderer not clearing the preview window
This commit is contained in:
parent
21ab64e962
commit
d0466fa777
@ -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()
|
||||
|
@ -1109,3 +1109,7 @@ func (w *LightWindow) Erase() {
|
||||
w.FinishFill()
|
||||
w.Move(0, 0)
|
||||
}
|
||||
|
||||
func (w *LightWindow) EraseMaybe() bool {
|
||||
return false
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user