1. ZyX_I
  2. notmuch-frontend

Commits

ZyX_I  committed 766f7ae

Better quote handling

  • Participants
  • Parent commits a3904bd
  • Branches default

Comments (0)

Files changed (1)

File python/notmuch_frontend.py

View file
             args[0]=self.db[args[0]].get_minfo()
         return func(self, *args, **kwargs)
     return r
+#▶1 strip_quotes :: String → String
+qreg=re.compile(r'"((?:\\.|[^"])*)"')
+qbreg=re.compile(r'\\(.)')
+bunescapes={}
+strip_quotes=lambda s: qreg.subn(lambda m: qbreg.subn(lambda bm:
+                                                        (lambda bs: bunescapes.get(bs, bs))(bm.group(0)),
+                                                      m.group(0))[0],
+                                 s)[0]
 #▶1 get_fne :: String → (String, String, String)
 ereg=re.compile('^(.*) <([^@<>]+@[^@<>]+)>$')
 def get_fne(s):
             e=None
     else:
         n, e = match.groups()
+    n=strip_quotes(n)
+    if e is not None:
+        e=strip_quotes(e)
     if n[0] == '"':
         n=n[1:-1]
     return s, n, e
 
             lines.append(s("".join([c for l, c in columns])))
 
-        self.set_buffer(buf, 'search', lines, msginfo=msginfo)
+        self.set_buffer(buf, 'search', lines, msginfo=msginfo, colfuncsorder=colfuncsorder)
     #▶2 show_message :: self, buf, m::Either msgid minfo
     @minfomethod
     @bufmethod