aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2015-02-05 14:57:32 +0000
committerStephen Blott2015-02-05 15:00:20 +0000
commitae1697b6697e24c77fc852b02c760871db995a3f (patch)
tree6a6635255e0a180fd4322920b5a19c0b00a4a016
parent0ca75980d714f2863ad8f46eb69ccc17e917ede6 (diff)
downloadvimium-ae1697b6697e24c77fc852b02c760871db995a3f.tar.bz2
Visual/edit modes: always fully remove the selection on exit from visual mode.
There's considerable discussion in #1441 as to what we should do with the selection on leaving visual mode. Good arguments have been made as to why we should keep the selection. However, at this point, keep-it-simple seems like the best strategy, and wholly removing the selection (probably) provides fewer ways for the user to shoot themselves in the foot.
-rw-r--r--content_scripts/mode_visual_edit.coffee12
1 files changed, 5 insertions, 7 deletions
diff --git a/content_scripts/mode_visual_edit.coffee b/content_scripts/mode_visual_edit.coffee
index c62fae87..7223e099 100644
--- a/content_scripts/mode_visual_edit.coffee
+++ b/content_scripts/mode_visual_edit.coffee
@@ -366,11 +366,7 @@ class Movement extends CountPrefix
# returns it.
yank: (args = {}) ->
@yankedText = @selection.toString()
-
- if @options.deleteFromDocument or args.deleteFromDocument
- @selection.deleteFromDocument()
- else
- @collapseSelectionToAnchor()
+ @selection.deleteFromDocument() if @options.deleteFromDocument or args.deleteFromDocument
message = @yankedText.replace /\s+/g, " "
message = message[...12] + "..." if 15 < @yankedText.length
@@ -382,8 +378,10 @@ class Movement extends CountPrefix
@yankedText
exit: (event, target) ->
- unless @options.parentMode or @options.oneMovementOnly
- @selection.removeAllRanges() if event?.type == "keydown" and KeyboardUtils.isEscape event
+ @selection.removeAllRanges() unless @options.parentMode or @options.oneMovementOnly
+ # Disabled. We'll go with always removing the selection (as above), for now.
+ # unless @options.parentMode or @options.oneMovementOnly
+ # @selection.removeAllRanges() 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