Skip to content

Commit

Permalink
small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenZcience committed Nov 14, 2024
1 parent a4e7f2f commit 00c7f40
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cat_win/src/service/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ def _action_reload(self) -> bool:
self._setup_file()
self._build_file_upto()
self.cpos.row = min(self.cpos.row, len(self.window_content)-1)
self.history = History()
self.history.clear()
break

return True
Expand Down
7 changes: 7 additions & 0 deletions cat_win/src/service/helper/editorhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,13 @@ def __init__(self, stack_size: int = 800) -> None:
self._stack_undo: list = []
self._stack_redo: list = []

def clear(self) -> None:
"""
clear the history
"""
self._stack_undo.clear()
self._stack_redo.clear()

def _add(self, action: _Action, stack_type: str = 'undo') -> None:
"""
Add an action to the stack.
Expand Down

0 comments on commit 00c7f40

Please sign in to comment.