Make punctuation highlighting configurable, disable it by default

This commit is contained in:
Lukas Wirth 2022-08-22 13:15:42 +02:00
parent 6627b473e2
commit 16315edaee
4 changed files with 56 additions and 13 deletions

View file

@ -296,7 +296,7 @@ impl Highlight {
Highlight { tag, mods: HlMods::default() }
}
pub fn is_empty(&self) -> bool {
self.tag == HlTag::None && self.mods == HlMods::default()
self.tag == HlTag::None && self.mods.is_empty()
}
}
@ -330,6 +330,10 @@ impl ops::BitOr<HlMod> for Highlight {
}
impl HlMods {
pub fn is_empty(&self) -> bool {
self.0 == 0
}
pub fn contains(self, m: HlMod) -> bool {
self.0 & m.mask() == m.mask()
}