pub trait Prompt: Send {
// Required methods
fn render_prompt_left(&self) -> Cow<'_, str>;
fn render_prompt_right(&self) -> Cow<'_, str>;
fn render_prompt_indicator(
&self,
prompt_mode: PromptEditMode
) -> Cow<'_, str>;
fn render_prompt_multiline_indicator(&self) -> Cow<'_, str>;
fn render_prompt_history_search_indicator(
&self,
history_search: PromptHistorySearch
) -> Cow<'_, str>;
// Provided methods
fn get_prompt_color(&self) -> Color { ... }
fn get_prompt_multiline_color(&self) -> Color { ... }
fn get_indicator_color(&self) -> Color { ... }
fn get_prompt_right_color(&self) -> Color { ... }
fn right_prompt_on_last_line(&self) -> bool { ... }
}
Expand description
API to provide a custom prompt.
Implementors have to provide str
-based content which will be
displayed before the LineBuffer
is drawn.
Required Methods§
sourcefn render_prompt_left(&self) -> Cow<'_, str>
fn render_prompt_left(&self) -> Cow<'_, str>
Provide content off the right full prompt
sourcefn render_prompt_right(&self) -> Cow<'_, str>
fn render_prompt_right(&self) -> Cow<'_, str>
Provide content off the left full prompt
sourcefn render_prompt_indicator(&self, prompt_mode: PromptEditMode) -> Cow<'_, str>
fn render_prompt_indicator(&self, prompt_mode: PromptEditMode) -> Cow<'_, str>
Render the prompt indicator (Last part of the prompt that changes based on the editor mode)
sourcefn render_prompt_multiline_indicator(&self) -> Cow<'_, str>
fn render_prompt_multiline_indicator(&self) -> Cow<'_, str>
Indicator to show before explicit new lines
sourcefn render_prompt_history_search_indicator(
&self,
history_search: PromptHistorySearch
) -> Cow<'_, str>
fn render_prompt_history_search_indicator( &self, history_search: PromptHistorySearch ) -> Cow<'_, str>
Render the prompt indicator for Ctrl-R
history search
Provided Methods§
sourcefn get_prompt_color(&self) -> Color
fn get_prompt_color(&self) -> Color
Get the default prompt color
sourcefn get_prompt_multiline_color(&self) -> Color
fn get_prompt_multiline_color(&self) -> Color
Get the default multilince prompt color
sourcefn get_indicator_color(&self) -> Color
fn get_indicator_color(&self) -> Color
Get the default indicator color
sourcefn get_prompt_right_color(&self) -> Color
fn get_prompt_right_color(&self) -> Color
Get the default right prompt color
sourcefn right_prompt_on_last_line(&self) -> bool
fn right_prompt_on_last_line(&self) -> bool
Whether to render right prompt on the last line