martinvonz / jj

A Git-compatible VCS that is both simple and powerful
https://martinvonz.github.io/jj/
Apache License 2.0
9.03k stars 313 forks source link

FR: Pager: better match `git` behavior #2980

Open colemickens opened 9 months ago

colemickens commented 9 months ago

Is your feature request related to a problem? Please describe. I want to be able to run jj log, somehow exit, and see the output in my terminal to type my next command, probably reading some change id from the output, etc.

However, git chooses to skip the pager entirely for very short outputs, or in cases where git does use a pager, exiting the pager leaves the output left visible when jj/pager exits.

Describe the solution you'd like I don't know enough about how pagers work, how git uses its, which ones git/jj default to, etc, to suggest the right solution.

Describe alternatives you've considered Using a different PAGER, but I'm not sure that addresses the core issue, and I think a different solution by default might be appropriate anyway.

Additional context https://asciinema.org/a/tIdymnAYdgCOg5A6TBQTTWtrE

ilyagr commented 9 months ago

https://github.com/martinvonz/jj/pull/2928 will hopefully fix this soon. There are many details in the PR and the issue it links to.

epage commented 9 months ago

If its of use, I dug into how git interacts with pagers and consolidated it down to a single rust file: https://github.com/epage/git-dive/blob/main/src/git_pager.rs