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: Musse Abdullahi
Subject: Re: bash long prompt, color going past the end of prompt after reaching bottom of terminal
Date: Fri, 23 Mar 2018 12:47:29 -0400

Virta,

your workaround solves the first issue but creates another one.

Here is the script with your workaround

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 \\w : \[$(tput bold)$(tput setab 1)$(tput setaf
7)\]${git_branch}\[$(tput sgr0)$(tput el)\]\$ "
    export PS1="$prompt"}

PROMPT_COMMAND="calculate_prompt1;"


Now keep pressing enter to the bottom of the terminal, and

you will see that the initial problem is solved. next write anything
that flows to the next line (forcing a scroll). Then press "Home"
button to go back to the beginning of what you wrote.

you will see that the entire line after the prompt is deleted.

Any workaround for that?


Thanks,

Musse A.


On Thu, Mar 22, 2018 at 6:36 PM, Ilkka Virta <itvirta@iki.fi> wrote:

> On 22.3. 22:22, Chet Ramey wrote:
>
>> On 3/22/18 1:44 PM, Musse Abdullahi wrote:
>>
>> Bash Version: 4.2
>>> Patch Level: 46
>>> Release Status: release
>>>
>>> Description:
>>>      look at Repeat-By section
>>>
>>
>> If the version information above is accurate, you should investigate
>> newer versions of bash. Version 4.2 is two major versions behind and
>> was released around seven years ago.
>>
>
> 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. At least one way to work around that seems to be
> to clear the end of the line after the colored part ends, by putting
> "$(tput el)" after "$(tput sgr0)". You probably don't have anything to the
> right of the cursor at that point, so it'll only reset the color.
>
> --
> Ilkka Virta / itvirta@iki.fi
>


reply via email to

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