On 12/15/25 1:27 AM, William Pursell wrote:
Configuration Information:
Machine: x86_64
OS: macOS 12.7.6
Compiler: clang version 21.1.0 (clang
3623fe661ae35c6c80ac221f14d85be76aa870f1)
Bash Version: devel branch, commit 637f5c8696a6adc9b4519f1cd74aa78492266b7f
Bash Commit Date: Dec 10, 2025

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').

That means that even though the code gets run, the current call to
readline() doesn't return and readline continues to edit the now-empty
line. This execution is supposed to be transparent to the editing. It
starts to break down if you're using command-oriented history and
trying to edit and execute a multi-line compound command.


Actual result:
"hello world" is printed, but bash displays the PS2 continuation
prompt and waits for input.  Any subsequent input is appended to
the original (pre-fc) command buffer.  Typing a closing quote
executes the original command.

This isn't exactly true. The `command buffer' (by which I assume you mean
the readline line buffer?) gets cleared, but readline continues to edit the
line. Maybe you mean the command that was in the history?

Analysis:
The fc mechanism executes the edited command but does not clear or
reset the readline/parser state that existed before 'v' was pressed.
The parser still believes it is waiting for a closing quote from the
original input.

It is.

Should the `v' command break the usual readline() semantics? I'll have
to see if there's a clean way to do that for this single case.

--
``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/

Reply via email to