mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
WIP [no ci]
This commit is contained in:
parent
802aa86e23
commit
b749972908
5 changed files with 8 additions and 9 deletions
|
|
@ -16,7 +16,7 @@ pub struct Completion {
|
||||||
|
|
||||||
impl Completion {
|
impl Completion {
|
||||||
pub fn show(&mut self, opt: CompletionOpt) {
|
pub fn show(&mut self, opt: CompletionOpt) {
|
||||||
self.close();
|
self.close(false);
|
||||||
self.items = opt.items;
|
self.items = opt.items;
|
||||||
|
|
||||||
self.identifier = format!(
|
self.identifier = format!(
|
||||||
|
|
@ -34,7 +34,7 @@ impl Completion {
|
||||||
self.max_width = opt.max_width;
|
self.max_width = opt.max_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn close(&mut self) -> bool {
|
pub fn close(&mut self, submit: bool) -> bool {
|
||||||
self.cursor = 0;
|
self.cursor = 0;
|
||||||
|
|
||||||
self.identifier = String::new();
|
self.identifier = String::new();
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use crate::{external, Position};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Input {
|
pub struct Input {
|
||||||
pub(super) snaps: InputSnaps,
|
snaps: InputSnaps,
|
||||||
pub visible: bool,
|
pub visible: bool,
|
||||||
|
|
||||||
title: String,
|
title: String,
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,7 @@ impl InputOpt {
|
||||||
Self {
|
Self {
|
||||||
title: title.as_ref().to_owned(),
|
title: title.as_ref().to_owned(),
|
||||||
value: String::new(),
|
value: String::new(),
|
||||||
position: Position::Top(
|
position: Position::Top(/* TODO: hardcode */ Rect { x: 0, y: 2, width: 50, height: 3 }),
|
||||||
// TODO: hardcode
|
|
||||||
Rect { x: 0, y: 2, width: 50, height: 3 },
|
|
||||||
),
|
|
||||||
realtime: false,
|
realtime: false,
|
||||||
highlight: false,
|
highlight: false,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
mod completion;
|
mod completion;
|
||||||
|
|
||||||
pub(super) use completion::*;
|
pub(super) use completion::*;
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,7 @@ impl Executor {
|
||||||
|
|
||||||
fn completion(cx: &mut Ctx, exec: &Exec) -> bool {
|
fn completion(cx: &mut Ctx, exec: &Exec) -> bool {
|
||||||
match exec.cmd.as_str() {
|
match exec.cmd.as_str() {
|
||||||
"close" => cx.completion.close(),
|
"close" => cx.completion.close(exec.named.contains_key("submit")),
|
||||||
|
|
||||||
"arrow" => {
|
"arrow" => {
|
||||||
let step: isize = exec.args.get(0).and_then(|s| s.parse().ok()).unwrap_or(0);
|
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,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue