diff options
author | Maximilian Bosch <[email protected]> | 2021-12-26 14:22:57 +0000 |
---|---|---|
committer | Maximilian Bosch <[email protected]> | 2021-12-30 17:06:49 +0000 |
commit | 4fd3ec330a89e4177099c21277d3c12e97ca0c21 (patch) | |
tree | a7cf2cb469b8d7b1285910af61472b1ea2bd05a8 /src | |
parent | cb3e69df8b17ffc0cab721e2dcc285731a1c5bc9 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/readline.rs | 7 |
1 files changed, 6 insertions, 1 deletions
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; | |||
7 | use rustyline::highlight::Highlighter; | 7 | use rustyline::highlight::Highlighter; |
8 | use rustyline::hint::{Hinter, HistoryHinter}; | 8 | use rustyline::hint::{Hinter, HistoryHinter}; |
9 | use rustyline::{Context, Editor, Helper}; | 9 | use rustyline::{Context, Editor, Helper}; |
10 | use rustyline::validate::Validator; | ||
10 | 11 | ||
11 | use directories::ProjectDirs; | 12 | use directories::ProjectDirs; |
12 | 13 | ||
@@ -75,6 +76,7 @@ impl Highlighter for LineHighlighter { | |||
75 | } | 76 | } |
76 | 77 | ||
77 | impl Highlighter for RLHelper { | 78 | impl Highlighter for RLHelper { |
79 | fn highlight_char(&self, _: &str, _: usize) -> bool { true } | ||
78 | fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str> { | 80 | fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str> { |
79 | self.highlighter.highlight_hint(hint) | 81 | self.highlighter.highlight_hint(hint) |
80 | } | 82 | } |
@@ -96,11 +98,14 @@ impl Completer for RLHelper { | |||
96 | } | 98 | } |
97 | 99 | ||
98 | impl Hinter for RLHelper { | 100 | impl Hinter for RLHelper { |
99 | fn hint(&self, line: &str, a: usize, b: &Context) -> Option<String> { | 101 | type Hint = String; |
102 | fn hint(&self, line: &str, a: usize, b: &Context) -> Option<Self::Hint> { | ||
100 | self.hinter.hint(line, a, b) | 103 | self.hinter.hint(line, a, b) |
101 | } | 104 | } |
102 | } | 105 | } |
103 | 106 | ||
107 | impl Validator for RLHelper {} | ||
108 | |||
104 | impl Helper for RLHelper {} | 109 | impl Helper for RLHelper {} |
105 | 110 | ||
106 | pub fn create_readline() -> Editor<RLHelper> { | 111 | pub fn create_readline() -> Editor<RLHelper> { |