diff --git a/helix-term/src/ui/explorer.rs b/helix-term/src/ui/explorer.rs index 22020c91..5563d1c0 100644 --- a/helix-term/src/ui/explorer.rs +++ b/helix-term/src/ui/explorer.rs @@ -722,12 +722,17 @@ impl Component for Explorer { } fn cursor(&self, area: Rect, editor: &Editor) -> (Option, CursorKind) { - let prompt = match self.prompt.as_ref() { - Some((_, prompt)) => prompt, - None => return (None, CursorKind::Hidden), - }; - let (x, y) = (area.x, area.y + area.height.saturating_sub(1)); - prompt.cursor(Rect::new(x, y, area.width, 1), editor) + if let Some(prompt) = self + .prompt + .as_ref() + .map(|(_, prompt)| prompt) + .or_else(|| self.tree.prompt()) + { + let (x, y) = (area.x, area.y + area.height.saturating_sub(1)); + prompt.cursor(Rect::new(x, y, area.width, 1), editor) + } else { + (None, CursorKind::Hidden) + } } } diff --git a/helix-term/src/ui/tree.rs b/helix-term/src/ui/tree.rs index 516e9459..7199570e 100644 --- a/helix-term/src/ui/tree.rs +++ b/helix-term/src/ui/tree.rs @@ -477,6 +477,14 @@ impl TreeView { Ok(()) } } + + pub fn prompt(&self) -> Option<&Prompt> { + if let Some((_, prompt)) = self.search_prompt.as_ref() { + Some(prompt) + } else { + None + } + } } pub fn tree_view_help() -> Vec<(&'static str, &'static str)> {