29 lines
1.0 KiB
Diff
29 lines
1.0 KiB
Diff
|
# HG changeset patch
|
||
|
# User Dejan Muhamedagic <dejan@hello-penguin.com>
|
||
|
# Date 1314633641 -7200
|
||
|
# Node ID f77e52725f2d98c219d8b22208da0b89b3d42112
|
||
|
# Parent ccd0c1e1edf9f23cafb4363014acba755f1b4e25
|
||
|
Low: Shell: let the pager decide how to handle output smaller than terminal
|
||
|
|
||
|
Instead of trying to calculate the size of the output, which may
|
||
|
not be trivial, better let the pager deal with it. For instance,
|
||
|
less(1) can be configured to exit immediately on a
|
||
|
less-than-screenful of input (-F). IIRC, more(1) does that
|
||
|
automatically.
|
||
|
|
||
|
diff --git a/shell/modules/utils.py b/shell/modules/utils.py
|
||
|
--- a/shell/modules/utils.py
|
||
|
+++ b/shell/modules/utils.py
|
||
|
@@ -524,10 +524,7 @@ def page_string(s):
|
||
|
'Write string through a pager.'
|
||
|
if not s:
|
||
|
return
|
||
|
- w,h = get_winsize()
|
||
|
- if s.count('\n') < h:
|
||
|
- print s
|
||
|
- elif not user_prefs.pager or not sys.stdout.isatty() or options.batch:
|
||
|
+ if not user_prefs.pager or not sys.stdout.isatty() or options.batch:
|
||
|
print s
|
||
|
else:
|
||
|
opts = ""
|