mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Issue #22314: pydoc now works when the LINES environment variable is set.
This commit is contained in:
parent
fc8e9b0e72
commit
ab5e9b9213
2 changed files with 13 additions and 2 deletions
10
Lib/pydoc.py
10
Lib/pydoc.py
|
|
@ -1479,12 +1479,18 @@ def ttypager(text):
|
||||||
old = tty.tcgetattr(fd)
|
old = tty.tcgetattr(fd)
|
||||||
tty.setcbreak(fd)
|
tty.setcbreak(fd)
|
||||||
getchar = lambda: sys.stdin.read(1)
|
getchar = lambda: sys.stdin.read(1)
|
||||||
except (ImportError, AttributeError):
|
except (ImportError, AttributeError, io.UnsupportedOperation):
|
||||||
tty = None
|
tty = None
|
||||||
getchar = lambda: sys.stdin.readline()[:-1][:1]
|
getchar = lambda: sys.stdin.readline()[:-1][:1]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = inc = os.environ.get('LINES', 25) - 1
|
try:
|
||||||
|
h = int(os.environ.get('LINES', 0))
|
||||||
|
except ValueError:
|
||||||
|
h = 0
|
||||||
|
if h <= 1:
|
||||||
|
h = 25
|
||||||
|
r = inc = h - 1
|
||||||
sys.stdout.write('\n'.join(lines[:inc]) + '\n')
|
sys.stdout.write('\n'.join(lines[:inc]) + '\n')
|
||||||
while lines[r:]:
|
while lines[r:]:
|
||||||
sys.stdout.write('-- more --')
|
sys.stdout.write('-- more --')
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,11 @@ Documentation
|
||||||
- Issue #21514: The documentation of the json module now refers to new JSON RFC
|
- Issue #21514: The documentation of the json module now refers to new JSON RFC
|
||||||
7159 instead of obsoleted RFC 4627.
|
7159 instead of obsoleted RFC 4627.
|
||||||
|
|
||||||
|
Tools/Demos
|
||||||
|
-----------
|
||||||
|
|
||||||
|
- Issue #22314: pydoc now works when the LINES environment variable is set.
|
||||||
|
|
||||||
Windows
|
Windows
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue