mirror of
https://github.com/python/cpython.git
synced 2025-10-17 04:08:28 +00:00
gh-127349: Add check for correct resizing in REPL (#127387)
This commit is contained in:
parent
4ca9fc08f8
commit
510fefdc62
3 changed files with 13 additions and 3 deletions
|
@ -587,10 +587,11 @@ class Reader:
|
|||
def pos2xy(self) -> tuple[int, int]:
|
||||
"""Return the x, y coordinates of position 'pos'."""
|
||||
# this *is* incomprehensible, yes.
|
||||
y = 0
|
||||
p, y = 0, 0
|
||||
l2: list[int] = []
|
||||
pos = self.pos
|
||||
assert 0 <= pos <= len(self.buffer)
|
||||
if pos == len(self.buffer):
|
||||
if pos == len(self.buffer) and len(self.screeninfo) > 0:
|
||||
y = len(self.screeninfo) - 1
|
||||
p, l2 = self.screeninfo[y]
|
||||
return p + sum(l2) + l2.count(0), y
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue