diff options
| author | Stephen Blott | 2015-04-18 13:19:44 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-04-18 13:19:44 +0100 |
| commit | f7b1204d8c4ec2e43df5cef65f89556d143cc43e (patch) | |
| tree | a238a2049a02a32c4a6eecf529a5162e72f547e5 | |
| parent | 9af974b03ac12ce3cb8ca8b835b06558f9949e19 (diff) | |
| parent | 865613d6d17bc4449784f34ada7adb83bdf94145 (diff) | |
| download | vimium-f7b1204d8c4ec2e43df5cef65f89556d143cc43e.tar.bz2 | |
Merge pull request #1571 from smblott-github/selection-handling-on-exit-from-visual-mode
Tweak selection handling on exiting visual mode.
| -rw-r--r-- | content_scripts/mode_visual_edit.coffee | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/content_scripts/mode_visual_edit.coffee b/content_scripts/mode_visual_edit.coffee index a5758a64..f3f754af 100644 --- a/content_scripts/mode_visual_edit.coffee +++ b/content_scripts/mode_visual_edit.coffee @@ -366,12 +366,12 @@ class Movement extends CountPrefix # # End of Movement constructor. - # Yank the selection; always exits; either deletes the selection or removes it; set @yankedText and return + # Yank the selection; always exits; either deletes the selection or collapses it; set @yankedText and return # it. yank: (args = {}) -> @yankedText = @selection.toString() @selection.deleteFromDocument() if @options.deleteFromDocument or args.deleteFromDocument - @selection.removeAllRanges() unless @options.parentMode + @selection.collapseToStart() unless @options.parentMode message = @yankedText.replace /\s+/g, " " message = message[...12] + "..." if 15 < @yankedText.length @@ -384,7 +384,7 @@ class Movement extends CountPrefix exit: (event, target) -> unless @options.parentMode or @options.oneMovementOnly - @selection.removeAllRanges() if event?.type == "keydown" and KeyboardUtils.isEscape event + @selection.collapseToStart() if event?.type == "keydown" and KeyboardUtils.isEscape event # Disabled, pending discussion of fine-tuning the UX. Simpler alternative is implemented above. # # If we're exiting on escape and there is a range selection, then we leave it in place. However, an |
