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

Re: [PATCH] Update man pages to match change to Functions/Misc/colors



On Wed, Dec 13, 2023 at 5:27 AM Jim <linux.tech.guy@xxxxxxxxx> wrote:
>
> The one thing that looks strange about the change is prompt %S and %s, previously
> standout mode, will now mean reverse mode.

The "colors" function should not be conflated with the prompt escapes.
They have almost nothing to do with one another.  Changes to the
function do not affect prompts unless you are using the PROMPT_SUBST
option to interpolate variables defined by "colors".  What's emitted
by the prompt escapes has not changed as a result of any updates to
zsh:

% echo $ZSH_VERSION
5.8
% print -r ${(V%):-%Sstandout%s}
^[[7mstandout^[[27m
% Src/zsh -f
% echo $ZSH_VERSION
5.9.0.1-dev
% print -r ${(V%):-%Sstandout%s}
^[[7mstandout^[[27m
%

The trouble here is that what "standout" means is not well-defined --
from the zle_highlight doc:
     The characters in the given context are shown in the terminal's
     standout mode.  The actual effect is specific to the terminal; on
     many terminals it is inverse video.
If you're seeing %S change appearance, it's probably the result of a
terminal definition or other difference outside of zsh.  Prompts still
use whatever the terminal (or its terminfo file) defines as "standout"
for %S, and it would be wrong to assert that it always means
"reverse".

> AFAICT ANSI defines "7" as reverse mode. Changes to the colors function now
> uses reverse mode instead of standout mode. Upto and including version 5.8.1
> standout was defined here as 03 which is italic. In 5.9 italic was added as 03 and
> standout was moved to 07 but was also commented out. Also no-italic was
> added as 23 and no-standout was moved to 27 and commented out.

The lack of a firm definition of "standout" is why this change was
made.  Even "italic" remains a bit iffy; from
 https://en.wikipedia.org/wiki/ANSI_escape_code
 3  Italic  Not widely supported. Sometimes treated as inverse or blink.

(That wikipedia page also has some useful color charts, I'd not found
those before.)

In any case you're right that the contrib.yo doc should be updated,
but none of your other changes would be correct.

> What I don't know is if C code behind things

C code is behind everything, unless you've loaded the "colors"
function and made explicit reference to its variables.




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