WIP [no ci]

This commit is contained in:
sxyazi 2023-11-01 18:30:31 +08:00
parent 802aa86e23
commit b749972908
No known key found for this signature in database
5 changed files with 8 additions and 9 deletions

View file

@ -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();

View file

@ -11,7 +11,7 @@ use crate::{external, Position};
#[derive(Default)]
pub struct Input {
pub(super) snaps: InputSnaps,
snaps: InputSnaps,
pub visible: bool,
title: String,

View file

@ -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,
}

View file

@ -1,2 +1,3 @@
mod completion;
pub(super) use completion::*;

View file

@ -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,
}
}