Simon Lydell [Mon, 29 Jul 2013 21:19:00 +0000 (23:19 +0200)]
Change `markers?.length` into `markers.length`
The existence check is no longer needed, since `injectHints` now always
returns an array: Where it before returned `undefined`, it now returns an
empty array.
Simon Lydell [Mon, 29 Jul 2013 18:27:31 +0000 (20:27 +0200)]
Fix typo
Line 64 in marker.coffee contains a reference to `@markedElement`, though
that is the only occurance in the entire files. It clearly looks like it
is a typo of `@markerElement`, by inspecting the nearby code. The odd
thing, though, is that that line seems to have been added by commit b5f488df, and already there the typo exists. Has the code ever worked?
I'm not sure if this fix currently fixes any issues, but it is needed in
the Huffman branch in order not to throw errors.
Simon Lydell [Mon, 29 Jul 2013 18:14:53 +0000 (20:14 +0200)]
Fix `injectHints` might return undefined markers
The `inner` function of `injectHints` now returns an empty array instead
of undefined if no markers could be produced, since all results of the
`inner` function are recursively concatenated. VimFx seems to have worked
well even though some entries in the array of markers returned by
`injectHints` could be undefined. However, on the Huffman branch, the
undefined entries sometimes caused a TypeError to be thrown, which
eventually resulted in that none of the hint markers were given any hints.
Closes #114, closes #115.
Find will now start from current selection/last found match
Find string is now global for all windows
'gh' command will now function properly for urls without protocol part (http://)
Simon Lydell [Tue, 16 Jul 2013 19:04:41 +0000 (21:04 +0200)]
Consistent use of parenthesis
Functions pretty much always use parenthesis, unless:
- The last argument is a function literal
- The function call is multiline for some (other) reason
- The specific case makes it less readable with parenthesis
- The function is `require`
Simon Lydell [Tue, 16 Jul 2013 16:17:15 +0000 (18:17 +0200)]
Remove chrome.coffee
- Remove chrome.coffee, which added Cc, Ci and Cu globally.
- Add definitions of those in files where needed.
- Fix consistent formatting of their definitions.
- Fix consistent placement of their definitions: after reqiures. Includes
cleaning up the requires sometimes, involving alignment.
- When fixing alignment of requires I couldn't help but to also fix
alignments in other places.
- Trailing whitespace was also removed by my editor.
Simon Lydell [Tue, 16 Jul 2013 14:35:00 +0000 (16:35 +0200)]
Fix frames handling
Every frame got the same hints as the others, basically. Now
`Marker.createMarkers()` does not give its markers any hints anymore.
Instead, all markers from all frames are collected in `injectHints()` and
then given markers. I am not sure how good/nice the solution is, but it
works.
Simon Lydell [Tue, 16 Jul 2013 09:31:50 +0000 (11:31 +0200)]
Use Huffman algorithm for hints generation (fix #112)
The Huffman algorithm is now used to generate optimal prefix codes for all
focusable elements. The area of each element is used as _weight_. The
higher the weight, the shorter the hint.
Note:
The old algorithm seemed to give shorter hints to `<a>` elements. That is
currently not the case with the new algorithm.
Other related changes:
- Change minimum allowed number of hint chars from 3 to 2, since the new
algorithm supports it.
- Change default hint chars, since with the new algorithm the best keys
should be at the beginning of the string.
- My editor is set to strip trailing white space. Apparently there was a
lot of trailing whitespace in many files, so a diff of this commit is a
bit messy.
Closes #111. Validating custom hint characters.
If there are less than 3 custom hint characters the the default hint characters are used.
Custom hint characters are filtered to remove duplicates.
Closes #36, closes #42, closes #85.
Reimplemented find mode. This mode now has fully featured text input that will accepts CJK input.
It also uses nsIFind interfase which boosts searching performance.
Also added a shortcut to highlight all occurances of particular string on the page
Hint markers will now reach into iframes
Firefox doesn't allow closing pinned tabs with a GUI button nor by
pressing Ctrl+W. This commit introduces similar behaviour in VimFx.
Pinned tabs won't be closed by pressing x.