From afda68a11d68d260a3864b32181686b7d2d5ebbd Mon Sep 17 00:00:00 2001 From: wongjiahau Date: Fri, 17 Mar 2023 09:47:40 +0800 Subject: [PATCH] chore: cargo fmt --- helix-term/src/ui/explorer.rs | 8 +++++++- helix-term/src/ui/tree.rs | 27 ++++++++++----------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/helix-term/src/ui/explorer.rs b/helix-term/src/ui/explorer.rs index 37b446cc..5f1bbeb8 100644 --- a/helix-term/src/ui/explorer.rs +++ b/helix-term/src/ui/explorer.rs @@ -423,7 +423,13 @@ impl Explorer { self.render_tree(list_area, area, surface, cx) } - fn render_tree(&mut self, area: Rect, prompt_area: Rect, surface: &mut Surface, cx: &mut Context) { + fn render_tree( + &mut self, + area: Rect, + prompt_area: Rect, + surface: &mut Surface, + cx: &mut Context, + ) { let title_style = cx.editor.theme.get("ui.text"); let title_style = if self.is_focus() { title_style.add_modifier(Modifier::BOLD) diff --git a/helix-term/src/ui/tree.rs b/helix-term/src/ui/tree.rs index fe533c07..516e9459 100644 --- a/helix-term/src/ui/tree.rs +++ b/helix-term/src/ui/tree.rs @@ -172,10 +172,7 @@ impl Tree { } fn get_children(&self) -> Result>> { - Ok(vec_to_tree( - self.item - .get_children()? - )) + Ok(vec_to_tree(self.item.get_children()?)) } fn sort(&mut self) { @@ -455,7 +452,6 @@ impl TreeView { Ok(()) } - fn move_to_first_line(&mut self) { self.move_up(usize::MAX / 2) } @@ -823,11 +819,17 @@ fn render_tree( } impl TreeView { - pub fn render(&mut self, area: Rect, prompt_area: Rect, surface: &mut Surface, cx: &mut Context) { + pub fn render( + &mut self, + area: Rect, + prompt_area: Rect, + surface: &mut Surface, + cx: &mut Context, + ) { let style = cx.editor.theme.get(&self.tree_symbol_style); if let Some((_, prompt)) = self.search_prompt.as_mut() { prompt.render_prompt(prompt_area, surface, cx) - } + } let ancestor_style = { let style = cx.editor.theme.get("ui.selection"); @@ -1152,12 +1154,7 @@ impl TreeView { self.save_view(); self.search_prompt = Some(( direction, - Prompt::new( - "search: ".into(), - None, - ui::completers::none, - |_, _, _| {}, - ), + Prompt::new("search: ".into(), None, ui::completers::none, |_, _, _| {}), )) } @@ -1258,7 +1255,6 @@ mod test_tree_view { Ok(vec![]) } } - } fn dummy_tree_view<'a>() -> TreeView> { @@ -2121,7 +2117,6 @@ krabby_patty ); } - #[test] fn test_jump_backward_forward() { let mut view = dummy_tree_view(); @@ -2250,7 +2245,6 @@ krabby_patty None => Ok(vec![]), } } - } pub fn render(view: &mut TreeView>) -> String { @@ -2520,7 +2514,6 @@ krabby_patty .trim() ); } - } #[cfg(test)]