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-03-14 15:58:27 +0100
commit34fe9997beb32d40f7419e89321b75db6d5ae65d (patch)
tree781782e9200803b8bb01f94ffd210f320c85d364
parent87b0d82e736f0ee64220be44b9d9875af00824c4 (diff)
downloadranger-34fe9997beb32d40f7419e89321b75db6d5ae65d.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):