On 12/17/25 11:27 AM, Chet Ramey wrote:

Description:
When using vi-mode and pressing 'v' to edit a multi-line command that
has an unclosed quote, the fc-edited command executes correctly, but
bash returns to the parser continuation state instead of resetting to
a fresh prompt.

I'll take a look at this again. The current code works pretty hard to make
the `v' (or C-xC-e) binding the same as any other readline key binding that
executes shell code (think programmable completion, or functions bound to
key sequences with `bind -x').

I got interested in this last night, and I made some changes that should
address your issue -- running C-xC-e (or `v') from a tty, not from a
string or readline macro.

I agree that in the case of a multi-line command (e.g., a compound command
or a multi-line string literal) it's unexpected to have to go back to the
original unedited command and close it out. This isn't a problem with
single-line commands, which is, I suppose, the predominant use. Your
approach of treating this as if the call to readline() completed and the
shell executed the file of edited commands is reasonable.

If you're going to jump back to the top level unconditionally, you don't
need to bother with saving and freeing the parser context -- running the
script will do its own parsing. You don't have to call reset_parser when
the file execution completes, but it doesn't hurt.

I'll have something for you to try out in the next devel branch push.
There might be some readline state to clean up; we'll have to do some
testing.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to