summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authornfnty <git@nfnty.se>2017-02-03 19:40:05 +0100
committernfnty <git@nfnty.se>2017-02-03 19:40:05 +0100
commitc210af0d0b40a9e2c9151d81bbf3e5ee34047a58 (patch)
tree36ed5552f30f52b7f4a457fbab2503463ffed963 /ranger
parentb7a7623934574f0f9c566d452c18b53f707dfdd8 (diff)
downloadranger-c210af0d0b40a9e2c9151d81bbf3e5ee34047a58.tar.gz
gui.widgets.browsercolumn: Redraw if file is outdated
Fixes #93
Diffstat (limited to 'ranger')
-rw-r--r--ranger/container/fsobject.py5
-rw-r--r--ranger/gui/widgets/browsercolumn.py27
2 files changed, 21 insertions, 11 deletions
diff --git a/ranger/container/fsobject.py b/ranger/container/fsobject.py
index 37603c0c..22e380fc 100644
--- a/ranger/container/fsobject.py
+++ b/ranger/container/fsobject.py
@@ -8,6 +8,8 @@ from grp import getgrgid
 from os import lstat, stat
 from os.path import abspath, basename, dirname, realpath, splitext, extsep, relpath
 from pwd import getpwuid
+from time import time
+
 from ranger.core.linemode import (
     DEFAULT_LINEMODE, DefaultLinemode, TitleLinemode,
     PermissionsLinemode, FileInfoLinemode, MtimeLinemode, SizeMtimeLinemode,
@@ -84,6 +86,8 @@ class FileSystemObject(  # pylint: disable=too-many-instance-attributes
 
     size = 0
 
+    last_load_time = -1
+
     vcsstatus = None
     vcsremotestatus = None
 
@@ -318,6 +322,7 @@ class FileSystemObject(  # pylint: disable=too-many-instance-attributes
             self.infostring = '->' + self.infostring
 
         self.stat = new_stat
+        self.last_load_time = time()
 
     def get_permission_string(self):
         if self.permissions is not None:
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index 28160265..89908979 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -144,19 +144,24 @@ class BrowserColumn(Pager):  # pylint: disable=too-many-instance-attributes
             self.need_redraw = True
             self.old_dir = self.target
 
-        if self.target:     # don't garbage collect this directory please
+        if self.target:
             self.target.use()
 
-        if self.target and self.target.is_directory \
-                and (self.level <= 0 or self.settings.preview_directories):
-            if self.target.pointed_obj != self.old_thisfile:
-                self.need_redraw = True
-                self.old_thisfile = self.target.pointed_obj
-
-            if self.target.load_content_if_outdated() \
-                    or self.target.sort_if_outdated() \
-                    or self.last_redraw_time < self.target.last_update_time:
-                self.need_redraw = True
+            if self.target.is_directory and (self.level <= 0 or self.settings.preview_directories):
+                if self.target.pointed_obj != self.old_thisfile:
+                    self.need_redraw = True
+                    self.old_thisfile = self.target.pointed_obj
+
+                if self.target.load_content_if_outdated() or \
+                        self.target.sort_if_outdated() or \
+                        self.last_redraw_time < self.target.last_update_time or \
+                        self.target.pointed_obj.load_if_outdated() or \
+                        self.last_redraw_time < self.target.pointed_obj.last_load_time:
+                    self.need_redraw = True
+            else:
+                if self.target.load_if_outdated() or \
+                        self.last_redraw_time < self.target.last_load_time:
+                    self.need_redraw = True
 
         if self.need_redraw:
             self.win.erase()