* %F{1} outputs code twice, %F{red} doesn't @ 2010-05-27 22:26 Mikael Magnusson 2010-06-01 21:07 ` Peter Stephenson 0 siblings, 1 reply; 3+ messages in thread From: Mikael Magnusson @ 2010-05-27 22:26 UTC (permalink / raw) To: zsh workers % print -P a%F{1}a|cat -v a^[[38;5;1m^[[38;5;1ma % echo ${(%V):-a%F{1}a} a^[[38;5;1m^[[38;5;1ma (wasn't sure if those use the same code path) % print -P a%F{red}a|cat -v a^[[38;5;1ma -- Mikael Magnusson ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: %F{1} outputs code twice, %F{red} doesn't 2010-05-27 22:26 %F{1} outputs code twice, %F{red} doesn't Mikael Magnusson @ 2010-06-01 21:07 ` Peter Stephenson 2010-06-01 21:30 ` Mikael Magnusson 0 siblings, 1 reply; 3+ messages in thread From: Peter Stephenson @ 2010-06-01 21:07 UTC (permalink / raw) To: zsh workers On Fri, 28 May 2010 00:26:49 +0200 Mikael Magnusson <mikachu@gmail.com> wrote: > % print -P a%F{1}a|cat -v > a^[[38;5;1m^[[38;5;1ma > % echo ${(%V):-a%F{1}a} > a^[[38;5;1m^[[38;5;1ma > > (wasn't sure if those use the same code path) > > % print -P a%F{red}a|cat -v > a^[[38;5;1ma I'm not sure how you get it duplicated, but it does look to me like it's trying to do the same thing two ways, one with termcap, and one with ANSI sequences, or whatever you've told it to use instead via zle_highlight. I'm not absolutely sure what I was doing, but I think I must have meant to return if the termcap code was found, and only drop through after that if it was an ANSI colour. However, I'm not sure even that's necessarily correct, it might be best just to try it in case the user is smarter than termcap and has set up zle_highlight appropriately. Any better theories... Index: Src/prompt.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/prompt.c,v retrieving revision 1.59 diff -p -u -r1.59 prompt.c --- Src/prompt.c 10 Jul 2009 21:32:49 -0000 1.59 +++ Src/prompt.c 1 Jun 2010 20:59:48 -0000 @@ -1925,8 +1925,13 @@ set_colour_attribute(int atr, int fg_bg, } else { tputs(tgoto(tcstr[tc], colour, colour), 1, putshout); } + /* That worked. */ + return; } - /* for 0 to 7 assume standard ANSI works, otherwise it won't. */ + /* + * Nope, that didn't work. + * If 0 to 7, assume standard ANSI works, otherwise it won't. + */ if (colour > 7) return; } -- Peter Stephenson <p.w.stephenson@ntlworld.com> Web page now at http://homepage.ntlworld.com/p.w.stephenson/ ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: %F{1} outputs code twice, %F{red} doesn't 2010-06-01 21:07 ` Peter Stephenson @ 2010-06-01 21:30 ` Mikael Magnusson 0 siblings, 0 replies; 3+ messages in thread From: Mikael Magnusson @ 2010-06-01 21:30 UTC (permalink / raw) To: zsh workers On 1 June 2010 23:07, Peter Stephenson <p.w.stephenson@ntlworld.com> wrote: > On Fri, 28 May 2010 00:26:49 +0200 > Mikael Magnusson <mikachu@gmail.com> wrote: >> % print -P a%F{1}a|cat -v >> a^[[38;5;1m^[[38;5;1ma >> % echo ${(%V):-a%F{1}a} >> a^[[38;5;1m^[[38;5;1ma >> >> (wasn't sure if those use the same code path) >> >> % print -P a%F{red}a|cat -v >> a^[[38;5;1ma > > I'm not sure how you get it duplicated, but it does look to me like it's > trying to do the same thing two ways, one with termcap, and one with > ANSI sequences, or whatever you've told it to use instead via > zle_highlight. The trick is it only happens with "1", not with "red". The patch appears to fix it. -- Mikael Magnusson ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-06-01 21:37 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-05-27 22:26 %F{1} outputs code twice, %F{red} doesn't Mikael Magnusson 2010-06-01 21:07 ` Peter Stephenson 2010-06-01 21:30 ` Mikael Magnusson
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).