zsh-workers
 help / color / mirror / code / Atom feed
* Should (z) PE flag split & during expansion?
@ 2023-06-03  6:00 Zaidhaan Hussain
  2023-06-05 20:01 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Zaidhaan Hussain @ 2023-06-03  6:00 UTC (permalink / raw)
  To: zsh-workers

The following:

printf '<%s>' ${(z)${:-'!-2:&'}}

Yields this:

<!-2:><&>

Which does not make sense if we consider that & is valid in parameter
expansions. At least for history expansions, such as would be the case
for the following setup:

echo foo_replaceme_bar
echo baz_replaceme_qux
!-2:s/replaceme/subst/ && !-1:&

I realize the manual (14.1.4) states "In parameter expansion the &
must appear inside braces, and in filename generation it must be
quoted with a backslash."

But even so, the following:

printf '<%s>' ${(z)${:-'!{-2:&}'}}

Yields this:

<!{-2:><&><}>

This was identified in issue #929 in zsh-users/zsh-syntax-highlighting
on GitHub.

--
Regards,
Zaidhaan


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Should (z) PE flag split & during expansion?
  2023-06-03  6:00 Should (z) PE flag split & during expansion? Zaidhaan Hussain
@ 2023-06-05 20:01 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2023-06-05 20:01 UTC (permalink / raw)
  To: Zaidhaan Hussain; +Cc: zsh-workers

On Fri, Jun 2, 2023 at 11:00 PM Zaidhaan Hussain <zaidhaan@gmx.com> wrote:
>
> printf '<%s>' ${(z)${:-'!-2:&'}}
> <!-2:><&>
>
> Which does not make sense if we consider that & is valid in parameter
> expansions.

History references are entirely separate from shell syntax -- they are
an interactive-use-only feature vaguely similar to macro expansion.
The (z) flag doesn't account for them at all, and really cannot.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-05 20:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-03  6:00 Should (z) PE flag split & during expansion? Zaidhaan Hussain
2023-06-05 20:01 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).