zsh-workers
 help / color / mirror / code / Atom feed
* Escape sequences are not interpreted by "zle -M"
@ 2022-06-16 19:34 Fabian Lindner
  2022-06-19 22:13 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Lindner @ 2022-06-16 19:34 UTC (permalink / raw)
  To: zsh-workers

Hello everyone,

I noticed a bug (I believe), where escape sequences (for example color
codes) do not work as intended when beeing displayed with "zle -M".
A minimal working example (with "zsh -f") that showcases what I mean:

$ echo $TERM
st-256color
$ zle-line-init () { zle -M "^[[38;5;1mred" }
$ zle -N zle-line-init

After that, the string displayed below the prompt is the literal string
"\033[38;5;1mred" (without any colors applied). I inserted the escape
character via Ctrl+V. I also tested with \033 instead of the escape
character, but I get the same result.
Running
$ echo "^[[38;5;1mred"
works as intended and displays the string "red" in the correct color.

I am using zsh version 5.9 (x86_64-pc-linux-gnu) on ArchLinux and my
terminal is st, but I also tested on gnome-terminal and allacrity with
the same result.

If someone knows how to fix this, or if this is fixed at any point,
please let me know! (Btw. I'm not subscribed to the mailing list, so I
would appreciate it, if I could get a direct answer.)

Fabian


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

* Re: Escape sequences are not interpreted by "zle -M"
  2022-06-16 19:34 Escape sequences are not interpreted by "zle -M" Fabian Lindner
@ 2022-06-19 22:13 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2022-06-19 22:13 UTC (permalink / raw)
  To: Fabian Lindner; +Cc: zsh-workers

On Thu, Jun 16, 2022 at 12:35 PM Fabian Lindner <MFL01@gmx.de> wrote:
>
> I noticed a bug (I believe), where escape sequences (for example color
> codes) do not work as intended when beeing displayed with "zle -M".

This is intentional, zle -M passes everything through the equivalent
of the parameter expansion (V) flag and always has.  The main reason
for this is to prevent the message from causing zle to lose track of
the cursor or have part of the other output scribbled over.  This is
also true of strings sent to zle -R.

Depending on what you're actually attempting to accomplish, there may
be an alternative to "zle -M".


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

end of thread, other threads:[~2022-06-19 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 19:34 Escape sequences are not interpreted by "zle -M" Fabian Lindner
2022-06-19 22:13 ` 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).