diff options
| -rw-r--r-- | README.md | 10 | ||||
| -rw-r--r-- | background_scripts/commands.coffee | 4 | ||||
| -rw-r--r-- | content_scripts/link_hints.coffee | 8 | ||||
| -rw-r--r-- | content_scripts/vimium.css | 2 | ||||
| -rw-r--r-- | lib/keyboard_utils.coffee | 25 |
5 files changed, 35 insertions, 14 deletions
@@ -97,6 +97,8 @@ Additional advanced browsing commands: gi focus the first (or n-th) text input box on the page gu go up one level in the URL hierarchy gU go up to root of the URL hierarchy + ge edit the current URL + gE edit the current URL and open in a new tab zH scroll all the way left zL scroll all the way right v enter visual mode; use p/P to paste-and-go, use y to yank @@ -157,6 +159,12 @@ Please see [CONTRIBUTING.md](https://github.com/philc/vimium/blob/master/CONTRIB Release Notes ------------- +Changes since previous release (not in the Chrome Store version) + +- You can now map `<backspace>` to a Vimium command (e.g. `map <backspace> goBack`). +- Bug fixes: + - `<c-a-[>` is no longer handled (incorrectly) as `Escape`. This also affects `<Alt-Gr-[>`. + 1.56 (2016-06-11) - Vimium now works around a Chromium bug affecting users with non-standard keyboard layouts (see #2147). @@ -383,7 +391,7 @@ Release Notes - In link hints mode, holding down the shift key will now toggle between opening in the current tab and opening in a new tab. - Two new commands (`zH` and `zL`) to scroll to the left and right edges of the page. -- A new command (`gi`) to focus the first (or n-th) text input box on the page. +- A new command (`gi`) to focus the first (or n-th) visible text input. - A new command (`<a-f>`) to open up multiple links at a time in new tabs. - Frame support. - More robust support for non-US keyboard layouts. diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index c334cf9d..f865131d 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -41,7 +41,7 @@ Commands = # them you have to press "shift" as well. normalizeKey: (key) -> key.replace(/<[acm]-/ig, (match) -> match.toLowerCase()) - .replace(/<([acm]-)?([a-zA-Z0-9]{2,5})>/g, (match, optionalPrefix, keyName) -> + .replace(/<([acm]-)?([a-zA-Z0-9]{2,})>/g, (match, optionalPrefix, keyName) -> "<" + (if optionalPrefix then optionalPrefix else "") + keyName.toLowerCase() + ">") parseCustomKeyMappings: (customKeyMappings) -> @@ -97,7 +97,7 @@ Commands = # Keys are either literal characters, or "named" - for example <a-b> (alt+b), <left> (left arrow) or <f12> # This regular expression captures two groups: the first is a named key, the second is the remainder of # the string. - namedKeyRegex = /^(<(?:[amc]-.|(?:[amc]-)?[a-z0-9]{2,5})>)(.*)$/ + namedKeyRegex = /^(<(?:[amc]-.|(?:[amc]-)?[a-z0-9]{2,})>)(.*)$/ keyStateMapping = {} for own keys, registryEntry of @keyToCommandRegistry currentMapping = keyStateMapping diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 0f2425c3..2548abb3 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -326,6 +326,8 @@ class LinkHintsMode else if localHintDescriptor.reason == "Scroll." # Tell the scroller that this is the activated element. handlerStack.bubbleEvent "DOMActivate", target: clickEl + else if localHintDescriptor.reason == "Open." + clickEl.open = !clickEl.open else if DomUtils.isSelectable clickEl window.focus() DomUtils.simulateSelect clickEl @@ -621,7 +623,8 @@ LocalHints = when "button", "select" isClickable ||= not element.disabled when "label" - isClickable ||= element.control? and (@getVisibleClickable element.control).length == 0 + isClickable ||= element.control? and not element.control.disabled and + (@getVisibleClickable element.control).length == 0 when "body" isClickable ||= if element == document.body and not windowIsFocused() and @@ -637,6 +640,9 @@ LocalHints = isClickable ||= if element.clientHeight < element.scrollHeight and Scroller.isScrollableElement element reason = "Scroll." + when "details" + isClickable = true + reason = "Open." # An element with a class name containing the text "button" might be clickable. However, real clickables # are often wrapped in elements with such class names. So, when we find clickables based only on their diff --git a/content_scripts/vimium.css b/content_scripts/vimium.css index ece35ddc..be9d4a65 100644 --- a/content_scripts/vimium.css +++ b/content_scripts/vimium.css @@ -88,7 +88,7 @@ div.internalVimiumHintMarker { div.internalVimiumHintMarker span { color: #302505; - font-family: Helvetica, Arial, sans-serif !important; + font-family: Helvetica, Arial, sans-serif; font-weight: bold; font-size: 11px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); diff --git a/lib/keyboard_utils.coffee b/lib/keyboard_utils.coffee index f997b455..dabf864d 100644 --- a/lib/keyboard_utils.coffee +++ b/lib/keyboard_utils.coffee @@ -4,7 +4,7 @@ KeyboardUtils = f12: 123, tab: 9, downArrow: 40, upArrow: 38 } keyNames: - { 37: "left", 38: "up", 39: "right", 40: "down", 32: "space" } + { 37: "left", 38: "up", 39: "right", 40: "down", 32: "space", 8: "backspace" } # This is a mapping of the incorrect keyIdentifiers generated by Webkit on Windows during keydown events to # the correct identifiers, which are correctly generated on Mac. We require this mapping to properly handle @@ -53,15 +53,21 @@ KeyboardUtils = "" getKeyCharUsingKeyIdentifier: (event) -> - # Not a letter - if (event.keyIdentifier.slice(0, 2) != "U+") - return @keyNames[event.keyCode] if (@keyNames[event.keyCode]) - # F-key - if (event.keyCode >= @keyCodes.f1 && event.keyCode <= @keyCodes.f12) - return "f" + (1 + event.keyCode - keyCodes.f1) - return "" + # Handle named keys. + keyCode = event.keyCode + if keyCode + if keyCode of @keyNames + return @keyNames[keyCode] + # Function keys. + if @keyCodes.f1 <= keyCode <= @keyCodes.f12 + return "f" + (1 + keyCode - keyCodes.f1) keyIdentifier = event.keyIdentifier + + # Not a letter. + if not keyIdentifier.startsWith "U+" + return "" + # On Windows, the keyIdentifiers for non-letter keys are incorrect. See # https://bugs.webkit.org/show_bug.cgi?id=19906 for more details. if ((@platform == "Windows" || @platform == "Linux") && @keyIdentifierCorrectionMap[keyIdentifier]) @@ -75,7 +81,8 @@ KeyboardUtils = isEscape: (event) -> # c-[ is mapped to ESC in Vim by default. - (event.keyCode == @keyCodes.ESC) || (event.ctrlKey && @getKeyChar(event) == '[' and not event.metaKey) + (event.keyCode == @keyCodes.ESC) || + (event.ctrlKey && @getKeyChar(event) == '[' and not event.metaKey and not event.altKey) # TODO. This is probably a poor way of detecting printable characters. However, it shouldn't incorrectly # identify any of chrome's own keyboard shortcuts as printable. |
