bug-bash
[Top][All Lists]
Advanced

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

Re: Including \t, \T or \A at beginning of PS1 causes line wrap issues


From: Chris Down
Subject: Re: Including \t, \T or \A at beginning of PS1 causes line wrap issues
Date: Fri, 17 Jan 2014 14:17:48 +0800
User-agent: Mutt/1.5.22 (2013-10-16)

+Cc: bug-bash

Please do not take discussions off-list, it decreases the value of
conversations for future readers.

On 2014-01-16 23:13:35 -0600, David C. Rankin wrote:
> A sanitized version w/o color.

That detail matters -- please include the full scope of the issue in
future when reporting issues. My first thought when hearing about
wrapping issues is always that there are improperly stated zero-width
sequences in the prompt.

> The full prompt exported in .bashrc is:
> 
> PS1="\[\e[0;37m\]\A\[\e[1;34m\] \h:\w> \[\e[0m\]"
> 
>   also tested with:
> 
> PS1="\[\e[0;37m\]\D{%R}\[\e[1;34m\] \h:\w> \[\e[0m\]"

Those actually look okay to me (and I can't seem to reproduce your
issue, unless I misunderstood the steps), but maybe I'm missing
something. Either way, just use "tput", it will save you from a world of
pain, and it actually uses the terminfo database:

    PS1='\[$(tput setaf 7)\]\A\[$(tput bold)$(tput setaf 4)\] \h:\w> \[$(tput 
sgr0)\]'

You can also put those in variables to avoid calling "tput" every time
the prompt is drawn.

Attachment: pgpXZ2oRWZCvK.pgp
Description: PGP signature


reply via email to

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