Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allowed font_style to be an array #124

Merged
merged 6 commits into from
Jan 16, 2024

Conversation

John-Toohey
Copy link
Contributor

This allows multiple font_styles to be used, allowing, say, for a bold and italic text. Fixes #49

All previous examples should work, but now you can also specify:

font-style:
  - bold
  - underline

This allows multiple `font_style`s to be used, allowing, say, for a bold and
italic text. Fixes sharkdp#49
@John-Toohey John-Toohey changed the title Allowed font_style to be an array DRAFT: Allowed font_style to be an array Jan 1, 2024
@John-Toohey John-Toohey changed the title DRAFT: Allowed font_style to be an array Allowed font_style to be an array Jan 1, 2024
@John-Toohey John-Toohey marked this pull request as draft January 1, 2024 20:01
@John-Toohey John-Toohey marked this pull request as ready for review January 2, 2024 11:26
src/theme.rs Show resolved Hide resolved
This allows multiple `font_style`s to be used, allowing, say, for a bold and
italic text. Fixes sharkdp#49
@sharkdp sharkdp force-pushed the multiple_font_styles branch from 4d2cdb9 to cd2298e Compare January 2, 2024 20:33
This removes a trailing semicolon that can occur in some positions
Comment on lines +60 to +66
for (i, style) in self.0.iter().enumerate() {
if i + 1 == self.0.len() {
write!(f, "{}", style)?;
} else {
write!(f, "{};", style)?;
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, because that would only work if the slice was a slice of strs.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, right. we could use intersperse from itertools, but it's not worth a new dependency. Maybe once it is stabilized in std 😄 (rust-lang/rust#79524, https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.intersperse)

@sharkdp sharkdp merged commit 2ddbc2f into sharkdp:master Jan 16, 2024
14 checks passed
@sharkdp
Copy link
Owner

sharkdp commented Jan 16, 2024

Thank you for the update

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using multiple font styles
2 participants