Skip to content

Conversation

yihong0618
Copy link
Contributor

@yihong0618 yihong0618 commented Oct 1, 2025

The root cause of the this lis the calc_screen() method of reader.py. When screen, screeninfo, and line_end_offsets are retrieved from the cache, they are passed by direct reference instead of by a copy.

before this patch

2025-10-01.12.31.25.mov

after this patch

2025-10-01.12.57.17.mov

del screeninfo[num_common_lines:]

last_refresh_line_end_offsets = self.last_refresh_cache.line_end_offsets
last_refresh_line_end_offsets = self.last_refresh_cache.line_end_offsets.copy()
Copy link

@kemingy kemingy Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this last_refresh_line_end_offsets has never been used in this function. The bug can be fixed by deleting this one.

The other two screen & screeninfo are synced back to self.last_refresh_cache. But for readability & maintenance, we should copy them here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

@kemingy
Copy link

kemingy commented Oct 1, 2025

The failed Windows test (test.test_pyrepl.test_windows_console.WindowsConsoleTests.test_multiline_ctrl_z) is not caused by this PR.

If we add the reader.screeninfo to the assert msg:

- (4, 2)
+ (2, 3) : [(0, [1, 1, 1, 1, 1]), (0, [1, 1, 1, 1, 1]), (0, [1, 2, 1])]

yihong0618 and others added 2 commits October 1, 2025 18:48
Signed-off-by: yihong0618 <[email protected]>
Co-authored-by: Keming <[email protected]>
Signed-off-by: yihong0618 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants