summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2012-01-23 12:49:33 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2012-01-23 12:49:33 +0000
commit524bcb2a6594914248577f6cb0d9146bf216cd62 (patch)
tree5131fa3c1bbb4adc8c98b98b654dedfbed6e743d
parente4419fd3648f29ec2ad7def147d67d3acabef8c9 (diff)
fix: contact completion for contacts w/o name
If the a contact (a pair of strings name, address) has no name, then propose the address only instead of some strange `"" <address>`. Moreover, don't strip the namestring but use as is.
-rw-r--r--alot/account.py2
-rw-r--r--alot/completion.py5
2 files changed, 5 insertions, 2 deletions
diff --git a/alot/account.py b/alot/account.py
index b1387c2a..f5584272 100644
--- a/alot/account.py
+++ b/alot/account.py
@@ -382,6 +382,6 @@ class MatchSdtoutAddressbook(AddressBook):
if m:
info = m.groupdict()
email = info['email'].strip()
- name = info['name'].strip()
+ name = info['name']
res.append((name, email))
return res
diff --git a/alot/completion.py b/alot/completion.py
index 5def4c22..94ab33c0 100644
--- a/alot/completion.py
+++ b/alot/completion.py
@@ -203,7 +203,10 @@ class AbooksCompleter(Completer):
else:
returnlist = []
for name, email in res:
- newtext = "%s <%s>" % (name, email)
+ if name:
+ newtext = "%s <%s>" % (name, email)
+ else:
+ newtext = email
returnlist.append((newtext, len(newtext)))
return returnlist