@@ 24,7 24,7 @@ func WithScreen(t *testing.T, charset st
assertNotEqual("sim screen", s, nil, t)
assertEqual("error", e, nil, t)
fn(s)
- s.Fini()
+ assertEqual("close screen", s.Close(), nil, t)
}
}
@@ 102,11 102,12 @@ func (s Style) Decompose() (fg Color, bg
return fg, bg, AttrMask(s) & attrAll
}
-func (s Style) setAttrs(attrs Style, on bool) Style {
+func (s Style) setAttrs(attrs AttrMask, on bool) Style {
+ a := Style(attrs)
if on {
- return s | attrs
+ return s | a
}
- return s &^ attrs
+ return s &^ a
}
// Normal returns the style with all attributes disabled.
@@ 117,30 118,30 @@ func (s Style) Normal() Style {
// Bold returns a new style based on s, with the bold attribute set
// as requested.
func (s Style) Bold(on bool) Style {
- return s.setAttrs(Style(AttrBold), on)
+ return s.setAttrs(AttrBold, on)
}
// Blink returns a new style based on s, with the blink attribute set
// as requested.
func (s Style) Blink(on bool) Style {
- return s.setAttrs(Style(AttrBlink), on)
+ return s.setAttrs(AttrBlink, on)
}
// Dim returns a new style based on s, with the dim attribute set
// as requested.
func (s Style) Dim(on bool) Style {
- return s.setAttrs(Style(AttrDim), on)
+ return s.setAttrs(AttrDim, on)
}
// Reverse returns a new style based on s, with the reverse attribute set
// as requested. (Reverse usually changes the foreground and background
// colors.)
func (s Style) Reverse(on bool) Style {
- return s.setAttrs(Style(AttrReverse), on)
+ return s.setAttrs(AttrReverse, on)
}
// Underline returns a new style based on s, with the underline attribute set
// as requested.
func (s Style) Underline(on bool) Style {
- return s.setAttrs(Style(AttrUnderline), on)
+ return s.setAttrs(AttrUnderline, on)
}