summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorA. Lopes <ajtluser@openmailbox.org>2015-06-10 22:04:06 +0100
committerA. Lopes <ajtluser@openmailbox.org>2015-06-10 22:04:06 +0100
commit9480940bbfd2a7631d358bc0dd8d2f32dc0b7714 (patch)
tree0641baf0ea21dbe91bd1ff4c07dd79f751b0fadb
parent1a5c0cb9a5409a6214797273b5398ef0e849cd63 (diff)
downloadranger-9480940bbfd2a7631d358bc0dd8d2f32dc0b7714.tar.gz
Fix for issue #259. If all the contents of the current folder are
hidden, now when the user toggle show_hidden, the topmost file or
directory is automatically selected. If the user toggles show_hidden,
hiding all files and folders those files can now not be interacted with.
-rw-r--r--ranger/container/directory.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/ranger/container/directory.py b/ranger/container/directory.py
index b851eece..52b494d5 100644
--- a/ranger/container/directory.py
+++ b/ranger/container/directory.py
@@ -229,6 +229,15 @@ class Directory(FileSystemObject, Accumulator, Loadable):
             filters.append(lambda file: temporary_filter_search(file.basename))
 
         self.files = [f for f in self.files_all if accept_file(f, filters)]
+        
+        # A fix for corner cases when the user invokes show_hidden on a
+        # directory that contains only hidden directories and hidden files.
+        if self.files and not self.pointed_obj:
+            self.pointed_obj = self.files[0]
+        elif not self.files:
+            self.content_loaded = False
+            self.pointed_obj = None
+
         self.move_to_obj(self.pointed_obj)
 
     # XXX: Check for possible race conditions