mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 04:18:31 +02:00
Updated rustyline to 6.0.0. Added completion_mode config (#1289)
* Updated rustyline to 6.0.0. Added completion_mode config * Formatted completion_mode config
This commit is contained in:
committed by
Jonathan Turner
parent
af51a0e6f0
commit
f8be1becf2
15
src/cli.rs
15
src/cli.rs
@ -18,8 +18,8 @@ use nu_protocol::{Signature, UntaggedValue, Value};
|
||||
use log::{debug, log_enabled, trace};
|
||||
use rustyline::error::ReadlineError;
|
||||
use rustyline::{
|
||||
self, config::Configurer, config::EditMode, At, Cmd, ColorMode, Config, Editor, KeyPress,
|
||||
Movement, Word,
|
||||
self, config::Configurer, config::EditMode, At, Cmd, ColorMode, CompletionType, Config, Editor,
|
||||
KeyPress, Movement, Word,
|
||||
};
|
||||
use std::error::Error;
|
||||
use std::io::{BufRead, BufReader, Write};
|
||||
@ -419,6 +419,17 @@ pub async fn cli() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
rl.set_edit_mode(edit_mode);
|
||||
|
||||
let completion_mode = config::config(Tag::unknown())?
|
||||
.get("completion_mode")
|
||||
.map(|s| match s.value.expect_string() {
|
||||
"list" => CompletionType::List,
|
||||
"circular" => CompletionType::Circular,
|
||||
_ => CompletionType::Circular,
|
||||
})
|
||||
.unwrap_or(CompletionType::Circular);
|
||||
|
||||
rl.set_completion_type(completion_mode);
|
||||
|
||||
let colored_prompt = {
|
||||
#[cfg(feature = "starship-prompt")]
|
||||
{
|
||||
|
@ -204,3 +204,7 @@ impl Painter {
|
||||
}
|
||||
|
||||
impl rustyline::Helper for Helper {}
|
||||
|
||||
// Use default validator for normal single line behaviour
|
||||
// In the future we can implement this for custom multi-line support
|
||||
impl rustyline::validate::Validator for Helper {}
|
||||
|
Reference in New Issue
Block a user