aboutsummaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2017-04-18Better check for handlerId.Stephen Blott
2017-04-18Set handlerId directly to a non-id.Stephen Blott
2017-04-18Make the consumeKeyup handler a singleton.Stephen Blott
That is, allow at most one handler to be installed at any one time. I have not observed this to be necessary. However, if there were any systematic way in which we weren't seeing the necessary keyup events, then these handlers would just be added and added. So this seems safer.
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-04-18Avoid repeating Backspace and Delete keys.Stephen Blott
2017-04-18Ignore keybiard repeats.Stephen Blott
Keyboard repeats were interfering with smooth scrolling. But we should be ignoreing them anyway.
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-04-18Check whether chrome.storage.sync is enabled, fall back to .local if notmrmr1993
2017-04-16Use browser independent new tab page URL (about:newtab)mrmr1993
2017-04-16Only remove settings from storage.local if it's not our main storemrmr1993
2017-04-16Fallback to storage.local if storage.sync is not availablemrmr1993
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.
2017-03-04Merge pull request #2369 from gdh1995/zoomed-docEl-offsetStephen Blott
getViewportTopLeft: support zoomed static documentElement
2017-02-09Guard against undefined (out of spec) getDestinationInsertionPointsmrmr1993
2017-01-03take documentElement's border into considerationgdh1995
2017-01-03getViewportTopLeft: consider the new style "contain"gdh1995
If an element's `contain` is/contains `paint`, then it will be forced showing just as its `position` is `relative`.
2017-01-03getViewportTopLeft: support zoomed static documentElementgdh1995
if `document.documentElement` is zoomed, Vimium's hints `<div>` are also zoomed, and then `scrollY` may be not equal with viewport client rect's `top`. Example: * make the tab zoom level is 1, `documentElement`'s `zoom` style is 2 * open a page, scroll to the top left corner * press `f`, and all things are right * exit LinkHints mode, scroll down for 100px, and then press `f` * this time all hints has moved down 200px from the correct place
2016-12-21Merge pull request #2311 from smblott-github/enterNormalModeStephen Blott
New command option to enter normal mode
2016-10-23Move SearchEngines to bg-utils.coffee.Stephen Blott
`SearchEngines` was previously in `utils.coffee`, which means it was loaded in *every* content frame. This is unnecessary, since it is only used on the background page. So this PR moves it there. Also: - Simplify some unnecessarily complex logic in `vomnibar.coffee`. - Re-use `Utils.parseLines()` to parse the custom search engine configuation text.
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-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-08Better positioning of link-hints flash rect.Stephen Blott
When an <a> spans the end of a line and the start of the next line, we now highlight both parts of the link (instead of just the first). Also, refactor code for calculating the position of the viewport into a separate utility in DomUtils.
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-10-01Remove legacy migrations.Stephen Blott
2016-09-25Space rotates hints (to make hidden hints visible).Stephen Blott
It is common for link-hint markers to be close togother, and overlapping. Here, `<Space>` rotates hint markers such that hidden markers become visible. For filtered hints we additionally require a modifier (because `<space>` on its own is already a token separator). The calculation of overlapping hints is quite expensive: O(n^2) in the best case and O(n^3) in the worst cast. The worst case is extraordinarily unlikely to arise in practice.
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-27Merge pull request #2132 from sco-tt/masterStephen Blott
Adds single left/right angle quotation marks to next/previous patterns
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-05-12Adds single left/right angle quotation marks to next/previous patternsScott Pinkelman
2016-05-12Revert "Improves next/previous links by targetting button elements and ↵Stephen Blott
adding single left/right angle quotation marks" This reverts commit ee8c235aeaf52d2bc867a00c37731690e337c7ff. This reverts #2117. This breaks next/prev on Reddit (it chooses a different link). Reddit is an important site, so we should unwind this for now. Mention @sco-tt.
2016-05-07Merge pull request #2118 from smblott-github/fix-ui-component-init-issuesStephen Blott
Fix UI-component initialization issues (maybe).
2016-04-28Fix UI-component initialization issues.Stephen Blott
This fixes some UI component initialization issues. It's a long story... The problem. - Go to this page: http://www.thejournal.ie/seanad-election-results-2016-2737768-Apr2016/ - Click one of the links from the "Most Popular" box on the right. - Navigate back (`H`) and, as the original page is loading, activate the Vomnibar. In 1.54 this renders Vimium unusable. In `master` this renders the Vomnibar unsable, but the rest of Vimium usable. It seems the source of the issue is that we're initializing UI components too soon. We need to wait until the `readyState` is "complete". With this PR: - The Vomnibar is initialised when the `readyState` is "complete" (in the top frame only, and only if Vimium is enabled). Requests arriving prior to then are silently discarded. - The HUD is also initialized only when the `readyState` is "complete"; however, requests arriving before then are queued. So, if the user immediately enters insert mode, then the "Insert mode" indicator will eventually be displayed. - The help dialog silently discards requests until the `readyState` is "complete. I'm posting this as a PR because: 1. It needs some visibility. 2. With this, if the `readyState` *never* reaches "complete", then the Vomnibar would be unusable. And that's pretty serious.
2016-04-28Make vimiumFlash a class.Stephen Blott
There are circumstances when we hav two (identical) vimiumFlash elements displayed: specifically, when using the waitForEnter keyboard blocker. So, we should use a class (rather than an id) to style the flash element.
2016-04-26Improves next/previous links by targetting button elements and adding single ↵Scott Pinkelman
left/right angle quotation marks
2016-04-18Revert "UI-compnent commands must wait for the document to be ready."Stephen Blott
This reverts commit c01d7eea8675f9a7d84999777e8de72244d687b6. Preparatory to implementing an alternative approach.
2016-04-17UI-compnent commands must wait for the document to be ready.Stephen Blott