help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Expand a prompt string to calculate its length?


From: Greg Wooledge
Subject: Re: [Help-bash] Expand a prompt string to calculate its length?
Date: Wed, 19 Jun 2019 14:23:48 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Wed, Jun 19, 2019 at 11:18:29AM -0700, Andy Chu wrote:
> The @P techniques works if you don't have color in your prompt.  If you
> have colors I'm not sure there's a way to do it in general.

If the prompt has colors or other terminal escape sequences, then the
question "calculate its length" is ambiguous at best.  Does the OP want
the byte length for storage, or the visible character length for
display width?

Of course, one could simply not use colors, and then it won't be an issue.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]