summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-01-15 03:34:31 +0100
committerhut <hut@lavabit.com>2012-01-15 03:34:56 +0100
commit1cc4c0e4c2a022d64dac2d380729ffacb2cfa31c (patch)
tree9bfe68718b280420b3689daaf03f8670bbffdf2e
parenta110af2a538104dd909e4766dd1c0044b804dbdc (diff)
downloadranger-1cc4c0e4c2a022d64dac2d380729ffacb2cfa31c.tar.gz
gui.ui: Fix title drawing. Since when is this broken anyway?!
-rw-r--r--ranger/gui/ui.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index 064d4a16..5599190d 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -21,7 +21,6 @@ import _curses
 from .displayable import DisplayableContainer
 from .mouse_event import MouseEvent
 from ranger.ext.keybinding_parser import ALT_KEY
-from ranger.fsobject.fsobject import safe_path
 
 TERMINALS_WITH_TITLE = ("xterm", "xterm-256color", "rxvt",
 		"rxvt-256color", "rxvt-unicode", "aterm", "Eterm",
@@ -294,7 +293,10 @@ class UI(DisplayableContainer):
 				split = cwd.rsplit(os.sep, self.settings.shorten_title)
 				if os.sep in split[0]:
 					cwd = os.sep.join(split[1:])
-			sys.stdout.write("\033]2;ranger:" + safe_path(cwd) + "\007")
+			fixed_cwd = cwd.encode('utf-8', 'surrogateescape'). \
+					decode('utf-8', 'replace')
+			sys.stdout.write("\033]2;ranger:" + fixed_cwd + "\007")
+			sys.stdout.flush()
 		self.win.refresh()
 
 	def finalize(self):