aboutsummaryrefslogtreecommitdiffstats
path: root/pages
diff options
context:
space:
mode:
authorStephen Blott2015-05-29 06:43:19 +0100
committerStephen Blott2015-05-29 06:43:19 +0100
commit42fa6e9506d95073e0ca6924b1b9a082d23bd483 (patch)
treeeb9e526f6f57ab4e49ff9e0579d26a9c648df521 /pages
parent67e012f2c9de903deeaa5ade730161665a0bf430 (diff)
parent45157bc460494503ca2b90caa762e72d224a1ef3 (diff)
downloadvimium-42fa6e9506d95073e0ca6924b1b9a082d23bd483.tar.bz2
Merge branch 'completion-on-custom-search-only' into completion-on-custom-search-only-merge
Conflicts: background_scripts/completion.coffee
Diffstat (limited to 'pages')
-rw-r--r--pages/options.html3
-rw-r--r--pages/vomnibar.coffee14
-rw-r--r--pages/vomnibar.css1
3 files changed, 14 insertions, 4 deletions
diff --git a/pages/options.html b/pages/options.html
index 8535823d..0fa5b18d 100644
--- a/pages/options.html
+++ b/pages/options.html
@@ -238,6 +238,8 @@ b: http://b.com/?q=%s description
</tr>
<!-- Vimium Labs -->
+ <!--
+ Disabled. But we leave this code here as a template for the next time we need to introduce "Vimium Labs".
<tr>
<td colspan="2"><header>Vimium Labs</header></td>
</tr>
@@ -263,6 +265,7 @@ b: http://b.com/?q=%s description
<input id="omniSearchWeight" type="number" min="0.0" max="1.0" step="0.05" />(0 to 1)
</td>
</tr>
+ -->
</tbody>
</table>
</div>
diff --git a/pages/vomnibar.coffee b/pages/vomnibar.coffee
index 423ffa59..71f22900 100644
--- a/pages/vomnibar.coffee
+++ b/pages/vomnibar.coffee
@@ -76,7 +76,7 @@ class VomnibarUI
updateSelection: ->
# For custom search engines, we suppress the leading term (e.g. the "w" of "w query terms") within the
# vomnibar input.
- if @lastReponse.customSearchMode and not @customSearchMode?
+ if @lastReponse.isCustomSearch and not @customSearchMode?
queryTerms = @input.value.trim().split /\s+/
@customSearchMode = queryTerms[0]
@input.value = queryTerms[1..].join " "
@@ -141,15 +141,23 @@ class VomnibarUI
@selection = @completions.length - 1 if @selection < @initialSelectionValue
@updateSelection()
else if (action == "enter")
- if @selection == -1
+ isCustomSearchPrimarySuggestion = @completions[@selection]?.isPrimarySuggestion and @lastReponse.engine?.searchUrl?
+ if @selection == -1 or isCustomSearchPrimarySuggestion
query = @input.value.trim()
# <Enter> on an empty query is a no-op.
return unless 0 < query.length
+ # First case (@selection == -1).
# If the user types something and hits enter without selecting a completion from the list, then:
# - If a search URL has been provided, then use it. This is custom search engine request.
# - Otherwise, send the query to the background page, which will open it as a URL or create a
# default search, as appropriate.
- query = Utils.createSearchUrl query, @lastReponse.searchUrl if @lastReponse.searchUrl?
+ #
+ # Second case (isCustomSearchPrimarySuggestion).
+ # Alternatively, the selected completion could be the primary selection for a custom search engine.
+ # Because the the suggestions are updated asynchronously in omni mode, the user may have typed more
+ # text than that which is included in the URL associated with the primary suggestion. Therefore, to
+ # avoid a race condition, we construct the query from the actual contents of the input (query).
+ query = Utils.createSearchUrl query, @lastReponse.engine.searchUrl if isCustomSearchPrimarySuggestion
@hide ->
chrome.runtime.sendMessage
handler: if openInNewTab then "openUrlInNewTab" else "openUrlInCurrentTab"
diff --git a/pages/vomnibar.css b/pages/vomnibar.css
index b1ed0252..1b19daad 100644
--- a/pages/vomnibar.css
+++ b/pages/vomnibar.css
@@ -126,7 +126,6 @@
#vomnibar li em { font-style: italic; }
#vomnibar li em .vomnibarMatch, #vomnibar li .vomnibarTitle .vomnibarMatch {
color: #333;
- text-decoration: underline;
}
#vomnibar li.vomnibarSelected {