Skip to content

Commit

Permalink
add a function to copy attributes from a compound to another one
Browse files Browse the repository at this point in the history
  • Loading branch information
Canop committed Jun 29, 2021
1 parent 5a5e41b commit 8a43754
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/compound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ impl<'s> Compound<'s> {
pub fn set_str(&mut self, src: &'s str) {
self.src = src;
}
/// change the attributes by taking the values from the other
/// compound, keeping the str
pub fn set_attributes_from(&mut self, other: &Compound) {
self.bold = other.bold;
self.italic = other.italic;
self.code = other.code;
self.strikeout = other.strikeout;
}
/// return a sub part of the compound, with the same styling
/// r_start is relative, that is 0 is the index of the first
/// byte of this compound.
Expand Down

0 comments on commit 8a43754

Please sign in to comment.