aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/mode_visual.coffee
diff options
context:
space:
mode:
authorStephen Blott2016-03-21 12:30:57 +0000
committerStephen Blott2016-03-21 12:31:00 +0000
commit741bc131353eb856022d66252309de23a0873fc7 (patch)
treedc5f2453155f4ef87c4eeb71247623997fb621cc /content_scripts/mode_visual.coffee
parent8783569983d8b3634b1b1eed9b6560dbea5698ab (diff)
downloadvimium-741bc131353eb856022d66252309de23a0873fc7.tar.bz2
Simplify singleton handling.
While working on the visual-mode code, it became apparent that our current "singleton" implementation is unnecessarily complicated. This simplifies it. The keys are now required to be strings. (Previously, they could be any object; which meant we needed to gove objects an identity. All of which was complicated.)
Diffstat (limited to 'content_scripts/mode_visual.coffee')
-rw-r--r--content_scripts/mode_visual.coffee5
1 files changed, 1 insertions, 4 deletions
diff --git a/content_scripts/mode_visual.coffee b/content_scripts/mode_visual.coffee
index 20560298..a6102987 100644
--- a/content_scripts/mode_visual.coffee
+++ b/content_scripts/mode_visual.coffee
@@ -212,9 +212,6 @@ class VisualMode extends KeyHandlerMode
"c": -> @movement.collapseSelectionToAnchor(); new CaretMode
"o": -> @movement.reverseSelection()
- # TODO(smblott): "aw", etc.
- # TODO(smblott): simplify singletons.
-
constructor: (options = {}) ->
@movement = new Movement options.alterMethod ? "extend"
@selection = @movement.selection
@@ -236,7 +233,7 @@ class VisualMode extends KeyHandlerMode
super extend options,
name: options.name ? "visual"
indicator: options.indicator ? "Visual mode"
- singleton: VisualMode
+ singleton: "visual-mode-group" # Visual mode, visual-line mode and caret mode each displace each other.
exitOnEscape: true
suppressAllKeyboardEvents: true
keyMapping: keyMapping