From 4fd3ec330a89e4177099c21277d3c12e97ca0c21 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 26 Dec 2021 15:22:57 +0100 Subject: Update rustyline to v9 Also refresh line always. This isn't a big deal for the small expressions we have here and also fixes a few annoying issues I had with the highlighter. --- src/readline.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/readline.rs b/src/readline.rs index 2939ee1..f59cd22 100644 --- a/src/readline.rs +++ b/src/readline.rs @@ -7,6 +7,7 @@ use rustyline::error::ReadlineError; use rustyline::highlight::Highlighter; use rustyline::hint::{Hinter, HistoryHinter}; use rustyline::{Context, Editor, Helper}; +use rustyline::validate::Validator; use directories::ProjectDirs; @@ -75,6 +76,7 @@ impl Highlighter for LineHighlighter { } impl Highlighter for RLHelper { + fn highlight_char(&self, _: &str, _: usize) -> bool { true } fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str> { self.highlighter.highlight_hint(hint) } @@ -96,11 +98,14 @@ impl Completer for RLHelper { } impl Hinter for RLHelper { - fn hint(&self, line: &str, a: usize, b: &Context) -> Option { + type Hint = String; + fn hint(&self, line: &str, a: usize, b: &Context) -> Option { self.hinter.hint(line, a, b) } } +impl Validator for RLHelper {} + impl Helper for RLHelper {} pub fn create_readline() -> Editor { -- cgit v1.2.3