mirror of
https://github.com/nushell/nushell
synced 2024-11-10 07:04:13 +00:00
fixed show_hints
option to allow hints to be turned off (#3780)
This commit is contained in:
parent
37612345f2
commit
2864eaebae
2 changed files with 5 additions and 2 deletions
|
@ -247,7 +247,7 @@ pub fn rustyline_hinter(
|
|||
) -> Option<rustyline::hint::HistoryHinter> {
|
||||
if let Some(line_editor_vars) = config.var("line_editor") {
|
||||
for (idx, value) in line_editor_vars.row_entries() {
|
||||
if idx == "show_hints" && value.expect_string() == "false" {
|
||||
if idx == "show_hints" && value.as_bool() == Ok(false) {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,10 @@ impl rustyline::completion::Completer for Helper {
|
|||
impl rustyline::hint::Hinter for Helper {
|
||||
type Hint = String;
|
||||
fn hint(&self, line: &str, pos: usize, ctx: &rustyline::Context<'_>) -> Option<String> {
|
||||
self.hinter.as_ref().and_then(|h| h.hint(line, pos, ctx))
|
||||
match &self.hinter {
|
||||
Some(the_hinter) => the_hinter.hint(line, pos, ctx),
|
||||
None => Some("".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue