From bf2e61d28d6e7fde91d98d853c4b6de7f73c6d44 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sat, 21 Sep 2024 01:46:29 +0800 Subject: [PATCH] .. --- yazi-plugin/src/elements/paragraph.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yazi-plugin/src/elements/paragraph.rs b/yazi-plugin/src/elements/paragraph.rs index c2de6f74..9ace9892 100644 --- a/yazi-plugin/src/elements/paragraph.rs +++ b/yazi-plugin/src/elements/paragraph.rs @@ -77,6 +77,9 @@ impl UserData for Paragraph { }; Ok(ud) }); + methods.add_method("max_width", |_, me, ()| { + Ok(me.text.lines.iter().take(me.area.height as usize).map(|l| l.width()).max()) + }); } }