-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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 repeats prompt with newline after each key #127068
Comments
Verified not in 3.12, starts in 3.13, so new REPL. Repetition starts with 2nd keypress. |
This issue is observed in these OS for me:
|
This issue looks interesting to me. I am willing to fix the issue but lack of context of what the above while loop is supposed to deal with. Hope my observation could help whoever will fix this issue. TL;DRThe new reader is not able to calculate the screen when prompt ( Test CaseTest case in this post: The CodePlease see the comments on how it happens # prompt = "\x1b[1;35mword\n\x1b[0m". following this pattern f"{ANSIColors.BOLD_MAGENTA}{prompt}{ANSIColors.RESET}" It is copied from reader.ps1 which is `word\n`
# is this while loop supposed to deal with the case when reader.ps1 has multiple lines?
while "\n" in prompt:
pre_prompt, _, prompt = prompt.partition("\n")
# pre_prompt = "\x1b[1;35mword"m; prompt = "\x1b[0m"
last_refresh_line_end_offsets.append(offset)
# bug: screen is wrongly updated:
# Each time user hit a keyboard button, this while loop is executed
# the same pre_prompt is added to screen
# screen = ["\x1b[1;35mword", "\x1b[1;35mword", "\x1b[1;35mword", ..., "\x1b[0mthe_actual_user_input"]
screen.append(pre_prompt)
screeninfo.append((0, [])) I checked the pypy code of pyrepl. This part of code is not modified. Tracing the CallThe calls that the example test case triggers: |
Bug report
Bug description:
When using Python 3.13.0 with the interpreter on Windows Terminal, I tried to write a simple input message to the user with a line break. It resulted in a repetition of the message for every character I wrote and every pressing of a key on the keyboard (including backspace). It does not affect the usability of the input command, but it is annoying.
The bug reproduced on Windows 10 and Windows 11. It does not appear to happen not on the IDLE nor on VSCode.
Windows 11 24H2
Windows 10 22H2
CPython versions tested on:
3.13
Operating systems tested on:
Windows
The text was updated successfully, but these errors were encountered: