Simon Lydell [Thu, 29 Oct 2015 07:52:24 +0000 (08:52 +0100)]
Play nicer with the dev tools
- Previously, events that occured in the dev tools were erraneously marked as
frame events, which made it impossible to blur the dev tools using VimFx.
- Improved Escape key handling: Blurring the dev tools using the Escape key no
longer toggles the split console.
Simon Lydell [Wed, 28 Oct 2015 17:53:38 +0000 (18:53 +0100)]
Make hints mode more robust
- Revive `hints.removeHints()`. While looking for an element that happens to
have the VimFx container ID and removing it perhaps is not very elegant, it is
very robust. If the reference to the hints container is ever lost (bugs
inevitably slip through, or if `gulp` is run while in hints mode), unremovable
hints are left on the screen.
- Enter hints mode _immediately_ when invoking one of the `f` commands. Hints
mode used to be entered first when the frame script had found all markable
elements. Remember that communicating with a frame script is asynchronous, and
that finding all markable elements may take time. In that time span, user key
presses should be handled in hints mode, not in normal mode.
Simon Lydell [Tue, 27 Oct 2015 06:25:34 +0000 (07:25 +0100)]
Use the red icon for ignore mode (for the button)
Simply mkaing it grayscale didn't stand out enough. I had a hard time seeing the
difference sometimes. Besides, it's a shame having that beautiful red version
lying around but not being used.
Simon Lydell [Mon, 26 Oct 2015 19:09:18 +0000 (20:09 +0100)]
Optimize the API
- Before, if an add-on called `vimfx.set()` around 200 times it could delay
Firefox's startup time with almost a second. Now there's no delay at all.
- Marks internal variables in public.coffee with a leading underscore. There's
nothing stopping people from importing them, but no they at least look
private.
- Remove `vimfx.refresh()`. That is done automatically now, in an efficient way.
- This also makes the test's teardown more robust.
Simon Lydell [Mon, 26 Oct 2015 06:37:49 +0000 (07:37 +0100)]
Fix broken setting of the API URL pref
Accidentally broken in commit 33ed14df. I hadn't noticed before, since the
correct pref still remained in my profiles. Testing in a new profile revealed
the error.
Simon Lydell [Sun, 25 Oct 2015 17:44:33 +0000 (18:44 +0100)]
Increase hackability of the help dialog
Provide `data-mode`, `data-category` and `data-command` attributes, that can be
used by custom CSS to, for example, hide unwanted modes, categories and/or
commands from the dialog.
Simon Lydell [Sat, 24 Oct 2015 15:51:17 +0000 (17:51 +0200)]
Fix `<late>` + `event.stopPropagation()`
If the page calls `event.stopPropagation()`, late listenOnce:es are of course
not triggered for that event. However, the listeners still remain. This caused
them to erraneously trigger commands on the _next_ keypress. This commit adds a
flag telling the late listeners if their event was `.stopPropagation()`:ed.
Simon Lydell [Sat, 24 Oct 2015 12:21:41 +0000 (14:21 +0200)]
Improve the public API consumption
Re-run all `.getAPI` calls when VimFx is updated. Otherwise you need to restart
Firefox, or disable and then enable every add-on that uses the API in order for
them to take effect on the new version.
Simon Lydell [Thu, 22 Oct 2015 17:08:00 +0000 (19:08 +0200)]
Properly handle key events in non-multi-process
This commit can alternatively be lableled:
"Fix `Vim::isFrameEvent`" in in-multi-process.
Before, _no key events were considered frame events non-multi-process, because
the check didn't work there. Most notably, this caused `<escape>` to be leaked
to the page when blurring text inputs.
Simon Lydell [Wed, 21 Oct 2015 16:46:42 +0000 (18:46 +0200)]
Replace a `console.log` in gulpfile.coffee
... with `process.stdout.write`. This means that there is only one `console.log`
occurance in all .coffee files, which makes it easier to search for left-over
temporary `console.log`s.
Simon Lydell [Sun, 18 Oct 2015 18:57:09 +0000 (20:57 +0200)]
Add support for `<late>` shortcuts
By including the special key `<late>` in a shortcut it is run _after_ web page
event listeners, allowing them to override the VimFx shortcut. This is useful
when binding to `<tab>` and the arrow keys.
Simon Lydell [Sat, 17 Oct 2015 22:30:18 +0000 (00:30 +0200)]
Fix documentation link in the readme
It pointed to master, which will be correct when 0.6.0 is released. However,
there are already other links in the readme that point to develop, so we could
just as well make that link work for the time being as well.
Simon Lydell [Sat, 17 Oct 2015 18:52:53 +0000 (20:52 +0200)]
Fix shortcut triggering on slowly loadnig pages
Frame scripts cannot receive events until a DOMWindow has been created in it. If
you opened a link in a new tab, and the page loaded very slowly making it take a
long time before a DOMWindow is created, it meant that no VimFx shortcuts could
used during that time.
The solution is to handle shortcuts in the main process until a DOMWindow has
been created.
Simon Lydell [Sat, 17 Oct 2015 13:35:36 +0000 (15:35 +0200)]
Fix VimFx being broken in new windows
Apparently, the VimFx button only needs to be added once, not once per window.
Trying to add it more than once caused an exception that prevented the rest of
VimFx from being set up.
Simon Lydell [Sun, 11 Oct 2015 16:41:08 +0000 (18:41 +0200)]
Improve keyboard shortcut overriding behavior
- When the feature was initially implemented, it was modeled after putting a
series of `map` commands after each other in .vimrc, which is written in a
procedural programming language. Then it makes sense that latter `map` calls
override earlier ones. That's why VimFx used to let commands further down the
list in VimFx's settings page in the Add-ons Manager override earlier
commands. The more I used it, though, that didn't feel entirely natural. After
a while I realized that in such an interface it makes sense having _earlier_
commands win. With this commit, latter commands _don't_ override earlier ones
anymore, and are ignored, showing an error message.
- The above point also means that editing a shortcut can never result in error
messages appearing _above_ that command. If you add `g` to a shortcut near the
end of the list, there used to appear an error message for every shortcut
starting with `g` above it (which is quite a few), causing dis-orientation
when the focused text box was moved down because of all those error messages.
- With this commit, the order of the modes, categories and commands is taken
into account. That used to work only when the user hadn't customized the
orders or hadn't added new modes, categories and/or commands.
- A small fix for `<force>` is also included. If a shortcut contains invalid
usage of `<force>` it is now properly ignored (still showing an error
message).
Simon Lydell [Sun, 28 Jun 2015 09:57:56 +0000 (11:57 +0200)]
Lay the foundation for using multi-process Firefox
This also fixes leaking of variables in bootstrap.coffee (which masked a missing
`require` call in parse-prefs.coffee). Apparently all modules share its scope,
which I had never realized before.
This also exposes `Cc`, `Ci` and `Cu` globally to all modules (which actually
was done before, too, but only accidentally.)
Simon Lydell [Sat, 29 Aug 2015 21:08:58 +0000 (23:08 +0200)]
Stop URI encoding the API URL pref
The reason we used to was to make it easier to consume the public API (because
it is easier to read an ASCII string pref than a unicode one). However, some
systems return spaces already URI encoded, which breaks when encoding it once
more. In the end, this tiny simplification of the API consumption is not worth
it. Better to simply store the API URL as-is in a complex string pref.