[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Surprising interaction between edit-and-execute-command, the cd buil
From: |
Chet Ramey |
Subject: |
Re: Surprising interaction between edit-and-execute-command, the cd builtin, and the prompt |
Date: |
Sat, 6 Nov 2021 15:18:37 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 |
On 11/6/21 9:57 AM, Piotr P. Stefaniak wrote:
Hi,
Using bash 5.0.17 edit-and-execute-command I type in something like
cd /tmp
save and exit to execute. $PWD is properly updated but the prompt
doesn't reflect the change (not until the next time it is printed).
The answer is the same as to this question from back in March:
https://lists.gnu.org/archive/html/bug-bash/2021-03/msg00145.html
`edit-and-execute-command' is a bindable readline command. The prompt
passed to readline persists throughout the entire duration of a single
call to readline(). When you run edit-and-execute-command via a readline
key binding, you're still within the same call to readline(), and readline
takes care of redisplaying the prompt and continuing to read input when
that command completes. There is no point where readline() returns a line
to its caller, so there's no point where the prompt is re-evaluated.
Chet
--
``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/