-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-65824: Improve help() when MANPAGER and PAGER variables are not set #21520
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
Conversation
Display "(q to quit)" when using help(). Use the --quit-at-eof option to make less quit if enter is pressed on the last line.
@@ -1574,7 +1574,8 @@ def getpager(): | |||
if sys.platform == 'win32': | |||
return lambda text: tempfilepager(plain(text), 'more <') | |||
if hasattr(os, 'system') and os.system('(less) 2>/dev/null') == 0: | |||
return lambda text: pipepager(text, 'less') | |||
cmd = 'less "-P?e(END) .(q to quit)" --quit-at-eof' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do also considering adding the -X
and -F
(latter is the same as --quit-if-one-screen
) flags.
From the less documentation,
-X
causes less to not clear screen upon quit
-X or --no-init Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.
and with -F, it quits if the help fits in one screen
-F or --quit-if-one-screen Causes less to automatically exit if the entire file can be displayed on the first screen.
cmd = 'less "-P?e(END) .(q to quit)" --quit-at-eof' | |
cmd = 'less "-P?e(END) .(q to quit)" -X --quit-if-one-screen --quit-at-eof' |
@@ -0,0 +1,2 @@ | |||
When the ``MANPAGER`` and ``PAGER`` environment variables are not set, | |||
interactive :func:`help` now quits if enter is pressed on the last line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add info about "(q to quit)" message on the status line?
See also #116050. |
Display "(q to quit)" when using help(). Use the --quit-at-eof
option to make less quit if enter is pressed on the last line.
https://bugs.python.org/issue21625