summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-06-19 22:17:47 +0200
committerFlorent Le Coz <louiz@louiz.org>2013-06-19 22:19:17 +0200
commit0d7fedceeaae5e5e17c34e51a571bc52786252e4 (patch)
tree4f4d774630dd6703fb61e200fc951ebf6aa6da41 /src
parentcbe00072493d6947d399f5fdd19b352cf8645a64 (diff)
downloadpoezio-0d7fedceeaae5e5e17c34e51a571bc52786252e4.tar.gz
poezio-0d7fedceeaae5e5e17c34e51a571bc52786252e4.tar.bz2
poezio-0d7fedceeaae5e5e17c34e51a571bc52786252e4.tar.xz
poezio-0d7fedceeaae5e5e17c34e51a571bc52786252e4.zip
And actually use poopt.wcswidth to properly count the nicks' size
see #2142
Diffstat (limited to 'src')
-rw-r--r--src/windows.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/windows.py b/src/windows.py
index 27439c8e..1efa0fa2 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -28,7 +28,7 @@ from threading import RLock
from contact import Contact, Resource
from roster import RosterGroup
-from poopt import cut_text
+import poopt
from sleekxmpp import JID
from common import safeJID
@@ -877,7 +877,7 @@ class TextWin(Win):
nick = truncate_nick(message.nickname)
offset = 0
if nick:
- offset += wcwidth.wcswidth(nick) + 2 # + nick + '> ' length
+ offset += poopt.wcswidth(nick) + 2 # + nick + '> ' length
if message.revisions > 0:
offset += ceil(log10(message.revisions + 1))
if message.me:
@@ -889,7 +889,7 @@ class TextWin(Win):
offset += 1
if get_theme().CHAR_TIME_RIGHT and message.str_time:
offset += 1
- lines = cut_text(self.width-offset-1, txt)
+ lines = poopt.cut_text(self.width-offset-1, txt)
prepend = ''
attrs = []
for line in lines:
@@ -953,7 +953,7 @@ class TextWin(Win):
# Offset for the timestamp (if any) plus a space after it
(0 if not with_timestamps else (len(line.msg.str_time) + 1)) +
# Offset for the nickname (if any) plus a space and a > after it
- (0 if not line.msg.nickname else (len(truncate_nick(line.msg.nickname)) + (3 if line.msg.me else 2) + ceil(log10(line.msg.revisions + 1)))),
+ (0 if not line.msg.nickname else (poopt.wcswidth(truncate_nick(line.msg.nickname)) + (3 if line.msg.me else 2) + ceil(log10(line.msg.revisions + 1)))),
line.prepend+line.msg.txt[line.start_pos:line.end_pos])
if y != self.height-1:
self.addstr('\n')
@@ -1457,7 +1457,7 @@ class Input(Win):
(y, x) = self._win.getyx()
size = self.width-x
self.addnstr(' '*size, size, to_curses_attr(self.color))
- self.addstr(0, wcwidth.wcswidth(displayed_text[:self.pos]), '')
+ self.addstr(0, poopt.wcswidth(displayed_text[:self.pos]), '')
if self.color:
self._win.attroff(to_curses_attr(self.color))
self._refresh()
@@ -1586,7 +1586,7 @@ class HistoryInput(Input):
self.update_completed()
self.addstr(0, width, self.current_completed.ljust(width+1, ' '), to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
- self.addstr(0, wcwidth.wcswidth(displayed_text[:self.pos]) + text_pos, '')
+ self.addstr(0, poopt.wcswidth(displayed_text[:self.pos]) + text_pos, '')
if self.color:
self._win.attroff(to_curses_attr(self.color))
self._refresh()