_pyrepl/pager.py: call less with --clear-screen#146382
Conversation
|
Thank you for your contribution! :) |
|
Thanks for your merge! |
|
Sorry, @StanFromIreland, it doesn't look as a cosmetic change. IMO, it's a regression, which introduces rather unhelpful behavior of the REPL. So, for small docstring - you can see all nearby repl interaction without scrolling. BTW, in the real world - my console size would be much bigger. So, more wasted space... Maybe we could solve your issue (if it exists at all) in a different way? BTW, why to keep pager at all for small texts? I think that git tools do this per default only if text doesn't fit to the screen ( The patch: diff --git a/Lib/_pyrepl/pager.py b/Lib/_pyrepl/pager.py
index 92afaa5933a..f937d7973d8 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 NoneThe behavior for git tools could be customized, i.e. they respect the |
You are right, this happens only if you near of the bottom of the screen. Though, it's a sort of common case in a long REPL session. BTW, with added
No, it was linux. |
|
This look like a regression to me. Previously, the text of the help remained on the screen after quiting the pager. Now it disappears. I think this change should be reverted. |
|
Hmm, it disappeared also in old Python versions. This was inconvenient sometimes. |
I can't reproduce this in 3.14 either? Are you sure that wasn't a different change? Or again just small differences in |
|
I was wrong. Sorry. |
|
Oh! I didn't see #146382 (comment) which must have been posted as I was writing, sorry! |
This was explained in the comment above: #146382 (comment) Usually the prompt will be at the bottom of the screen - and then the pager will appear at the bottom, but the screen will not be cleared. For this reason, I think that backporting #148322 not so important. |
|
Anyway, I think this change should be reverted. See #148321 (comment). |



Since this is only a cosmetic change, I don't think it qualifies for a news entry.
Currently, text is written bottom-to-top, resulting in odd placement for
copyright():This patch fixes that:
By passing
--clear-screen(-c) toless, which "causes full screen repaints to be painted from the top line down."