diff options
| author | Stephen Blott | 2015-06-03 05:39:56 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2015-06-03 05:39:56 +0100 | 
| commit | 8ae866667f7bce9b1bca30118b5b597c5fbe24d8 (patch) | |
| tree | fcf910373400536dfc8bd0eea025d7c7727e08ff /pages | |
| parent | a5fce54c6c5cc62a29028238f0ddacde93a0030d (diff) | |
| download | vimium-8ae866667f7bce9b1bca30118b5b597c5fbe24d8.tar.bz2 | |
Tweak vomnibar custom search behaviour.
With this, if we're in custom search mode and the cursor is at the start
of the vomnibar input and the user types <Delete>, then we exit custom
search mode and reinstate the keyword (and arrange for the cursor to be
in the right place).
This makes it possible to change (or just disable) the custom search
engine without having to first wholly delete the query.
Diffstat (limited to 'pages')
| -rw-r--r-- | pages/vomnibar.coffee | 10 | 
1 files changed, 5 insertions, 5 deletions
| diff --git a/pages/vomnibar.coffee b/pages/vomnibar.coffee index d5659fdc..cf9ed7b0 100644 --- a/pages/vomnibar.coffee +++ b/pages/vomnibar.coffee @@ -169,14 +169,14 @@ class VomnibarUI          completion = @completions[@selection]          @hide -> completion.performAction openInNewTab      else if action == "delete" -      inputIsEmpty = @input.value.length == 0 -      if inputIsEmpty and @customSearchMode? +      if @customSearchMode? and @input.selectionEnd == 0          # Normally, with custom search engines, the keyword (e,g, the "w" of "w query terms") is suppressed. -        # If the input is empty, then reinstate the keyword (the "w"). -        @input.value = @customSearchMode +        # If the cursor is at the start of the input, then reinstate the keyword (the "w"). +        @input.value = @customSearchMode + @input.value.ltrim() +        @input.selectionStart = @input.selectionEnd = @customSearchMode.length          @customSearchMode = null          @update true -      else if inputIsEmpty and @seenTabToOpenCompletionList +      else if @seenTabToOpenCompletionList and @input.value.trim().length == 0          @seenTabToOpenCompletionList = false          @update true        else | 
