about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-05-17 18:52:51 +0200
committerhut <hut@lavabit.com>2010-05-17 18:52:51 +0200
commitd0e56912638b2a90bb960574ceb5c0bbbf415aca (patch)
tree129657d830485f9c49c0db19860fc18e07fec0ee
parent637fc4a1011b0f8b66ee213de1a1c3343d1bad0e (diff)
downloadranger-d0e56912638b2a90bb960574ceb5c0bbbf415aca.tar.gz
utf: partial fix of console width overflow handling
-rw-r--r--ranger/gui/widgets/console.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index 48116187..3bb41482 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -99,8 +99,9 @@ class Console(Widget):
 
 		self.win.erase()
 		self.addstr(0, 0, self.prompt)
-		overflow = -self.wid + len(self.prompt) + len(self.line) + 1
+		overflow = -self.wid + len(self.prompt) + uwid(self.line) + 1
 		if overflow > 0: 
+			#XXX: cut uft-char-wise, consider width
 			self.addstr(self.line[overflow:])
 		else:
 			self.addstr(self.line)
@@ -223,6 +224,7 @@ class Console(Widget):
 	def move(self, **keywords):
 		direction = Direction(keywords)
 		if direction.horizontal():
+			# Ensure that the pointer is moved utf-char-wise
 			uc = uchars(self.line)
 			upos = len(uchars(self.line[:self.pos]))
 			newupos = direction.move(
@@ -268,6 +270,7 @@ class Console(Widget):
 			if not self.line:
 				self.close()
 			return
+		# Delete utf-char-wise
 		uc = uchars(self.line)
 		upos = len(uchars(self.line[:self.pos])) + mod
 		left_part = ''.join(uc[:upos])