partial completions (#4704)

This commit is contained in:
Fernando Herrera 2022-03-03 09:13:44 +00:00 committed by GitHub
parent d90b7953dd
commit 2fd42d25b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 1 deletions

2
Cargo.lock generated
View File

@ -3392,7 +3392,7 @@ dependencies = [
[[package]]
name = "reedline"
version = "0.2.0"
source = "git+https://github.com/nushell/reedline?branch=main#3d933d52cee44b889b2d92b9688e071a8e4b992d"
source = "git+https://github.com/nushell/reedline?branch=main#e9c1e37d7cd0d301362b2b900a85dcaf3de05d53"
dependencies = [
"chrono",
"crossterm",

View File

@ -26,6 +26,7 @@ pub struct Config {
pub filesize_format: String,
pub use_ansi_coloring: bool,
pub quick_completions: bool,
pub partial_completions: bool,
pub edit_mode: String,
pub max_history_size: i64,
pub log_level: String,
@ -49,6 +50,7 @@ impl Default for Config {
filesize_format: "auto".into(),
use_ansi_coloring: true,
quick_completions: true,
partial_completions: true,
edit_mode: "emacs".into(),
max_history_size: 1000,
log_level: String::new(),
@ -160,6 +162,13 @@ impl Value {
eprintln!("$config.quick_completions is not a bool")
}
}
"partial_completions" => {
if let Ok(b) = value.as_bool() {
config.partial_completions = b;
} else {
eprintln!("$config.partial_completions is not a bool")
}
}
"rm_always_trash" => {
if let Ok(b) = value.as_bool() {
config.rm_always_trash = b;

View File

@ -170,6 +170,7 @@ let $config = {
use_grid_icons: true
footer_mode: "25" # always, never, number_of_rows, auto
quick_completions: true # set this to false to prevent auto-selecting completions when only one remains
partial_completions: true # set this to false to prevent partial filling of the prompt
animate_prompt: false # redraw the prompt every second
float_precision: 2
use_ansi_coloring: true

View File

@ -147,6 +147,7 @@ pub(crate) fn evaluate(
stack.vars.get(&CONFIG_VARIABLE_ID).cloned(),
)))
.with_quick_completions(config.quick_completions)
.with_partial_completions(config.partial_completions)
.with_ansi_colors(config.use_ansi_coloring);
if is_perf_true() {