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

View File

@ -87,19 +87,19 @@ func drawBorder(c *Container) error {
var cOpts, titleCOpts []cell.Option
if c.focusTracker.isActive(c) {
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))
} else {
} else {
titleCOpts = cOpts
}
} else {
} else {
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))
} else {
} else {
titleCOpts = cOpts
}
}
}
if err := draw.Border(cvs, ar,
draw.BorderLineStyle(c.opts.border),