aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/mode_insert.coffee
AgeCommit message (Collapse)Author
2017-08-18Check whether events are trusted before executing listenersmrmr1993
2017-04-18Use event.code to detect/suppress keyup events.Stephen Blott
This avoids the possibility of leaking keyup events if the keys a released in a different order from that in which they were pressed. Also, replace suppressKeyupAfterEscape with this same mechanism. This fixes a bug (in master/1.59) whereby we leak the keyup event for `i` when entering insert mode. TODO: - `/`, `<Escape>` leaks a keyup event - `i` leaks a keyup event
2017-03-04Merge pull request #2384 from gdh1995/pass-keys-on-body-lockedStephen Blott
InsertMode should not handle key events if document.body is editable
2017-02-08Stop using non-standard event.srcElement; switch to event.targetmrmr1993
2017-01-03InsertMode should not handle key events if document.body is editablegdh1995
For example, the host JavaScript may create an "about:blank" iframe with a `content-editable` `body`, and then: * the parent frame may handle `Escape` key events by itself * but now, Vimium always grabs `Escape` events * and tries to exit `InsertMode` * although `document.body` is still current `activeElement` after `body.blur()` * as a result, neither the parent can receive and handle wanted keyevents, nor Vimium will succeed in returing back to NormalMode
2016-10-15enterNormalMode; new command - implementationStephen Blott
Here's the problem... Many sites define their own keyboard shortcuts, for example Google Play Music defines `gh` for "go home". On such sites, it's natural to set up pass keys for `g` and `h`. But that makes any Vimium key bindings which begin with `g` inaccessible. Here, we add a new command `enterNormalMode` which installs a new normal-mode instance (without any pass keys). This executes a single normal-mode command then exits. Example: map \ enterNormalMode map | enterNormalMode count=999999 Assuming `g` and `o` are pass keys: - `gh` or `o` - use the page's binding - `\gg` - scroll to top - `2\ggo` - scroll to the top and open the Vomnibar - `\g<Escape>o` - open the Vomnibar - `\<Escape>o` - use the page's bindings - `\\\\\\<Escape>o` - use the page's bindings (new normal-mode instances displace previous ones) This required some changes to the scroller. Previously, we only ever had one normal-mode instance, and could arrange statically that the scroller's key listeners were above normal-mode's key listeners in the handler stack. Here, we fix this by adding and removing the scroller's listeners dynamically, so they're always at the top of the handler stack.
2016-03-31Use @suppressEvent instead of false.Stephen Blott
2016-03-30Rename handlerStack constants.Stephen Blott
Problems: - The meanings of some of the Mode/handlerStack constant names is far from obvious. - The same thing is named different things in different places. This changes various constant names such that: - the names used in the handler stack and in the modes are the same. - ditto vis-a-vis DomUtils. Also, break out the core of the handler stacks' `bubbleEvent` method into a switch statements. This makes it more obvious that the cases are mutually exclusive.
2016-03-04Do not use standalone @.Stephen Blott
The styles guide says not to use standalone `@`. So this changes the occurrences I could find (with sed) to `this`. Occurrences within files with major outstanding PRs are omitted.
2016-02-22Remove legacy reference to edit mode.Stephen Blott
Omitted from #1961.
2016-02-20hideHUD option applies to insert mode only.Stephen Blott
This makes the `hideHud` option apply only to insert mode (when entered with `i`). Fixes #1953. Fixes #487. We could rename the option itself and add migration code, but that seems overkill. An alternative would be to remove this option entirely.
2016-02-18PassNextKey; allow multiple mappings.Stephen Blott
This allows: map a passNextKey map b passNextKey (Previously, we only picked up the first mapping.)
2016-02-18PassNextKey; handle pass-next-key in insert mode.Stephen Blott
(First "fully" functional version.)
2016-02-18PassNextKey; initial implementation.Stephen Blott
This implements a passNextKey command (initially for normal mode only), as discussed in #1955.
2016-02-16Use `for own ... of` instead of `for ... of`mrmr1993
2015-06-08Remove "experimental" comment.Stephen Blott
I think we can safely remove this comment now, @mrmr1993. This is working out very nicely.
2015-05-05Possible re-working of #1627.Stephen Blott
2015-05-01Enter insert mode if an input inside a shadow DOM is focusedmrmr1993
This fixes issue #853.
2015-04-18Mode indicator: fix insert mode within edit mode.Stephen Blott
2015-04-18Mode indicator: initial move to HUD.Stephen Blott
2015-04-18Mode indicator: strip all references to badges.Stephen Blott
2015-02-09Merge branch 'visual-and-edit-modes'Stephen Blott
Conflicts: background_scripts/main.coffee content_scripts/vimium_frontend.coffee lib/keyboard_utils.coffee
2015-01-29Visual/edit modes: fix restore of insert-mode sub mode.Stephen Blott
2015-01-27Visual/edit modes: minor changes.Stephen Blott
- Minor changes. - Deactivate modes on inputs from focusInput().
2015-01-26Visual/edit modes: fix problem resuming insert mode.Stephen Blott
2015-01-26Visual/edit modes: better recovery after focus change.Stephen Blott
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.
2015-01-23Visual/edit modes: more (and better) commands.Stephen Blott
2015-01-23Visual/edit modes: develop edit mode.Stephen Blott
- implement "i", "a". - fix "w" for edit mode. - try out "e" for enter edit mode. - initial implementation "o", "O" - Suppress backspace and delete. - Scroll in text areas.
2015-01-20Rework DOM tests (clean up).Stephen Blott
2015-01-18Modes; refactor permanent instance.Stephen Blott
I had intended the whole Insert.permanentInstance lark to be gone before merging #1413. Somehow, this got missed. It's retained, here, but is only needed for the tests. It gives the tests a hook into the single insert-mode permanent instance, so they can test its state.
2015-01-18Modes; fix error for exit insert mode.Stephen Blott
We were blurring the active input element whenever we exit insert mode (my bad). It should only be blurred when we exit insert mode via Escape.
2015-01-18Modes; pre-merge clean up.Stephen Blott
2015-01-17Modes; yet more tweaks...Stephen Blott
- Mainly comments. - Rename chooseBadge to updateBadge (for consistency). - No badge for passkeys; also fix tests.
2015-01-16Modes; clean up.Stephen Blott
2015-01-16Modes; tweaks.Stephen Blott
2015-01-15Modes; yet more teaks and fiddles.Stephen Blott
2015-01-15Modes; tweaks and fiddles.Stephen Blott
2015-01-14Modes; more reworking.Stephen Blott
2015-01-14Modes; fix tests.Stephen Blott
2015-01-14Modes; rework PostFindMode (again).Stephen Blott
2015-01-14Modes; substantial reworking of insert mode (and friends).Stephen Blott
2015-01-13Modes; temporary commit.Stephen Blott
2015-01-13Modes; temporary commit.Stephen Blott
2015-01-10Modes; re-architect key suppression and passkeys.Stephen Blott
2015-01-10Modes; better printable detection, move to keyboard_utils.Stephen Blott
2015-01-10Modes; reinstate key blockers:Stephen Blott
- when the selection is contentEditable - in PostFindMode Restricted to printable characters.
2015-01-10Modes; minor changes.Stephen Blott
2015-01-10Modes; revert to master's handling of #1415.Stephen Blott
The behaviour in the situations described in #1415 require more thought and discussion.
2015-01-10Modes; instrument for debugging...Stephen Blott
- Set Mode.debug to true to see mode activation/deactivation on the console. - Use Mode.log() to see a list of currently-active modes. - Use handlerStack.debugOn() to enable debugging of the handler stack.
2015-01-10Modes; more changes...Stephen Blott
- Better comments. - Strip unnecessary handlers for leaving post-find mode. - Simplify passKeys. - focusInput now re-bubbles its triggering keydown event.