diff options
| author | sigoden <sigoden@gmail.com> | 2023-11-27 15:39:55 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-27 15:39:55 +0800 |
| commit | 2508d56598a37844e369ab623ceb5bc7b2c78d38 (patch) | |
| tree | 744986163dcfe09aade1ef61ef63ad21279666cc /src/repl/highlighter.rs | |
| parent | 25e545474fcbd69dfb2a283981178491717cc6b5 (diff) | |
| download | aichat-2508d56598a37844e369ab623ceb5bc7b2c78d38.tar.gz | |
feat: state-aware completer (#251)
Diffstat (limited to 'src/repl/highlighter.rs')
| -rw-r--r-- | src/repl/highlighter.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/repl/highlighter.rs b/src/repl/highlighter.rs index 7d3c197..65cb1cc 100644 --- a/src/repl/highlighter.rs +++ b/src/repl/highlighter.rs @@ -28,11 +28,11 @@ impl Highlighter for ReplHighlighter { let mut styled_text = StyledText::new(); - if REPL_COMMANDS.iter().any(|(cmd, _)| line.contains(cmd)) { + if REPL_COMMANDS.iter().any(|cmd| line.contains(cmd.name)) { let matches: Vec<&str> = REPL_COMMANDS .iter() - .filter(|(cmd, _)| line.contains(*cmd)) - .map(|(cmd, _)| *cmd) + .filter(|cmd| line.contains(cmd.name)) + .map(|cmd| cmd.name) .collect(); let longest_match = matches.iter().fold(String::new(), |acc, &item| { if item.len() > acc.len() { |
