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: David C. Rankin
Subject: Re: Including \t, \T or \A at beginning of PS1 causes line wrap issues
Date: Fri, 17 Jan 2014 03:21:23 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/17/2014 12:17 AM, Chris Down wrote:
> +Cc: bug-bash
> 
> Please do not take discussions off-list, it decreases the value of
> conversations for future readers.

Chris, I apologize, I should have caught the reply-address was yours and not the
list's.

> 
> 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.
> 

  Yes, I pick through the zero-width sequences and insure they always begin with
\[ and are terminated with \]. I have seen/read about using tput and assigning
color names to the tput calls, but had not tried it yet. I suspect it would not
have made any difference in this case. I believe we were dealing with a kernel
bug that was fixed upon updating to a new kernel today.

  I believe the problem started when I upgraded linux (3.12.5-1 -> 3.12.6-1).
Today I upgraded linux (3.12.6-1 -> 3.12.7-2) and the problem seems to have
resolved itself. Even using:

  PS1="\[\e[0;37m\]\D{%R}\[\e[1;34m\] \h:\w> \[\e[0m\]"

  As mentioned earlier, I have experienced these line-wrap issues intermittently
over the past decade. When they are reported (usually to the Linux distro bug
list, they have generally been resolved at that level). This time, I had not
seen a line-wrap issue on Archlinux for at leash the past 4 years. Looking at
the logs I saw the bash 4.2.045-5 install on 11/27 and concluded it was likely
connected. I still cannot confirm the kernel was 100% the problem, but
regardless, I am not seeing the issue after the update.

  Thank your for your time and the tput suggestion. You guys have a good 
weekend.

- -- 
David C. Rankin, J.D.,P.E.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlLY9hIACgkQZMpuZ8Cyrci0iwCfUIxv0UFt0KHUZsChVHGzI8og
N0cAn0G3A2cWHg+ERLe2dtiStgY82BvH
=cxX0
-----END PGP SIGNATURE-----



reply via email to

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