diff --git a/crates/nu-command/src/platform/clear.rs b/crates/nu-command/src/platform/clear.rs index b47db161c6..21e3a3054c 100644 --- a/crates/nu-command/src/platform/clear.rs +++ b/crates/nu-command/src/platform/clear.rs @@ -41,14 +41,21 @@ impl Command for Clear { call: &Call, _input: PipelineData, ) -> Result { - let clear_type: ClearType = match call.has_flag(engine_state, stack, "keep-scrollback")? { - true => ClearType::All, - _ => ClearType::Purge, + match call.has_flag(engine_state, stack, "keep-scrollback")? { + true => { + std::io::stdout() + .queue(MoveTo(0, 0))? + .queue(ClearCommand(ClearType::All))? + .flush()?; + } + _ => { + std::io::stdout() + .queue(MoveTo(0, 0))? + .queue(ClearCommand(ClearType::All))? + .queue(ClearCommand(ClearType::Purge))? + .flush()?; + } }; - std::io::stdout() - .queue(ClearCommand(clear_type))? - .queue(MoveTo(0, 0))? - .flush()?; Ok(PipelineData::Empty) }