From 9918ceb7f49b7567af7d335643a89a7d70187707 Mon Sep 17 00:00:00 2001 From: Rolv Apneseth Date: Wed, 20 Mar 2024 05:14:48 +0000 Subject: [PATCH] fix: adjust calculation for number of lines in a notification message (#828) Co-authored-by: sxyazi --- yazi-core/src/notify/message.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yazi-core/src/notify/message.rs b/yazi-core/src/notify/message.rs index da80c186..8006467c 100644 --- a/yazi-core/src/notify/message.rs +++ b/yazi-core/src/notify/message.rs @@ -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 } }