Simon Lydell [Sat, 31 Aug 2013 23:16:48 +0000 (01:16 +0200)]
Fix a likely future bug
Now passing an array of arguments to the `enter` method of modes, instead
of using splats, in order not to destroy the `this` context of the `enter`
methods.
Simon Lydell [Sat, 31 Aug 2013 22:39:41 +0000 (00:39 +0200)]
Fix: Proper modes support
The vim code is now more maintainable, easier to understand and
extensible. This commit makes it easier to implement new modes, such as
the proposed ignore mode.
1. It changed from "agent" sheets to "author" sheets
2. It removed all `!important`
That caused problems with userstyles in userContent.css or Stylish.
Website themes installed by the user often make the hint markers
unreadable, for example.
LordJZ [Fri, 2 Aug 2013 01:56:50 +0000 (05:56 +0400)]
Makefile cleanup.
Removed *.lint.coffee targets as they are never actually created.
Simplified lint target, now coffeelint runs for all the files at once.
Removed gen and zip phony targets.
Removed uglifyjs command text output.
Fixed order of operations when minifying js.
Simon Lydell [Tue, 30 Jul 2013 22:00:21 +0000 (00:00 +0200)]
Enhance performance
Instead of sorting the whole array of elements in each iteration of the
huffman tree construction, we now search backwards for the first index
where the sum to insert is equal to or greater than the weight at that
index. Directly after that index the sum is inserted. According to some
tests I made, this is about 3 times faster than before.
Simon Lydell [Tue, 30 Jul 2013 12:47:26 +0000 (14:47 +0200)]
Group all hint injection code in hints.coffee
Before, the hint/marker injection code was spread out in both hints.coffee
and marker.coffee. Creation and injection of markers does not really
belong to the Marker class. It is just a wrapper around a single markable
element.
Now, all hint/marker creation and injection is done in hints.coffee. This
has several benefits: The code is a lot easier to understand, and the
number of loops over arrays of markers could be reduced a lot, enhancing
performance.
I've also cleaned the code up, as well as removed code that was totally
useless: Before, `element.getClientRects()` was scanned for rectangles
matching the `isRectOk()` test. However, none of them could ever pass,
since `isRectOk()` looks for width and height properties on the
rectangles, which do not even exist (however, they do on the rectangle
returned by `element.getBoundingClientRect()`). This also fixes the uncaught
ReferenceErrors complaining about undefined width and height properties.
This also removed unnecessary loops, which enhances performance even more.
Some of these changes could have been made outside the huffman branch, I
realize now. However, it would take some work, and I'm not sure it is
worth it.
An improvement I noticed with this patch: It is now possible to click the
green, hidden until hover install buttons on AMO:
https://addons.mozilla.org/firefox/addon/VimFx/versions/
Simon Lydell [Tue, 30 Jul 2013 09:44:56 +0000 (11:44 +0200)]
Refactor to clarify and enhance performance
The code should be easier to understand now, and has a more flexible API.
Thanks to the latter, we now get better performance. Before, we had to
iterate the whole array of markers generated by `injectHints` both before
and after `addHuffmanCodeWordsTo`. Now, that is not necessary anymore.
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://)