summaryrefslogtreecommitdiffstats
path: root/src/draw.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/draw.rs')
-rw-r--r--src/draw.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/draw.rs b/src/draw.rs
index 7211e620..6ec3a84f 100644
--- a/src/draw.rs
+++ b/src/draw.rs
@@ -36,7 +36,16 @@ pub fn write_boxed_with_line(
) -> std::io::Result<()> {
let box_width = strip_ansi_codes(text).graphemes(true).count() + 1;
write_boxed_with_horizontal_whisker(writer, text, box_width, line_style, heavy)?;
- write_horizontal_line(writer, line_width - box_width - 1, line_style, heavy)?;
+ write_horizontal_line(
+ writer,
+ if line_width > box_width {
+ line_width - box_width - 1
+ } else {
+ 0
+ },
+ line_style,
+ heavy,
+ )?;
Ok(())
}