From bb68797b026815d979d426e5957bc086117bbd73 Mon Sep 17 00:00:00 2001 From: Timon Ringwald Date: Tue, 3 May 2022 17:49:25 +0200 Subject: [PATCH] HideBorder flag for BorderView --- views/view_border.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/views/view_border.go b/views/view_border.go index 8f8611a..e4dcbae 100644 --- a/views/view_border.go +++ b/views/view_border.go @@ -7,7 +7,8 @@ import "git.tordarus.net/Tordarus/tui" // This can lead to color artifacts when using BorderView with colored styles. type BorderView struct { tui.WrapperTmpl - Border BorderBox + Border BorderBox + HideBorder bool } var _ tui.Wrapper = &BorderView{} @@ -20,6 +21,11 @@ func NewBorderView(view tui.View) *BorderView { } func (g *BorderView) Draw(buf *tui.ViewBuffer) { + if g.HideBorder { + g.View().Draw(buf) + return + } + g.View().Draw(buf.Sub(1, 1, buf.Width()-2, buf.Height()-2)) buf.Set(0, 0, tui.Rune{Rn: g.Border.TopLeft, Style: g.Style()})