diff options
| author | mrmr1993 | 2015-02-19 17:23:07 +0000 | 
|---|---|---|
| committer | mrmr1993 | 2015-02-19 17:23:07 +0000 | 
| commit | 0bda93d8ba36e64d7759d2f4e4f2965a3312425d (patch) | |
| tree | ffba42152d030324a5f55ad7fafe66f1294731a7 /lib | |
| parent | eb7b8bea2ae2a7c4f49960f7d0807c75cb3250b3 (diff) | |
| download | vimium-0bda93d8ba36e64d7759d2f4e4f2965a3312425d.tar.bz2 | |
Only send cursor to end when selection has the cursor at the start
This restores behaviour to how it was at commit
7cedc5d2481f61f4b0d1cbf99fbd203bb5c68b54.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dom_utils.coffee | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index a68edd6c..3633b285 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -191,6 +191,18 @@ DomUtils =        handlerStack.bubbleEvent "click", target: element      else        element.focus() +        # If the cursor is at the start of the element's contents, send it to the end. Motivation: +        # * the end is a more useful place to focus than the start, +        # * we've been moving the cursor to the end for quite some time now, +        # * this way preserves the last used position (except when it's at the beginning), so the user can +        #   'resume where they left off'. +        # NOTE(mrmr1993): Some elements throw an error when we try to access their selection properties, so +        # wrap this with a try. +      try +        if element.selectionStart == 0 and element.selectionEnd == 0 +          element.setSelectionRange element.value.length, element.value.length + +    simulateClick: (element, modifiers) ->      modifiers ||= {} | 
