From d772fd9d593d4303a282b17524fdf1d89de63507 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Fri, 10 Apr 2026 06:43:53 +0300 Subject: [PATCH 1/2] gh-148321: use --quit-if-one-screen option for the pager (new REPL) Currently, by passing --clear-screen (-c) to the pager --- small texts (like few-sentences docstrings) are shown at top of the screen, just as big texts. I believe it would be better to show this inline instead, not clearing last session commands with output and so on. BTW, this is the default for git commands, e.g. git-log. Of course, we loose on this way ability to use pager for search, but terminal emulators usually have similar capability on its own. --- Lib/_pyrepl/pager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/_pyrepl/pager.py b/Lib/_pyrepl/pager.py index 92afaa5933a225..32ef67a1e044e9 100644 --- a/Lib/_pyrepl/pager.py +++ b/Lib/_pyrepl/pager.py @@ -138,7 +138,7 @@ def pipe_pager(text: str, cmd: str, title: str = '') -> None: '.' '?e (END):?pB %pB\\%..' ' (press h for help or q to quit)') - env['LESS'] = '-RcmPm{0}$PM{0}$'.format(prompt_string) + env['LESS'] = '-F-RmPm{0}$PM{0}$'.format(prompt_string) proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, errors='backslashreplace', env=env) assert proc.stdin is not None From f15445be1404191b46326750ce08310c30895bf4 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Fri, 10 Apr 2026 11:31:10 +0300 Subject: [PATCH 2/2] Update Lib/_pyrepl/pager.py Co-authored-by: Stan Ulbrych --- Lib/_pyrepl/pager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/_pyrepl/pager.py b/Lib/_pyrepl/pager.py index 32ef67a1e044e9..abcf81b9415235 100644 --- a/Lib/_pyrepl/pager.py +++ b/Lib/_pyrepl/pager.py @@ -138,7 +138,7 @@ def pipe_pager(text: str, cmd: str, title: str = '') -> None: '.' '?e (END):?pB %pB\\%..' ' (press h for help or q to quit)') - env['LESS'] = '-F-RmPm{0}$PM{0}$'.format(prompt_string) + env['LESS'] = '-FRmPm{0}$PM{0}$'.format(prompt_string) proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, errors='backslashreplace', env=env) assert proc.stdin is not None