diff options
| author | Stephen Blott | 2015-05-11 14:52:48 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-11 14:52:48 +0100 |
| commit | 4ba12991a277d193969e87706facdba12fdee4d0 (patch) | |
| tree | 29c3029d4dcb0364a50ecb7b897cd1a6957eecbd | |
| parent | 3975c13fe040639beb56582e50d951ad4839afbb (diff) | |
| download | vimium-4ba12991a277d193969e87706facdba12fdee4d0.tar.bz2 | |
Search completion; better left/right controls.
| -rw-r--r-- | pages/vomnibar.coffee | 8 |
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 |
