Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch builtin pager to streampager #4203

Merged
merged 5 commits into from
Jan 14, 2025
Merged

Conversation

yuja
Copy link
Contributor

@yuja yuja commented Aug 3, 2024

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

Cargo.toml Outdated Show resolved Hide resolved
@ilyagr
Copy link
Contributor

ilyagr commented Aug 3, 2024

I would really like a version of streampager with its dependencies updated for this (can/should we ask the Facebook people to do it? Should we fork it?). It's annoying to have to link an old version of clap (see the diff in Cargo.toml).

IIRC, streampager's interface seemed a bit annoying in parts by default, so we might want to change its default config (or try it out at least).

Apart from that, I think this might be great!

@yuja
Copy link
Contributor Author

yuja commented Aug 3, 2024

I would really like a version of streampager with its dependencies updated for this

Totally agree, and the stripped-down version exists in Sapling tree. Asked question at markbt/streampager#61

@yuja yuja marked this pull request as draft August 3, 2024 14:30
@yuja yuja force-pushed the push-vwqpwvoxokrt branch from 8cb0ad3 to 193516d Compare August 5, 2024 02:16
@yuja yuja force-pushed the push-vwqpwvoxokrt branch from 193516d to 7ea0283 Compare August 17, 2024 03:25
@yuja yuja force-pushed the push-vwqpwvoxokrt branch 3 times, most recently from 2c07fa0 to b2e8fdf Compare January 12, 2025 08:45
@yuja yuja changed the title RFC: switch builtin pager to streampager switch builtin pager to streampager Jan 12, 2025
@yuja yuja marked this pull request as ready for review January 12, 2025 09:08
@yuja
Copy link
Contributor Author

yuja commented Jan 12, 2025

Updated dependency to sapling-streampager.

@yuja yuja force-pushed the push-vwqpwvoxokrt branch 2 times, most recently from 097b69f to 7bf4644 Compare January 12, 2025 10:59
yuja added 5 commits January 14, 2025 10:00
Perhaps, the "windows" feature was enabled through "minus" or "scm-record". If I
removed "minus" in earlier revision, the Windows build of crossterm 0.27.0
failed.
The WTFPL license is added to the allow list. I've never heard about this
license, but it's basically the same as public domain according to wikipedia.
According to the discussion on Discord, streampager is still maintained.
It brings more dependencies, but seems more reliable in our use case. For
example, the streampager doesn't consume inputs indefinitely whereas minus
does. We can also use OS-level pipe to redirect child stderr to the pager.
@yuja yuja force-pushed the push-vwqpwvoxokrt branch from 7bf4644 to 4a50a11 Compare January 14, 2025 01:00
@yuja yuja enabled auto-merge January 14, 2025 01:04
@yuja yuja added this pull request to the merge queue Jan 14, 2025
Merged via the queue into jj-vcs:main with commit be9483b Jan 14, 2025
19 checks passed
@yuja yuja deleted the push-vwqpwvoxokrt branch January 14, 2025 01:25
cli/src/ui.rs Show resolved Hide resolved
ilyagr added a commit to ilyagr/sapling that referenced this pull request Jan 18, 2025
Currently, there is no way for a calling program (like `sl` or `jj`) to
start streampager without it trying to read
`$CONFIG/streampager/streampager.toml` and the environment variables
`SP_INTERFACE_MODE`, `SP_SCROLL_PAST_EOF`, and `SP_READ_AHEAD_LINES`.
This is undesireable if we'd like to control Streampager's behavior
fully from `jj` config (or `sl` config). Sapling currently overrides
the most important Streampager config from its own config anyway.

I'd like there to be a way to invoke Streampager with a given config.
I carefully implemented it so that no changes to Sapling are required,
though I think it'd also benefit from using the API I introduce here
(and the old UI could be deprecated).

Another, less invasive, possibility would be to simply make
`Pager::config` public. However, this would mean that Streampager
would uselessly read `$CONFIG/streampager/streampager.toml` even
if the config is later fully overriden by `jj`.

As an aside, the docs for the config from
https://github.com/markbt/streampager#example-configuration do not seem
to be fully correct, setting `interface_mode = "delayed"` as described
there did not work for me. However, I'd rather not use that
configuration method at all for my purposes with `jj`.

Cc: jj-vcs/jj#4203 (comment),
@yuja.

As ever, thanks for making it convenient for us to use Streampager in
`jj`! :)
ilyagr added a commit to ilyagr/jj that referenced this pull request Jan 18, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in jj-vcs#4203, I didn't mention this in
the Changelog.

As discussed in jj-vcs#4203 (comment)
ilyagr added a commit to ilyagr/jj that referenced this pull request Jan 18, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in jj-vcs#4203, I didn't mention this in
the Changelog.

As discussed in jj-vcs#4203 (comment)
ilyagr added a commit to ilyagr/jj that referenced this pull request Jan 18, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in jj-vcs#4203, I didn't mention this in
the Changelog.

As discussed in jj-vcs#4203 (comment)
ilyagr added a commit to ilyagr/jj that referenced this pull request Jan 21, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in jj-vcs#4203, I didn't mention this in
the Changelog.

As discussed in jj-vcs#4203 (comment)
ilyagr added a commit that referenced this pull request Jan 21, 2025
…ests?

This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in #4203, I didn't mention this in
the Changelog.

As discussed in #4203 (comment)

I initially kept the config closer to streampager's (see
https://github.com/jj-vcs/jj/compare/main...ilyagr:jj:streamopts?expand=1), but
then decided to make it more generic, smaller, and hopefully easier to
understand.
ilyagr added a commit to ilyagr/jj that referenced this pull request Jan 21, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in jj-vcs#4203, I didn't mention this in
the Changelog.

As discussed in jj-vcs#4203 (comment)
ilyagr added a commit that referenced this pull request Jan 21, 2025
…ests?

This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in #4203, I didn't mention this in
the Changelog.

As discussed in #4203 (comment)

I initially kept the config closer to streampager's (see
https://github.com/jj-vcs/jj/compare/main...ilyagr:jj:streamopts?expand=1), but
then decided to make it more generic, smaller, and hopefully easier to
understand.
ilyagr added a commit that referenced this pull request Jan 21, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in #4203, I didn't mention this in
the Changelog.

As discussed in #4203 (comment)

I initially kept the config closer to streampager's (see
https://github.com/jj-vcs/jj/compare/main...ilyagr:jj:streamopts?expand=1), but
then decided to make it more generic, smaller, and hopefully easier to
understand.
ilyagr added a commit that referenced this pull request Jan 21, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in #4203, I didn't mention this in
the Changelog.

As discussed in #4203 (comment)

I initially kept the config closer to streampager's (see
https://github.com/jj-vcs/jj/compare/main...ilyagr:jj:streamopts?expand=1), but
then decided to make it more generic, smaller, and hopefully easier to
understand.
ilyagr added a commit to ilyagr/jj that referenced this pull request Jan 22, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in jj-vcs#4203, I didn't mention this in
the Changelog.

As discussed in jj-vcs#4203 (comment)
ilyagr added a commit that referenced this pull request Jan 22, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in #4203, I didn't mention this in
the Changelog.

As discussed in #4203 (comment)

I initially kept the config closer to streampager's (see
https://github.com/jj-vcs/jj/compare/main...ilyagr:jj:streamopts?expand=1), but
then decided to make it more generic, smaller, and hopefully easier to
understand.
ilyagr added a commit to ilyagr/jj that referenced this pull request Jan 22, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in jj-vcs#4203, I didn't mention this in
the Changelog.

As discussed in jj-vcs#4203 (comment)
ilyagr added a commit that referenced this pull request Jan 22, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in #4203, I didn't mention this in
the Changelog.

As discussed in #4203 (comment)

I initially kept the config closer to streampager's (see
https://github.com/jj-vcs/jj/compare/main...ilyagr:jj:streamopts?expand=1), but
then decided to make it more generic, smaller, and hopefully easier to
understand.
ilyagr added a commit to ilyagr/jj that referenced this pull request Jan 22, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in jj-vcs#4203, I didn't mention this in
the Changelog.

As discussed in jj-vcs#4203 (comment)
ilyagr added a commit that referenced this pull request Jan 22, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in #4203, I didn't mention this in
the Changelog.

As discussed in #4203 (comment)

I initially kept the config closer to streampager's (see
https://github.com/jj-vcs/jj/compare/main...ilyagr:jj:streamopts?expand=1), but
then decided to make it more generic, smaller, and hopefully easier to
understand.
ilyagr added a commit to ilyagr/jj that referenced this pull request Jan 22, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in jj-vcs#4203, I didn't mention this in
the Changelog.

As discussed in jj-vcs#4203 (comment)
ilyagr added a commit that referenced this pull request Jan 22, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in #4203, I didn't mention this in
the Changelog.

As discussed in #4203 (comment)

I initially kept the config closer to streampager's (see
https://github.com/jj-vcs/jj/compare/main...ilyagr:jj:streamopts?expand=1), but
then decided to make it more generic, smaller, and hopefully easier to
understand.
ilyagr added a commit to ilyagr/jj that referenced this pull request Jan 24, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in jj-vcs#4203, I didn't mention this in
the Changelog.

As discussed in jj-vcs#4203 (comment)
ilyagr added a commit to ilyagr/jj that referenced this pull request Jan 24, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in jj-vcs#4203, I didn't mention this in
the Changelog.

As discussed in jj-vcs#4203 (comment)
ilyagr added a commit to ilyagr/jj that referenced this pull request Jan 27, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in jj-vcs#4203, I didn't mention this in
the Changelog.

As discussed in jj-vcs#4203 (comment)
facebook-github-bot pushed a commit to facebook/sapling that referenced this pull request Jan 27, 2025
…es (#1011)

Summary:
This could be considered as a bug report/feature request instead of a PR.

Currently, there is no way for a calling program (like `sl` or `jj`) to start streampager without it trying to read
`$CONFIG/streampager/streampager.toml` and the environment variables `SP_INTERFACE_MODE`, `SP_SCROLL_PAST_EOF`, and `SP_READ_AHEAD_LINES`. This is undesireable if we'd like to control Streampager's behavior fully from `jj` config (or `sl` config). Sapling currently overrides the most important Streampager config from its own config anyway.

I'd like there to be a way to invoke Streampager with a given config. I carefully implemented it so that no changes to Sapling are required, though I think it'd also benefit from using the API I introduce here (and the old UI could be deprecated).

If there's a better way to achieve that than my approach here, I'd be happy to do that. Another, less invasive, possibility would be to simply make `Pager::config` public. However, this would mean that Streampager would uselessly read `$CONFIG/streampager/streampager.toml` even if the config is later fully overriden by `jj`.

As an aside, the docs for the config from
https://github.com/markbt/streampager#example-configuration do not seem to be fully correct, setting `interface_mode = "delayed"` as described there did not work for me. However, I'd rather not use that configuration method at all for my purposes with `jj`.

Cc: jj-vcs/jj#4203 (comment), yuja.

As ever, thanks for making it convenient for us to use Streampager in `jj`! :)

Pull Request resolved: #1011

Reviewed By: quark-zju

Differential Revision: D68191198

fbshipit-source-id: c1a180d8bf09a82f5439e2b32510c2f9eafc3d45
ilyagr added a commit to ilyagr/jj that referenced this pull request Jan 28, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in jj-vcs#4203, I didn't mention this in
the Changelog.

As discussed in jj-vcs#4203 (comment)
ilyagr added a commit to ilyagr/jj that referenced this pull request Jan 29, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in jj-vcs#4203, I didn't mention this in
the Changelog.

As discussed in jj-vcs#4203 (comment)
ilyagr added a commit that referenced this pull request Jan 29, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in #4203, I didn't mention this in
the Changelog.

As discussed in #4203 (comment)

I initially kept the config closer to streampager's (see
https://github.com/jj-vcs/jj/compare/main...ilyagr:jj:streamopts?expand=1), but
then decided to make it more generic, smaller, and hopefully easier to
understand.
ilyagr added a commit that referenced this pull request Jan 29, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in #4203, I didn't mention this in
the Changelog.

As discussed in #4203 (comment)

I initially kept the config closer to streampager's (see
https://github.com/jj-vcs/jj/compare/main...ilyagr:jj:streamopts?expand=1), but
then decided to make it more generic, smaller, and hopefully easier to
understand.
ilyagr added a commit that referenced this pull request Jan 29, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in #4203, I didn't mention this in
the Changelog.

As discussed in #4203 (comment)

I initially kept the config closer to streampager's (see
https://github.com/jj-vcs/jj/compare/main...ilyagr:jj:streamopts?expand=1), but
then decided to make it more generic, smaller, and hopefully easier to
understand.
ilyagr added a commit that referenced this pull request Jan 29, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in #4203, I didn't mention this in
the Changelog.

As discussed in #4203 (comment)

I initially kept the config closer to streampager's (see
https://github.com/jj-vcs/jj/compare/main...ilyagr:jj:streamopts?expand=1), but
then decided to make it more generic, smaller, and hopefully easier to
understand.
ilyagr added a commit that referenced this pull request Jan 29, 2025
This also changes the default to be closer to `less -FRX`. Since this
default last changed very recently in #4203, I didn't mention this in
the Changelog.

As discussed in #4203 (comment)

I initially kept the config closer to streampager's (see
https://github.com/jj-vcs/jj/compare/main...ilyagr:jj:streamopts?expand=1), but
then decided to make it more generic, smaller, and hopefully easier to
understand.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants