Skip to content
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

gh-119434: Fix culmitive errors in wrapping as lines proceed #119435

Merged
merged 1 commit into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Lib/_pyrepl/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ def calc_complete_screen(self) -> list[str]:
screen.append(prompt + l)
screeninfo.append((lp, l2))
else:
for i in range(wrapcount + 1):
i = 0
while l:
prelen = lp if i == 0 else 0
index_to_wrap_before = 0
column = 0
Expand All @@ -317,12 +318,17 @@ def calc_complete_screen(self) -> list[str]:
index_to_wrap_before += 1
column += character_width
pre = prompt if i == 0 else ""
post = "\\" if i != wrapcount else ""
after = [1] if i != wrapcount else []
if len(l) > index_to_wrap_before:
post = "\\"
after = [1]
else:
post = ""
after = []
screen.append(pre + l[:index_to_wrap_before] + post)
screeninfo.append((prelen, l2[:index_to_wrap_before] + after))
l = l[index_to_wrap_before:]
l2 = l2[index_to_wrap_before:]
i += 1
self.screeninfo = screeninfo
self.cxy = self.pos2xy()
if self.msg and self.msg_at_bottom:
Expand Down
Loading