diff --git a/cli/src/ui.rs b/cli/src/ui.rs index b57bf4d904..12e6c61588 100644 --- a/cli/src/ui.rs +++ b/cli/src/ui.rs @@ -132,6 +132,11 @@ impl UiOutput { fn new_paged(pager_cmd: &CommandNameAndArgs) -> io::Result { let mut cmd = pager_cmd.to_command(); tracing::info!(?cmd, "spawning pager"); + if env::var_os("LESS").is_none() { + // LESS=FRX causes escape sequences to render correctly when PAGER=less. + // It's harmless when using other pagers + cmd.env("LESS", "FRX"); + }; let mut child = cmd.stdin(Stdio::piped()).spawn()?; let child_stdin = child.stdin.take().unwrap(); Ok(UiOutput::Paged { child, child_stdin })