aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaximilian Bosch <[email protected]>2021-12-26 14:22:57 +0000
committerMaximilian Bosch <[email protected]>2021-12-30 17:06:49 +0000
commit4fd3ec330a89e4177099c21277d3c12e97ca0c21 (patch)
treea7cf2cb469b8d7b1285910af61472b1ea2bd05a8 /src
parentcb3e69df8b17ffc0cab721e2dcc285731a1c5bc9 (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.rs7
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;
7use rustyline::highlight::Highlighter; 7use rustyline::highlight::Highlighter;
8use rustyline::hint::{Hinter, HistoryHinter}; 8use rustyline::hint::{Hinter, HistoryHinter};
9use rustyline::{Context, Editor, Helper}; 9use rustyline::{Context, Editor, Helper};
10use rustyline::validate::Validator;
10 11
11use directories::ProjectDirs; 12use directories::ProjectDirs;
12 13
@@ -75,6 +76,7 @@ impl Highlighter for LineHighlighter {
75} 76}
76 77
77impl Highlighter for RLHelper { 78impl 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
98impl Hinter for RLHelper { 100impl 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
107impl Validator for RLHelper {}
108
104impl Helper for RLHelper {} 109impl Helper for RLHelper {}
105 110
106pub fn create_readline() -> Editor<RLHelper> { 111pub fn create_readline() -> Editor<RLHelper> {