diff options
| author | Stephen Blott | 2015-05-12 13:51:48 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-12 13:51:48 +0100 |
| commit | db7f7a8d7c2f7fa3f372a29eee14709a2156a76b (patch) | |
| tree | e0b35a7e3f449a2985c54054537b7958487a238d /pages | |
| parent | 95d3aa2830b4a64c0c30ab682d63f0623ea35a3f (diff) | |
| parent | 1663edc62d84a0b6fd9610c0e167961b98084773 (diff) | |
| download | vimium-db7f7a8d7c2f7fa3f372a29eee14709a2156a76b.tar.bz2 | |
Merge pull request #1657 from smblott-github/vomnibar-action-on-enter
Vomnibar action on enter
Diffstat (limited to 'pages')
| -rw-r--r-- | pages/vomnibar.coffee | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/pages/vomnibar.coffee b/pages/vomnibar.coffee index 7c9eef83..2aa70379 100644 --- a/pages/vomnibar.coffee +++ b/pages/vomnibar.coffee @@ -191,16 +191,20 @@ class VomnibarUI @updateSelection() else if (action == "enter") if @selection == -1 + # <Alt>/<Meta> includes prompted text in the query (normally it is not included). + # + # FIXME(smblott). This is a terrible binding. <Ctrl-Enter> would be better, but that's already being + # used. We need a better UX around how to include the prompted text in the query. <Right> then + # <Enter> works, but that's ugly too. + window.getSelection().collapseToEnd() if event.altKey or event.metaKey # The user has not selected a suggestion. - query = @input.value.trim() + query = @getInputWithoutPromptedText().trim() # <Enter> on an empty vomnibar is a no-op. return unless 0 < query.length if @suppressedLeadingKeyword? - # This is a custom search engine completion. Because of the way we add prompted text to the input - # (addPromptedText), the text in the input might not correspond to any of the completions. So we - # fire off the query to the background page and use the completion at the top of the list (which - # will be the right one). - window.getSelection()?.collapseToEnd() if @inputContainsASelectionRange() + # This is a custom search engine completion. The text in the input might not correspond to any of + # the completions. So we fire off the query to the background page and use the completion at the + # top of the list (which will be the right one). @update true, => if @completions[0] completion = @completions[0] |
