aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/mode_find.coffee10
1 files changed, 10 insertions, 0 deletions
diff --git a/content_scripts/mode_find.coffee b/content_scripts/mode_find.coffee
index 30f136e9..519e99ad 100644
--- a/content_scripts/mode_find.coffee
+++ b/content_scripts/mode_find.coffee
@@ -12,6 +12,7 @@
class PostFindMode extends InsertModeBlocker
constructor: (findModeAnchorNode) ->
element = document.activeElement
+ initialSelection = window.getSelection().toString()
super
name: "post-find"
@@ -20,6 +21,15 @@ class PostFindMode extends InsertModeBlocker
singleton: PostFindMode
exitOnBlur: element
suppressPrintableEvents: element
+ # If the selection changes (e.g. via paste, or the arrow keys), then the user is interacting with the
+ # element, so get out of the way and activate insert mode. This implements 5c (without the input
+ # listener) as discussed in #1415.
+ keyup: =>
+ @alwaysContinueBubbling =>
+ if window.getSelection().toString() != initialSelection
+ @exit()
+ new InsertMode
+ targetElement: element
return @exit() unless element and findModeAnchorNode