zsh-workers
 help / color / mirror / code / Atom feed
* Why does colors() not use %{ %}?
@ 2008-07-19  0:23 Richard Hartmann
  2008-07-19  0:39 ` Philippe Troin
  2008-07-19  1:03 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Hartmann @ 2008-07-19  0:23 UTC (permalink / raw)
  To: Zsh hackers list

Hi all,

after a somewhat embarassing email to -users, I realized colors() does
not properly escape color codes in its variables. What is the reason
for this behaviour?

I see three possible fixes, if there is interest in such a thing:

1) Change the existing functions. This _might_ break existing stuff.

2) Introduce new associative arrays with similar names.

3) Create a second function, colors_escaped(), which can be loaded
   either additionally or instead.


It is, of course, possible that there is a good reason for not escaping
the color codes. If that is the case, I would love to learn it :)


Thanks,
Richard


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

* Re: Why does colors() not use %{ %}?
  2008-07-19  0:23 Why does colors() not use %{ %}? Richard Hartmann
@ 2008-07-19  0:39 ` Philippe Troin
  2008-07-19  0:46   ` Richard Hartmann
  2008-07-19  1:03 ` Bart Schaefer
  1 sibling, 1 reply; 4+ messages in thread
From: Philippe Troin @ 2008-07-19  0:39 UTC (permalink / raw)
  To: Richard Hartmann; +Cc: Zsh hackers list

"Richard Hartmann" <richih.mailinglist@gmail.com> writes:

> Hi all,
> 
> after a somewhat embarassing email to -users, I realized colors() does
> not properly escape color codes in its variables. What is the reason
> for this behaviour?

Because %{ %} is only recognized in prompt expansions.
And colors is meant to be used for more than just in the prompt.
 
Phil.


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

* Re: Why does colors() not use %{ %}?
  2008-07-19  0:39 ` Philippe Troin
@ 2008-07-19  0:46   ` Richard Hartmann
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Hartmann @ 2008-07-19  0:46 UTC (permalink / raw)
  To: Philippe Troin; +Cc: Zsh hackers list

On Sat, Jul 19, 2008 at 02:39, Philippe Troin <phil@fifi.org> wrote:

> Because %{ %} is only recognized in prompt expansions.
> And colors is meant to be used for more than just in the prompt.

True. In that case, I assume there is no interest in special
variables/another function?


Richard


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

* Re: Why does colors() not use %{ %}?
  2008-07-19  0:23 Why does colors() not use %{ %}? Richard Hartmann
  2008-07-19  0:39 ` Philippe Troin
@ 2008-07-19  1:03 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2008-07-19  1:03 UTC (permalink / raw)
  To: Zsh hackers list

On Jul 19,  2:23am, Richard Hartmann wrote:
}
} after a somewhat embarassing email to -users, I realized colors() does
} not properly escape color codes in its variables. What is the reason
} for this behaviour?

Because prompts are not the only place you might want to use colors,
and even in a prompt it's wasteful to include the %{ and %} multiple
times if you're going to use several color sequences in a row.


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

end of thread, other threads:[~2008-07-19  1:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-19  0:23 Why does colors() not use %{ %}? Richard Hartmann
2008-07-19  0:39 ` Philippe Troin
2008-07-19  0:46   ` Richard Hartmann
2008-07-19  1:03 ` 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).