Skip to content

Commit

Permalink
IMPROVED: Splitted open(...) to __reset_open(self)
Browse files Browse the repository at this point in the history
  • Loading branch information
GiorgosXou committed Aug 28, 2023
1 parent 84603d3 commit 511f696
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions TUIFIManager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,24 @@ def __try_open_with(self, directory: str, open_with: Optional[str], multiple=Fal
return


def __reset_open(self):
if self.vim_mode and self.escape_event_consumed and not self.is_in_command_mode: # SuS SuS SuS SuS SuS damn that's so Sus lol
self.find()
else:
self.is_in_find_mode = False
self.escape_event_consumed = False
self.__change_escape_event_consumed = False
self.is_in_command_mode = False
self.__temp_findname = ''
self.__temp_find_filename = '' # Ahh..
self.__clicked_file = None
self.__pre_clicked_file = None
self.__index_of_clicked_file = None
self.__pre_hov = None
self.__count_selected = 0
self.position.iy = 0


def open(self, directory, suffixes=[], sort_by=None, _with=None):
"""
`open()` is `load_files()` + `draw()`
Expand All @@ -330,21 +348,7 @@ def open(self, directory, suffixes=[], sort_by=None, _with=None):
open_with = TUIFIProfiles.get(prof, DEFAULT_PROFILE).open_with
return self.__try_open_with(directory, open_with, multiple) # TODO: check if the multiple selected files are folders and open them in new tabs

if self.vim_mode and self.escape_event_consumed and not self.is_in_command_mode: # SuS SuS SuS SuS SuS damn that's so Sus lol
self.find()
else:
self.is_in_find_mode = False
self.escape_event_consumed = False
self.__change_escape_event_consumed = False
self.is_in_command_mode = False
self.__temp_findname = ''
self.__temp_find_filename = '' # Ahh..
self.__clicked_file = None
self.__pre_clicked_file = None
self.__index_of_clicked_file = None
self.__pre_hov = None
self.__count_selected = 0
self.position.iy = 0
self.__reset_open()
self.load_files(directory, suffixes, sort_by)
self.draw()
return self.files
Expand Down

0 comments on commit 511f696

Please sign in to comment.