1use std::borrow::Cow;
7
8use reedline::{Color, Prompt, PromptEditMode, PromptHistorySearch, PromptHistorySearchStatus};
9
10pub struct RPrompt;
11
12impl Prompt for RPrompt {
13 fn render_prompt_left(&self) -> Cow<'_, str> {
14 Cow::Borrowed("")
15 }
16
17 fn render_prompt_right(&self) -> Cow<'_, str> {
18 Cow::Borrowed("")
19 }
20
21 fn render_prompt_indicator(&self, _prompt_mode: PromptEditMode) -> Cow<'_, str> {
22 Cow::Borrowed("> ")
23 }
24
25 fn render_prompt_multiline_indicator(&self) -> Cow<'_, str> {
26 Cow::Borrowed("+ ")
27 }
28
29 fn render_prompt_history_search_indicator(
30 &self,
31 history_search: PromptHistorySearch,
32 ) -> Cow<'_, str> {
33 let prefix = match history_search.status {
34 PromptHistorySearchStatus::Passing => "",
35 PromptHistorySearchStatus::Failing => "failing ",
36 };
37 Cow::Owned(format!(
38 "({}reverse-search: {}) ",
39 prefix, history_search.term
40 ))
41 }
42
43 fn get_prompt_color(&self) -> Color {
44 Color::Reset
45 }
46
47 fn get_indicator_color(&self) -> Color {
48 Color::Reset
49 }
50
51 fn get_prompt_multiline_color(&self) -> nu_ansi_term::Color {
52 nu_ansi_term::Color::Default
53 }
54}