aboutsummaryrefslogtreecommitdiffstats
path: root/lib/keyboard_utils.coffee
AgeCommit message (Collapse)Author
2017-11-11Don't resolve modifiers as keysmrmr1993
2017-11-05Rationalise the order of these tests.Stephen Blott
The tests make more sense in this order.
2017-11-05Add more named keys (version 2)Stephen Blott
This allows any special key to mapped, simply by using the `event.key` key name. E.g. map <enter> scrollDown Replaces #2770. Fixes #2769.
2017-10-25FF: Share |root| global proxy, re-add the globals to window on DOMLoadmrmr1993
This is a workaround for Firefox bug 1408996.
2017-10-14Allow <c-[> to be mapped as a regular command.Stephen Blott
If map <c-[> someCommand is configured, then the hardwired `<c-[>` meaning `Escape` behaviour is disabled. Users who want to map `<c-[>` probably *never* use it as `Escape`. Fixes #2722.
2017-09-02Fix special keys (e.g. <Shift-Left>).Stephen Blott
2017-09-01Use event.key for numpad.Stephen Blott
See this comment: https://github.com/philc/vimium/pull/2626#issuecomment-326553282.
2017-09-01Handle shifted numeric keys.Stephen Blott
2017-09-01Translate event.code key representations to the corresponding event.key format.Stephen Blott
2017-09-01Implement ignoreKeyboardLayout option in getKeyChar.Stephen Blott
Fixes #2618.
2017-04-19Simplify isPrintable(event) test.Stephen Blott
2017-04-18Avoid repeating Backspace and Delete keys.Stephen Blott
2017-04-18Remove use of keyCodes entirely.Stephen Blott
event.keyCode` is depricated: - https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
2017-04-18Move keyboard utils to keydown and migrate normal/visual modes.Stephen Blott
2017-03-22Note TODO re. keydown, keypress.Stephen Blott
2017-03-22Move key handling to keydown and event.key.Stephen Blott
- For PDF tabs, we see keydown events but we don't see the corresponding keypress events, so this allows us to navigate through PDF tabs with J/K. - This relies on using `event.key` instead of `event.keyIdentifier` (which is no longer supported). - Also move mapkey handling into the keyboard utils. The effect of all of this is to simplify and unify much of our key handling. Fixes #1243 (for tab commands). There are known places where we can prune a considerable amount of key handling code. However, that code is left in place for now in case this change throws up some unexpected issues.
2017-03-22Remove and refactor mapKeyRegistery.Stephen Blott
1. Remove the use of mapKeyRegistery from the mode handler. 2. Refactor use of mapKeyRegistery keyboard utils. This is preparatory to refactoring all of the keyboard handling.
2017-03-19event.key is not always definedStephen Blott
Fixes #2453.
2016-10-10Add TODO.Stephen Blott
2016-10-10Rename 'translate' to 'mapkey'.Stephen Blott
2016-10-09Tweak (simplify) #2306.Stephen Blott
2016-10-09Extend key translation to include Escape.Stephen Blott
Here, these map to escape: translate x <c-[> translate <c-c> <c-[>
2016-10-02Rework key-sequence parsing.Stephen Blott
This reworks the parsing of key sequences like `<c-a-Z>x`: Advantages over the status quo: - Parses key sequences in one only place (previously two), - Removes two hideous regular expression. - Admits multi-modifier bindings (like `<c-a-Z>`). - Adds more (and better) tests. - (And it should be easier to maintain.) Replaces #2210 (this also simplifies key parsing substantially).
2016-09-17Merge branch 'gdh1995-backspace-as-go-back'Stephen Blott
2016-09-17Rework #2223 (backspace).Stephen Blott
2016-09-17use keyNames to check backspace keyCodegdh1995
2016-09-10simpler logic to detect backsapcegdh1995
2016-08-18support mapping <backspace>gdh1995
Chrome stop using <backspace> to go back, but some still wants this feature. This should fix #2207 and #2214.
2016-08-10Consider the alt-key status when trying to detect <c-[>Colin Kiegel
see https://github.com/philc/vimium/issues/986#issuecomment-53955175
2016-06-02Favour event.keyIdentifier over event.key.Stephen Blott
See #2147. Chromium's implementation of event.key currently fails to take account of keyboard mappings (e.g. neo2). Here, we favour using event.keyIdentifier (while it's available) as a workaround.
2016-05-15Also remove event.keyIdentifier in getKeyCharString().Stephen Blott
This was an oversight from a5262f4e68f62a922c9c05d871c4a874f6737a7b.
2016-05-15Use event.key (not event.keyIdentifier).Stephen Blott
event.keyIdentifier is depricated and will be removed soon. It is being replaced by event.key. Unfortunatelty, event.key is not yet available in the stable Chrome version. Here, we use whichever API is available. In due course, we can remove the event.keyIdentifier implementation (and a considerable amount of machinery surrounding it). For the time being, if both APIs are available, then we verify one against the other and show a warning message of they do not match. This should help us track down any issues which arise. Using event.key has the additional benefit of correctly detecting shifted characters on the numbers row on keydown, which has been a problem for some users. Fixes #2128. Note: We have a problem with the tests. phantomjs does not currently support event.key, and possibly never will.
2016-02-18PassNextKey; minor tweak.Stephen Blott
2016-02-18PassNextKey; move key parsing to keyboard_utils.coffee.Stephen Blott
Previously, key event parsing was embedded in the normal-mode key handlers. Here, we move it to a new function (getKeyCharString) in KeyboardUtils so that it can also be used from elsewhere... In particular for detecting the pass-next-key key in insertmode.
2015-12-04For Ctrl-[, also require NOT AltStephen Blott
See #1906. It is not obvious that this is in fact correct. In particular, it's not clear how `Ctrl-[` should work on Mac keyboards.
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-02-01Give find mode a history.Stephen Blott
2015-01-29Visual/edit modes: initial caret mode.Stephen Blott
2015-01-22Visual/edit modes: further development.Stephen Blott
- Better abstraction. - Add HUD message on yank. - Require initial selection for visual mode. - Try to start with a visible selection. - Scroll the active end of the selection into view (with smooth scrolling, if enabled).
2015-01-10Modes; better printable detection, move to keyboard_utils.Stephen Blott
2014-04-23Recognise <ctrl> key in LinkHintsmrmr1993
2012-06-12Port keyboard_utils.js to coffeescriptPhil Crosby