Changes to the help page's layout can break the embedding of settings
into it. We fix this by making sure the CSS path selected doesn't depend
on the DOM hierarchy.
The minimal userChrome file causes 8 pixels to be cut off from the top of the "content" part of the page, but only when the navbar is hidden. This change, as written, will reverse the situation: it will add 8 pixels of extraneous padding when the navbar is not hidden. Given that we spend most of our browsing time with the navbar hidden, this optimises for the common case instead of the uncommon case.
This implements excmd completion. We're using the typescript compiler
API in order to get the documentation and the type of every function of
Tridactyl and generate a file named "src/metadata.ts" which contains
this information. Since this file is dependency-less it can be imported
from every source file.
We then write a regular completion source which just uses the data
contained in metadata.ts in order to generate its completions.
Making hint mode less janky is achieved by not resetting hint mode when
a hint has been selected. New command line options, `-q*` where `*`
stands for any alread-existing flag, are added.
The global hint flow is as following:
- User goes into hint mode
- hint mode promise is created
- When a hint is selected, the corresponding action is performed (e.g.
opening a link, killing an element...)
- The result of the action is saved in the hint
- If we're not in rapid hint mode, modeState is reset, and the hint mode
promise is resolved with the result of the action as parameter
- If we're in rapid hint mode, modeState is not reset. Instead its
filter is reset and all its hints are displayed again.
- Rapid hint mode is only left on escape, and this means that the
promise will be rejected.
Rejecting the promise means that we can't pipe elements selected in hint
rapid hint mode to other commands. This makes sense because pursuing
execution of a pipe several times in parallel, on top of being possibly
hard to implement, would probably be confusing.
Instead of using a pipe in order to execute arbitrary commands in hint
mode, users can use `-qW excmd`. Contrary to the pipe, this makes clear that
the excmd will be executed multiple times, once per focused hint.
This way of handling rapid hint mode has the advantage of simplifying
the `hint` function. Now, instead of having to return a tuple with the
number of available hints, the function can just return the selected
element or whatever the command line arguments specifies it should
return.
Instead of returning null when no hint has been selected, hinting.pipe
will now return a promise that will be resolved once a hint has been
selected or rejected if hintstate is destroyed without a hint being
explicitly selected by the user or if there are no hints to select.
Promise rejection is then handled at the end of excmds.ts:hint(), as
suggested by bovine3dom on Riot.
On SVG pages, trying to open the commandline results in an error. We
attempted to log this error using logger.error, which in turn tried to
open the command line. Recursion ensued.
This is fixed by not using the logger to log these errors to the. A
better solution could be to have the logger use the notification API to
tell the user about errors that happen while logging errors, but this
would require a new permission, which we shouldn't ask for until a
solution to https://github.com/cmcaine/tridactyl/issues/788 and
https://github.com/cmcaine/tridactyl/issues/708 is found.
This fixes https://github.com/cmcaine/tridactyl/issues/879.
In hinting.ts, pipe() and pipe_elements() assumed that the resolve
function they passed to hintPage() would always be called, which wasn't
always the case (e.g. when a users goes into hint mode but presses
`<Esc>`).
This caused unresolved promises to linger in the tab. When the tab was
closed, an error was thrown about the message manager being
disconnected. This was caught by Tridactyl and displayed in the command
line.
We're fixing this bug by passing no-op functions as onSelect to
hintPage() and explicitly passing the resolve function. The resolve
function is then saved in HintState and called when destroying
HintState.
We parametrize reset() in order to be able to distinguish between resets
caused by a hint being selected and by the user pressing `<Esc>`. This
is necessary because we need to know when the function should resolve
the last focused hint and when it shouldn't.
We then add a bunch of null handling in excmds.ts:hint() in order to
make sure not to introduce other bugs.
This fixes https://github.com/cmcaine/tridactyl/issues/855.