about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2022-05-26 20:10:19 +0200
committertoonn <toonn@toonn.io>2022-05-26 23:42:28 +0200
commitc9cb40d86bcfb7cff6453d99ba0ed70356203b5c (patch)
tree407b7a94d4f58702e4e67e935d4b78696c42cf69
parent5db21cc02e10027bfc1148f85664c2c44b6b631d (diff)
downloadranger-c9cb40d86bcfb7cff6453d99ba0ed70356203b5c.tar.gz
browsercolumn: Remove off-by-one trailing space
The file size was always followed by a space in case it needed to be
separated from other trailing information but this should only happen if
anything actually follows it.
-rw-r--r--ranger/gui/widgets/browsercolumn.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index 14f68589..28e91922 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -374,15 +374,16 @@ class BrowserColumn(Pager):  # pylint: disable=too-many-instance-attributes
             try:
                 infostringdata = current_linemode.infostring(drawn, metadata)
                 if infostringdata:
-                    infostring.append([" " + infostringdata + " ",
+                    infostring.append([" " + infostringdata,
                                        ["infostring"]])
             except NotImplementedError:
                 infostring = self._draw_infostring_display(drawn, space)
             if infostring:
                 infostringlen = self._total_len(infostring)
                 if space - infostringlen > 2:
-                    predisplay_right = infostring + predisplay_right
-                    space -= infostringlen
+                    sep = [" ", []] if predisplay_right else []
+                    predisplay_right = infostring + sep + predisplay_right
+                    space -= infostringlen + len(sep)
 
             textstring = self._draw_text_display(text, space)
             textstringlen = self._total_len(textstring)
@@ -448,7 +449,7 @@ class BrowserColumn(Pager):  # pylint: disable=too-many-instance-attributes
         infostring_display = []
         if self.display_infostring and drawn.infostring \
                 and self.settings.display_size_in_main_column:
-            infostring = str(drawn.infostring) + " "
+            infostring = str(drawn.infostring)
             if len(infostring) <= space:
                 infostring_display.append([infostring, ['infostring']])
         return infostring_display