summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-11-23 23:45:47 -0500
committerDan Davison <dandavison7@gmail.com>2021-11-23 23:47:06 -0500
commit05e2ccf2bb92e722269218b7ed0b95a7cb713dcb (patch)
tree5a803fa2d20967abde5b1e6599df331a4a94590f
parent4d4b19ca3d8d401b7ca0b79dd352bcf04afd1d8e (diff)
-rw-r--r--src/paint.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/paint.rs b/src/paint.rs
index 0f429d5c..b6c11852 100644
--- a/src/paint.rs
+++ b/src/paint.rs
@@ -944,15 +944,23 @@ mod superimpose_style_sections {
let mut coalesced: Vec<(Style, String)> = Vec::new();
let mut style_sections = style_sections.iter();
if let Some((style_pair, c)) = style_sections.next() {
+ let mut seen_non_white_space = c != &' ' && c != &'\t';
let mut current_string = c.to_string();
let mut current_style_pair = style_pair;
for (style_pair, c) in style_sections {
if style_pair != current_style_pair {
- let style = make_superimposed_style(*current_style_pair);
+ let mut style = make_superimposed_style(*current_style_pair);
+ if style.ansi_term_style.is_underline && !seen_non_white_space {
+ style.ansi_term_style.is_underline = false;
+ }
+ if style.ansi_term_style.is_strikethrough && !seen_non_white_space {
+ style.ansi_term_style.is_strikethrough = false;
+ }
coalesced.push((style, current_string));
current_string = String::new();
current_style_pair = style_pair;
}
+ seen_non_white_space |= c != &' ' && c != &'\t';
current_string.push(*c);
}