Skip to content

Commit

Permalink
cli: set LESS=FRX when running $PAGER
Browse files Browse the repository at this point in the history
  • Loading branch information
ddevault committed Nov 11, 2024
1 parent 6739dcc commit 180fa98
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cli/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ impl UiOutput {
fn new_paged(pager_cmd: &CommandNameAndArgs) -> io::Result<UiOutput> {
let mut cmd = pager_cmd.to_command();
tracing::info!(?cmd, "spawning pager");
let mut child = cmd.stdin(Stdio::piped()).spawn()?;
// LESS=FRX causes escape sequences to render correctly when PAGER=less
// It's harmless when using other pagers
let mut child = cmd
.env("LESS", "FRX")
.stdin(Stdio::piped()).spawn()?;
let child_stdin = child.stdin.take().unwrap();
Ok(UiOutput::Paged { child, child_stdin })
}
Expand Down

0 comments on commit 180fa98

Please sign in to comment.