Alfred_SourceTree icon indicating copy to clipboard operation
Alfred_SourceTree copied to clipboard

Typing a dash (-) breaks the search

Open KKSzymanowski opened this issue 5 years ago • 2 comments

I have a project with a dash in it's name: image If I add the dash to the search query, the result disappears: image

I'm using a similar workflow for PhpStorm and it works there: image

KKSzymanowski avatar Apr 02 '19 12:04 KKSzymanowski

Changing this line

  def _splitMatchWords(self, title):
    res = []
    cam = self._camel_case_split(title)
    for m in cam:
      ret = re.split('-|_| |',m)
      for n in ret:
        res.append(n)
-     return ' '.join(res);
+     return ' '.join(res) + ' ' + title;

seems to fix it.

This just adds the whole title to the list of words in the match field. You can do some fancy stuff to for example only add the whole title if the res array has more than one element(which means it has actually been split) but what I proposed might be just enough. Should I create a Pull Request?

KKSzymanowski avatar Apr 02 '19 13:04 KKSzymanowski

Or even better:

  def _splitMatchWords(self, title):
-   res = []
+   res = [title]
    cam = self._camel_case_split(title)
    for m in cam:
      ret = re.split('-|_| |',m)
      for n in ret:
        res.append(n)
    return ' '.join(res);

KKSzymanowski avatar Apr 02 '19 13:04 KKSzymanowski