-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
gh-128067: Fix pyrepl overriding printed output without newlines #138732
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
Changes from all commits
074d743
771b387
011a7ca
713b649
edf20b7
a43a319
8c75345
3308891
611a1f8
22e9542
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,8 +183,9 @@ def refresh(self, screen: list[str], c_xy: tuple[int, int]) -> None: | |
|
|
||
| while len(self.screen) < min(len(screen), self.height): | ||
| self._hide_cursor() | ||
| self._move_relative(0, len(self.screen) - 1) | ||
| self.__write("\n") | ||
| if self.screen: | ||
| self._move_relative(0, len(self.screen) - 1) | ||
| self.__write("\n") | ||
| self.posxy = 0, len(self.screen) | ||
| self.screen.append("") | ||
|
|
||
|
|
@@ -501,7 +502,7 @@ def clear(self) -> None: | |
| """Wipe the screen""" | ||
| self.__write(CLEAR) | ||
| self.posxy = 0, 0 | ||
| self.screen = [""] | ||
| self.screen = [] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "" here before was a clear attempt at working around the same issue that you're solving here, but I agree the In I'm okay with being defensive here, especially that this makes the behavior symmetrical between Windows and Unix. |
||
|
|
||
| def finish(self) -> None: | ||
| """Move the cursor to the end of the display and otherwise get | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix a bug in PyREPL on Windows where output without a trailing newline was overwritten by the next prompt. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spot on,
len(self.screen) - 1should not get negative here.