diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-08-14 01:42:51 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-08-14 10:14:54 -0400 |
commit | de114e3ea52c82ab92f4cc52aefaf76e027a3f07 (patch) | |
tree | 7349f4976b73b854355177da8fc03bd95c0e0344 /src/draw.rs | |
parent | 0a9c48c75051fb507ec1a801ca9d0cf96fadbc48 (diff) |
Use native ansi-parsing utilities instead of console crate
Fixes #262
console was great but it didn't support ANSI OSC sequences.
Diffstat (limited to 'src/draw.rs')
-rw-r--r-- | src/draw.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/draw.rs b/src/draw.rs index 9def6db8..a01e6a96 100644 --- a/src/draw.rs +++ b/src/draw.rs @@ -3,9 +3,8 @@ use std::io::Write; use ansi_term; use box_drawing; -use console::strip_ansi_codes; -use unicode_width::UnicodeWidthStr; +use crate::ansi; use crate::cli::Width; use crate::style::Style; @@ -40,7 +39,7 @@ pub fn write_boxed( } else { box_drawing::light::UP_LEFT }; - let box_width = UnicodeWidthStr::width(strip_ansi_codes(text).as_ref()); + let box_width = ansi::measure_text_width(text); write_boxed_partial( writer, text, @@ -63,7 +62,7 @@ pub fn write_boxed_with_underline( text_style: Style, decoration_style: ansi_term::Style, ) -> std::io::Result<()> { - let box_width = UnicodeWidthStr::width(strip_ansi_codes(text).as_ref()); + let box_width = ansi::measure_text_width(text); write_boxed_with_horizontal_whisker( writer, text, @@ -162,7 +161,7 @@ fn _write_under_or_over_lined( text_style: Style, decoration_style: ansi_term::Style, ) -> std::io::Result<()> { - let text_width = UnicodeWidthStr::width(strip_ansi_codes(text).as_ref()); + let text_width = ansi::measure_text_width(text); let line_width = match *line_width { Width::Fixed(n) => max(n, text_width), Width::Variable => text_width, |