Skip to content

Commit

Permalink
scroll to actual start and end on end/home key
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenZcience committed Jan 26, 2024
1 parent b8c6147 commit d32d946
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cat_win/util/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
"""
Expand Down

0 comments on commit d32d946

Please sign in to comment.