mirror of
https://github.com/nushell/nushell.git
synced 2025-04-11 06:48:31 +02:00
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:
parent
a7274115d0
commit
111ad868a7
@ -319,7 +319,7 @@ pub fn cli(context: EvaluationContext, options: Options) -> Result<(), Box<dyn E
|
||||
|
||||
match line {
|
||||
LineResult::Success(line) => {
|
||||
if options.save_history {
|
||||
if options.save_history && !line.trim().is_empty() {
|
||||
rl.add_history_entry(&line);
|
||||
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) => {
|
||||
if options.save_history {
|
||||
if options.save_history && !line.trim().is_empty() {
|
||||
rl.add_history_entry(&line);
|
||||
let _ = rl.save_history(&history_path);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user