Skip to content

Commit 696a4ec

Browse files
committed
Fix REPL cursor position on Windows when module completion suggestion line hits console width
1 parent bad8d6d commit 696a4ec

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Lib/_pyrepl/windows_console.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,11 @@ def __write_changed_line(
283283

284284
self.__write(newline[x_pos:])
285285
if wlen(newline) == self.width:
286-
# If we wrapped we want to start at the next line
287-
self._move_relative(0, y + 1)
288-
self.posxy = 0, y + 1
286+
# Wrapping with self._move_relative(0, y+1) can't move cursor down
287+
# here. Windows keeps the cursor at the end of the line. It only
288+
# wraps when the next character is written.
289+
# https://github.com/microsoft/terminal/issues/349
290+
self.posxy = wlen(newline) - 1, y
289291
else:
290292
self.posxy = wlen(newline), y
291293

0 commit comments

Comments
 (0)