diff options
| author | Stephen Blott | 2015-05-12 13:45:45 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-12 13:45:45 +0100 |
| commit | 1663edc62d84a0b6fd9610c0e167961b98084773 (patch) | |
| tree | e0b35a7e3f449a2985c54054537b7958487a238d | |
| parent | ea0b6f04e47668e4374c1f3a1eb95e510a5f62b3 (diff) | |
| download | vimium-1663edc62d84a0b6fd9610c0e167961b98084773.tar.bz2 | |
Fix bad UX for <Enter> with prompted text.
The existing behaviour is poor UX.
Also, add <Alt-Enter> binding. This is a poor choice. We'll need to
think about this.
| -rw-r--r-- | pages/vomnibar.coffee | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/pages/vomnibar.coffee b/pages/vomnibar.coffee index 6485aed8..2aa70379 100644 --- a/pages/vomnibar.coffee +++ b/pages/vomnibar.coffee @@ -191,19 +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). - # - # <Enter> on its own selects only the text that the user has typed. <Control-Enter> also includes - # any prompted text. - window.getSelection()?.collapseToEnd() if @inputContainsASelectionRange() and event.ctrlKey + # 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] |
