diff --git a/yazi-core/src/completion/completion.rs b/yazi-core/src/completion/completion.rs index 6b547399..4b41f2dc 100644 --- a/yazi-core/src/completion/completion.rs +++ b/yazi-core/src/completion/completion.rs @@ -16,7 +16,7 @@ pub struct Completion { impl Completion { pub fn show(&mut self, opt: CompletionOpt) { - self.close(); + self.close(false); self.items = opt.items; self.identifier = format!( @@ -34,7 +34,7 @@ impl Completion { self.max_width = opt.max_width; } - pub fn close(&mut self) -> bool { + pub fn close(&mut self, submit: bool) -> bool { self.cursor = 0; self.identifier = String::new(); diff --git a/yazi-core/src/input/input.rs b/yazi-core/src/input/input.rs index 4ad4847c..649218a2 100644 --- a/yazi-core/src/input/input.rs +++ b/yazi-core/src/input/input.rs @@ -11,8 +11,8 @@ use crate::{external, Position}; #[derive(Default)] pub struct Input { - pub(super) snaps: InputSnaps, - pub visible: bool, + snaps: InputSnaps, + pub visible: bool, title: String, pub position: Position, diff --git a/yazi-core/src/input/option.rs b/yazi-core/src/input/option.rs index 6c380c9a..7424df87 100644 --- a/yazi-core/src/input/option.rs +++ b/yazi-core/src/input/option.rs @@ -15,10 +15,7 @@ impl InputOpt { Self { title: title.as_ref().to_owned(), value: String::new(), - position: Position::Top( - // TODO: hardcode - Rect { x: 0, y: 2, width: 50, height: 3 }, - ), + position: Position::Top(/* TODO: hardcode */ Rect { x: 0, y: 2, width: 50, height: 3 }), realtime: false, highlight: false, } diff --git a/yazi-fm/src/completion/mod.rs b/yazi-fm/src/completion/mod.rs index d222e39f..3084e503 100644 --- a/yazi-fm/src/completion/mod.rs +++ b/yazi-fm/src/completion/mod.rs @@ -1,2 +1,3 @@ mod completion; + pub(super) use completion::*; diff --git a/yazi-fm/src/executor.rs b/yazi-fm/src/executor.rs index a4722b03..6be2f567 100644 --- a/yazi-fm/src/executor.rs +++ b/yazi-fm/src/executor.rs @@ -281,7 +281,7 @@ impl Executor { fn completion(cx: &mut Ctx, exec: &Exec) -> bool { match exec.cmd.as_str() { - "close" => cx.completion.close(), + "close" => cx.completion.close(exec.named.contains_key("submit")), "arrow" => { let step: isize = exec.args.get(0).and_then(|s| s.parse().ok()).unwrap_or(0); @@ -292,6 +292,7 @@ impl Executor { } } + "help" => cx.help.toggle(cx.layer()), _ => false, } }