diff options
-rw-r--r-- | ranger/container/directory.py | 19 | ||||
-rw-r--r-- | ranger/container/fsobject.py | 6 | ||||
-rw-r--r-- | ranger/ext/vcs/vcs.py | 15 |
3 files changed, 26 insertions, 14 deletions
diff --git a/ranger/container/directory.py b/ranger/container/directory.py index c96633b9..a31d4ec9 100644 --- a/ranger/container/directory.py +++ b/ranger/container/directory.py @@ -323,17 +323,20 @@ class Directory(FileSystemObject, Accumulator, Loadable): stats = None is_a_dir = False if is_a_dir: - if self.flat: + try: + item = self.fm.get_directory(name) + item.load_if_outdated() + except: item = Directory(name, preload=stats, path_is_abs=True, - basename_is_rel_to=basename_is_rel_to) + basename_is_rel_to=basename_is_rel_to) item.load() else: - try: - item = self.fm.get_directory(name) - item.load_if_outdated() - except: - item = Directory(name, preload=stats, path_is_abs=True) - item.load() + if self.flat: + item.relative_path = os.path.relpath(item.path, self.path) + else: + item.relative_path = item.basename + item.relative_path_lower = item.relative_path.lower() + if item.vcs and item.vcs.track: if item.vcs.is_root: self.has_vcschild = True diff --git a/ranger/container/fsobject.py b/ranger/container/fsobject.py index 1a33f1c4..c2a8004c 100644 --- a/ranger/container/fsobject.py +++ b/ranger/container/fsobject.py @@ -75,8 +75,6 @@ class FileSystemObject(FileManagerAware, SettingsAware): vcspathstatus = None - basename_is_rel_to = None - _linemode = DEFAULT_LINEMODE linemode_dict = dict( (linemode.name, linemode()) for linemode in @@ -87,12 +85,10 @@ class FileSystemObject(FileManagerAware, SettingsAware): if not path_is_abs: path = abspath(path) self.path = path - self.basename_is_rel_to = basename_is_rel_to + self.basename = basename(path) if basename_is_rel_to == None: - self.basename = basename(path) self.relative_path = self.basename else: - self.basename = basename(path) self.relative_path = relpath(path, basename_is_rel_to) self.relative_path_lower = self.relative_path.lower() self.extension = splitext(self.basename)[1].lstrip(extsep) or None diff --git a/ranger/ext/vcs/vcs.py b/ranger/ext/vcs/vcs.py index 6cb4809d..2815916a 100644 --- a/ranger/ext/vcs/vcs.py +++ b/ranger/ext/vcs/vcs.py @@ -360,11 +360,23 @@ class VcsThread(threading.Thread): self.delay = idle_delay / 1000 self.wake = threading.Event() + def _is_flat(self): + """Check for flat mode""" + for column in self.ui.browser.columns: + if column.target and column.target.is_directory and column.target.flat: + return True + return False + def run(self): # Set for already updated roots roots = set() redraw = False while True: + if self._is_flat(): + self.wake.wait(timeout=self.delay) + self.wake.clear() + continue + for column in self.ui.browser.columns: target = column.target if target and target.is_directory and target.vcs: @@ -382,6 +394,7 @@ class VcsThread(threading.Thread): target.vcs.update_root() target.vcs.update_tree() redraw = True + if redraw: redraw = False for column in self.ui.browser.columns: @@ -389,8 +402,8 @@ class VcsThread(threading.Thread): column.need_redraw = True self.ui.status.need_redraw = True self.ui.redraw() - roots.clear() + roots.clear() self.wake.wait(timeout=self.delay) self.wake.clear() |