Skip to content

Commit

Permalink
Make less handle ANSI escape codes
Browse files Browse the repository at this point in the history
  • Loading branch information
walles committed Nov 9, 2020
1 parent 0ab08b0 commit 5316683
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions px/px_pager.py
Expand Up @@ -89,6 +89,16 @@ def launch_pager():
# Prevent --quit-if-one-screen, we always want a pager
env['LESS'] = ''

# Git sets this to "FRX", but "F" means "don't page if output is too short"
# and we always want to page, so we go for "RX" only.
#
# "F" might work when somebody does "px 1234", but when ptop wants to show
# process info it w
env['LESS'] = 'RX'

# Git does this as well
env['LV'] = '-c'

pager_cmd = to_command_line(env.get('PAGER', None))
if not pager_cmd:
# Prefer moar: https://github.com/walles/moar
Expand Down

0 comments on commit 5316683

Please sign in to comment.