zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: %F{1} outputs code twice, %F{red} doesn't
Date: Tue, 1 Jun 2010 22:07:00 +0100	[thread overview]
Message-ID: <20100601220700.6e7be66e@pws-pc> (raw)
In-Reply-To: <AANLkTikHRAqO7fOkcv48f_k2iIIdKjynAO3ImmSSaYP6@mail.gmail.com>

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/


  reply	other threads:[~2010-06-01 21:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-27 22:26 Mikael Magnusson
2010-06-01 21:07 ` Peter Stephenson [this message]
2010-06-01 21:30   ` Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100601220700.6e7be66e@pws-pc \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).