diff options
| author | Pavel Yarmak | 2017-10-07 15:06:48 -0500 | 
|---|---|---|
| committer | Pavel Yarmak | 2017-10-07 15:06:48 -0500 | 
| commit | 27691f8c4dcdecdb884349189966eb6e2667330e (patch) | |
| tree | df3740e1e7646ecfe3e19b3344346509b24eadba | |
| parent | 9da17bfd35f5e97bc4e6949debbaae073bc367e5 (diff) | |
| parent | 0e1d0d317e5d5f9fcebebbdf4a0a243f122b7471 (diff) | |
| download | vimium-27691f8c4dcdecdb884349189966eb6e2667330e.tar.bz2 | |
Merge remote-tracking branch 'origin/master'
| -rw-r--r-- | .travis.yml | 15 | ||||
| -rw-r--r-- | content_scripts/link_hints.coffee | 26 | ||||
| -rw-r--r-- | pages/options.html | 6 | ||||
| -rw-r--r-- | tests/dom_tests/dom_tests.coffee | 2 | 
4 files changed, 27 insertions, 22 deletions
| diff --git a/.travis.yml b/.travis.yml index a1484d2e..81d73211 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,13 @@ +sudo: false  language: node_js -node_js: 0.12 +node_js: "8"  before_install: -  - "npm install -g coffee-script" -  - "npm install path@0.11" -  - "npm install util" -  - "npm install -g phantomjs@1.9.20" -  - "cake build" -script: "cake test" +  - npm install -g coffee-script +  - npm install path@0.11 +  - npm install util +  - npm install -g phantomjs@1.9.20 +  - cake build +script: cake test  notifications:    email: false  branches: diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index eeadfc0c..d9ce5d06 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -236,13 +236,8 @@ class LinkHintsMode      previousTabCount = @tabCount      @tabCount = 0 -    # NOTE(smblott) As of 1.54, the Ctrl modifier doesn't work for filtered link hints; therefore we only -    # offer the control modifier for alphabet hints.  It is not clear whether we should fix this.  As of -    # 16-03-28, nobody has complained. -    modifiers = ["Shift"] -    modifiers.push "Control" unless Settings.get "filterLinkHints" - -    if event.key in modifiers and +    # NOTE(smblott) The modifier behaviour here applies only to alphabet hints. +    if event.key in ["Control", "Shift"] and not Settings.get("filterLinkHints") and        @mode in [ OPEN_IN_CURRENT_TAB, OPEN_WITH_QUEUE, OPEN_IN_NEW_BG_TAB, OPEN_IN_NEW_FG_TAB ]          @tabCount = previousTabCount          # Toggle whether to open the link in a new or current tab. @@ -289,7 +284,12 @@ class LinkHintsMode      else        @tabCount = previousTabCount if event.ctrlKey or event.metaKey or event.altKey        unless event.repeat -        if keyChar = KeyboardUtils.getKeyChar(event).toLowerCase() +        keyChar = +          if Settings.get "filterLinkHints" +            KeyboardUtils.getKeyChar(event) +          else +            KeyboardUtils.getKeyChar(event).toLowerCase() +        if keyChar            keyChar = " " if keyChar == "space"            if keyChar.length == 1              @markerMatcher.pushKeyChar keyChar @@ -473,10 +473,10 @@ class AlphabetHints    # For alphabet hints, <Space> always rotates the hints, regardless of modifiers.    shouldRotateHints: -> true -# Use numbers (usually) for hints, and also filter links by their text. +# Use characters for hints, and also filter links by their text.  class FilterHints    constructor: -> -    @linkHintNumbers = Settings.get "linkHintNumbers" +    @linkHintNumbers = Settings.get("linkHintNumbers").toUpperCase()      @hintKeystrokeQueue = []      @linkTextKeystrokeQueue = []      @activeHintMarker = null @@ -526,11 +526,15 @@ class FilterHints    pushKeyChar: (keyChar) ->      if 0 <= @linkHintNumbers.indexOf keyChar        @hintKeystrokeQueue.push keyChar +    else if keyChar.toLowerCase() != keyChar and @linkHintNumbers.toLowerCase() != @linkHintNumbers.toUpperCase() +      # The the keyChar is upper case and the link hint "numbers" contain characters (e.g. [a-zA-Z]).  We don't want +      # some upper-case letters matching hints (above) and some matching text (below), so we ignore such keys. +      return      # We only accept <Space> and characters which are not used for splitting (e.g. "a", "b", etc., but not "-").      else if keyChar == " " or not @splitRegexp.test keyChar        # Since we might renumber the hints, we should reset the current hintKeyStrokeQueue.        @hintKeystrokeQueue = [] -      @linkTextKeystrokeQueue.push keyChar +      @linkTextKeystrokeQueue.push keyChar.toLowerCase()    popKeyChar: ->      @hintKeystrokeQueue.pop() or @linkTextKeystrokeQueue.pop() diff --git a/pages/options.html b/pages/options.html index 412e17df..46307b6f 100644 --- a/pages/options.html +++ b/pages/options.html @@ -115,11 +115,11 @@ b: http://b.com/?q=%s description              </td>            </tr>            <tr id="linkHintNumbersContainer"> -            <td class="caption">Numbers used<br/> for link hints</td> +            <td class="caption">Characters used<br/> for link hints</td>              <td verticalAlign="top">                  <div class="help">                    <div class="example"> -                    The numbers placed next to each link after typing "f" to enter link-hint mode. +                    The characters placed next to each link after typing "f" to enter link-hint mode.                    </div>                  </div>                  <input id="linkHintNumbers" type="text" /> @@ -145,7 +145,7 @@ b: http://b.com/?q=%s description                </div>                <label>                  <input id="filterLinkHints" type="checkbox"/> -                Use the link's name and numbers for link-hint filtering +                Use the link's name and characters for link-hint filtering                </label>              </td>            </tr> diff --git a/tests/dom_tests/dom_tests.coffee b/tests/dom_tests/dom_tests.coffee index 5439e119..a5c85606 100644 --- a/tests/dom_tests/dom_tests.coffee +++ b/tests/dom_tests/dom_tests.coffee @@ -76,7 +76,7 @@ createGeneralHintTests = (isFilteredMode) ->        assertStartPosition = (element1, element2) ->          assert.equal element1.getClientRects()[0].left, element2.getClientRects()[0].left          assert.equal element1.getClientRects()[0].top, element2.getClientRects()[0].top -      stub document.body, "style", "static" +      stub document.body.style, "position", "static"        linkHints = activateLinkHintsMode()        hintMarkers = getHintMarkers()        assertStartPosition document.getElementsByTagName("a")[0], hintMarkers[0] | 
