diff options
| author | Stephen Blott | 2015-05-11 11:31:38 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-11 11:31:38 +0100 |
| commit | 4f8aeea11d86ac6f7051680edf0b45bf15ce2c14 (patch) | |
| tree | 27e443e6be24af34688b8c29e7a005da3961d88d | |
| parent | 34ced40ea60669110dc9a21d74360f751c87aff0 (diff) | |
| parent | 9ea1dc3a69180ffa7778c7f2cf1879f22fe60a92 (diff) | |
| download | vimium-4f8aeea11d86ac6f7051680edf0b45bf15ce2c14.tar.bz2 | |
Merge branch 'search-engine-completion-v2' into search-engine-completion-v5
Conflicts:
background_scripts/completion.coffee
| -rw-r--r-- | background_scripts/completion.coffee | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index e6814831..68cd52fc 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -366,6 +366,7 @@ class SearchEngineCompleter { queryTerms, query } = request keyword = queryTerms[0] if keyword and engines[keyword] and (1 < queryTerms.length or /\s$/.test query) + request.completers = [ this ] extend request, queryTerms: queryTerms[1..] keyword: keyword @@ -504,10 +505,12 @@ class MultiCompleter return @mostRecentQuery = arguments if @filterInProgress # Provide each completer with an opportunity to see (and possibly alter) the request before it is - # launched. This is primarily for SearchEngineCompleter, which notes a search query and removes any - # keyword from the queryTerms. Then, other completers don't include keywords in their matching and - # relevancy scores. + # launched. Each completer is provided with a list of all of the completers we're using + # (request.completers), and may change that list to override the default. + request.completers = @completers completer.triageRequest? request for completer in @completers + completers = request.completers + delete request.completers RegexpCache.clear() { queryTerms } = request @@ -516,7 +519,7 @@ class MultiCompleter [ suggestions, continuations, filters ] = [ [], [], [] ] # Run each of the completers (asynchronously). - jobs = new JobRunner @completers.map (completer) -> + jobs = new JobRunner completers.map (completer) -> (callback) -> completer.filter request, (newSuggestions = [], { continuation, filter } = {}) -> suggestions.push newSuggestions... |
