Skip to content

Commit 22a8e9e

Browse files
Update Lib/_pyrepl/windows_console.py
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
1 parent e085733 commit 22a8e9e

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

Lib/_pyrepl/windows_console.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -272,22 +272,17 @@ def __write_changed_line(
272272

273273
self.__write(newline[x_pos:])
274274
if wlen(newline) == self.width:
275-
if self.__vt_support:
276-
info = CONSOLE_SCREEN_BUFFER_INFO()
277-
if not GetConsoleScreenBufferInfo(OutHandle, info):
278-
raise WinError(GetLastError())
279-
win_y = int(info.dwCursorPosition.Y - info.srWindow.Top)
280-
expected = y - self.__offset
281-
if win_y == expected + 1:
282-
# Terminal wrapped to next row.
283-
self.posxy = 0, y + 1
284-
else:
285-
# Terminal did not wrap; cursor stays at end-of-line.
286-
self.posxy = self.width, y
287-
else:
288-
# If we wrapped we want to start at the next line
289-
self._move_relative(0, y + 1)
275+
info = CONSOLE_SCREEN_BUFFER_INFO()
276+
if not GetConsoleScreenBufferInfo(OutHandle, info):
277+
raise WinError(get_last_error())
278+
win_y = int(info.dwCursorPosition.Y - info.srWindow.Top)
279+
expected = y - self.__offset
280+
if win_y == expected + 1:
281+
# Terminal wrapped to next row.
290282
self.posxy = 0, y + 1
283+
else:
284+
# Terminal did not wrap; cursor stays at end-of-line.
285+
self.posxy = self.width, y
291286
else:
292287
self.posxy = wlen(newline), y
293288

0 commit comments

Comments
 (0)