Skip to content

Commit

Permalink
fix cursor column preservation
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenZcience committed Dec 5, 2024
1 parent 03b0231 commit 26cfb17
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cat_win/src/service/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1357,11 +1357,13 @@ def _enforce_boundaries(self, key: bytes) -> None:
rowlen = len(self.window_content[self.cpos.row]) if(
self.cpos.row < len(self.window_content)
) else 0
if self.snap_pos.row == self.cpos.row or key not in MOVE_HOTKEYS | SELECT_HOTKEYS:
self.snap_pos.set_pos(self.cpos.get_pos())
else:
if key in MOVE_HOTKEYS | SELECT_HOTKEYS and (
b'_up' in key or b'_down' in key
):
self.snap_pos.row = self.cpos.row
self.cpos.col = min(self.snap_pos.col, rowlen)
else:
self.snap_pos.set_pos(self.cpos.get_pos())
self.cpos.col = min(self.cpos.col, rowlen)

if not self.scrolling:
Expand Down

0 comments on commit 26cfb17

Please sign in to comment.