[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: |
Chet Ramey |
Subject: |
Re: bash long prompt, color going past the end of prompt after reaching bottom of terminal |
Date: |
Sun, 25 Mar 2018 16:50:44 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 3/23/18 12:47 PM, Musse Abdullahi wrote:
> 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.
I can't reproduce this with bash-4.4.19, using ^A for HOME (no HOME button
on my keyboard).
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/