summary refs log tree commit diff stats
diff options
context:
space:
mode:
authornfnty <git@nfnty.se>2017-02-07 03:32:35 +0100
committernfnty <git@nfnty.se>2017-02-07 04:14:39 +0100
commit4cc68b8694e9dbedcc9b7a47bdab30182c5684d8 (patch)
tree4b355a5fb6c84f923826aea308f68e23518ed182
parent01ba7b58201ac2b6b6b9f80183cc2b90b7102714 (diff)
downloadranger-4cc68b8694e9dbedcc9b7a47bdab30182c5684d8.tar.gz
gui.widgets.titlebar.Titlebar: Fix right width logic
Fixes #563
-rw-r--r--ranger/gui/widgets/titlebar.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py
index 6f4a4cf1..ec2b4ab7 100644
--- a/ranger/gui/widgets/titlebar.py
+++ b/ranger/gui/widgets/titlebar.py
@@ -20,9 +20,9 @@ class TitleBar(Widget):
     old_keybuffer = None
     old_wid = None
     result = None
+    right_sumsize = 0
     throbber = ' '
     need_redraw = False
-    tab_width = 0
 
     def __init__(self, *args, **keywords):
         Widget.__init__(self, *args, **keywords)
@@ -43,7 +43,7 @@ class TitleBar(Widget):
         self._print_result(self.result)
         if self.wid > 2:
             self.color('in_titlebar', 'throbber')
-            self.addnstr(self.y, self.wid - 2 - self.tab_width, self.throbber, 1)
+            self.addnstr(self.y, self.wid - self.right_sumsize, self.throbber, 1)
 
     def click(self, event):
         """Handle a MouseEvent"""
@@ -86,6 +86,7 @@ class TitleBar(Widget):
             bar.shrink_from_the_left(self.wid)
         except ValueError:
             bar.shrink_by_removing(self.wid)
+        self.right_sumsize = bar.right.sumsize()
         self.result = bar.combine()
 
     def _get_left_part(self, bar):
@@ -124,13 +125,12 @@ class TitleBar(Widget):
         # TODO: fix that pressed keys are cut off when chaining CTRL keys
         kbuf = str(self.fm.ui.keybuffer)
         self.old_keybuffer = kbuf
+        bar.addright(' ', 'space', fixed=True)
         bar.addright(kbuf, 'keybuffer', fixed=True)
-        bar.addright('  ', 'space', fixed=True)
-        self.tab_width = 0
+        bar.addright(' ', 'space', fixed=True)
         if len(self.fm.tabs) > 1:
             for tabname in self.fm.get_tab_list():
                 tabtext = self._get_tab_text(tabname)
-                self.tab_width += len(tabtext)
                 clr = 'good' if tabname == self.fm.current_tab else 'bad'
                 bar.addright(tabtext, 'tab', clr, fixed=True)