mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-30 07:01:22 -03:00
Support "$(cmd)" command substitution without line splitting
This adds a hack to the parser. Given a command echo "x$()y z" we virtually insert double quotes before and after the command substitution, so the command internally looks like echo "x"$()"y z" This hack allows to reuse the existing logic for handling (recursive) command substitutions. This makes the quoting syntax more complex; external highlighters should consider adding this if possible. The upside (more Bash compatibility) seems worth it. Closes #159
This commit is contained in:
@@ -494,6 +494,9 @@ static size_t color_variable(const wchar_t *in, size_t in_len,
|
||||
wchar_t next = in[idx + 1];
|
||||
if (next == L'$' || valid_var_name_char(next)) {
|
||||
colors[idx] = highlight_role_t::operat;
|
||||
} else if (next == L'(') {
|
||||
colors[idx] = highlight_role_t::operat;
|
||||
return idx + 1;
|
||||
} else {
|
||||
colors[idx] = highlight_role_t::error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user