From 83d00ac3079a4658e1089521f889a78ea2b8865b Mon Sep 17 00:00:00 2001 From: sxyazi Date: Thu, 23 Nov 2023 21:06:03 +0800 Subject: [PATCH] .. --- yazi-config/src/open/opener.rs | 4 ++-- yazi-core/src/help/help.rs | 3 --- yazi-core/src/manager/commands/create.rs | 1 - yazi-core/src/tasks/commands/toggle.rs | 2 -- yazi-core/src/which/which.rs | 15 ++++----------- yazi-fm/src/app.rs | 5 ++++- 6 files changed, 10 insertions(+), 20 deletions(-) diff --git a/yazi-config/src/open/opener.rs b/yazi-config/src/open/opener.rs index 456f1180..c3cb9a29 100644 --- a/yazi-config/src/open/opener.rs +++ b/yazi-config/src/open/opener.rs @@ -41,9 +41,9 @@ impl<'de> Deserialize<'de> for Opener { #[serde(rename = "for")] for_: Option, - // TODO: remove this when v1.0.5 is released -- + // TODO: remove this when v0.1.6 is released -- display_name: Option, - // TODO: -- remove this when v1.0.5 is released + // TODO: -- remove this when v0.1.6 is released } let mut shadow = Shadow::deserialize(deserializer)?; diff --git a/yazi-core/src/help/help.rs b/yazi-core/src/help/help.rs index 94e9734f..4da65c18 100644 --- a/yazi-core/src/help/help.rs +++ b/yazi-core/src/help/help.rs @@ -34,9 +34,6 @@ impl Help { self.offset = 0; self.cursor = 0; - - // TODO: Peek - // emit!(Peek); // Show/hide preview for images true } diff --git a/yazi-core/src/manager/commands/create.rs b/yazi-core/src/manager/commands/create.rs index cea6fce1..64fbad46 100644 --- a/yazi-core/src/manager/commands/create.rs +++ b/yazi-core/src/manager/commands/create.rs @@ -44,7 +44,6 @@ impl Manager { if let Ok(f) = File::from(child.clone()).await { emit!(Files(FilesOp::Creating(cwd, f.into_map()))); Manager::_hover(Some(child)); - Manager::_refresh(); } Ok::<(), anyhow::Error>(()) }); diff --git a/yazi-core/src/tasks/commands/toggle.rs b/yazi-core/src/tasks/commands/toggle.rs index 730c1c75..ad7a4cda 100644 --- a/yazi-core/src/tasks/commands/toggle.rs +++ b/yazi-core/src/tasks/commands/toggle.rs @@ -14,8 +14,6 @@ impl From<()> for Opt { impl Tasks { pub fn toggle(&mut self, _: impl Into) -> bool { self.visible = !self.visible; - // TODO: Peek - // emit!(Peek); // Show/hide preview for images true } } diff --git a/yazi-core/src/which/which.rs b/yazi-core/src/which/which.rs index a34def36..ab7c7dbd 100644 --- a/yazi-core/src/which/which.rs +++ b/yazi-core/src/which/which.rs @@ -24,7 +24,7 @@ impl Which { self.times = 1; self.cands = KEYMAP.get(layer).iter().filter(|s| s.on.len() > 1 && &s.on[0] == key).cloned().collect(); - self.switch(true); + self.visible = true; true } @@ -35,23 +35,16 @@ impl Which { .collect(); if self.cands.is_empty() { - self.switch(false); + self.visible = false; } else if self.cands.len() == 1 { - self.switch(false); + self.visible = false; emit!(Call(self.cands[0].to_call(), self.layer)); } else if let Some(i) = self.cands.iter().position(|c| c.on.len() == self.times + 1) { - self.switch(false); + self.visible = false; emit!(Call(self.cands[i].to_call(), self.layer)); } self.times += 1; true } - - #[inline] - fn switch(&mut self, state: bool) { - self.visible = state; - // TODO: Peek - // emit!(Peek); // Show/hide preview for images - } } diff --git a/yazi-fm/src/app.rs b/yazi-fm/src/app.rs index 42fa51a1..64481935 100644 --- a/yazi-fm/src/app.rs +++ b/yazi-fm/src/app.rs @@ -86,6 +86,10 @@ impl App { yazi_plugin::scope(&self.cx, |_| { f.render_widget(Root::new(&self.cx), f.size()); }); + + if let Some((x, y)) = self.cx.cursor() { + f.set_cursor(x, y); + } })?; if !COLLISION.load(Ordering::Relaxed) { return Ok(()); @@ -106,7 +110,6 @@ impl App { term.show_cursor()?; term.set_cursor(x, y)?; } - term.backend_mut().flush()?; Ok(()) }