summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-10-04 21:52:46 +0200
committerhut <hut@lavabit.com>2010-10-04 21:52:46 +0200
commit70cd83bb27d6b4a3236af0f2c922fb1975af342a (patch)
treeb8cd80cf5a91377987db668121c8c0a7fc78a553 /ranger
parentb514d28d25e24c674058342e61bd6678ba24c21f (diff)
downloadranger-70cd83bb27d6b4a3236af0f2c922fb1975af342a.tar.gz
gui.widgets.titlebar: truncate dirnames in tab titles
Diffstat (limited to 'ranger')
-rw-r--r--ranger/gui/widgets/titlebar.py12
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)
/a> 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218