mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 09:25:38 +02:00
Lift line editor construction out of loop (#5041)
Enables the use of some features on reedline - Keeping the line when clearing the screen with `Ctrl-L` - Using the internal cut buffer between lines - Submitting external commands via keybinding and keeping the line Additional effect: Keep the history around and do basic syncs (performance improvement minimal as session changes have to be read and written) Additional change: Give the option to defer writing/rereading the history file to the closing of the session ($config.sync_history_on_enter)
This commit is contained in:
committed by
GitHub
parent
6a6471b04b
commit
0986c61a5d
@ -29,6 +29,7 @@ pub struct Config {
|
||||
pub partial_completions: bool,
|
||||
pub edit_mode: String,
|
||||
pub max_history_size: i64,
|
||||
pub sync_history_on_enter: bool,
|
||||
pub log_level: String,
|
||||
pub menu_config: HashMap<String, Value>,
|
||||
pub keybindings: Vec<ParsedKeybinding>,
|
||||
@ -54,6 +55,7 @@ impl Default for Config {
|
||||
partial_completions: true,
|
||||
edit_mode: "emacs".into(),
|
||||
max_history_size: 1000,
|
||||
sync_history_on_enter: true,
|
||||
log_level: String::new(),
|
||||
menu_config: HashMap::new(),
|
||||
history_config: HashMap::new(),
|
||||
@ -199,6 +201,13 @@ impl Value {
|
||||
eprintln!("$config.max_history_size is not an integer")
|
||||
}
|
||||
}
|
||||
"sync_history_on_enter" => {
|
||||
if let Ok(b) = value.as_bool() {
|
||||
config.sync_history_on_enter = b;
|
||||
} else {
|
||||
eprintln!("$config.sync_history_on_enter is not a bool")
|
||||
}
|
||||
}
|
||||
"log_level" => {
|
||||
if let Ok(v) = value.as_string() {
|
||||
config.log_level = v.to_lowercase();
|
||||
|
Reference in New Issue
Block a user