macOS and (AFAICT) most Linux distributions ship with the Info-ZIP
version of unzip, which has the `unzip -h` flag; but other
implementations of unzip do not necessarily have it (i.e. FreeBSD).
`unzip` under FreeBSD does not support `unzip -h`. Under both Linux and
FreeBSD, `unzip -v` presents the list of options, though. Using this
instead of `unzip -h` to detect the Debian-patched version of the
Info-ZIP unzip program.
[9/13] Building CXX object CMakeFiles/fishlib.dir/src/builtin_string.cpp.o
../src/builtin_string.cpp:1221:12: warning: mangled name of 'string_transform' will change in C++17 due to non-throwing exception specification in function signature [-Wc++17-compat-mangling]
static int string_transform(parser_t &parser, io_streams_t &streams, int argc, wchar_t **argv, decltype(std::towlower) func) {
^
1 warning generated.
This prints an escape sequence, so it can break scp or similar when
someone has an unqualified
fish_vi_key_bindings
in config.fish and happens to run a terminal that can set the cursor.
Our completion machinery calls our `__fish_describe_command` function
to describe commands via apropos. Only it trusts the output a bit too
much, so it crashes when any line from that is shorter than the
original string.
Fix this by skipping any string that is shorter than the original,
since it can't be a match anyway.
Also stop doing wcslen so often - std::strings are nice!
Fixes#5014.
These completions are apparently based on an auto-generated version,
so there's a whole bunch of rewording to be done here.
Also for some reason some of the options are mentioned more than once?
I can't seem to find a reason why the shell interpreter needs to be bash
and not just sh here. Needed to replace `BASH_SOURCE[0]` with the legacy
`$0` supported by sh, but otherwise it seems to still work.
Many non-Linux platforms do not ship with bash out-of-the-box (and as a
shell, I don't think we need to encourage the further proliferation of
bash ;-), this lets fish build on a clean install of FreeBSD, which does
not have bash.
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).