forked from extern/nushell
Before storing an entry into the history nushell will check if the entry consists only of whitespaces and if so, it does not store it in the history and this avoids newline repetition when user is navigating in the history.
This commit is contained in:
@ -319,7 +319,7 @@ pub fn cli(context: EvaluationContext, options: Options) -> Result<(), Box<dyn E
|
|||||||
|
|
||||||
match line {
|
match line {
|
||||||
LineResult::Success(line) => {
|
LineResult::Success(line) => {
|
||||||
if options.save_history {
|
if options.save_history && !line.trim().is_empty() {
|
||||||
rl.add_history_entry(&line);
|
rl.add_history_entry(&line);
|
||||||
let _ = rl.save_history(&history_path);
|
let _ = rl.save_history(&history_path);
|
||||||
}
|
}
|
||||||
@ -334,7 +334,7 @@ pub fn cli(context: EvaluationContext, options: Options) -> Result<(), Box<dyn E
|
|||||||
}
|
}
|
||||||
|
|
||||||
LineResult::Error(line, err) => {
|
LineResult::Error(line, err) => {
|
||||||
if options.save_history {
|
if options.save_history && !line.trim().is_empty() {
|
||||||
rl.add_history_entry(&line);
|
rl.add_history_entry(&line);
|
||||||
let _ = rl.save_history(&history_path);
|
let _ = rl.save_history(&history_path);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user