aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authorStephen Blott2015-01-26 11:42:39 +0000
committerStephen Blott2015-01-26 11:42:39 +0000
commit48e5f84237c073d8ac96f02fb51528e726c1bcdd (patch)
treeb53ff9b6566d7dcd55eb077f6840165f1faad4bd /content_scripts
parentd57b08232513b285360b220dbb4de91bc6b61765 (diff)
downloadvimium-48e5f84237c073d8ac96f02fb51528e726c1bcdd.tar.bz2
Visual/edit modes: fix problem resuming entering visual line mode.
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/mode_visual_edit.coffee24
1 files changed, 10 insertions, 14 deletions
diff --git a/content_scripts/mode_visual_edit.coffee b/content_scripts/mode_visual_edit.coffee
index ff9114e9..03b883c6 100644
--- a/content_scripts/mode_visual_edit.coffee
+++ b/content_scripts/mode_visual_edit.coffee
@@ -262,19 +262,15 @@ class VisualMode extends Movement
constructor: (options = {}) ->
@selection = window.getSelection()
- if options.initialRange
- @selection.removeAllRanges()
- @selection.addRange options.initialRange
- else
- switch @selection.type
- when "None"
- unless @establishInitialSelection()
- HUD.showForDuration "Create a selection before entering visual mode.", 2500
- return
- when "Caret"
- # Try to start with a visible selection.
- @moveInDirection(forward) or @moveInDirection backward unless options.editModeParent
- @scrollIntoView() if @selection.type == "Range"
+ switch @selection.type
+ when "None"
+ unless @establishInitialSelection()
+ HUD.showForDuration "Create a selection before entering visual mode.", 2500
+ return
+ when "Caret"
+ # Try to start with a visible selection.
+ @moveInDirection(forward) or @moveInDirection backward unless options.editModeParent
+ @scrollIntoView() if @selection.type == "Range"
defaults =
name: "visual"
@@ -285,7 +281,7 @@ class VisualMode extends Movement
super extend defaults, options
extend @commands,
- "V": -> new VisualLineMode initialRange: @selection.getRangeAt(0).cloneRange()
+ "V": -> new VisualLineMode
"y": ->
# Special case: "yy" (the first from edit mode, and now the second).
@selectLexicalEntity "lineboundary" if @options.yYanksLine and @keyPressCount == 1