Tslint and sonarts are pretty cool linters/static analyzers. Currently,
we ask them to ignore any of the rules that Tridactyl might not respect.
This enables progressively re-enabling rules and submitting small,
reviewable PRs that fix things.
The problem was the `[ ! -f "${bin_loc}" ]` check. `command -v` does not
necessarily return an absolute path (it can just return the name of the
command for builtins) and this is what happened for 'printf'. Thus, the
`[ ! -f` check failed.
This check doesn't really make sense. If `command -v $binary` doesn't
fail you're good to go, it doesn't really matter where $binary is
located.
Before this commit, Tridactyl had a bug where resizeArea could be called
before completion computation had ended, which resulted in completions
pushing the input field out of the viewport (easy way to reproduce this:
open a lot of tabs and press `b` to open buffer completions).
This happened because for some of the completion sources, `filter`
returned before completion computation had actually ended. This is fixed
by making sure that filter() (and all underlying calls to updateOptions,
onInput, updateChain...) return a promise that will only be resolved
once completion computation has actually ended.
One of the problems of the command line was that it made a resizeArea()
call for each enabled completion, no matter whether its status was
"hidden" or "normal". This was a problem because a resizeArea call
results in 2 cross-script messages: a "show" and a "focus" message. This
means that for each keystroke, we sent 28 messages. This commit fixes
that thanks to modifications in multiple files:
- commandline_frame.ts: Stop accumulating event listeners on resizeArea
calls. Make sure completion sources actually need a refresh before
calling resizeArea().
- completions.ts: Add logic to know whether a completion source needs a
refresh or not.
- {Rss,Sessions,Tab,TabAll,Window}.ts: Make sure that completions are
actually needed before computing them.
This seems to make opening the command line slightly faster for me,
although I can't tell if this is placebo or not.
This commit removes commandline_background.ts. I believe this is useful
because the only thing it did was provide recvExStr, which just
triggered a synthetic "onLine" event the only consumer of which was the
parser. Since we already used controller_background + acceptExCmd in
some places, it made sense to me to directly use controller_background +
acceptExCmd everywhere.