From a6c9822fe5150a83ec6d0093e0a5f6f7801c07fd Mon Sep 17 00:00:00 2001 From: Dino Viehland Date: Wed, 22 May 2024 15:03:32 -0700 Subject: [PATCH] gh-119434: Fix culmitive errors in wrapping as lines proceed (GH-119435) Fix culmitive errors in wrapping as lines proceed (cherry picked from commit e3bf5381fd056d0bbdd775463e3724aab2012e45) Co-authored-by: Dino Viehland --- Lib/_pyrepl/reader.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Lib/_pyrepl/reader.py b/Lib/_pyrepl/reader.py index 9a207a241d5f8d..40cbe422fabdbe 100644 --- a/Lib/_pyrepl/reader.py +++ b/Lib/_pyrepl/reader.py @@ -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 @@ -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: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy