Before this patch, selected completion options weren't properly
deselected when available options changed. This commit fixes this.
This does not break completion option autoselect because the reset
happens before autoselection.
This fixes https://github.com/cmcaine/tridactyl/issues/833.
e5d2be7 introduced a bug while trying to fix
https://github.com/cmcaine/tridactyl/issues/838: when the command line
contains `tabopen -flag ` and the user tries to insert the selected
completion option in the command line by pressing <Space>, the resulting
command line will be `tabopen -flagurl` instead of `tabopen -flag url`.
This is fixed by appending a trailing space to the `options` variable if
it isn't an empty string.
This is simpler, as we do not have to worry about:
- randomly generating a unique here-doc tag to avoid
colliding with the yanked content
- newline munging as in 4a5dcd7557
- whether "sed -z" is portable (it's not in POSIX, though
I'd expect most modern implementations to have it)
This is the client side that matches the stdin handling
added in the previous commit. Note that we _don't_ check a
nativegate here. It's the responsibility of a caller sending
a non-empty content parameter to do so.
There's currently no way to tell the native messenger to
provide a particular stdin to a "run" command. This leads to
awkward uses of here-docs, which in turn require hacks like
the one in 4a5dcd7557.
Instead, let's take the "content" field from the message
body and feed that to the command's stdin, which gives us a
more robust channel for passing arbitrary bytes.
Note that we have to switch to using subprocess.Popen's
communicate() method, which will make sure we don't deadlock
if the input or output exceeds a pipe buffer.
Note also that when no stdin is provided by the caller
(i.e., all current cases), we'll pass an empty string. This
actually fixes a minor bug. Because we didn't override the
command's stdin argument, it's hooked to the messenger's
stdin, which is the pipe coming from firefox. If the command
tries to read, it (and the messenger) will hang forever,
since firefox is waiting for the messenger to respond before
writing anything else.
I bumped the native messenger version. This is mostly
backwards compatible (existing callers just don't send any
stdin content at all). But a caller that wants to send stdin
should check to make sure we have at least 0.1.7.
This makes debugging work correctly on Linux. Otherwise
you'll generally get EPERM as `/home/user\.tridactyl` is a
path in `/home`, which you likely don't have access to
write.
Apparently, Firefox can't give you key events for the window if <body>
is `display: none`. This is fixed by turning the page transparent
instead of not displaying it. Since the scrollbar is still visible when
the page is transparent, we also set the page's height to 0px.
All of these modifications are reversed when the page needs to be
displayed.
Mute takes a couple of arguments that are a bit loosely defined. `-u`
unmutes, as seen by the `unmute` exalias. `toggle` toggles between the
states. `all` applies `mute/unmute/toggle` on all the tabs in the current window.