about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/actions.py15
-rw-r--r--ranger/gui/ui.py6
2 files changed, 9 insertions, 12 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 438b85e6..1816867b 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -480,10 +480,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
     # --------------------------
 
     def pager_move(self, narg=None, **kw):
-        if self.ui.pager.visible:
-            self.ui.pager.move(narg=narg, **kw)
-        if self.ui.browser.pager.visible:
-            self.ui.browser.pager.move(narg=narg, **kw)
+        self.ui.get_pager().move(narg=narg, **kw)
 
     def taskview_move(self, narg=None, **kw):
         self.ui.taskview.move(narg=narg, **kw)
@@ -795,10 +792,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
             return False
 
     def get_preview(self, file, width, height):
-        if self.ui.pager.visible:
-            pager = self.ui.pager
-        else:
-            pager = self.ui.browser.pager
+        pager = self.ui.get_pager()
         path = file.realpath
 
         if self.settings.preview_images and file.image:
@@ -872,10 +866,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
                     if self.thisfile and self.thisfile.realpath == path:
                         self.ui.browser.need_redraw = True
                     data['loading'] = False
-                    if self.ui.pager.visible:
-                        pager = self.ui.pager
-                    else:
-                        pager = self.ui.browser.pager
+                    pager = self.ui.get_pager()
                     if self.thisfile and self.thisfile.is_file:
                         pager.set_source(self.thisfile.get_preview_source(
                             pager.wid, pager.hei))
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index 145e57c5..83b324e3 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -378,3 +378,9 @@ class UI(DisplayableContainer):
 
     def hint(self, text=None):
         self.status.hint = text
+
+    def get_pager(self):
+        if self.browser.pager.visible:
+            return self.browser.pager
+        else:
+            return self.pager