Fix crashes during scrolling

- Occured due to negative scroll positions or not finding the
  equivalent line in the other editor.
This commit is contained in:
Andrew Hamilton 2022-03-08 10:06:47 +10:00
parent 7986f1c7d9
commit 87e62e8570
3 changed files with 4 additions and 5 deletions

View file

@ -658,7 +658,7 @@ class Editor:
def scroll(self, dx, dy):
view_x, view_y = self.scroll_position
self.scroll_position = view_x + dx, view_y + dy
self.scroll_position = max(0, view_x + dx), max(0, view_y + dy)
def on_mouse_press(self, x, y):
view_x, view_y = self.view_widget.position