From d0e56912638b2a90bb960574ceb5c0bbbf415aca Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 17 May 2010 18:52:51 +0200 Subject: utf: partial fix of console width overflow handling --- ranger/gui/widgets/console.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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]) -- cgit 1.4.1-2-gfad0 s='active' href='/andinus/cetus/tree/cache/getdir_darwin.go?h=v0.6.6&id=4dcdf6a3cd8193e51e0cfb12cbeaaa8abdaa6f00'>tree commit diff stats
path: root/cache/getdir_darwin.go
blob: 733e94ef722b869373f0c052094749fd80de5470 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23