Fix crash when switching to non-existant line
- When switching from an insert area at the bottom of a file.
This commit is contained in:
parent
54f3b94caf
commit
365a76c4ed
2 changed files with 5 additions and 3 deletions
|
|
@ -209,7 +209,8 @@ class DiffEditor:
|
|||
right_start, right_end, left_start, left_end
|
||||
if left_start <= y < left_end:
|
||||
fraction = (y - left_start) / (left_end - left_start)
|
||||
return round(right_start + fraction * (right_end - right_start))
|
||||
other_y = round(right_start + fraction * (right_end - right_start))
|
||||
return other_y - 1 if other_y == len(self.editors[1].text_widget) else other_y
|
||||
return 0
|
||||
|
||||
def follow_scroll(self):
|
||||
|
|
|
|||
|
|
@ -263,6 +263,7 @@ class Editor:
|
|||
if not self.is_editing:
|
||||
return result
|
||||
if self.mark is None:
|
||||
with contextlib.suppress(IndexError): # Fix. The cursor should always be on screen.
|
||||
result[self.cursor_y - view_y] = highlight_str(result[self.cursor_y - view_y],
|
||||
termstr.Color.white, 0.8)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue