bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem when editing cmd-line with external editor


From: Michael Naumann
Subject: Re: Problem when editing cmd-line with external editor
Date: Wed, 6 Aug 2003 13:04:10 +0200

On Tuesday 05 August 2003 15:52, Chet Ramey wrote:
> > Machine Type: i386-pc-linux-gnu
> >
> > Bash Version: 2.05a
> > Patch Level: 0
> > Release Status: release
> >
> > Description:
> >   When invoking an external editor in "set -o vi"-mode and issuing a "cd
> > anywhere"-command, the PS1 is updated delayed
>
> PS1 will not be updated until the next time the shell either prints the
> prompt itself or calls readline().
>
> The command you execute after doing the history edit effectively happens
> during the same call to readline().  readline() doesn't return until you
> accept the line with a newline, and the shell doesn't update PS1 until
> after readline() returns, the command is executed, and it's ready to call
> readline() again.
>
> Chet

Thank you for your reply (and your work on this great shell).
I kind of understand, what you write, yet I consider this a design-flaw.
The behaviour has some other ugly implications, that I try to sketch here:

For simplicity my Prompt is
  PS1='$?'
And again, I have
  set -o vi

If I  now issue (e.G) 'echo', the prompt will be '0', and will remain
'0' even if I press 'Return' any number of times - This is good.

Now I do <ESC>v and enter 'echo' here.
After leaving the editor, the prompt is '0'.
Now after pressing 'Return' the prompt changes to '1' - which is all wrong.

Another flaw:
If I enter 'read' I can can enter my text and get it echoed. The input
can be terminated with <Return> - This is good

If I do the same with <ESC>v, I
  1) do not see any characters echoed
  2) can not terminate the input with <Return>, <C-J> still works

I hope, I could make clear, why I'm so stubborn on this issue.

Kind regards, Michael




reply via email to

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