From 26244ad8c21ccc946393e10eea7d6b1ad32096e1 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 9 Mar 2024 14:01:49 +0900 Subject: [PATCH] Fix preview area not being cleared when using certain types of border styles fzf --preview 'sleep 3; date' --preview-window hidden \ --bind ctrl-/:change-preview-window:up,border-bottom --- src/tui/light.go | 16 ++++++++++++++-- src/tui/tcell.go | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/tui/light.go b/src/tui/light.go index a591152..216c4c3 100644 --- a/src/tui/light.go +++ b/src/tui/light.go @@ -808,13 +808,25 @@ func (w *LightWindow) drawBorderHorizontal(top, bottom bool) { color = ColPreviewBorder } hw := runeWidth(w.border.top) + pad := repeat(' ', w.width/hw) + + w.Move(0, 0) if top { - w.Move(0, 0) w.CPrint(color, repeat(w.border.top, w.width/hw)) + } else { + w.CPrint(color, pad) } + + for y := 1; y < w.height-1; y++ { + w.Move(y, 0) + w.CPrint(color, pad) + } + + w.Move(w.height-1, 0) if bottom { - w.Move(w.height-1, 0) w.CPrint(color, repeat(w.border.bottom, w.width/hw)) + } else { + w.CPrint(color, pad) } } diff --git a/src/tui/tcell.go b/src/tui/tcell.go index ae3cb2e..0ca8aee 100644 --- a/src/tui/tcell.go +++ b/src/tui/tcell.go @@ -544,7 +544,7 @@ func (r *FullscreenRenderer) NewWindow(top int, left int, width int, height int, height: height, normal: normal, borderStyle: borderStyle} - w.drawBorder(false) + w.Erase() return w } @@ -561,8 +561,8 @@ func fill(x, y, w, h int, n ColorPair, r rune) { } func (w *TcellWindow) Erase() { - w.drawBorder(false) fill(w.left-1, w.top, w.width+1, w.height-1, w.normal, ' ') + w.drawBorder(false) } func (w *TcellWindow) EraseMaybe() bool {