Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2bc2aa7

Browse filesBrowse files
fix cursor_row problems
1 parent 8f67583 commit 2bc2aa7
Copy full SHA for 2bc2aa7

1 file changed

+6-5Lines changed: 6 additions & 5 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎bpython/curtsiesfrontend/repl.py‎

Copy file name to clipboardExpand all lines: bpython/curtsiesfrontend/repl.py
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -769,16 +769,17 @@ def paint(self, about_to_exit=False, user_quit=False):
769769
lines = paint.display_linize(self.current_cursor_line+'X', width)
770770
# extra character for space for the cursor
771771
current_line_end_row = current_line_start_row + len(lines) - 1
772-
cursor_row = current_line_start_row + (len(self.current_cursor_line) - len(self._current_line) + self.cursor_offset_in_line) / width
772+
773773
if self.stdin.has_focus:
774-
cursor_column = (len(self.current_stdouterr_line) + self.stdin.cursor_offset_in_line) % width
774+
cursor_row, cursor_column = divmod(len(self.current_stdouterr_line) + self.stdin.cursor_offset_in_line, width)
775775
assert cursor_column >= 0, cursor_column
776-
elif self.coderunner.running:
777-
cursor_column = (len(self.current_cursor_line) + self.cursor_offset_in_line) % width
776+
elif self.coderunner.running: #TODO does this ever happen?
777+
cursor_row, cursor_column = divmod(len(self.current_cursor_line) + self.cursor_offset_in_line, width)
778778
assert cursor_column >= 0, (cursor_column, len(self.current_cursor_line), len(self._current_line), self.cursor_offset_in_line)
779779
else:
780-
cursor_column = (len(self.current_cursor_line) - len(self._current_line) + self.cursor_offset_in_line) % width
780+
cursor_row, cursor_column = divmod(len(self.current_cursor_line) - len(self._current_line) + self.cursor_offset_in_line, width)
781781
assert cursor_column >= 0, (cursor_column, len(self.current_cursor_line), len(self._current_line), self.cursor_offset_in_line)
782+
cursor_row += current_line_start_row
782783

783784
if self.list_win_visible:
784785
logging.debug('infobox display code running')

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.