aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2015-05-11 14:52:48 +0100
committerStephen Blott2015-05-11 14:52:48 +0100
commit4ba12991a277d193969e87706facdba12fdee4d0 (patch)
tree29c3029d4dcb0364a50ecb7b897cd1a6957eecbd
parent3975c13fe040639beb56582e50d951ad4839afbb (diff)
downloadvimium-4ba12991a277d193969e87706facdba12fdee4d0.tar.bz2
Search completion; better left/right controls.
-rw-r--r--pages/vomnibar.coffee8
1 files changed, 5 insertions, 3 deletions
diff --git a/pages/vomnibar.coffee b/pages/vomnibar.coffee
index 56159dab..acf45648 100644
--- a/pages/vomnibar.coffee
+++ b/pages/vomnibar.coffee
@@ -227,16 +227,18 @@ class VomnibarUI
else
# Don't suppress the Delete. We want it to happen.
return true
- else if action == "control-right" and @inputContainsASelectionRange()
- # "Control-Right" advances the start of the selection by a word.
+ else if action == "control-right"
[ start, end ] = [ @input.selectionStart, @input.selectionEnd ]
+ return true unless @inputContainsASelectionRange() and end == @input.value.length
+ # "Control-Right" advances the start of the selection by a word.
text = @input.value[start...end]
newText = text.replace /^\s*\S+\s*/, ""
@input.setSelectionRange start + (text.length - newText.length), end
else if action == "control-left"
- # "Control-Left" extends the start of the selection to the start of the current word.
[ start, end ] = [ @input.selectionStart, @input.selectionEnd ]
+ return true unless @inputContainsASelectionRange() and end == @input.value.length
+ # "Control-Left" extends the start of the selection to the start of the current word.
text = @input.value[0...start]
newText = text.replace /\S+\s*$/, ""
@input.setSelectionRange start + (newText.length - text.length), end