summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--doc/ranger.pod7
-rw-r--r--ranger/config/commands.py7
2 files changed, 12 insertions, 2 deletions
diff --git a/doc/ranger.pod b/doc/ranger.pod
index 370bbb85..eb13d2b8 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -818,6 +818,7 @@ ranger.  For your convenience, this is a list of the "public" commands including
  eval [-q] python_code
  filter [string]
  find pattern
+ flat level
  grep pattern
  load_copy_buffer
  map key command
@@ -963,6 +964,12 @@ be run immediately. (Or entered, if it's a directory.)
 
 This command is based on the I<scout> command and supports all of its options.
 
+=item flat level
+
+Flattens the directory view up to the specified level. Level -1 means infinite
+level. Level 0 means standard view without flattened directory view. Level
+values -2 and less are invalid.
+
 =item grep I<pattern>
 
 Looks for a string in all marked files or directories.
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 953e2cc3..b0089e59 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -1266,9 +1266,10 @@ class flat(Command):
     """
     :flat <level>
 
-    Flattens the directory view up to level specified.
+    Flattens the directory view up to the specified level.
+
         -1 fully flattened
-        0  remove flattened view
+         0 remove flattened view
     """
 
     def execute(self):
@@ -1277,6 +1278,8 @@ class flat(Command):
             level = int(level)
         except ValueError:
             level = self.quantifier
+        if level < -1:
+            self.fm.notify("Need an integer number (-1, 0, 1, ...)", bad=True)
         self.fm.thisdir.unload()
         self.fm.thisdir.flat = level
         self.fm.thisdir.load_content()