Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Turning display attributes on / off in prompt strings



Bart Schaefer wrote:
> A consideration is that if we simply replaced $"\e[m' with $'\e[24m'
> and so on, the present prompt code would still emit the
> then-unnecessary sequences to restore the other attributes.  Is it
> worth the effort to rework that?

It's probably not worth replacing the escape sequence without also
allowing it to avoid that because the original problem would only be
partially solved.

> > And if we need a way to
> > override terminal settings, something more generic may be better.
>
> Would populating a writable special hash parameter be a security issue?

I can't think of anything it would open up that isn't already the case.
It can depend on what you regard as untrusted data.

> As you implied, though, the hash key names could be tricky to choose.

We do already have an interface in the form of zle -T transformation func
Transformation is currently only "tc" for termcap but something for end
bold* or general attribute changing could be added. Prompt handling is in
the main part of zsh rather than zle but the zle module could define a
callback. The existing tc transformation interface doesn't make it easy
to modify only some capabilities, you'd need to reimplement tparm(3) in
shell code. A function provides maximum flexibility but could be slow
and a string would suffice for most uses. A hash seems like a nicer
interface but we can have a transformation function do the hash lookup
and keep that in shell code.

Oliver

* \e[22m selects normal, disabling also faint so naming indicating end
of bold would be a poor choice.




Messages sorted by: Reverse Date, Date, Thread, Author