diff options
author | nfnty <git@nfnty.se> | 2015-12-21 00:56:09 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2016-02-08 04:43:04 +0100 |
commit | 5374beaf5f5022a33889a7ebfa00fa9aaa07f670 (patch) | |
tree | f4978e0b0fbe1df5ed5a83c195031518e5483e7e /ranger | |
parent | 89a97553f9175ba6b007c594eb6f25a9310583cc (diff) | |
download | ranger-5374beaf5f5022a33889a7ebfa00fa9aaa07f670.tar.gz |
VCS: Improve repodir detection
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/ext/vcs/vcs.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/ranger/ext/vcs/vcs.py b/ranger/ext/vcs/vcs.py index fbcfc9c4..1c62afe7 100644 --- a/ranger/ext/vcs/vcs.py +++ b/ranger/ext/vcs/vcs.py @@ -345,6 +345,18 @@ class VcsThread(threading.Thread): return True return False + def _targeted_directory_rightmost(self): + """Return rightmost targeted directory""" + target = self.ui.browser.columns[-1].target + if target: + if target.is_directory: + return target + else: + target = self.ui.browser.columns[-2].target + if target and target.is_directory: + return target + return None + def run(self): roots = set() # already updated roots redraw = False @@ -354,6 +366,11 @@ class VcsThread(threading.Thread): self.wake.clear() continue + # Exclude root if repodir in the rightmost column (causes strobing) + target = self._targeted_directory_rightmost() + if target and target.vcs and target.vcs.in_repodir: + roots.add(target.vcs.root) + for column in self.ui.browser.columns: target = column.target if target and target.is_directory and target.vcs: @@ -362,12 +379,6 @@ class VcsThread(threading.Thread): redraw = True if target.vcs.track and target.vcs.root not in roots: roots.add(target.vcs.root) - # Do not update repo when repodir is displayed (causes strobing) - if tuple(clmn for clmn in self.ui.browser.columns - if clmn.target - and (clmn.target.path == target.vcs.repodir or - clmn.target.path.startswith(target.vcs.repodir + '/'))): - continue lazy = target.vcs.REPOTYPES[target.vcs.repotype]['lazy'] if (target.vcs.rootvcs.status_subpaths is None \ or (lazy and target.vcs.check_outdated()) \ @@ -375,6 +386,7 @@ class VcsThread(threading.Thread): and target.vcs.update_root(): target.vcs.update_tree() redraw = True + roots.clear() if redraw: redraw = False @@ -385,7 +397,6 @@ class VcsThread(threading.Thread): if self.wake.is_set(): self.ui.redraw() - roots.clear() self.wake.clear() self.wake.wait(timeout=self.delay) |