There really is no need to
- Timeout just because the _first_ character was a control character
- Timeout because of any control character other than escape
The reason to timeout because the '\e' sequence can appear by itself (signifying
pressing the escape key) and still make
sense - e.g. vi-mode has it bound to a rather important function!
But a \c can't appear by itself, so we can just block.
This allows binding sequences like \cx\ce and inputting them at a
leisurely pace rather than the frantic escape_timeout one.
It should also improve sequences that _include_ escape somewhere else.
E.g. something like a\eb ("a, then alt+b") should now time out for the "\eb" part,
allowing users to bind a\e ("a, then escape") to something else. Why you'd want to do
that, I have no idea. But it's more consistent, and that's nice!
For regex-mode, this should be enough to read NUL-delimited strings to act on, but not
quite patterns and replacements.
Glob-mode requires more work - it uses wcscmp internally, which is unsuitable.
Also the various styles have one function each with barely any
difference - mostly passing the corresponding STYLE argument.
Pack them into one function for escape and one for unescape to save
about 100 lines.
We're now actually handling wchar_t here, so comparing the 0x80 bit
would break for UTF-16, causing ASCII false-positives.
Also simplifies a bit, since we no longer need a second variable.
printf 'a\0b' | string length
used to print "1". Now it prints "3".
Note that this switches to using C++'s std::string::length, which
might give differing results.
Under FreeBSD, as annoying as it is, switches must directly follow the
command or subcommand in question, and cannot come after actual payload
argument. Calling `zpool get all -H` instead of `zpool get -H all`
caused error messages to be spewed to the console under FreeBSD when
simply completing `zfs <TAB>`, this should fix that. The change should
also be compatible with other operating systems (namely Linux) that
don't have this requirement, as they (generally) allow arguments to come
before _or_ after the primary non-switch argument (though I do not have
access to a zfs-enabled Linux machine to test this).
Previously, trying to complete a token with any of these
expansion-related characters would cause the completion to return no
results, as it would emit expanded values which weren't matched by the
autocompleter.