From 32944f0554eafe0b091967a7669bf25d704f68bb Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 18 Dec 2010 16:30:50 +0100 Subject: core.actions: Fixed get_preview() Previews didn't show up when pressing i on the first time, you had to preview twice. --- ranger/core/actions.py | 2 ++ ranger/gui/widgets/pager.py | 3 +-- 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) -- cgit 1.4.1-2-gfad0