diff options
| author | Stephen Blott | 2015-02-11 05:47:05 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2015-02-11 05:52:14 +0000 | 
| commit | 91767943290f799ce99a935a8ce19f1766508d91 (patch) | |
| tree | c3da9a1d018b4d67bfec108c5ad722674fc7bffd | |
| parent | 90afb58f3752d562b5c5683d170317cc5f15b42c (diff) | |
| download | vimium-91767943290f799ce99a935a8ce19f1766508d91.tar.bz2 | |
Fix error on yank/scroll.
When we exit visual mode with "y"...
"y" is a command for visual mode.  Currently it clears the selection.
Because it's executed as a command, scrollIntoView is called after
running the command.  Because the selection is cleared, scrollIntoView
found nothing to scroll, and was creating an error.
So we need to check whether there's anything to scroll into view, before
trying to scroll it.
Also fix mis-named file in the tests.
| -rw-r--r-- | content_scripts/mode_visual_edit.coffee | 5 | ||||
| -rw-r--r-- | tests/dom_tests/dom_tests.html | 2 | 
2 files changed, 4 insertions, 3 deletions
| diff --git a/content_scripts/mode_visual_edit.coffee b/content_scripts/mode_visual_edit.coffee index e11c29ec..16872140 100644 --- a/content_scripts/mode_visual_edit.coffee +++ b/content_scripts/mode_visual_edit.coffee @@ -456,8 +456,9 @@ class Movement extends CountPrefix              coords = DomUtils.getCaretCoordinates @element, position              Scroller.scrollToPosition @element, coords.top, coords.left        else -        elementWithFocus = DomUtils.getElementWithFocus @selection, @getDirection() == backward -        Scroller.scrollIntoView elementWithFocus if elementWithFocus +        unless @selection.type == "None" +          elementWithFocus = DomUtils.getElementWithFocus @selection, @getDirection() == backward +          Scroller.scrollIntoView elementWithFocus if elementWithFocus  class VisualMode extends Movement    constructor: (options = {}) -> diff --git a/tests/dom_tests/dom_tests.html b/tests/dom_tests/dom_tests.html index 33759abd..cbd91bca 100644 --- a/tests/dom_tests/dom_tests.html +++ b/tests/dom_tests/dom_tests.html @@ -43,7 +43,7 @@      <script type="text/javascript" src="../../content_scripts/mode_passkeys.js"></script>      <script type="text/javascript" src="../../content_scripts/mode_insert.js"></script>      <script type="text/javascript" src="../../content_scripts/mode_find.js"></script> -    <script type="text/javascript" src="../../content_scripts/mode_visual.js"></script> +    <script type="text/javascript" src="../../content_scripts/mode_visual_edit.js"></script>      <script type="text/javascript" src="../../content_scripts/vimium_frontend.js"></script>      <script type="text/javascript" src="../shoulda.js/shoulda.js"></script> | 
