Make search match 'git filter-branch' when searching for 'filter-'

Fixes #600.
pull/605/head
Thibaut Courouble 8 years ago
parent 612aeafa22
commit 9d919591c2

@ -113,6 +113,7 @@ class app.Searcher
fuzzy_min_length: 3 fuzzy_min_length: 3
SEPARATORS_REGEXP = /#|::|:-|->|\$(?=\w)|\-(?=\w)|\:(?=\w)|\ [\/\-&]\ |:\ |\ /g SEPARATORS_REGEXP = /#|::|:-|->|\$(?=\w)|\-(?=\w)|\:(?=\w)|\ [\/\-&]\ |:\ |\ /g
EOS_SEPARATORS_REGEXP = /(\w)[\-:]$/
INFO_PARANTHESES_REGEXP = /\ \(\w+?\)$/ INFO_PARANTHESES_REGEXP = /\ \(\w+?\)$/
EMPTY_PARANTHESES_REGEXP = /\(\)/ EMPTY_PARANTHESES_REGEXP = /\(\)/
EVENT_REGEXP = /\ event$/ EVENT_REGEXP = /\ event$/
@ -134,6 +135,10 @@ class app.Searcher
.replace EMPTY_PARANTHESES_REGEXP, EMPTY_STRING .replace EMPTY_PARANTHESES_REGEXP, EMPTY_STRING
.replace WHITESPACE_REGEXP, EMPTY_STRING .replace WHITESPACE_REGEXP, EMPTY_STRING
@normalizeQuery: (string) ->
string = @normalizeString(string)
string.replace EOS_SEPARATORS_REGEXP, '$1.'
constructor: (options = {}) -> constructor: (options = {}) ->
@options = $.extend {}, DEFAULTS, options @options = $.extend {}, DEFAULTS, options
@ -149,7 +154,7 @@ class app.Searcher
return return
setup: -> setup: ->
query = @query = @constructor.normalizeString(@query) query = @query = @constructor.normalizeQuery(@query)
queryLength = query.length queryLength = query.length
@dataLength = @data.length @dataLength = @data.length
@matchers = [exactMatch] @matchers = [exactMatch]

Loading…
Cancel
Save