I don't quite understand how it worked at all without focusing the commandline first.
Peppered code with some more awaits as part of debugging and couldn't be bothered to test which were necessary.
The problem was that when calling sort on an array of numbers without
specifying the sort function that should be used, the array will be
sorted according to the lexicographic order of the elements.
This is fixed by specifying what function should be used to sort the
array.
This fixes https://github.com/cmcaine/tridactyl/issues/819.
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.
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.
Here-documents require a newline at the end of their content and there's
no way around it. In order to prevent the newline to be sent to the
clipboard command, we can do two things: not use here-documents or pipe
the content to sed first to remove the newline.
Not using here-documents means doing a lot of string manipulations to
escape the string properly. Using here-documents is conceptually
simpler.
Hence, we keep using here-documents and pipe the string to sed in order
to remove the newline.