about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-10-05 13:31:21 +0200
committerhut <hut@lavabit.com>2011-10-05 13:31:47 +0200
commit3da2e57f2f10b95d136da88e2a42bfd90d40b0f4 (patch)
tree40bb28e231d815f33c9a8dc7932d1f6a2614cff9
parentf5a50c93ba163b7014bb0dd8f5635c1b9257a629 (diff)
downloadranger-3da2e57f2f10b95d136da88e2a42bfd90d40b0f4.tar.gz
widgets.console: Fixed drawing of wide characters
-rw-r--r--ranger/gui/widgets/console.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index d9141df8..2a7a34d3 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -24,7 +24,7 @@ from collections import deque
 
 from . import Widget
 from ranger.ext.direction import Direction
-from ranger.ext.widestring import uwid
+from ranger.ext.widestring import uwid, WideString
 from ranger.container import History
 from ranger.container.history import HistoryEmptyException
 import ranger
@@ -75,13 +75,10 @@ class Console(Widget):
 	def draw(self):
 		self.win.erase()
 		self.addstr(0, 0, self.prompt)
-		if self.fm.py3:
-			overflow = -self.wid + len(self.prompt) + len(self.line) + 1
-		else:
-			overflow = -self.wid + len(self.prompt) + uwid(self.line) + 1
+		line = WideString(self.line)
+		overflow = -self.wid + len(self.prompt) + len(line) + 1
 		if overflow > 0: 
-			#XXX: cut uft-char-wise, consider width
-			self.addstr(self.line[overflow:])
+			self.addstr(str(line[overflow:]))
 		else:
 			self.addstr(self.line)