Added Has to text.Attribute
This commit is contained in:
parent
6bb1d742a2
commit
d4917d2e6d
|
@ -51,6 +51,11 @@ type Attributor interface {
|
||||||
// Attribute is the type for basic rich text markup attributes.
|
// Attribute is the type for basic rich text markup attributes.
|
||||||
type Attribute uint16
|
type Attribute uint16
|
||||||
|
|
||||||
|
// HasAttr returns whether or not "attr" has "this" attribute.
|
||||||
|
func (attr Attribute) Has(this Attribute) bool {
|
||||||
|
return (attr & this) == this
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// AttrBold represents bold text.
|
// AttrBold represents bold text.
|
||||||
AttrBold Attribute = 1 << iota
|
AttrBold Attribute = 1 << iota
|
||||||
|
|
Loading…
Reference in New Issue