Trait rustyline::highlight::Highlighter [−][src]
Syntax highlighter with ANSI color. Rustyline will try to handle escape sequence for ANSI color on windows when not supported natively (windows <10).
Currently, the highlighted version must have the same display width as the original input.
Provided methods
fn highlight<'l>(&self, line: &'l str, pos: usize) -> Cow<'l, str>[src]
Takes the currently edited line with the cursor position and
returns the highlighted version (with ANSI color).
For example, you can implement blink-matching-paren.
fn highlight_prompt<'b, 's: 'b, 'p: 'b>(
&'s self,
prompt: &'p str,
default: bool
) -> Cow<'b, str>[src]
&'s self,
prompt: &'p str,
default: bool
) -> Cow<'b, str>
Takes the prompt and
returns the highlighted version (with ANSI color).
fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str>[src]
Takes the hint and
returns the highlighted version (with ANSI color).
fn highlight_candidate<'c>(
&self,
candidate: &'c str,
completion: CompletionType
) -> Cow<'c, str>[src]
&self,
candidate: &'c str,
completion: CompletionType
) -> Cow<'c, str>
Takes the completion candidate and
returns the highlighted version (with ANSI color).
Currently, used only with CompletionType::List.
fn highlight_char(&self, line: &str, pos: usize) -> bool[src]
Tells if line needs to be highlighted when a specific char is typed or
when cursor is moved under a specific char.
Used to optimize refresh when a character is inserted or the cursor is moved.
Implementations on Foreign Types
impl Highlighter for ()[src]
impl<'r, H: ?Sized + Highlighter> Highlighter for &'r H[src]
fn highlight<'l>(&self, line: &'l str, pos: usize) -> Cow<'l, str>[src]
fn highlight_prompt<'b, 's: 'b, 'p: 'b>(
&'s self,
prompt: &'p str,
default: bool
) -> Cow<'b, str>[src]
&'s self,
prompt: &'p str,
default: bool
) -> Cow<'b, str>
fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str>[src]
fn highlight_candidate<'c>(
&self,
candidate: &'c str,
completion: CompletionType
) -> Cow<'c, str>[src]
&self,
candidate: &'c str,
completion: CompletionType
) -> Cow<'c, str>