Re: cd won't change the prompt if the command is typed in the vi editor (vi mode).

2013-05-13 Thread Greg Wooledge
On Sun, May 12, 2013 at 05:50:18PM -0500, Peng Yu wrote:
> set -o vi.
> 
> Then I type v to enter the vi editor. In the vi editor, I type 'cd
> /tmp'. Then, I get the following screen output. Notice that the prompt
> does not change immediately after the cd command. Could anybody
> reproduce this behavior? Thanks.
> 
> ~$
> cd /tmp
> ~$ echo $PWD
> /tmp
> /tmp$

Yes, this happens to me as well running bash-4.3-alpha.  (You left out
the part where you put \w into your PS1 variable, but I assumed it.)



Re: cd won't change the prompt if the command is typed in the vi editor (vi mode).

2013-05-13 Thread Chet Ramey
On 5/12/13 6:50 PM, Peng Yu wrote:
> Hi,
> 
> I have vi mode set.
> 
> set -o vi.
> 
> Then I type v to enter the vi editor. In the vi editor, I type 'cd
> /tmp'. Then, I get the following screen output. Notice that the prompt
> does not change immediately after the cd command. Could anybody
> reproduce this behavior? Thanks.
> 
> ~$
> cd /tmp
> ~$ echo $PWD
> /tmp
> /tmp$

This all happens within the context of the same call to readline().  PS1
isn't reevaluated until before the next readline() call.

>From the bash/readline perspective, this is just an editing command that
causes other shell commands to be executed.  There's no equivalent of
`accept-line' there that would return control to the parser.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/