diff options
author | Marcel Partap <mpartap@gmx.net> | 2015-04-09 13:19:48 +0200 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2015-10-20 13:26:52 +0200 |
commit | 60d5880785647a9c4c8fbee760fac4ef4179ec30 (patch) | |
tree | 5f6ebb3c6d64e3bf617e6c59e062e39cd11efd3e /ranger | |
parent | d0d07546e24eaaa1b666129b03f5493ad860eb74 (diff) | |
download | ranger-60d5880785647a9c4c8fbee760fac4ef4179ec30.tar.gz |
Show file extension for cut-off filenames. If still too long, trunca…
Somewhat goes against the code logic to let os.path.foo() operate on a "text" object, but.
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/gui/widgets/browsercolumn.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index b38d0b5b..0dc39a9b 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -7,6 +7,7 @@ import curses import stat from time import time +from os.path import splitext from . import Widget from .pager import Pager @@ -342,8 +343,12 @@ class BrowserColumn(Pager): def _draw_text_display(self, text, space): wtext = WideString(text) + wext = WideString(splitext(text)[1]) wellip = WideString(self.ellipsis[self.settings.unicode_ellipsis]) if len(wtext) > space: + wtext = wtext[:max(1, space - len(wext) - len(wellip))] + wellip + wext + # Truncate again if still too long. + if len(wtext) > space: wtext = wtext[:max(0, space - len(wellip))] + wellip return [[str(wtext), []]] |