Trait Highlighter
trait Highlighter
Syntax highlighter with ANSI color.
Currently, the highlighted version must have the same display width as the original input.
Provided Methods
fn highlight<'l>(self: &Self, line: &'l str, pos: usize) -> Cow<'l, str>Takes the currently edited
linewith the cursorposition and returns the highlighted version (with ANSI color).For example, you can implement blink-matching-paren.
fn highlight_prompt<'b, 's: 'b, 'p: 'b>(self: &'s Self, prompt: &'p str, default: bool) -> Cow<'b, str>Takes the
promptand returns the highlighted version (with ANSI color).fn highlight_hint<'h>(self: &Self, hint: &'h str) -> Cow<'h, str>Takes the
hintand returns the highlighted version (with ANSI color).fn highlight_candidate<'c>(self: &Self, candidate: &'c str, completion: CompletionType) -> Cow<'c, str>Takes the completion
candidateand returns the highlighted version (with ANSI color).Currently, used only with
CompletionType::List.fn highlight_char(self: &Self, line: &str, pos: usize, kind: CmdKind) -> boolTells if
lineneeds 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.
Implementors
impl Highlighter for ()impl Highlighter for MatchingBracketHighlighter