From c7ec9ccefff4bdef9c582b75d3e2d29671b59903 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Fri, 19 Jan 2024 13:22:08 +0800 Subject: [PATCH] .. --- yazi-fm/src/which/layout.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/yazi-fm/src/which/layout.rs b/yazi-fm/src/which/layout.rs index d260709d..e7cdca36 100644 --- a/yazi-fm/src/which/layout.rs +++ b/yazi-fm/src/which/layout.rs @@ -25,13 +25,9 @@ impl Widget for Which<'_> { } } - let height = cands.0.len() as u16 + 2; - let area = Rect { - x: 1, - y: area.height.saturating_sub(height + 2), - width: area.width.saturating_sub(2), - height, - }; + let height = area.height.min(cands.0.len() as u16 + 2); + let y = area.height.saturating_sub(height + 2); + let area = Rect { x: area.width.min(1), y, width: area.width.saturating_sub(2), height }; let chunks = layout::Layout::new(Direction::Horizontal, [ Constraint::Ratio(1, 3),