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. Repeat-By: $ bash --norc -i $ set -o vi $ echo 'hello > world [press ESC then v] [in editor, change buffer to: echo 'hello world'] [save and exit] Expected result: "hello world" is printed and a fresh PS1 prompt appears. 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. 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. A naive attempt to fix this is available at https://github.com/wrp/bash/tree/wrp/flush-parser, but no tests are provided. (I have an expect based test, but I don't think that's appropriate). This patch appears to fix the problem and existing tests pass, but I am not familiar with bash code and am not confident with this solution.
