Skip to content

Commit 54cfe14

Browse files
committed
Add check for correct resizing
1 parent 78cb377 commit 54cfe14

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/_pyrepl/reader.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,10 +587,11 @@ def setpos_from_xy(self, x: int, y: int) -> None:
587587
def pos2xy(self) -> tuple[int, int]:
588588
"""Return the x, y coordinates of position 'pos'."""
589589
# this *is* incomprehensible, yes.
590-
y = 0
590+
p, y = 0, 0
591+
l2: list[int] = []
591592
pos = self.pos
592593
assert 0 <= pos <= len(self.buffer)
593-
if pos == len(self.buffer):
594+
if pos == len(self.buffer) and len(self.screeninfo) > 0:
594595
y = len(self.screeninfo) - 1
595596
p, l2 = self.screeninfo[y]
596597
return p + sum(l2) + l2.count(0), y

0 commit comments

Comments
 (0)