summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--TODO3
-rw-r--r--ranger/defaults/options.py3
-rw-r--r--ranger/gui/widgets/browsercolumn.py4
-rw-r--r--ranger/shared/settings.py1
4 files changed, 9 insertions, 2 deletions
diff --git a/TODO b/TODO
index 78aaeb97..bbf59c37 100644
--- a/TODO
+++ b/TODO
@@ -44,7 +44,8 @@ General
    ( ) #57  10/01/30  warn before deleting unseen marked files
    (X) #58  10/02/04  change the title of the terminal
    (X) #61  10/02/09  show sum of size of marked files
-   ( ) #63  10/02/15  limit filesize in previews
+   (X) #63  10/02/15  limit filesize in previews
+   ( ) #64  10/02/25  scroll in previews
 
 
 Bugs
diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py
index 1f564eb0..6a1ae862 100644
--- a/ranger/defaults/options.py
+++ b/ranger/defaults/options.py
@@ -6,9 +6,12 @@ intact and the type of the value stays the same.
 
 from ranger.api.options import *
 
+one_kb = 1024
+
 colorscheme = colorschemes.default
 
 max_history_size = 20
+max_filesize_for_preview = 300 * one_kb
 scroll_offset = 2
 preview_files = True
 flushinput = True
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index 956fd301..b07d86ed 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -137,8 +137,10 @@ class BrowserColumn(Pager, Widget):
 			self.last_redraw_time = time()
 
 	def _preview_this_file(self, target):
+		maxsize = self.settings.max_filesize_for_preview
 		return self.settings.preview_files \
-				and not PREVIEW_BLACKLIST.search(target.basename)
+				and not PREVIEW_BLACKLIST.search(target.basename) \
+				and (maxsize is None or maxsize >= target.size)
 
 	def _draw_file(self):
 		"""Draw a preview of the file, if the settings allow it"""
diff --git a/ranger/shared/settings.py b/ranger/shared/settings.py
index 4ae97e03..152dfbd1 100644
--- a/ranger/shared/settings.py
+++ b/ranger/shared/settings.py
@@ -19,6 +19,7 @@ preview_files max_history_size colorscheme
 collapse_preview update_title
 hidden_filter flushinput
 autosave_bookmarks
+max_filesize_for_preview
 """.split()
 
 # -- globalize the settings --
#fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
getwtxt
*.log
local/
*.db/
*.db