Fix --preview-window noborder with non-default background color

This commit is contained in:
Junegunn Choi 2019-11-15 18:27:08 +09:00
parent d630484eeb
commit 2886f06977
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
2 changed files with 16 additions and 3 deletions

View File

@ -624,9 +624,9 @@ func (t *Terminal) resizeWindows() {
noBorder := tui.MakeBorderStyle(tui.BorderNone, t.unicode)
if previewVisible {
createPreviewWindow := func(y int, x int, w int, h int) {
previewBorder := noBorder
if t.preview.border {
previewBorder = tui.MakeBorderStyle(tui.BorderAround, t.unicode)
previewBorder := tui.MakeBorderStyle(tui.BorderAround, t.unicode)
if !t.preview.border {
previewBorder = tui.MakeTransparentBorder()
}
t.pborder = t.tui.NewWindow(y, x, w, h, previewBorder)
pwidth := w - 4

View File

@ -221,6 +221,8 @@ type BorderStyle struct {
bottomRight rune
}
type BorderCharacter int
func MakeBorderStyle(shape BorderShape, unicode bool) BorderStyle {
if unicode {
return BorderStyle{
@ -244,6 +246,17 @@ func MakeBorderStyle(shape BorderShape, unicode bool) BorderStyle {
}
}
func MakeTransparentBorder() BorderStyle {
return BorderStyle{
shape: BorderAround,
horizontal: ' ',
vertical: ' ',
topLeft: ' ',
topRight: ' ',
bottomLeft: ' ',
bottomRight: ' '}
}
type Renderer interface {
Init()
Pause(clear bool)