Skip to content

Commit

Permalink
Fix preview area not being cleared when using certain types of border…
Browse files Browse the repository at this point in the history
… styles

    fzf --preview 'sleep 3; date' --preview-window hidden \
      --bind ctrl-/:change-preview-window:up,border-bottom
  • Loading branch information
junegunn committed Mar 9, 2024
1 parent fa0aa55 commit 26244ad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
16 changes: 14 additions & 2 deletions src/tui/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/tui/tcell.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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 {
Expand Down

0 comments on commit 26244ad

Please sign in to comment.