chiark / gitweb /
Improve tags file parsing
authorRoss Younger <ross@impropriety.org.uk>
Thu, 28 Feb 2013 21:56:10 +0000 (10:56 +1300)
committerRoss Younger <ross@impropriety.org.uk>
Thu, 28 Feb 2013 21:56:10 +0000 (10:56 +1300)
TagsSearch.py

index 150c3a9..2d0b08e 100644 (file)
@@ -9,12 +9,17 @@ class TagsResponse:
 
 def quote_pattern(pat):
    pat = re.sub('~', '\~', pat)
-   pat = re.sub('\*', '\\\*', pat)
+   pat = re.sub('\*', '\*', pat)
+   pat = re.sub('\[', '\\[', pat)
    return pat
 
 class CTag:
    def __init__(self, line):
-      self.fields = line.split('\t')
+      # We don't use the comment part (vi comment, introduced by ") -
+      # so strip it out
+      parts = line.split('"', 1)
+      # curveball: sometimes the ex-command contains a tab.
+      self.fields = parts[0].split('\t', 2)
    def to_response(self):
       return TagsResponse(self.filename(), self.pattern())
    def tag(self):