summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpazz <patricktotzke@gmail.com>2011-07-15 11:05:39 +0100
committerpazz <patricktotzke@gmail.com>2011-07-15 11:05:39 +0100
commit4b6fbded970444e2b130d4a44e9d0853a7c5ec74 (patch)
treea03a4fbe9fb75dc05f0075c9b15ffadf5923d9ba
parentb6959446fb66905efe5991179711c029e66197b2 (diff)
unicode prompts
urwid.Edit().get_text() converts input to unicode iff its text arg was a unicode obj. partly fixes issue #46
-rw-r--r--alot/ui.py2
-rw-r--r--alot/widgets.py4
2 files changed, 4 insertions, 2 deletions
diff --git a/alot/ui.py b/alot/ui.py
index 0a1bc713..56bafb85 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -77,7 +77,7 @@ class UI:
"""
raise urwid.ExitMainLoop()
- def prompt(self, prefix='>', text='', completer=None):
+ def prompt(self, prefix='>', text=u'', completer=None):
self.logger.info('open prompt')
prefix_widget = PromptWidget(prefix, text, completer)
diff --git a/alot/widgets.py b/alot/widgets.py
index a95ad1da..bee616fc 100644
--- a/alot/widgets.py
+++ b/alot/widgets.py
@@ -129,9 +129,11 @@ class TagWidget(urwid.Text):
class PromptWidget(urwid.AttrMap):
- def __init__(self, prefix, text='', completer=None):
+ def __init__(self, prefix, text=u'', completer=None):
self.completer = completer
leftpart = urwid.Text(prefix, align='left')
+ if not isinstance(text,unicode):
+ text = unicode(text, errors='replace')
self.editpart = urwid.Edit(edit_text=text)
self.start_completion_pos = len(text)
self.completion_results = None