From d32d946ea6981079e8ef14ef77b782b53b8fbba2 Mon Sep 17 00:00:00 2001 From: Silas Kraume Date: Sat, 27 Jan 2024 00:17:12 +0100 Subject: [PATCH] scroll to actual start and end on end/home key --- cat_win/util/editor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cat_win/util/editor.py b/cat_win/util/editor.py index 8dc516cf..40f2bf07 100644 --- a/cat_win/util/editor.py +++ b/cat_win/util/editor.py @@ -324,8 +324,10 @@ def _move_key_ctl_end(self) -> None: self.cpos.col = len(self.window_content[-1]) def _scroll_key_end(self) -> None: - max_y, _ = self.getxymax() + max_y, max_x = self.getxymax() self.wpos.row = max(len(self.window_content)-max_y, 0) + max_line = max(map(len,self.window_content[-max_y:])) + self.wpos.col = max(max_line+1-max_x, 0) def _move_key_home(self) -> None: self.cpos.col = 0 @@ -336,6 +338,7 @@ def _move_key_ctl_home(self) -> None: def _scroll_key_home(self) -> None: self.wpos.row = 0 + self.wpos.col = 0 def _key_string(self, wchars) -> str: """