Compare commits

...

19 Commits
3.1b1 ... 3.1.0

Author SHA1 Message Date
David Adam
9b7b4b91c6 Release 3.1.0
Closes #5934. Closes #6333.
2020-02-12 22:04:07 +08:00
David Adam
eab6f2f37b CHANGELOG: final final work on 3.1.0 2020-02-12 22:03:56 +08:00
Fabian Homborg
407a9e2dee Drop "invalid wide char string" message down to debug level 3
Super annoying in a C locale if the prompt contains non-ascii chars.

See #6584
2020-02-12 14:57:05 +01:00
David Adam
8d34f74320 CHANGELOG: typo 2020-02-12 15:51:19 +08:00
David Adam
d7dd30852f CHANGELOG: final work on 3.1.0 2020-02-12 15:15:30 +08:00
Maksim Novikov
2e709dc58c Include special characters in conda env names
Allows completion for environments with names containing special
characters. For example: my-env, myenv.1, myenv+1
2020-02-11 18:28:55 +01:00
David Adam
bd7608a6b7 make_pkg: use absolute source directories in all arguments
(cherry picked from commit 6682f0e8ca)
2020-02-11 14:26:48 +08:00
Fabian Homborg
30d98d385c CHANGELOG
[ci skip]
2020-02-10 21:46:24 +01:00
Collin Styles
3a5eb6151d Correct list-language to list-languages in bat completions 2020-02-10 21:39:27 +01:00
Geoff Nixon
6866f8e6b5 Avoid apropos on macOS 10.15 with man completion
Same issue occurs here, as in #6270 (and fixed in 611a658 for `__fish_describe_command.fish`). Same reason. I've just copied the same workaround and changed the function name to match.

(cherry picked from commit f7edfba5d7)
2020-02-07 20:53:09 +08:00
David Adam
ee3f0b19b4 config.fish: skip path modifications if tests running
Closes #6556.
2020-02-06 12:48:08 +08:00
ridiculousfish
eaecb817ca Retain leading spaces in non-expanding braces
This makes two changes:

1. Remove the 'brace_text_start' idea. The idea of 'brace_text_start' was
to prevent emitting `BRACE_SPACE` at the beginning or end of an item. But
we later strip these off anyways, so there is no apparent benefit. If we
are not doing brace expansion, this prevented emitting whitespace at the
beginning or end of an item, leading to #6564.

2. When performing brace expansion, only stomp the space character with
`BRACE_SPACE`; do not stomp newlines and tabs. This is because the fix in
came from a newline or tab literal, then we would have effectively
replaced a newline or tab with a space, so this is important for #6564 as
well. Moreover, it is not easy to place a literal newline or tab inside a
brace expansion, and users who do probably do not mean for it to be
stripped, so I believe this is a good change in general.

Fixes #6564
2020-02-04 12:34:34 -08:00
Jason Nader
9b4cb28c8f Remove explicit .html links
See commit 1711636

(cherry picked from commit ce61c745a5)
2020-01-31 23:22:44 +08:00
Jason Nader
5932440e49 Fix broken links to index.html in cmd docs
(cherry picked from commit bc3b64bb50)
2020-01-31 23:22:43 +08:00
David Adam
578cde6ec6 CHANGELOG: work towards 3.1.0 2020-01-31 22:25:35 +08:00
ridiculousfish
4cee045967 Update to latest widecharwidth
Fixes a Cygwin incompatibility. Fixes #6549

Cherry-pick from 73106198c8
2020-01-30 21:19:21 -08:00
Fabian Homborg
ef618b2626 Add Solaris' error message to a test
Just another version of the error. We still want to get a bug if it
ever triggers a *wrong* error, so we still list all the options
instead of going for `.*option:.*Z.*`.

Fixes #6554

(cherry picked from commit e8000cfea9)
2020-01-30 21:43:42 +01:00
Fabian Homborg
105a256e5a Tests: Don't remove a parent of $PWD
Solaris/OpenIndiana/Illumos `rm` checks that and errors out.

In these cases we don't actually need it to be a part of $PWD as
it's just for cleanup, so we `cd` out before.

See #5472
See 1ee57e9244
Fixes #6555
Fixes #6558

(cherry picked from commit 9cbd3d57a0)
2020-01-30 21:43:42 +01:00
David Adam
b313ba555a iothread: add missing #include
Closes #6553.
2020-01-30 17:21:15 +08:00
31 changed files with 111 additions and 77 deletions

View File

@@ -1,3 +1,16 @@
# fish 3.1.0 (released February 12, 2020)
Compared to the beta release of fish 3.1b1, fish version 3.1.0:
- fixes a regression where spaces after a brace were removed despite brace expansion not occurring (#6564)
- fixes a number of problems in compiling and testing on Cygwin (#6549) and Solaris-derived systems such as Illumos (#6553, #6554, #6555, #6556, and #6558);
- fixes the process for building macOS packages;
- fixes a regression where excessive error messages are printed if Unicode characters are emitted in non-Unicode-capable locales (#6584); and
- contains some improvements to the documentation and a small number of completions.
If you are upgrading from version 3.0.0 or before, please also review the release notes for 3.1b1 (included below).
---
# fish 3.1b1 (released January 26, 2020)
## Notable improvements and fixes

View File

@@ -24,9 +24,9 @@ OUTPUT_PATH=${FISH_ARTEFACT_PATH:-~/fish_built}
mkdir -p "$PKGDIR/build" "$PKGDIR/root" "$PKGDIR/intermediates" "$PKGDIR/dst"
{ cd "$PKGDIR/build" && cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo "$SRC_DIR" && make -j 4 && env DESTDIR="$PKGDIR/root/" make install; }
pkgbuild --scripts build_tools/osx_package_scripts --root "$PKGDIR/root/" --identifier 'com.ridiculousfish.fish-shell-pkg' --version "$VERSION" "$PKGDIR/intermediates/fish.pkg"
pkgbuild --scripts "$SRC_DIR/build_tools/osx_package_scripts" --root "$PKGDIR/root/" --identifier 'com.ridiculousfish.fish-shell-pkg' --version "$VERSION" "$PKGDIR/intermediates/fish.pkg"
productbuild --package-path "$PKGDIR/intermediates" --distribution build_tools/osx_distribution.xml --resources build_tools/osx_package_resources/ "$OUTPUT_PATH/fish-$VERSION.pkg"
productbuild --package-path "$PKGDIR/intermediates" --distribution "$SRC_DIR/build_tools/osx_distribution.xml" --resources "$SRC_DIR/build_tools/osx_package_resources/" "$OUTPUT_PATH/fish-$VERSION.pkg"
# Make the app

View File

@@ -56,7 +56,7 @@ set -l tabs_opts '
'
complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -s l -l language -a '(__bat_complete_languages_and_extensions)' -d 'Set language for syntax highlighting'
complete -c bat -n 'not __fish_seen_subcommand_from cache' -f -s L -l list-language -d 'List supported languages for syntax highlighting'
complete -c bat -n 'not __fish_seen_subcommand_from cache' -f -s L -l list-languages -d 'List supported languages for syntax highlighting'
complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -s m -l map-syntax -d 'Map file name/extension to existing syntax'
complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -l theme -a '(__bat_complete_themes)' -d 'Set theme for syntax highlighting'
complete -c bat -n 'not __fish_seen_subcommand_from cache' -f -l list-themes -d 'List syntax-highlighting themes'

View File

@@ -31,7 +31,7 @@ function __fish_conda_config_keys
end
function __fish_conda_environments
conda env list | string match -rv '^#' | string match -r '^\w+'
conda env list | string match -rv '^#' | string match -r '^\S+'
end
# common options

View File

@@ -123,7 +123,7 @@ end
# system utilities.
#
if test -d /usr/xpg4/bin
if begin; not set -q FISH_UNIT_TESTS_RUNNING; and test -d /usr/xpg4/bin; end
not contains -- /usr/xpg4/bin $PATH
and set PATH /usr/xpg4/bin $PATH
end

View File

@@ -1,3 +1,20 @@
# macOS 10.15 "Catalina" has some major issues.
# The whatis database is non-existent, so apropos tries (and fails) to create it every time,
# which takes about half a second.
#
# So we disable this entirely in that case.
if test (uname) = Darwin
set -l darwin_version (uname -r | string split .)
# macOS 15 is Darwin 19, this is an issue at least up to 10.15.3.
# If this is fixed in later versions uncomment the second check.
if test "$darwin_version[1]" = 19 # -a "$darwin_version[2]" -le 3
function __fish_complete_man
end
# (remember: exit when `source`ing only exits the file, not the shell)
exit
end
end
function __fish_complete_man
# Try to guess what section to search in. If we don't know, we
# use [^)]*, which should match any section.

View File

@@ -18,7 +18,7 @@ Description
``and`` statements may be used as part of the condition in an :ref:`while <cmd-while>` or :ref:`if <cmd-if>` block.
``and`` does not change the current exit status itself, but the command it runs most likely will. The exit status of the last foreground command to exit can always be accessed using the `$status <index.html#variables-status>`__ variable.
``and`` does not change the current exit status itself, but the command it runs most likely will. The exit status of the last foreground command to exit can always be accessed using the :ref:`$status <variables-status>` variable.
Example
-------

View File

@@ -13,7 +13,7 @@ Synopsis
Description
-----------
``bg`` sends `jobs <index.html#syntax-job-control>`__ to the background, resuming them if they are stopped.
``bg`` sends :ref:`jobs <syntax-job-control>` to the background, resuming them if they are stopped.
A background job is executed simultaneously with fish, and does not have access to the keyboard. If no job is specified, the last job to be used is put in the background. If PID is specified, the jobs with the specified process group IDs are put in the background.

View File

@@ -20,7 +20,7 @@ Description
``bind`` adds a binding for the specified key sequence to the specified command.
SEQUENCE is the character sequence to bind to. These should be written as `fish escape sequences <index.html#escapes>`__. For example, because pressing the Alt key and another character sends that character prefixed with an escape character, Alt-based key bindings can be written using the ``\e`` escape. For example, :kbd:`Alt+w` can be written as ``\ew``. The control character can be written in much the same way using the ``\c`` escape, for example :kbd:`Control+X` (^X) can be written as ``\cx``. Note that Alt-based key bindings are case sensitive and Control-based key bindings are not. This is a constraint of text-based terminals, not ``fish``.
SEQUENCE is the character sequence to bind to. These should be written as :ref:`fish escape sequences <escapes>`. For example, because pressing the Alt key and another character sends that character prefixed with an escape character, Alt-based key bindings can be written using the ``\e`` escape. For example, :kbd:`Alt+w` can be written as ``\ew``. The control character can be written in much the same way using the ``\c`` escape, for example :kbd:`Control+X` (^X) can be written as ``\cx``. Note that Alt-based key bindings are case sensitive and Control-based key bindings are not. This is a constraint of text-based terminals, not ``fish``.
The default key binding can be set by specifying a ``SEQUENCE`` of the empty string (that is, ``''`` ). It will be used whenever no other binding matches. For most key bindings, it makes sense to use the ``self-insert`` function (i.e. ``bind '' self-insert``) as the default keybinding. This will insert any keystrokes not specifically bound to into the editor. Non- printable characters are ignored by the editor, so this will not result in control sequences being printable.
@@ -36,7 +36,7 @@ When multiple ``COMMAND``\s are provided, they are all run in the specified orde
If no ``SEQUENCE`` is provided, all bindings (or just the bindings in the specified ``MODE``) are printed. If ``SEQUENCE`` is provided without ``COMMAND``, just the binding matching that sequence is printed.
To save custom keybindings, put the ``bind`` statements into `config.fish <index.html#initialization>`__. Alternatively, fish also automatically executes a function called ``fish_user_key_bindings`` if it exists.
To save custom keybindings, put the ``bind`` statements into :ref:`config.fish <initialization>`. Alternatively, fish also automatically executes a function called ``fish_user_key_bindings`` if it exists.
Key bindings may use "modes", which mimics Vi's modal input behavior. The default mode is "default", and every bind applies to a single mode. The mode can be viewed/changed with the ``$fish_bind_mode`` variable.

View File

@@ -16,6 +16,6 @@ Description
``breakpoint`` is used to halt a running script and launch an interactive debugging prompt.
For more details, see `Debugging fish scripts <index.html#debugging>`__ in the ``fish`` manual.
For more details, see :ref:`Debugging fish scripts <debugging>` in the ``fish`` manual.
There are no parameters for ``breakpoint``.

View File

@@ -13,7 +13,7 @@ Synopsis
Description
-----------
``disown`` removes the specified `job <index.html#syntax-job-control>`__ from the list of jobs. The job itself continues to exist, but fish does not keep track of it any longer.
``disown`` removes the specified :ref:`job <syntax-job-control>` from the list of jobs. The job itself continues to exist, but fish does not keep track of it any longer.
Jobs in the list of jobs are sent a hang-up signal when fish terminates, which usually causes the job to terminate; ``disown`` allows these processes to continue regardless.

View File

@@ -13,7 +13,7 @@ Synopsis
Description
-----------
``fg`` brings the specified `job <index.html#syntax-job-control>`__ to the foreground, resuming it if it is stopped. While a foreground job is executed, fish is suspended. If no job is specified, the last job to be used is put in the foreground. If PID is specified, the job with the specified group ID is put in the foreground.
``fg`` brings the specified :ref:`job <syntax-job-control>` to the foreground, resuming it if it is stopped. While a foreground job is executed, fish is suspended. If no job is specified, the last job to be used is put in the foreground. If PID is specified, the job with the specified group ID is put in the foreground.
Example

View File

@@ -18,7 +18,7 @@ Description
By defining the ``fish_breakpoint_prompt`` function, the user can choose a custom prompt when asking for input in response to a :ref:`breakpoint <cmd-breakpoint>` command. The ``fish_breakpoint_prompt`` function is executed when the prompt is to be shown, and the output is used as a prompt.
The exit status of commands within ``fish_breakpoint_prompt`` will not modify the value of `$status <index.html#variables-status>`__ outside of the ``fish_breakpoint_prompt`` function.
The exit status of commands within ``fish_breakpoint_prompt`` will not modify the value of :ref:`$status <variables-status>` outside of the ``fish_breakpoint_prompt`` function.
``fish`` ships with a default version of this function that displays the function name and line number of the current execution context.

View File

@@ -18,7 +18,7 @@ Description
By defining the ``fish_prompt`` function, the user can choose a custom prompt. The ``fish_prompt`` function is executed when the prompt is to be shown, and the output is used as a prompt.
The exit status of commands within ``fish_prompt`` will not modify the value of `$status <index.html#variables-status>`__ outside of the ``fish_prompt`` function.
The exit status of commands within ``fish_prompt`` will not modify the value of :ref:`$status <variables-status>` outside of the ``fish_prompt`` function.
``fish`` ships with a number of example prompts that can be chosen with the ``fish_config`` command.

View File

@@ -44,7 +44,7 @@ The following options are available:
- ``-V`` or ``--inherit-variable NAME`` snapshots the value of the variable ``NAME`` and defines a local variable with that same name and value when the function is defined. This is similar to a closure in other languages like Python but a bit different. Note the word "snapshot" in the first sentence. If you change the value of the variable after defining the function, even if you do so in the same scope (typically another function) the new value will not be used by the function you just created using this option. See the ``function notify`` example below for how this might be used.
If the user enters any additional arguments after the function, they are inserted into the environment `variable list <index.html#variables-lists>`__ ``$argv``. If the ``--argument-names`` option is provided, the arguments are also assigned to names specified in that option.
If the user enters any additional arguments after the function, they are inserted into the environment :ref:`variable list <variables-lists>` ``$argv``. If the ``--argument-names`` option is provided, the arguments are also assigned to names specified in that option.
By using one of the event handler switches, a function can be made to run automatically at specific events. The user may generate new events using the :ref:`emit <cmd-emit>` builtin. Fish generates the following named events:

View File

@@ -14,7 +14,7 @@ Synopsis
Description
-----------
``jobs`` prints a list of the currently running `jobs <index.html#syntax-job-control>`__ and their status.
``jobs`` prints a list of the currently running :ref:`jobs <syntax-job-control>` and their status.
jobs accepts the following switches:

View File

@@ -233,7 +233,7 @@ Fish history recall is very simple yet effective:
- If you want to reuse several arguments from the same line ("!!:3*" and the like), consider recalling the whole line and removing what you don't need (:kbd:`Alt+D` and :kbd:`Alt+Backspace` are your friends).
See `documentation <index.html#editor>`__ for more details about line editing in fish.
See :ref:`documentation <editor>` for more details about line editing in fish.
How can I use ``-`` as a shortcut for ``cd -``?

View File

@@ -77,7 +77,7 @@ You can make fish your default shell by adding fish's executable in two places:
- add ``/usr/local/bin/fish`` to ``/etc/shells``
- change your default shell with ``chsh -s`` to ``/usr/local/bin/fish``
For for detailed instructions see `Switching to fish <tutorial.html#tut_switching_to_fish>`_.
For for detailed instructions see :ref:`Switching to fish <switching-to-fish>`.
Uninstalling
------------

View File

@@ -1435,7 +1435,6 @@ static bool unescape_string_internal(const wchar_t *const input, const size_t in
// The positions of variable expansions or brace ","s.
// We only read braces as expanders if there's a variable expansion or "," in them.
std::vector<size_t> vars_or_seps;
bool brace_text_start = false;
int brace_count = 0;
bool errored = false;
@@ -1531,7 +1530,6 @@ static bool unescape_string_internal(const wchar_t *const input, const size_t in
// assert(brace_count > 0 && "imbalanced brackets are a tokenizer error, we
// shouldn't be able to get here");
brace_count--;
brace_text_start = brace_text_start && brace_count > 0;
to_append_or_none = BRACE_END;
if (!braces.empty()) {
// If we didn't have a var or separator since the last '{',
@@ -1559,17 +1557,13 @@ static bool unescape_string_internal(const wchar_t *const input, const size_t in
case L',': {
if (unescape_special && brace_count > 0) {
to_append_or_none = BRACE_SEP;
brace_text_start = false;
vars_or_seps.push_back(input_position);
}
break;
}
case L'\n':
case L'\t':
case L' ': {
if (unescape_special && brace_count > 0) {
to_append_or_none =
brace_text_start ? maybe_t<wchar_t>(BRACE_SPACE) : none();
to_append_or_none = BRACE_SPACE;
}
break;
}
@@ -1586,9 +1580,6 @@ static bool unescape_string_internal(const wchar_t *const input, const size_t in
break;
}
default: {
if (unescape_special && brace_count > 0) {
brace_text_start = true;
}
break;
}
}

View File

@@ -6,6 +6,7 @@
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/types.h>

View File

@@ -404,7 +404,7 @@ void outputter_t::writestr(const wchar_t *str) {
size_t len = wcstombs(nullptr, str, 0); // figure amount of space needed
if (len == static_cast<size_t>(-1)) {
debug(1, L"Tried to print invalid wide character string");
debug(3, L"Tried to print invalid wide character string");
return;
}

View File

@@ -1,5 +1,5 @@
/**
* widechar_width.h, generated on 2019-05-14.
* widechar_width.h, generated on 2020-01-30.
* See https://github.com/ridiculousfish/widecharwidth/
*
* SHA1 file hashes:
@@ -30,8 +30,8 @@ enum {
/* An inclusive range of characters. */
struct widechar_range {
wchar_t lo;
wchar_t hi;
uint32_t lo;
uint32_t hi;
};
/* Simple ASCII characters - used a lot, so we check them first. */
@@ -506,14 +506,14 @@ static const struct widechar_range widechar_widened_table[] = {
};
template<typename Collection>
bool widechar_in_table(const Collection &arr, wchar_t c) {
bool widechar_in_table(const Collection &arr, uint32_t c) {
auto where = std::lower_bound(std::begin(arr), std::end(arr), c,
[](widechar_range p, wchar_t c) { return p.hi < c; });
[](widechar_range p, uint32_t c) { return p.hi < c; });
return where != std::end(arr) && where->lo <= c;
}
/* Return the width of character c, or a special negative value. */
int widechar_wcwidth(wchar_t c) {
int widechar_wcwidth(uint32_t c) {
if (widechar_in_table(widechar_ascii_table, c))
return 1;
if (widechar_in_table(widechar_private_table, c))

View File

@@ -1,2 +1,2 @@
#RUN: %fish -Z
#CHECKERR: {{.*fish}}: {{unrecognized option: Z|invalid option -- '?Z'?|unknown option -- Z}}
#CHECKERR: {{.*fish}}: {{unrecognized option: Z|invalid option -- '?Z'?|unknown option -- Z}|illegal option -- Z}}

50
tests/checks/braces.fish Normal file
View File

@@ -0,0 +1,50 @@
#RUN: %fish %s
echo x-{1}
#CHECK: x-{1}
echo x-{1,2}
#CHECK: x-1 x-2
echo foo-{1,2{3,4}}
#CHECK: foo-1 foo-23 foo-24
echo foo-{} # literal "{}" expands to itself
#CHECK: foo-{}
echo foo-{{},{}} # the inner "{}" expand to themselves, the outer pair expands normally.
#CHECK: foo-{} foo-{}
echo foo-{{a},{}} # also works with something in the braces.
#CHECK: foo-{a} foo-{}
echo foo-{""} # still expands to foo-{}
#CHECK: foo-{}
echo foo-{$undefinedvar} # still expands to nothing
#CHECK:
echo foo-{,,,} # four empty items in the braces.
#CHECK: foo- foo- foo- foo-
echo foo-{,\,,} # an empty item, a "," and an empty item.
#CHECK: foo- foo-, foo-
echo .{ foo bar }. # see 6564
#CHECK: .{ foo bar }.
# whitespace within entries is retained
for foo in {a, hello
wo rld }
echo \'$foo\'
end
# CHECK: 'a'
# CHECK: 'hello
# CHECK: wo rld'
for foo in {hello
world}
echo \'$foo\'
end
#CHECK: '{hello
#CHECK: world}'

View File

@@ -19,8 +19,8 @@ begin
cd x
pwd
end
rm -rf $tmp
cd $oldpwd
rm -rf $tmp
# Create a test directory to store our stuff.
set -l base /tmp/cdcomp_test

View File

@@ -2,6 +2,7 @@
# Ensure that, if variable expansion results in multiple strings
# and one of them fails a glob, that we don't fail the entire expansion.
set -l oldpwd (pwd)
set dir (mktemp -d)
cd $dir
mkdir a
@@ -12,4 +13,5 @@ set dirs ./a ./b
echo $dirs/*.txt
# CHECK: ./b/file.txt
cd $oldpwd
rm -Rf $dir

View File

@@ -14,12 +14,6 @@ echo \'{ hello , world }\'
for phrase in {good\,, beautiful ,morning}; echo -n "$phrase "; end | string trim;
for phrase in {goodbye\,,\ cruel\ ,world\n}; echo -n $phrase; end;
# whitespace within entries converted to spaces in a single entry
for foo in {a, hello
world }
echo \'$foo\'
end
# dual expansion cartesian product
echo { alpha, beta }\ {lambda, gamma }, | string replace -r ',$' ''

View File

@@ -6,8 +6,6 @@ apple orange banana
'hello' 'world'
good, beautiful morning
goodbye, cruel world
'a'
'hello world'
alpha lambda, beta lambda, alpha gamma, beta gamma
Meg
Jo

View File

@@ -2,9 +2,6 @@
####################
# Comments in odd places don't cause problems
####################
# Brace expansion
####################
# Escaped newlines

View File

@@ -11,21 +11,6 @@ for i in 1 2 # Comment on same line as command
end;
end
logmsg Brace expansion
echo x-{1}
echo x-{1,2}
echo foo-{1,2{3,4}}
echo foo-{} # literal "{}" expands to itself
echo foo-{{},{}} # the inner "{}" expand to themselves, the outer pair expands normally.
echo foo-{{a},{}} # also works with something in the braces.
echo foo-{""} # still expands to foo-{}
echo banana # just as a marker
echo foo-{$undefinedvar} # still expands to nothing
echo foo-{,,,} # four empty items in the braces.
echo foo-{,\,,} # an empty item, a "," and an empty item.
logmsg Escaped newlines
echo foo\ bar
echo foo\

View File

@@ -6,20 +6,6 @@
2a
2b
####################
# Brace expansion
x-{1}
x-1 x-2
foo-1 foo-23 foo-24
foo-{}
foo-{} foo-{}
foo-{a} foo-{}
foo-{}
banana
foo- foo- foo- foo-
foo- foo-, foo-
####################
# Escaped newlines
foo bar