mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-27 11:43:37 +08:00
Revert "read: discard IFS delimiters before the last token"
See #6650. This reverts commit1410f938aa
. (cherry-picked from commmit91fcb8c42c
)
This commit is contained in:
parent
e6248cf7be
commit
0c74ff4209
|
@ -607,14 +607,6 @@ int builtin_read(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
|||
wcstring substr;
|
||||
loc = wcstring_tok(buff, (vars_left() > 1) ? opts.delimiter : wcstring(), loc);
|
||||
if (loc.first != wcstring::npos) {
|
||||
if (vars_left() == 1) { // Discard trailing delimiters, see #6406
|
||||
loc.first =
|
||||
std::find_if(buff.begin() + loc.first, buff.end(),
|
||||
[&opts](wchar_t c) {
|
||||
return opts.delimiter.find(c) == wcstring::npos;
|
||||
}) -
|
||||
buff.begin();
|
||||
}
|
||||
substr = wcstring(buff, loc.first, loc.second);
|
||||
}
|
||||
vars.set_one(*var_ptr++, opts.place, substr);
|
||||
|
|
|
@ -12,13 +12,3 @@ set -l
|
|||
# CHECK: a 'afoo barb'
|
||||
# CHECK: b
|
||||
# CHECK: c
|
||||
|
||||
echo "a b b" | read a b
|
||||
string escape $a $b
|
||||
# CHECK: a
|
||||
# CHECK: 'b b'
|
||||
|
||||
echo 'a<><>b<>b' | read -d '<>' a b
|
||||
printf %s\n $a $b
|
||||
# CHECK: a
|
||||
# CHECK: <>b<>b
|
||||
|
|
Loading…
Reference in New Issue
Block a user