-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New REPL: python -q
outputs unnecessary blank space on empty terminal
#131743
Comments
I think so. I can't reproduce this in gterm. |
@skirpichev, what is gterm? Is it |
Hmm, my fault. It's important to run commands as one-liner's, i.e. |
this is also reproduced on my system. i use It would be great to know what the behavior is on Windows |
it seems that these actions are not needed in some cases, so if we do this inside block we also have same code in if no one minds i'll send PR, and it would be nice to make backport for 3.13 |
That sounds like a safe change to me, @donBarbos. I'm curious though: can you explain why we ever need to do this? Why are we jumping 1 line above where we need to go just to go one 1 down right after? Why are we even jumping the cursor around at all? (I don't think we're redrawing the entire screen, are we?) |
for example when we want to move to the next line after entering but I'm not an expert :-) it's better to ask the author or some of core team |
I still don't understand why we wouldn't jump straight to where we want to go. Why one above and then down? |
cc @pablogsal as author of new python repl sorry for ping, do you mind? |
Bug report
Bug description:
If I start the new REPL on a clear terminal, I get an unnecessary blank space.
Whereas this does not happen if I run the old ("basic") REPL:
Analysis
I've tracked this down to these 2 lines of code: https://github.com/python/cpython/blob/3.13/Lib/_pyrepl/unix_console.py#L241-L242
I don't totally understand this code, but it certainly smells like there's a bug here when dealing with an empty screen (for example, if
len(self.screen) == 0
, are we trying to move the cursor to index-1
?)I'm not sure what the fix is here, though. I don't really understand this code: why are we moving up to a line just to move the cursor down a line afterwards? why can't we jump straight to where we want to be? I tried digging through the git history for answers, but it looks like this incantation dates back all the way to this initial commit to pypi/pyrepl. I'm not sure how to dig any further back in time.
CPython versions tested on:
3.13, 3.14, CPython main branch
Operating systems tested on:
Linux
I'm using Alacritty, in case that's relevant.
Linked PRs
The text was updated successfully, but these errors were encountered: