diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-12 19:28:02 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-12 19:28:02 +0100 |
commit | 2aae5ed855f34784027f33aac182fafd19468a4a (patch) | |
tree | a6d75d06a52824114a83bd07986ac198d1aef667 /alot | |
parent | 41e98823363445826d6041ab87feb59a0f7c9ab1 (diff) | |
parent | db8a5c2d3466d3ad7b749c312e6bc019b087b29d (diff) |
Merge branch 'master' into commandrefactoring
Diffstat (limited to 'alot')
-rw-r--r-- | alot/command.py | 8 | ||||
-rw-r--r-- | alot/completion.py | 4 | ||||
-rw-r--r-- | alot/defaults/alot.rc | 8 | ||||
-rw-r--r-- | alot/helper.py | 5 | ||||
-rw-r--r-- | alot/ui.py | 23 |
5 files changed, 22 insertions, 26 deletions
diff --git a/alot/command.py b/alot/command.py index bd47a18b..34c1928a 100644 --- a/alot/command.py +++ b/alot/command.py @@ -186,8 +186,8 @@ class ExternalCommand(Command): if self.spawn: cmd = '%s %s' % (settings.config.get('general', 'terminal_cmd'), - cmd) - cmd = cmd.encode('ascii', errors='ignore') + cmd) + cmd = cmd.encode('utf-8', errors='ignore') ui.logger.info('calling external command: %s' % cmd) returncode = subprocess.call(shlex.split(cmd)) if returncode == 0: @@ -834,7 +834,7 @@ class OpenAttachmentCommand(Command): handler = settings.get_mime_handler(mimetype) if handler: path = self.attachment.save(tempfile.gettempdir()) - handler = handler.replace('\'%s\'', '{}') + handler = handler.replace('%s', '{}') def afterwards(): os.remove(path) @@ -991,7 +991,7 @@ class EnvelopeRefineCommand(Command): def apply(self, ui): mail = ui.current_buffer.get_email() - value = mail.get(self.key, '') + value = decode_header(mail.get(self.key, '')) ui.commandprompt('set %s %s' % (self.key, value)) diff --git a/alot/completion.py b/alot/completion.py index 686846a0..142bc1de 100644 --- a/alot/completion.py +++ b/alot/completion.py @@ -158,7 +158,7 @@ class CommandCompleter(Completer): #TODO refine <tab> should get current querystring commandprefix = original[:pos] logging.debug('original="%s" prefix="%s"' % (original, commandprefix)) - cmdlist = command.COMMANDS['global'] + cmdlist = command.COMMANDS['global'].copy() cmdlist.update(command.COMMANDS[self.mode]) matching = [t for t in cmdlist if t.startswith(commandprefix)] return [(t, len(t)) for t in matching] @@ -175,7 +175,7 @@ class CommandLineCompleter(Completer): self._querycompleter = QueryCompleter(dbman, accountman) self._tagscompleter = TagsCompleter(dbman) abooks = accountman.get_addressbooks() - self._contactscompleter = ContactsCompleter(abooks, addressesonly=True) + self._contactscompleter = ContactsCompleter(abooks) self._pathcompleter = PathCompleter() def complete(self, line, pos): diff --git a/alot/defaults/alot.rc b/alot/defaults/alot.rc index cae15711..63bf6ad9 100644 --- a/alot/defaults/alot.rc +++ b/alot/defaults/alot.rc @@ -87,14 +87,14 @@ colon = prompt [bufferlist-maps] x = closefocussed -enter = openfocussed +select = openfocussed [search-maps] a = toggletag inbox & = toggletag killed l = retagprompt O = refineprompt -enter = openthread +select = openthread | = refineprompt [envelope-maps] @@ -104,10 +104,9 @@ s = 'refine Subject' t = 'refine To' b = 'refine Bcc' c = 'refine Cc' -enter = reedit +select = reedit [taglist-maps] -enter = select [thread-maps] C = fold --all @@ -121,7 +120,6 @@ f = forward p = print s = save r = reply -enter = select | = 'prompt pipeto ' [command-aliases] diff --git a/alot/helper.py b/alot/helper.py index a06236c2..7b038d29 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -138,7 +138,7 @@ def pretty_datetime(d): def cmd_output(command_line): - args = shlex.split(command_line.encode('ascii', errors='ignore')) + args = shlex.split(command_line.encode('utf-8', errors='ignore')) try: output = subprocess.check_output(args) output = output.decode(urwid.util.detected_encoding, errors='replace') @@ -150,8 +150,7 @@ def cmd_output(command_line): def pipe_to_command(cmd, stdin): - # no unicode in shlex on 2.x - args = shlex.split(cmd.encode('ascii')) + args = shlex.split(cmd.encode('utf-8', errors='ignore')) try: proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, @@ -50,18 +50,17 @@ class InputWrap(urwid.WidgetWrap): else: return False - def keypress(self, size, key, interpret=True): + def keypress(self, size, key): self.ui.logger.debug('got key: \'%s\'' % key) - if interpret: - mode = self.ui.mode - if self.select_cancel_only: - mode = 'global' - cmdline = config.get_mapping(mode, key) - if cmdline: - cmd = interpret_commandline(cmdline, self.ui.mode) - if self.allowed_command(cmd): - self.ui.apply_command(cmd) - return None + mode = self.ui.mode + if self.select_cancel_only: + mode = 'global' + cmdline = config.get_mapping(mode, key) + if cmdline: + cmd = interpret_commandline(cmdline, mode) + if self.allowed_command(cmd): + self.ui.apply_command(cmd) + return None self.ui.logger.debug('relaying key: %s' % key) return self._w.keypress(size, key) @@ -101,7 +100,7 @@ class UI(object): self.logger.debug('unhandeled input: %s' % key) def keypress(self, key): - self.inputwrap.keypress((150, 20), key, interpret=False) + self.inputwrap.keypress((150, 20), key) def show_as_root_until_keypress(self, w, key): def oe(): |