diff options
| author | Stephen Blott | 2015-01-13 05:50:18 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-01-13 05:50:18 +0000 |
| commit | 7684019cb5d5c1d0ac5d7216653613220b4fd8d9 (patch) | |
| tree | 16a8e8b1443edc0b3ee1fd93468f65da2e48e1cc /content_scripts | |
| parent | eb8c5587cec5a629dfbddf8a884a2aa6fc06f436 (diff) | |
| download | vimium-7684019cb5d5c1d0ac5d7216653613220b4fd8d9.tar.bz2 | |
Modes; enter insert mode if the selection changes.
See discussion in #1415.
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/mode_find.coffee | 10 |
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 |
