aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/mode_insert.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-01-26 10:15:33 +0000
committerStephen Blott2015-01-26 10:19:25 +0000
commitf644d622ffd7b8ce332d4c2470cd52772abadb2a (patch)
tree1038dbe6baf5fbc86a59b8e62b6e6f17d3fa478f /content_scripts/mode_insert.coffee
parentef9a8473d7d6b932de21642684f27e7696aac01b (diff)
downloadvimium-f644d622ffd7b8ce332d4c2470cd52772abadb2a.tar.bz2
Visual/edit modes: better recovery after focus change.
If we're in edit mode and the user changes tab, we lose the focus. That causes edit mode (and any sub mode like visual mode) to exit. When we return, we're in insert mode! With this commit, we save the state, and restore it when appropriate.
Diffstat (limited to 'content_scripts/mode_insert.coffee')
-rw-r--r--content_scripts/mode_insert.coffee3
1 files changed, 2 insertions, 1 deletions
diff --git a/content_scripts/mode_insert.coffee b/content_scripts/mode_insert.coffee
index 741f36cd..bee2ce58 100644
--- a/content_scripts/mode_insert.coffee
+++ b/content_scripts/mode_insert.coffee
@@ -45,7 +45,8 @@ class InsertMode extends Mode
# We can't rely on focus and blur events arriving in the expected order. When the active element
# changes, we might get "focus" before "blur". We track the active element in @insertModeLock, and
# exit only when that element blurs.
- @exit event, target if @insertModeLock and target == @insertModeLock
+ # We don't exit is we're running under edit mode. Edit mode itself will handles that case.
+ @exit event, target if @insertModeLock and target == @insertModeLock and not @options.editModeParent
"focus": (event) => @alwaysContinueBubbling =>
if @insertModeLock != event.target and DomUtils.isFocusable event.target
@activateOnElement event.target