diff options
| author | mike-work | 2014-06-20 15:24:30 +0100 |
|---|---|---|
| committer | mike-work | 2014-06-20 15:24:30 +0100 |
| commit | ea0bfa0038795fef9e7cee55c6776087b999740f (patch) | |
| tree | 26d1a21de715049c13bfd05f22e5e43f0d7611a8 /content_scripts | |
| parent | c5989eb9c001429f11beff44f47adadca1784467 (diff) | |
| download | vimium-ea0bfa0038795fef9e7cee55c6776087b999740f.tar.bz2 | |
added selection of search engines without pressing tab
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/vomnibar.coffee | 10 |
1 files changed, 10 insertions, 0 deletions
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. |
