summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-12-18 16:30:50 +0100
committerhut <hut@lavabit.com>2010-12-18 16:30:50 +0100
commit32944f0554eafe0b091967a7669bf25d704f68bb (patch)
tree33576ac645159115249990f1d31292c0d0cbcaaa
parentea45cca99102e2c0c2629c7129b2970e8a85a5fe (diff)
downloadranger-32944f0554eafe0b091967a7669bf25d704f68bb.tar.gz
core.actions: Fixed get_preview()
Previews didn't show up when pressing i on the first time, you had to
preview twice.
-rw-r--r--ranger/core/actions.py2
-rw-r--r--ranger/gui/widgets/pager.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 75f85baf..473701cb 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -620,6 +620,8 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 					if self.env.cf.realpath == path:
 						self.ui.browser.need_redraw = True
 					data['loading'] = False
+					pager = self.ui.browser.pager
+					pager.set_source(self.env.cf.get_preview_source(pager.wid, pager.hei))
 				def on_destroy(signal):
 					try:
 						del self.previews[path]
diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py
index 196db499..bff30c55 100644
--- a/ranger/gui/widgets/pager.py
+++ b/ranger/gui/widgets/pager.py
@@ -169,19 +169,18 @@ class Pager(Widget):
 
 		if isinstance(source, str):
 			self.source_is_stream = False
-			self.markup = 'ansi'
 			self.lines = source.splitlines()
 		elif hasattr(source, '__getitem__'):
 			self.source_is_stream = False
 			self.lines = source
 		elif hasattr(source, 'readline'):
 			self.source_is_stream = True
-			self.markup = 'ansi'
 			self.lines = []
 		else:
 			self.source = None
 			self.source_is_stream = False
 			return False
+		self.markup = 'ansi'
 
 		if not self.source_is_stream and strip:
 			self.lines = map(lambda x: x.strip(), self.lines)