Skip to content

Commit

Permalink
Got all the tests working
Browse files Browse the repository at this point in the history
This removes a trailing semicolon that can occur in some positions
  • Loading branch information
John-Toohey authored and sharkdp committed Jan 16, 2024
1 parent 4eb1379 commit 2ddbc2f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/font_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,19 @@ impl FontStyle {
}
_ => panic!("font-style should be a string or an array of strings"),
},
None => Self::default(),
None => Self(vec![0]),
}
}
}

impl Display for FontStyle {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
for style in &self.0 {
write!(f, "{};", style)?;
for (i, style) in self.0.iter().enumerate() {
if i + 1 == self.0.len() {
write!(f, "{}", style)?;
} else {
write!(f, "{};", style)?;
}
}
Ok(())
}
Expand Down
5 changes: 4 additions & 1 deletion src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ impl Theme {
let mut style: String = format!("{font_style}");
if let Some(foreground) = foreground {
let foreground_code = foreground.get_style(ColorType::Foreground, self.color_mode);
style.push_str(&foreground_code);
style.push_str(&format!(
";{foreground_code}",
foreground_code = foreground_code
));
}

if let Some(background) = background {
Expand Down

0 comments on commit 2ddbc2f

Please sign in to comment.