diff options
author | Dino Viehland <dinoviehland@gmail.com> | 2024-05-22 22:03:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-22 22:03:32 (GMT) |
commit | e3bf5381fd056d0bbdd775463e3724aab2012e45 (patch) | |
tree | 00d57e1f25b50128060ba6bc99035099d31fc3b9 /Lib/_pyrepl | |
parent | 9b422fc6af87b81812aaf3010c004eb27c4dc280 (diff) | |
download | cpython-e3bf5381fd056d0bbdd775463e3724aab2012e45.zip cpython-e3bf5381fd056d0bbdd775463e3724aab2012e45.tar.gz cpython-e3bf5381fd056d0bbdd775463e3724aab2012e45.tar.bz2 |
gh-119434: Fix culmitive errors in wrapping as lines proceed (#119435)
Fix culmitive errors in wrapping as lines proceed
Diffstat (limited to 'Lib/_pyrepl')
-rw-r--r-- | Lib/_pyrepl/reader.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/_pyrepl/reader.py b/Lib/_pyrepl/reader.py index 768d45a..81df0c9 100644 --- a/Lib/_pyrepl/reader.py +++ b/Lib/_pyrepl/reader.py @@ -307,7 +307,8 @@ class Reader: 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 @@ -317,12 +318,17 @@ class Reader: 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: |