diff --git a/examples/input_multiline.rs b/examples/input_multiline.rs index 7dd5b6f5b..ead5e8825 100644 --- a/examples/input_multiline.rs +++ b/examples/input_multiline.rs @@ -1,3 +1,4 @@ +use rustyline::highlight::MatchingBracketHighlighter; use rustyline::validate::MatchingBracketValidator; use rustyline::{Cmd, Editor, EventHandler, KeyCode, KeyEvent, Modifiers, Result}; use rustyline::{Completer, Helper, Highlighter, Hinter, Validator}; @@ -6,11 +7,14 @@ use rustyline::{Completer, Helper, Highlighter, Hinter, Validator}; struct InputValidator { #[rustyline(Validator)] brackets: MatchingBracketValidator, + #[rustyline(Highlighter)] + highlighter: MatchingBracketHighlighter, } fn main() -> Result<()> { let h = InputValidator { brackets: MatchingBracketValidator::new(), + highlighter: MatchingBracketHighlighter::new(), }; let mut rl = Editor::new()?; rl.set_helper(Some(h)); diff --git a/rustyline-derive/src/lib.rs b/rustyline-derive/src/lib.rs index 5f57060a8..c25e6165b 100644 --- a/rustyline-derive/src/lib.rs +++ b/rustyline-derive/src/lib.rs @@ -126,8 +126,8 @@ pub fn highlighter_macro_derive(input: TokenStream) -> TokenStream { ::rustyline::highlight::Highlighter::highlight_candidate(&self.#field_name_or_index, candidate, completion) } - fn highlight_char(&self, line: &str, pos: usize) -> bool { - ::rustyline::highlight::Highlighter::highlight_char(&self.#field_name_or_index, line, pos) + fn highlight_char(&self, line: &str, pos: usize, forced: bool) -> bool { + ::rustyline::highlight::Highlighter::highlight_char(&self.#field_name_or_index, line, pos, forced) } } }