Skip to content

Commit e69d621

Browse files
glehmanndjc
authored andcommitted
Fix wide_bar width computation with multiline a message
1 parent 985f053 commit e69d621

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/style.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,11 @@ impl WideElement<'_> {
463463
buf: &mut String,
464464
width: u16,
465465
) -> String {
466-
let left = (width as usize).saturating_sub(measure_text_width(&cur.replace('\x00', "")));
466+
let left =
467+
(width as usize).saturating_sub(match cur.lines().find(|line| line.contains('\x00')) {
468+
Some(line) => measure_text_width(&line.replace('\x00', "")),
469+
None => measure_text_width(&cur),
470+
});
467471
match self {
468472
Self::Bar { alt_style } => cur.replace(
469473
'\x00',

0 commit comments

Comments
 (0)