diff options
| author | Stephen Blott | 2016-01-28 16:59:46 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2016-01-28 16:59:46 +0000 | 
| commit | 4c6c3210639bcf23f33b419963d930743062811a (patch) | |
| tree | e0eb80e68a5f9f3b256678f73abcdd5b1eb28041 | |
| parent | 75463367b337bd600e9c8a9e4d56ca06da341527 (diff) | |
| download | vimium-4c6c3210639bcf23f33b419963d930743062811a.tar.bz2 | |
Simplify hint-string generation; simplification.
| -rw-r--r-- | content_scripts/link_hints.coffee | 9 | ||||
| -rw-r--r-- | lib/utils.coffee | 1 | 
2 files changed, 5 insertions, 5 deletions
| diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 4ced15f6..61ea1e37 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -444,13 +444,12 @@ class AlphabetHints      offset = 0      while hints.length - offset < linkCount or hints.length == 1        hint = hints[offset++] -      hints.push hint + ch for ch in @linkHintCharacters +      hints.push ch + hint for ch in @linkHintCharacters      hints = hints[offset...offset+linkCount] -    # This shuffles the hints so that they're scattered; hints starting with the same character are spread -    # evenly throughout the array.  We reverse each hint, then sort them, then reverse them again. -    hints = (hint.split("").reverse().join "" for hint in hints).sort() -    return (hint.split("").reverse().join "" for hint in hints) +    # Shuffle the hints so that they're scattered; hints starting with the same character are spread evenly +    # throughout the array. +    return hints.sort().map (str) -> str.reverse()    getMatchingHints: (hintMarkers) ->      matchString = @hintKeystrokeQueue.join "" diff --git a/lib/utils.coffee b/lib/utils.coffee index b69b926b..c255102e 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -281,6 +281,7 @@ Array.copy = (array) -> Array.prototype.slice.call(array, 0)  String::startsWith = (str) -> @indexOf(str) == 0  String::ltrim = -> @replace /^\s+/, ""  String::rtrim = -> @replace /\s+$/, "" +String::reverse = -> @split("").reverse().join ""  globalRoot = window ? global  globalRoot.extend = (hash1, hash2) -> | 
