diff options
-rw-r--r-- | ranger/gui/widgets/titlebar.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py index fc2b9dae..d87a0803 100644 --- a/ranger/gui/widgets/titlebar.py +++ b/ranger/gui/widgets/titlebar.py @@ -144,10 +144,16 @@ class TitleBar(Widget): bar.addright(tabtext, 'tab', clr, fixed=True) def _get_tab_text(self, tabname): + result = ' ' + str(tabname) if self.settings.dirname_in_tabs: - return ' ' + str(tabname) + ":" + (basename(self.fm.tabs[tabname]) or '/') - else: - return ' ' + str(tabname) + dirname = basename(self.fm.tabs[tabname]) + if not dirname: + result += ":/" + elif len(dirname) > 15: + result += ":" + dirname[:14] + "~" + else: + result += ":" + dirname + return result def _print_result(self, result): self.win.move(0, 0) |