summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-03-14 15:58:27 +0100
committerhut <hut@lavabit.com>2012-05-03 18:00:50 +0200
commit9fcef7132f7503498398ba13f2cda86be443be2f (patch)
tree781782e9200803b8bb01f94ffd210f320c85d364
parent27e5907532c6b44192015f08490f11bb75395e5d (diff)
downloadranger-9fcef7132f7503498398ba13f2cda86be443be2f.tar.gz
gui.ui: catch an exception with surrogates in "update title" code
-rw-r--r--ranger/gui/ui.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index e6c7d065..69b8463b 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -293,10 +293,13 @@ class UI(DisplayableContainer):
 				split = cwd.rsplit(os.sep, self.settings.shorten_title)
 				if os.sep in split[0]:
 					cwd = os.sep.join(split[1:])
-			fixed_cwd = cwd.encode('utf-8', 'surrogateescape'). \
-					decode('utf-8', 'replace')
-			sys.stdout.write("\033]2;ranger:" + fixed_cwd + "\007")
-			sys.stdout.flush()
+			try:
+				fixed_cwd = cwd.encode('utf-8', 'surrogateescape'). \
+						decode('utf-8', 'replace')
+				sys.stdout.write("\033]2;ranger:" + fixed_cwd + "\007")
+				sys.stdout.flush()
+			except:
+				pass
 		self.win.refresh()
 
 	def finalize(self):