diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-05-29 11:25:46 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-05-29 11:40:24 -0400 |
commit | ed7c7b8ae36e100dae269aa04d4c1a06f511db3d (patch) | |
tree | 1a4deda9995b09940d88dd5e3d2e26dafdfaa0cf /src/draw.rs | |
parent | c4f19de44630884c2a9066b27f807f43d36aaf01 (diff) |
Paint box-drawing characters with bold attribute when bold requested
Reverts functionality change in ad9c0899c32217f42ce0b68e5191e16c69355c77
Diffstat (limited to 'src/draw.rs')
-rw-r--r-- | src/draw.rs | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/src/draw.rs b/src/draw.rs index cecc263a..67a15bb2 100644 --- a/src/draw.rs +++ b/src/draw.rs @@ -6,19 +6,6 @@ use box_drawing; use console::strip_ansi_codes; use unicode_width::UnicodeWidthStr; -trait NotBoldExt { - fn not_bold(&self) -> Self; -} - -impl NotBoldExt for ansi_term::Style { - fn not_bold(&self) -> Self { - Self { - is_bold: false, - ..*self - } - } -} - /// Write text to stream, surrounded by a box, leaving the cursor just /// beyond the bottom right corner. pub fn write_boxed( @@ -35,7 +22,7 @@ pub fn write_boxed( }; let box_width = UnicodeWidthStr::width(strip_ansi_codes(text).as_ref()); write_boxed_partial(writer, text, box_width, text_style, decoration_style)?; - write!(writer, "{}", decoration_style.not_bold().paint(up_left))?; + write!(writer, "{}", decoration_style.paint(up_left))?; Ok(()) } @@ -161,9 +148,7 @@ fn write_horizontal_line( write!( writer, "{}", - decoration_style - .not_bold() - .paint(horizontal.repeat(line_width)) + decoration_style.paint(horizontal.repeat(line_width)) ) } @@ -180,11 +165,7 @@ fn write_boxed_with_horizontal_whisker( box_drawing::light::UP_HORIZONTAL }; write_boxed_partial(writer, text, box_width, text_style, decoration_style)?; - write!( - writer, - "{}", - decoration_style.not_bold().paint(up_horizontal) - )?; + write!(writer, "{}", decoration_style.paint(up_horizontal))?; Ok(()) } @@ -209,7 +190,6 @@ fn write_boxed_partial( ) }; let horizontal_edge = horizontal.repeat(box_width); - let decoration_style = decoration_style.not_bold(); write!( writer, "{}{}\n{}{}\n{}", |