From 599086f4b609f2782eb18de00ee5218f5f9b0403 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Fri, 31 Jan 2025 16:58:58 +0800 Subject: [PATCH] fix: squeeze the parent directory offset after terminal size change --- yazi-core/src/manager/manager.rs | 3 +++ yazi-fm/src/app/commands/resize.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/yazi-core/src/manager/manager.rs b/yazi-core/src/manager/manager.rs index 51c44eb0..da5b7179 100644 --- a/yazi-core/src/manager/manager.rs +++ b/yazi-core/src/manager/manager.rs @@ -70,6 +70,9 @@ impl Manager { #[inline] pub fn parent(&self) -> Option<&Folder> { self.active().parent.as_ref() } + #[inline] + pub fn parent_mut(&mut self) -> Option<&mut Folder> { self.active_mut().parent.as_mut() } + #[inline] pub fn hovered(&self) -> Option<&File> { self.active().hovered() } diff --git a/yazi-fm/src/app/commands/resize.rs b/yazi-fm/src/app/commands/resize.rs index e55930d8..cb96e81d 100644 --- a/yazi-fm/src/app/commands/resize.rs +++ b/yazi-fm/src/app/commands/resize.rs @@ -20,5 +20,6 @@ impl App { self.cx.current_mut().sync_page(true); self.cx.manager.hover(None); + self.cx.manager.parent_mut().map(|f| f.arrow(0)); } }