From 7f5eb416029fbcd33bb4e1b2dd78c43ac279456f Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 20 Apr 2016 16:38:39 +0300 Subject: [PATCH] init.py: pass options '-F', '-R' and '-X' to 'less' --- lib/python/init.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/python/init.py b/lib/python/init.py index a5e6323..7ef24db 100644 --- a/lib/python/init.py +++ b/lib/python/init.py @@ -117,11 +117,20 @@ def init(): except (ImportError, locale.Error): pass # no locale support or unsupported locale - # set displayhook + # set displayhook and excepthook from pprint import pprint pager = os.environ.get("PAGER") or 'more' + # if your pager is 'less', options '-F' and '-R' must be passed to it, + # and option '-X' is very much recommended + if pager == 'less': + less = os.environ.get("LESS") or '' + for opt in 'X', 'R', 'F': + if opt not in less: + less = opt + less + os.environ["LESS"] = less + class BasePager: def write(self, value): self.stdin.write(value) -- 2.39.5