fix: number of lines calculation for notification message

This commit is contained in:
rolv 2024-03-19 13:38:50 +00:00
parent 955e8f59a9
commit 5b437ff835

View file

@ -36,7 +36,11 @@ impl Message {
return 0; // In case we can't get the width of the terminal
}
let lines = (self.content.width() as f64 / width as f64).ceil();
lines as usize + NOTIFY_BORDER as usize
let mut num_lines = 0;
for line in self.content.lines() {
num_lines += (line.width() + 1).div_ceil(width as usize)
}
num_lines + NOTIFY_BORDER as usize
}
}