diff options
| author | Phil Crosby | 2014-06-30 00:37:45 -0700 |
|---|---|---|
| committer | Phil Crosby | 2014-06-30 00:37:45 -0700 |
| commit | 6b3d8b8b5aa460227c3ad4d7a102cdb0832ba2ca (patch) | |
| tree | 736a2cf87054e3b0274dd413784b65989d617d3c | |
| parent | c235443bf2836471c6d4c2f2b58dc46d3b5e54b9 (diff) | |
| parent | ea0bfa0038795fef9e7cee55c6776087b999740f (diff) | |
| download | vimium-6b3d8b8b5aa460227c3ad4d7a102cdb0832ba2ca.tar.bz2 | |
Merge pull request #1073 from mijoharas/master
added selection of search engines without pressing tab
| -rw-r--r-- | CREDITS | 1 | ||||
| -rw-r--r-- | content_scripts/vomnibar.coffee | 10 |
2 files changed, 11 insertions, 0 deletions
@@ -28,6 +28,7 @@ Contributors: markstos Matthew Cline <matt@nightrealms.com> Matt Garriott (github: mgarriott) + Michael Hauser-Raspe (github: mijoharas) Murph (github: pandeiro) Niklas Baumstark <niklas.baumstark@gmail.com> (github: niklasb) rodimius diff --git a/content_scripts/vomnibar.coffee b/content_scripts/vomnibar.coffee index 6782ab28..fdf6c88b 100644 --- a/content_scripts/vomnibar.coffee +++ b/content_scripts/vomnibar.coffee @@ -68,8 +68,18 @@ class VomnibarUI @update(true) updateSelection: -> + # We have taken the option to add some global state here (previousCompletionType) to tell if a search + # item has just appeared or disappeared, if that happens we either set the initialSelectionValue to 0 or 1 + # I feel that this approach is cleaner than bubbling the state up from the suggestion level + # so we just inspect it afterwards + if @completions[0] + if @previousCompletionType != "search" && @completions[0].type == "search" + @selection = 0 + else if @previousCompletionType == "search" && @completions[0].type != "search" + @selection = -1 for i in [0...@completionList.children.length] @completionList.children[i].className = (if i == @selection then "vomnibarSelected" else "") + @previousCompletionType = @completions[0].type if @completions[0] # # Returns the user's action ("up", "down", "enter", "dismiss" or null) based on their keypress. |
