[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: print/echo lost from COMMAND_PROMPT Function
From: |
Manish Patel |
Subject: |
Re: print/echo lost from COMMAND_PROMPT Function |
Date: |
Tue, 4 Feb 2020 16:59:26 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 |
Thank you Chet,
In that case, how do I compile my own bash with specific version of
readline?
I can not install readline to system but I can compile both in my home
directory.
Thanks
Manish.
On 2/4/20 10:07 AM, Chet Ramey wrote:
> On 2/3/20 3:26 PM, Manish Patel wrote:
>
>> Bash Version: 4.4
>> Patch Level: 20
>> Release Status: release
>>
>> Description:
>> Print/echo is lost when generated from a function in
>> COMMAND_PROMPT and placed in background in subshell.
>>
>> I have embedded some git information in my command prompt.
>> However, due to large git data, it takes some time to calculate it all.
>> So I have placed
>> the git processing in the background function, which I call from
>> COMMAND_PROMPT.
> Readline assumes two things: it starts with the cursor in column 0, and
> it is the only thing writing to the screen during redisplay, so it always
> knows where the cursor is and can make redisplay decisions accordingly.
> Your writing to the screen from a background process violates one or both
> of these, so all bets are off. It may be the case that readline decides to
> redisplay by moving to column 0, redrawing the prompt, moving the cursor,
> and redrawing the changed portions of the line,in which case whatever your
> process writes at the beginning of the line gets overwritten. It may be the
> case that writing to the screen moves the cursor forward so readline
> doesn't move the cursor to the right place or wrap correctly.
>
> There are no guarantees that anything a background process writes to the
> screen will be preserved, or that writing to the screen and moving the
> physical cursor will not interfere with readline's redisplay.
>
> Chet
>