mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-02 07:53:43 +08:00
eaecb817ca
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
30 lines
733 B
Fish
30 lines
733 B
Fish
# basic expansion test
|
|
echo {}
|
|
echo {apple}
|
|
echo {apple,orange}
|
|
|
|
# expansion tests with spaces
|
|
echo {apple, orange}
|
|
echo { apple, orange, banana }
|
|
|
|
# expansion with spaces and cartesian products
|
|
echo \'{ hello , world }\'
|
|
|
|
# expansion with escapes
|
|
for phrase in {good\,, beautiful ,morning}; echo -n "$phrase "; end | string trim;
|
|
for phrase in {goodbye\,,\ cruel\ ,world\n}; echo -n $phrase; end;
|
|
|
|
# dual expansion cartesian product
|
|
echo { alpha, beta }\ {lambda, gamma }, | string replace -r ',$' ''
|
|
|
|
# expansion with subshells
|
|
for name in { (echo Meg), (echo Jo) }
|
|
echo $name
|
|
end
|
|
|
|
# subshells with expansion
|
|
for name in (for name in {Beth, Amy}; printf "$name\n"; end); printf "$name\n"; end
|
|
|
|
echo {{a,b}}
|
|
# vim: set ft=fish:
|