From 5b437ff83591ac7e1f4aa0ae21cf65585f07c67c Mon Sep 17 00:00:00 2001 From: rolv Date: Tue, 19 Mar 2024 13:38:50 +0000 Subject: [PATCH] fix: number of lines calculation for notification message --- 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..73f78191 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 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 } }