Skip to content

Commit

Permalink
pager: default to less -FRX
Browse files Browse the repository at this point in the history
As dbarnett@ reported on #9, our default of `less`, combined with our
default of enabling color on TTYs, means that we print ANSI codes to
`less` by default. Unless the user has set e.g. `$LESS=R`, `less` is
going to escape those codes, resulting in garbage like this:

```
@ ESC[1;35mbb39c26a29feESC[0m ESC[1;33m(no email configured)ESC[0m ESC[1;36m2022-12-03....
```

I guess most of us didn't notice because we have something like
`$LESS=FRX` set.

This patch changes our default from `less` to `less -FRX`. Those are
the flags we're using for our internal hg distribution at Google, and
that has seemed quite uncontroversial.

I added a pointer from the changelog to the tracking issue while at
it.
  • Loading branch information
martinvonz committed Dec 4, 2022
1 parent be383ce commit c5c89b9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### New features

* Commands with long output are paginated.
[#9](https://github.com/martinvonz/jj/issues/9)

* The new `jj git remote rename` command allows git remotes to be renamed
in-place.
Expand Down
2 changes: 1 addition & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The priority is as follows (environment variables are marked with a `$`):

`ui.pager` > `$PAGER`

`less` is the default pager in the absence of any other setting.
`less -FRX` is the default pager in the absence of any other setting.


## Editor
Expand Down
2 changes: 1 addition & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn pager_setting(settings: &UserSettings) -> FullCommandArgs {
settings
.config()
.get("ui.pager")
.unwrap_or_else(|_| "less".into())
.unwrap_or_else(|_| "less -FRX".into())
}

impl Ui {
Expand Down

0 comments on commit c5c89b9

Please sign in to comment.