From 6254e77275076f7b0ce573f11bbb4319701f25d9 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Thu, 27 Jan 2022 16:57:16 +1000 Subject: [PATCH] Coding style - Remove unnecessary scroll limiting code. Its now done in the portal. --- diff_edit/editor.py | 18 ++---------------- setup.py | 2 +- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/diff_edit/editor.py b/diff_edit/editor.py index 657a5db..c1a393f 100755 --- a/diff_edit/editor.py +++ b/diff_edit/editor.py @@ -222,21 +222,7 @@ class Editor: @scroll_position.setter def scroll_position(self, position): - x, y = position - text_width = self.text_widget.max_line_length - if x < 0: - new_x = 0 - elif x > text_width - self.last_width + 2: - new_x = max(text_width - self.last_width + 2, 0) - else: - new_x = x - if y < 0: - new_y = 0 - elif y > len(self.text_widget) - self.last_height + 2: - new_y = max(len(self.text_widget) - self.last_height + 2, 0) - else: - new_y = y - self.view_widget.position = new_x, new_y + self.view_widget.position = position def get_selection_interval(self): mark_x, mark_y = self.mark @@ -252,8 +238,8 @@ class Editor: self.decor_widget = Decor(self.text_widget, lambda appearance: add_highlights(self, appearance)) self.view_widget = fill3.View.from_widget(self.decor_widget) + self.view_widget.portal.is_scroll_limited = True if not self.is_left_aligned: - self.view_widget.portal.is_scroll_limited = True self.view_widget.portal.is_left_aligned = False self.cursor_x, self.cursor_y = 0, 0 self.original_text = self.text_widget.actual_text.copy() diff --git a/setup.py b/setup.py index 764ff7e..de06887 100755 --- a/setup.py +++ b/setup.py @@ -18,4 +18,4 @@ setup(name="diff-edit", entry_points={"console_scripts": ["diff-edit=diff_edit:main"]}, install_requires=[ "pygments==2.10.0", "docopt==0.6.2", - "fill3 @ git+https://github.com/ahamilton/eris@v2022.01.24#subdirectory=fill3"]) + "fill3 @ git+https://github.com/ahamilton/eris@v2022.01.27#subdirectory=fill3"])