mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
fix: adjust calculation for number of lines in a notification message (#828)
Co-authored-by: sxyazi <sxyazi@gmail.com>
This commit is contained in:
parent
955e8f59a9
commit
9918ceb7f4
1 changed files with 6 additions and 2 deletions
|
|
@ -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 lines = 0;
|
||||
for line in self.content.lines() {
|
||||
lines += (line.width() + 1).div_ceil(width as usize)
|
||||
}
|
||||
|
||||
lines + NOTIFY_BORDER as usize
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue