diff --git a/yazi-fm/src/app.rs b/yazi-fm/src/app.rs index c16522a5..3735ca81 100644 --- a/yazi-fm/src/app.rs +++ b/yazi-fm/src/app.rs @@ -8,6 +8,9 @@ use yazi_config::{keymap::{Exec, Key, KeymapLayer}, BOOT}; use yazi_core::{emit, files::FilesOp, input::InputMode, Ctx, Event}; use yazi_shared::Term; +use yazi_adaptor::ADAPTOR; +// use yazi_config::MANAGER; + use crate::{Executor, Logs, Panic, Root, Signals}; pub(super) struct App { @@ -176,10 +179,16 @@ impl App { Event::Select(opt, tx) => { self.cx.select.show(opt, tx); + let Rect { x, y, width, height} = self.cx.area(&self.cx.select.position); + let select_area = Rect {x:x+1, y:y+1, width:width-2, height:height-2}; + ADAPTOR.image_hide(select_area).ok(); emit!(Render); } Event::Input(opt, tx) => { self.cx.input.show(opt, tx); + let Rect { x, y, width, height} = self.cx.area(&self.cx.input.position); + let input_area = Rect {x:x+1, y:y+1, width:width-2, height:height-2}; + ADAPTOR.image_hide(input_area).ok(); emit!(Render); } diff --git a/yazi-fm/src/executor.rs b/yazi-fm/src/executor.rs index 68dedcbe..f2bcefee 100644 --- a/yazi-fm/src/executor.rs +++ b/yazi-fm/src/executor.rs @@ -184,11 +184,15 @@ impl<'a> Executor<'a> { }; } - on!(close); on!(arrow); match exec.cmd.as_str() { "help" => self.cx.help.toggle(KeymapLayer::Select), + "close" => { + self.cx.manager.active_mut().preview.reset(|_| true); + self.cx.manager.peek(false); + self.cx.select.close(exec) + }, _ => false, } } @@ -207,11 +211,22 @@ impl<'a> Executor<'a> { }; } - on!(close); - on!(escape); on!(move_, "move"); - if exec.cmd.as_str() == "complete" { + + if exec.cmd.as_str() == "close" { + self.cx.manager.active_mut().preview.reset(|_| true); + self.cx.manager.peek(false); + return self.cx.input.close(exec); + } + else if exec.cmd.as_str() == "escape" { + if self.cx.input.mode() == InputMode::Normal { + self.cx.manager.active_mut().preview.reset(|_| true); + self.cx.manager.peek(false); + } + return self.cx.input.escape(exec); + } + else if exec.cmd.as_str() == "complete" { return if exec.args.is_empty() { self.cx.completion.trigger(exec) } else {