Fix formatting issues.

This commit is contained in:
Andreea Sobon 2021-01-04 12:34:23 -05:00
parent 22ae449020
commit f8470e7dfe
2 changed files with 11 additions and 12 deletions

View File

@ -1003,7 +1003,7 @@ func TestNew(t *testing.T) {
return ft return ft
}, },
}, },
{ {
desc: "sets border title on root container of different color", desc: "sets border title on root container of different color",
termSize: image.Point{10, 10}, termSize: image.Point{10, 10},
container: func(ft *faketerm.Terminal) (*Container, error) { container: func(ft *faketerm.Terminal) (*Container, error) {
@ -1065,9 +1065,9 @@ func TestNew(t *testing.T) {
SplitVertical( SplitVertical(
Left( Left(
Border(linestyle.Light), Border(linestyle.Light),
BorderTitle("Ab"), BorderTitle("Ab"),
TitleColor(cell.ColorMagenta), TitleColor(cell.ColorMagenta),
TitleFocusedColor(cell.ColorCyan), TitleFocusedColor(cell.ColorCyan),
), ),
Right( Right(
Border(linestyle.Light), Border(linestyle.Light),
@ -1103,7 +1103,6 @@ func TestNew(t *testing.T) {
return ft return ft
}, },
}, },
{ {
desc: "inherits title color on left child container", desc: "inherits title color on left child container",
termSize: image.Point{10, 10}, termSize: image.Point{10, 10},
@ -1116,7 +1115,7 @@ func TestNew(t *testing.T) {
SplitVertical( SplitVertical(
Left( Left(
Border(linestyle.Light), Border(linestyle.Light),
BorderTitle("Ab"), BorderTitle("Ab"),
), ),
Right( Right(
Border(linestyle.Light), Border(linestyle.Light),

View File

@ -87,19 +87,19 @@ func drawBorder(c *Container) error {
var cOpts, titleCOpts []cell.Option var cOpts, titleCOpts []cell.Option
if c.focusTracker.isActive(c) { if c.focusTracker.isActive(c) {
cOpts = append(cOpts, cell.FgColor(c.opts.inherited.focusedColor)) cOpts = append(cOpts, cell.FgColor(c.opts.inherited.focusedColor))
if c.opts.inherited.titleFocusedColor != nil { if c.opts.inherited.titleFocusedColor != nil {
titleCOpts = append(titleCOpts, cell.FgColor(*c.opts.inherited.titleFocusedColor)) titleCOpts = append(titleCOpts, cell.FgColor(*c.opts.inherited.titleFocusedColor))
} else { } else {
titleCOpts = cOpts titleCOpts = cOpts
} }
} else { } else {
cOpts = append(cOpts, cell.FgColor(c.opts.inherited.borderColor)) cOpts = append(cOpts, cell.FgColor(c.opts.inherited.borderColor))
if c.opts.inherited.titleColor != nil { if c.opts.inherited.titleColor != nil {
titleCOpts = append(titleCOpts, cell.FgColor(*c.opts.inherited.titleColor)) titleCOpts = append(titleCOpts, cell.FgColor(*c.opts.inherited.titleColor))
} else { } else {
titleCOpts = cOpts titleCOpts = cOpts
} }
} }
if err := draw.Border(cvs, ar, if err := draw.Border(cvs, ar,
draw.BorderLineStyle(c.opts.border), draw.BorderLineStyle(c.opts.border),