Skip to content

gh-148321: use --quit-if-one-screen option for the pager (new REPL)#148322

Open
skirpichev wants to merge 2 commits intopython:mainfrom
skirpichev:pager-quit-if-one-screen
Open

gh-148321: use --quit-if-one-screen option for the pager (new REPL)#148322
skirpichev wants to merge 2 commits intopython:mainfrom
skirpichev:pager-quit-if-one-screen

Conversation

@skirpichev
Copy link
Copy Markdown
Member

@skirpichev skirpichev commented Apr 10, 2026

Currently, by passing --clear-screen (-c) to the pager --- small texts (like few-sentences docstrings) are shown at top of the screen, just as big texts.

I believe it would be better to show this inline instead, not clearing last session commands with output and so on. BTW, this is the default for git commands, e.g. git-log. Of course, we loose on this way ability to use pager for search, but terminal emulators usually have similar capability on its own.

…EPL)

Currently, by passing --clear-screen (-c) to the pager --- small texts (like
few-sentences docstrings) are shown at top of the screen, just as big texts.

I believe it would be better to show this inline instead, not clearing
last session commands with output and so on.  BTW, this is the default
for git commands, e.g. git-log.  Of course, we loose on this way ability
to use pager for search, but terminal emulators usually have similar
capability on its own.
@skirpichev
Copy link
Copy Markdown
Member Author

Like #146382, this might be viewed as a cosmetic change. Though, it's user-visible. So, let me know if I should add news.

@skirpichev skirpichev requested review from ambv and lysnikolaou April 10, 2026 04:05
@StanFromIreland
Copy link
Copy Markdown
Member

Currently, by passing --clear-screen (-c) to the pager --- small texts (like few-sentences docstrings) are shown at top of the screen, just as big texts.

Not exactly, before -c's addition, small texts still appeared in the pager, just at the bottom of the screen. However that issue is irrelevant with -F.

Co-authored-by: Stan Ulbrych <stan@python.org>
@skirpichev
Copy link
Copy Markdown
Member Author

Not exactly, before -c's addition, small texts still appeared in the pager, just at the bottom of the screen.

No. If your input at the bottom of the screen (which is usual for a long session) - the screen will not be cleared. For this reason, I doubt this worth a backports. But technically, we can do backports for 3.13/14.

@StanFromIreland
Copy link
Copy Markdown
Member

StanFromIreland commented Apr 10, 2026

If your input at the bottom of the screen

I still don't quite get how to reproduce that? I tried at the bottom of the screen,

Screencast.From.2026-04-10.09-36-19.mp4

But no luck?

@skirpichev
Copy link
Copy Markdown
Member Author

@StanFromIreland, indeed. I would guess it's related to our local settings.

In my case:

$ echo $PAGER 
less
$ $PAGER --version
less 668 (GNU regular expressions)
Copyright (C) 1984-2024  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less

The current patch does work for you as expected (ie. not clear screen)? If so, then it does make sense to backport it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants