zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Meino Christian Cramer <Meino.Cramer@gmx.de>, zsh-users@sunsite.dk
Subject: Re: Colored PS1
Date: Thu, 08 Sep 2005 16:05:13 +0000	[thread overview]
Message-ID: <1050908160513.ZM15498@candle.brasslantern.com> (raw)
In-Reply-To: <20050908.053110.07640431.Meino.Cramer@gmx.de>

On Sep 8,  5:31am, Meino Christian Cramer wrote:
}
} > "escape sequence" in the context of terminals means "a series of ASCII
} > characters, often beginning with the ESC (\033, \x1B) character."  It
} > is common for terminals and terminal emulators to recognize such a
} > series of characters in the output and alter the terminal's behavior.
} 
}   ...oh I see...something like "commands"! :)

Yes, except that the "commands" are embedded in the same stream as the
ordinary non-command data.  It's more like a very crude form of markup.
In HTML, you'd write
    I am not bold but <bold>I am brave!</bold>
and in "terminal markup" you'd write
    I am not bold but ^[[01;39mI am brave!^[[00m
(where ^[ is the ESC character).  In neither case do you see the markup
when the text is displayed (hence, no cursor movement).

} > The trouble is that "escape sequnce" in the context of a prompt means
} > one of the pairs of characters that begins with a percent (%) sign.
} > Again this is from the concept of a special combination of characters
} > causing a change (an escape from) the usual interpretation of such
} > characters.
} >
} ...do I understand this cxorrectly? In other words:
}   The trouble is, that a escape seuence can be misinterpreted as a
} special sign of the prompt expanding itsself ?

No, nothing like that.  I'm only talking about humans misunderstanding
the confusing terminology, not zsh misinterpreting the strings.  Look
at what I was just saying about markup ... prompts have "markup" too:

    I am not bold but %BI am brave!%b

Prompt markup can't change colors, though, so sometimes you have to mix
terminal markup and prompt markup.  The prompt markup %{ and %} tell zsh
that what's in between is some other kind of markup, so that it should
not count it as something that occupies space on the display.

} > In the worst case, you go look at the documentation for an ANSI standard
} > terminal
} > the definition whether any cursor movement is involved.
} 
}   URKS!

Yeah, but that's why I said "in the worst case."

} Setting PS1 directly without the addtional step using $prompt it does
} not work.

That makes no sense at all.  Something is happening that you don't know
how to tell us, and I don't know what to ask to learn what it is.

However ...

} I am happy haveing a colored prompt

... if you're happy, we don't need to pursue it any further right now.

} ... only wihing that sometimes
} zshall would be more understandable than totally complete.

Wishing?  Buy Oliver and Peter's book!


  reply	other threads:[~2005-09-08 16:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-07  3:25 Meino Christian Cramer
2005-09-07  7:53 ` Tim Kruse
2005-09-07 14:57   ` Bart Schaefer
2005-09-07 17:21   ` Meino Christian Cramer
2005-09-08  2:39     ` Bart Schaefer
2005-09-08  3:31       ` Meino Christian Cramer
2005-09-08 16:05         ` Bart Schaefer [this message]
2005-09-08 16:59           ` Meino Christian Cramer
2005-09-09 14:32             ` Bart Schaefer

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=1050908160513.ZM15498@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=Meino.Cramer@gmx.de \
    --cc=zsh-users@sunsite.dk \
    /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).