Added Has to text.Attribute

This commit is contained in:
diamondburned (Forefront) 2020-06-17 16:10:53 -07:00
parent 6bb1d742a2
commit d4917d2e6d
1 changed files with 5 additions and 0 deletions

View File

@ -51,6 +51,11 @@ type Attributor interface {
// Attribute is the type for basic rich text markup attributes.
type Attribute uint16
// HasAttr returns whether or not "attr" has "this" attribute.
func (attr Attribute) Has(this Attribute) bool {
return (attr & this) == this
}
const (
// AttrBold represents bold text.
AttrBold Attribute = 1 << iota