feat(explore): refresh

pull/9/head
wongjiahau 2 years ago
parent 5a5a1de4b8
commit 52a26ff72c

@ -934,6 +934,11 @@ impl Component for Explorer {
key!(']') => self.change_root(cx, self.tree.current_item().path.clone()), key!(']') => self.change_root(cx, self.tree.current_item().path.clone()),
key!('d') => self.new_remove_prompt(cx), key!('d') => self.new_remove_prompt(cx),
key!('r') => self.new_rename_prompt(), key!('r') => self.new_rename_prompt(),
shift!('R') => {
if let Err(error) = self.tree.refresh() {
cx.editor.set_error(error.to_string())
}
}
_ => { _ => {
self.tree self.tree
.handle_event(Event::Key(key_event), cx, &mut self.state); .handle_event(Event::Key(key_event), cx, &mut self.state);

@ -478,6 +478,10 @@ impl<T: TreeItem> TreeView<T> {
Ok(()) Ok(())
} }
} }
pub fn refresh(&mut self) -> Result<()> {
self.tree.refresh()
}
} }
impl<T: TreeItem> TreeView<T> { impl<T: TreeItem> TreeView<T> {

Loading…
Cancel
Save