From 52a26ff72c1922fccb95ac5fadf4485ac12840b7 Mon Sep 17 00:00:00 2001 From: wongjiahau Date: Mon, 13 Feb 2023 16:13:47 +0800 Subject: [PATCH] feat(explore): refresh --- helix-term/src/ui/explore.rs | 5 +++++ helix-term/src/ui/tree.rs | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/helix-term/src/ui/explore.rs b/helix-term/src/ui/explore.rs index d4d3ae69..1f2d31bb 100644 --- a/helix-term/src/ui/explore.rs +++ b/helix-term/src/ui/explore.rs @@ -934,6 +934,11 @@ impl Component for Explorer { key!(']') => self.change_root(cx, self.tree.current_item().path.clone()), key!('d') => self.new_remove_prompt(cx), key!('r') => self.new_rename_prompt(), + shift!('R') => { + if let Err(error) = self.tree.refresh() { + cx.editor.set_error(error.to_string()) + } + } _ => { self.tree .handle_event(Event::Key(key_event), cx, &mut self.state); diff --git a/helix-term/src/ui/tree.rs b/helix-term/src/ui/tree.rs index d8e00741..b0e129f4 100644 --- a/helix-term/src/ui/tree.rs +++ b/helix-term/src/ui/tree.rs @@ -478,6 +478,10 @@ impl TreeView { Ok(()) } } + + pub fn refresh(&mut self) -> Result<()> { + self.tree.refresh() + } } impl TreeView {