diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2019-11-15 18:27:08 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2019-11-15 18:27:08 +0900 |
commit | 2886f06977579276d0c1a8273d29d5bdad23d628 (patch) | |
tree | ce3b919a6d104b6bf8343391d68302af54559782 /src | |
parent | d630484eeb41097788d62aededb6ec6f188a46ee (diff) |
Fix --preview-window noborder with non-default background color
Diffstat (limited to 'src')
-rw-r--r-- | src/terminal.go | 6 | ||||
-rw-r--r-- | src/tui/tui.go | 13 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/terminal.go b/src/terminal.go index 13b932e5..4cd507a3 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -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 diff --git a/src/tui/tui.go b/src/tui/tui.go index de1d4b56..5a2e8d1b 100644 --- a/src/tui/tui.go +++ b/src/tui/tui.go @@ -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) |