Skip to content

Commit 3c3d0aa

Browse files
committed
Revert unrelated change "Remove irrelevant self.dch1 comment and unused px_pos variable"
This reverts commit 742096d.
1 parent 742096d commit 3c3d0aa

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Lib/_pyrepl/windows_console.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,22 @@ def input_hook(self):
249249
def __write_changed_line(
250250
self, y: int, oldline: str, newline: str, px_coord: int
251251
) -> None:
252+
# this is frustrating; there's no reason to test (say)
253+
# self.dch1 inside the loop -- but alternative ways of
254+
# structuring this function are equally painful (I'm trying to
255+
# avoid writing code generators these days...)
252256
minlen = min(wlen(oldline), wlen(newline))
253257
x_pos = 0
254258
x_coord = 0
255259

260+
px_pos = 0
261+
j = 0
262+
for c in oldline:
263+
if j >= px_coord:
264+
break
265+
j += wlen(c)
266+
px_pos += 1
267+
256268
# reuse the oldline as much as possible, but stop as soon as we
257269
# encounter an ESCAPE, because it might be the start of an escape
258270
# sequence

0 commit comments

Comments
 (0)