Skip to content

Commit 2f64705

Browse files
fix cursor in wrong column on multiline input
--HG-- branch : scroll-frontend
1 parent 402bb33 commit 2f64705

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,13 +669,13 @@ def paint(self, about_to_exit=False):
669669
# extra character for space for the cursor
670670
cursor_row = current_line_start_row + len(lines) - 1
671671
if self.stdin.has_focus:
672-
cursor_column = len(self.current_stdouterr_line) + self.stdin.cursor_offset_in_line
672+
cursor_column = (len(self.current_stdouterr_line) + self.stdin.cursor_offset_in_line) % width
673673
assert cursor_column >= 0, cursor_column
674674
elif self.coderunner.running:
675-
cursor_column = len(self.current_cursor_line) + self.cursor_offset_in_line
675+
cursor_column = (len(self.current_cursor_line) + self.cursor_offset_in_line) % width
676676
assert cursor_column >= 0, (cursor_column, len(self.current_cursor_line), len(self._current_line), self.cursor_offset_in_line)
677677
else:
678-
cursor_column = len(self.current_cursor_line) - len(self._current_line) + self.cursor_offset_in_line
678+
cursor_column = (len(self.current_cursor_line) - len(self._current_line) + self.cursor_offset_in_line) % width
679679
assert cursor_column >= 0, (cursor_column, len(self.current_cursor_line), len(self._current_line), self.cursor_offset_in_line)
680680

681681
if self.list_win_visible:

0 commit comments

Comments
 (0)