This commit fixes smooth scrolling. The issue with smooth scrolling was
that from time to time, pressing `j` would only scroll the page by a
pixel. This happened because the computed scrolling step was smaller
than a pixel. When writing to elem.scrollTop, this value would be
rounded to the nearest integer, which sometimes was equal to the
previous scrollTop value. This resulted in Tridactyl believing that the
element couldn't be further scrolled and stopping there.
This is fixed by using Math.ceil()/round() on the step in order to make
sure a round value is obtained. This value is then compared to the
current scrollTop value and incremented in case they're equal, in order
to make sure scrolling makes progress.
Fixes https://github.com/tridactyl/tridactyl/issues/627 and maybe
https://github.com/tridactyl/tridactyl/issues/54 ?
What happened in https://github.com/tridactyl/tridactyl/issues/1615 was
that when pressing `<Space>`, tridactyl tried to run `hint.pushKey `.
Since our ex command parser didn't care about whitespace, nothing
happened.
This is fixed by having a specific ex command to push `<Space>` the hint
filter.
On some websites, searching for specific strings could result in errors
because some matches did not have a rectangle (= they were hidden from
the page). This commit fixes that.
Before 7717c18, calling `config.get()` would result in target being an
empty array. After 7717c18, `config.get()` resulted in `target` being an
array containing one element, `undefined`. Since there isn't any
setting named `undefined`, get completions returned `undefined` and
completions gracefully failed.
We fix this by turning `target` into an empty array if `target_typed` is
undefined.
This commit turns hint mode into a real mode. This required several
changes:
- In `src/content/hinting.ts`: create a function named getHintCommands
which returns an object containing functions that can be used as ex
commands.
- In `src/content/hinting.ts`: rewriting the `parser` function to have
it check the `hintmaps` object in the config and trigger these if
they're bound to anything. We can't use a generic parser because
vimperator hints need to catch every single keypress, even the ones
that aren't bound to anything and act on them.
- Creating `src/background/hinting.ts`, which just wraps ex commands
from src/content/hintings.ts in a proxy which will forward calls to the
content script.
Also document noiframeon, which I discovered was undocumented
because of the type checking.
It makes splatted config.gets rather uglier with `...args` ->
`args[0] as keyof config.default_config, args.slice(1)...`.
It has apparently also broken config completions.