mirror of
https://github.com/python/cpython.git
synced 2024-12-11 10:50:11 +08:00
gh-119434: Fix culmitive errors in wrapping as lines proceed (#119435)
Fix culmitive errors in wrapping as lines proceed
This commit is contained in:
parent
9b422fc6af
commit
e3bf5381fd
@ -307,7 +307,8 @@ class Reader:
|
|||||||
screen.append(prompt + l)
|
screen.append(prompt + l)
|
||||||
screeninfo.append((lp, l2))
|
screeninfo.append((lp, l2))
|
||||||
else:
|
else:
|
||||||
for i in range(wrapcount + 1):
|
i = 0
|
||||||
|
while l:
|
||||||
prelen = lp if i == 0 else 0
|
prelen = lp if i == 0 else 0
|
||||||
index_to_wrap_before = 0
|
index_to_wrap_before = 0
|
||||||
column = 0
|
column = 0
|
||||||
@ -317,12 +318,17 @@ class Reader:
|
|||||||
index_to_wrap_before += 1
|
index_to_wrap_before += 1
|
||||||
column += character_width
|
column += character_width
|
||||||
pre = prompt if i == 0 else ""
|
pre = prompt if i == 0 else ""
|
||||||
post = "\\" if i != wrapcount else ""
|
if len(l) > index_to_wrap_before:
|
||||||
after = [1] if i != wrapcount else []
|
post = "\\"
|
||||||
|
after = [1]
|
||||||
|
else:
|
||||||
|
post = ""
|
||||||
|
after = []
|
||||||
screen.append(pre + l[:index_to_wrap_before] + post)
|
screen.append(pre + l[:index_to_wrap_before] + post)
|
||||||
screeninfo.append((prelen, l2[:index_to_wrap_before] + after))
|
screeninfo.append((prelen, l2[:index_to_wrap_before] + after))
|
||||||
l = l[index_to_wrap_before:]
|
l = l[index_to_wrap_before:]
|
||||||
l2 = l2[index_to_wrap_before:]
|
l2 = l2[index_to_wrap_before:]
|
||||||
|
i += 1
|
||||||
self.screeninfo = screeninfo
|
self.screeninfo = screeninfo
|
||||||
self.cxy = self.pos2xy()
|
self.cxy = self.pos2xy()
|
||||||
if self.msg and self.msg_at_bottom:
|
if self.msg and self.msg_at_bottom:
|
||||||
|
Loading…
Reference in New Issue
Block a user