summary refs log tree commit diff stats
path: root/ranger/gui/widgets/browsercolumn.py
diff options
context:
space:
mode:
Diffstat (limited to 'ranger/gui/widgets/browsercolumn.py')
-rw-r--r--ranger/gui/widgets/browsercolumn.py35
1 files changed, 26 insertions, 9 deletions
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index 07830b31..129d8486 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -27,7 +27,7 @@ class BrowserColumn(Pager):
     old_dir = None
     old_thisfile = None
 
-    def __init__(self, win, level):
+    def __init__(self, win, level, tab=None):
         """Initializes a Browser Column Widget
 
         win = the curses window object of the BrowserView
@@ -40,6 +40,7 @@ class BrowserColumn(Pager):
         Pager.__init__(self, win)
         Widget.__init__(self, win)
         self.level = level
+        self.tab = tab
         self.original_level = level
 
         self.settings.signal_bind('setopt.display_size_in_main_column',
@@ -48,9 +49,6 @@ class BrowserColumn(Pager):
     def request_redraw(self):
         self.need_redraw = True
 
-    def resize(self, y, x, hei, wid):
-        Widget.resize(self, y, x, hei, wid)
-
     def click(self, event):
         """Handle a MouseEvent"""
         direction = event.mouse_wheel_direction()
@@ -132,7 +130,11 @@ class BrowserColumn(Pager):
 
     def poke(self):
         Widget.poke(self)
-        self.target = self.fm.thistab.at_level(self.level)
+        if self.tab is None:
+            tab = self.fm.thistab
+        else:
+            tab = self.tab
+        self.target = tab.at_level(self.level)
 
     def draw(self):
         """Call either _draw_file() or _draw_directory()"""
@@ -201,6 +203,15 @@ class BrowserColumn(Pager):
 
         base_color = ['in_browser']
 
+        if self.fm.ui.viewmode == 'multipane' and self.tab is not None:
+            active_pane = self.tab == self.fm.thistab
+            if active_pane:
+                base_color.append('active_pane')
+            else:
+                base_color.append('inactive_pane')
+        else:
+            active_pane = False
+
         self.win.move(0, 0)
 
         if not self.target.content_loaded:
@@ -228,7 +239,7 @@ class BrowserColumn(Pager):
 
         copied = [f.path for f in self.fm.copy_buffer]
 
-        selected_i = self.target.pointer
+        selected_i = self._get_index_of_selected_file()
         for line in range(self.hei):
             i = line + self.scroll_begin
             if line > self.hei:
@@ -258,7 +269,7 @@ class BrowserColumn(Pager):
             key = (self.wid, selected_i == i, drawn.marked, self.main_column,
                    drawn.path in copied, tagged_marker, drawn.infostring,
                    drawn.vcsstatus, drawn.vcsremotestatus, self.target.has_vcschild,
-                   self.fm.do_cut, current_linemode.name, metakey)
+                   self.fm.do_cut, current_linemode.name, metakey, active_pane)
 
             if key in drawn.display_data:
                 self.execute_curses_batch(line, drawn.display_data[key])
@@ -336,6 +347,12 @@ class BrowserColumn(Pager):
             self.execute_curses_batch(line, display_data)
             self.color_reset()
 
+    def _get_index_of_selected_file(self):
+        if self.fm.ui.viewmode == 'multipane' and hasattr(self, 'tab'):
+            return self.tab.pointer
+        else:
+            return self.target.pointer
+
     def _total_len(self, predisplay):
         return sum([len(WideString(s)) for s, L in predisplay])
 
@@ -391,7 +408,7 @@ class BrowserColumn(Pager):
 
     def _draw_directory_color(self, i, drawn, copied):
         this_color = []
-        if i == self.target.pointer:
+        if i == self._get_index_of_selected_file():
             this_color.append('selected')
 
         if drawn.marked:
@@ -431,7 +448,7 @@ class BrowserColumn(Pager):
         dirsize = len(self.target)
         winsize = self.hei
         halfwinsize = winsize // 2
-        index = self.target.pointer or 0
+        index = self._get_index_of_selected_file() or 0
         original = self.target.scroll_begin
         projected = index - original