From d51092f2a499e559e47c6dbcfa829055ac1348a4 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Mon, 22 Aug 2011 22:47:37 +0100 Subject: fix issue #10 --- alot/widgets.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'alot/widgets.py') diff --git a/alot/widgets.py b/alot/widgets.py index 690c6260..9d295cc2 100644 --- a/alot/widgets.py +++ b/alot/widgets.py @@ -139,15 +139,16 @@ class TagWidget(urwid.AttrMap): def __init__(self, tag): self.tag = tag self.translated = config.get('tag translate', tag, fallback=tag) - # encode to utf-8 before passing to urwid (issue #4) self.translated = self.translated.encode('utf-8') - txt = urwid.Text(self.translated, wrap='clip') + self.txt = urwid.Text(self.translated, wrap='clip') normal = config.get_tagattr(tag) focus = config.get_tagattr(tag, focus=True) - urwid.AttrMap.__init__(self, txt, normal, focus) + urwid.AttrMap.__init__(self, self.txt, normal, focus) - def len(self): - return len(self.translated) + def width(self): + # evil voodoo hotfix for double width chars that may + # lead e.g. to strings with length 1 that need width 2 + return self.txt.pack()[0] def selectable(self): return True -- cgit v1.2.3 From aa4ff122194467b311fc972d6c71ea4bc98d4604 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Tue, 23 Aug 2011 09:19:46 +0100 Subject: fix: forgot to rename method --- alot/widgets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'alot/widgets.py') diff --git a/alot/widgets.py b/alot/widgets.py index 9d295cc2..a209a513 100644 --- a/alot/widgets.py +++ b/alot/widgets.py @@ -59,7 +59,7 @@ class ThreadlineWidget(urwid.AttrMap): for tag in tags: tw = TagWidget(tag) self.tag_widgets.append(tw) - cols.append(('fixed', tw.len(), tw)) + cols.append(('fixed', tw.width(), tw)) authors = self.thread.get_authors() or '(None)' maxlength = config.getint('general', 'authors_maxlength') -- cgit v1.2.3 From d9d8d4b02d84323a5568e90db38de39ba753f27a Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Wed, 24 Aug 2011 10:54:59 +0100 Subject: better use of screenspace in long header values --- alot/widgets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'alot/widgets.py') diff --git a/alot/widgets.py b/alot/widgets.py index a209a513..c56d5af6 100644 --- a/alot/widgets.py +++ b/alot/widgets.py @@ -443,8 +443,8 @@ class MessageHeaderWidget(urwid.AttrMap): else: value = value + v #sanitize it a bit: - value = value.replace('\t', '') - value = value.replace('\r', '') + value = value.replace('\t', ' ') + value = ' '.join([line.strip() for line in value.splitlines()]) keyw = ('fixed', max_key_len + 1, urwid.Text(('message_header_key', key))) valuew = urwid.Text(('message_header_value', value)) -- cgit v1.2.3 From afcbc8cfeac580484300ca486ca8f165d2f7f4d2 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Thu, 25 Aug 2011 22:58:05 +0100 Subject: rename "tag translate" section to "tag-translate" --- alot/widgets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'alot/widgets.py') diff --git a/alot/widgets.py b/alot/widgets.py index c56d5af6..2b811146 100644 --- a/alot/widgets.py +++ b/alot/widgets.py @@ -138,7 +138,7 @@ class BufferlineWidget(urwid.Text): class TagWidget(urwid.AttrMap): def __init__(self, tag): self.tag = tag - self.translated = config.get('tag translate', tag, fallback=tag) + self.translated = config.get('tag-translate', tag, fallback=tag) self.translated = self.translated.encode('utf-8') self.txt = urwid.Text(self.translated, wrap='clip') normal = config.get_tagattr(tag) -- cgit v1.2.3