cli: add config option for built-in pager's ruler

This commit is contained in:
Sam 2025-04-17 18:29:18 -07:00
parent 6e5f0297e2
commit 001801a3b1
5 changed files with 21 additions and 0 deletions

View File

@ -55,6 +55,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* `jj absorb` can now squash a deleted file if it was added by one of the
destination revisions.
* Added `ui.streampager.show-ruler` setting to configure whether the ruler should be
shown when the builtin pager starts up.
### Fixed bugs
* Fixed crash on change-delete conflict resolution.

View File

@ -141,6 +141,11 @@
"none"
],
"default": "anywhere"
},
"show-ruler": {
"type": "boolean",
"description": "Whether the ruler should start visible",
"default": true
}
}
},

View File

@ -43,6 +43,7 @@ edit = false
[ui.streampager]
interface = "quit-if-one-page"
wrapping = "anywhere"
show-ruler = true
[snapshot]
max-new-file-size = "1MiB"

View File

@ -83,6 +83,7 @@ impl UiOutput {
let streampager_config = streampager::config::Config {
wrapping_mode: config.wrapping.into(),
interface_mode: config.streampager_interface_mode(),
show_ruler: config.show_ruler,
// We could make scroll-past-eof configurable, but I'm guessing people
// will not miss it. If we do make it configurable, we should mention
// that it's a bad idea to turn this on if `interface=quit-if-one-page`,
@ -297,6 +298,7 @@ impl From<StreampagerWrappingMode> for streampager::config::WrappingMode {
struct StreampagerConfig {
interface: StreampagerAlternateScreenMode,
wrapping: StreampagerWrappingMode,
show_ruler: bool,
// TODO: Add an `quit-quickly-delay-seconds` floating point option or a
// `quit-quickly-delay` option that takes a 's' or 'ms' suffix. Note that as
// of this writing, floating point numbers do not work with `--config`

View File

@ -763,6 +763,16 @@ interface = "full-screen-clear-output"
interface = "quit-quickly-or-clear-output"
```
#### Showing the ruler on startup
```toml
[ui.streampager]
# Start with the ruler showing
show-ruler = true # (default)
# Start with the ruler hidden
show-ruler = false
```
### Processing contents to be paged