Skip to content

Commit 5316683

Browse files
committed
Make less handle ANSI escape codes
1 parent 0ab08b0 commit 5316683

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

px/px_pager.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ def launch_pager():
8989
# Prevent --quit-if-one-screen, we always want a pager
9090
env['LESS'] = ''
9191

92+
# Git sets this to "FRX", but "F" means "don't page if output is too short"
93+
# and we always want to page, so we go for "RX" only.
94+
#
95+
# "F" might work when somebody does "px 1234", but when ptop wants to show
96+
# process info it w
97+
env['LESS'] = 'RX'
98+
99+
# Git does this as well
100+
env['LV'] = '-c'
101+
92102
pager_cmd = to_command_line(env.get('PAGER', None))
93103
if not pager_cmd:
94104
# Prefer moar: https://github.com/walles/moar

0 commit comments

Comments
 (0)