summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorNikolay Puzanov <punzik@gmail.com>2013-12-03 14:58:59 +0400
committerNikolay Puzanov <punzik@gmail.com>2013-12-03 14:58:59 +0400
commit23345a7875357405c774d47335322aee933692c0 (patch)
tree9bda7cd311b3ed75aa4641a3356feddfe4ac750c /ranger
parent792406e7fcb83d7caf17fbaccff11d4755fa9be9 (diff)
downloadranger-23345a7875357405c774d47335322aee933692c0.tar.gz
Add preview_max_size option.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/container/file.py2
-rw-r--r--ranger/container/settings.py1
2 files changed, 3 insertions, 0 deletions
diff --git a/ranger/container/file.py b/ranger/container/file.py
index 7c11dc63..3205ce61 100644
--- a/ranger/container/file.py
+++ b/ranger/container/file.py
@@ -68,6 +68,8 @@ class File(FileSystemObject):
             return False
         if not self.accessible:
             return False
+        if self.size > self.fm.settings.preview_max_size:
+            return False
         if self.fm.settings.preview_script and \
                 self.fm.settings.use_preview_script:
             return True
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index 58ddffc9..29e6d729 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -31,6 +31,7 @@ ALLOWED_SETTINGS = {
     'preview_files': bool,
     'preview_images': bool,
     'preview_script': (str, type(None)),
+    'preview_max_size': int,
     'save_console_history': bool,
     'scroll_offset': int,
     'shorten_title': int,