aboutsummaryrefslogtreecommitdiffstats
path: root/pages
diff options
context:
space:
mode:
Diffstat (limited to 'pages')
-rw-r--r--pages/vomnibar.coffee10
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