gh-65824: Improve help() when MANPAGER and PAGER variables are not set#21520
Closed
ZackerySpytz wants to merge 2 commits intopython:mainfrom
Closed
gh-65824: Improve help() when MANPAGER and PAGER variables are not set#21520ZackerySpytz wants to merge 2 commits intopython:mainfrom
ZackerySpytz wants to merge 2 commits intopython:mainfrom
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.
nagarajan
reviewed
Jul 18, 2020
| 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.
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.
Suggested change
| 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.
Also add info about "(q to quit)" message on the status line?
Member
|
See also #116050. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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