bug-bash
[Top][All Lists]
Advanced

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

Re: bash long prompt, color going past the end of prompt after reaching


From: Clint Hepner
Subject: Re: bash long prompt, color going past the end of prompt after reaching bottom of terminal
Date: Fri, 23 Mar 2018 13:22:40 -0400

> On 2018 Mar 23 , at 8:26 a, Greg Wooledge <address@hidden> wrote:
> 
> On Fri, Mar 23, 2018 at 12:36:22AM +0200, Ilkka Virta wrote:
>> I get the same with '4.4.12(1)-release' too, but it doesn't seem related to
>> Bash or the prompt. I can get it with just a printf, the colored part just
>> needs to get wrapped by the end of line.
>> 
>> printf "%100s $(tput setab 1)colored part$(tput sgr0) normal again\n"
>> 
>> If the screen scrolls, the background color on the last character gets
>> copied to the next line.
> 
> Ahh.  In that case, it's a bug (or undesired feature) of your terminal
> emulator, and you should address the bug reports in that direction.
> 

I can reproduce buggy appearance in the following, all running on macOS:
 * iTerm2
 * Terminal
 * The console of a CentOS 7 VM running in Virtual Box

Adapting the original function to work with zsh,

# Changes:
# \w -> %~
# \[...\] -> %{...%}
# \$ -> %#
calculate_prompt1()
{
    host="my-linux"
    git_branch="a very very very very very very very very very very very very 
very very long prompt"
    prompt="@$host %~ : %{$(tput bold)$(tput setab 1)$(tput setaf 
7)%}${git_branch}%{$(tput sgr0)%}%# "
    export PS1="$prompt"
}

I cannot reproduce in any of the three environments listed above.

Clint




reply via email to

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