HideBorder flag for BorderView
This commit is contained in:
parent
7a1a6503e8
commit
bb68797b02
@ -7,7 +7,8 @@ import "git.tordarus.net/Tordarus/tui"
|
|||||||
// This can lead to color artifacts when using BorderView with colored styles.
|
// This can lead to color artifacts when using BorderView with colored styles.
|
||||||
type BorderView struct {
|
type BorderView struct {
|
||||||
tui.WrapperTmpl
|
tui.WrapperTmpl
|
||||||
Border BorderBox
|
Border BorderBox
|
||||||
|
HideBorder bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ tui.Wrapper = &BorderView{}
|
var _ tui.Wrapper = &BorderView{}
|
||||||
@ -20,6 +21,11 @@ func NewBorderView(view tui.View) *BorderView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *BorderView) Draw(buf *tui.ViewBuffer) {
|
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))
|
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()})
|
buf.Set(0, 0, tui.Rune{Rn: g.Border.TopLeft, Style: g.Style()})
|
||||||
|
Loading…
Reference in New Issue
Block a user