Repository navigation
late background color replies escape during startup commands - #21985
Open
akasakariko wants to merge 1 commit into
Open
akasakariko wants to merge 1 commit into
akasakariko wants to merge 1 commit into
Conversation
Problem: Late terminal background replies can escape to the shell when
'termbackgroundwait' is positive and startup commands quit or
invoke a shell command (h-east).
Solution: Defer the background request until command-line startup commands
have finished, preserve the early wait without these commands,
and add PTY regression tests (Asuka).
related: vim#21664
Assisted-by: OpenAI Codex
Signed-off-by: Asuka <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With a positive
termbackgroundwait, OSC 11 is sent before command-line startup commands. A terminal reply delayed by 400 ms withtbw=50is echoed into the caller's shell aftervim -c q, or while the shell command invim -c '!sleep 1'is running. This reproduces the regression reported by h-east after patch 9.2.1375.Defer the background query when
+,-c, or-Sstartup commands are present. If Vim continues, the existing query after these commands still detects the background. Ordinary interactive startup retains the early query and wait. Document that command-line startup commands do not receive the wait before the first screen clear.Add a PTY regression covering
-c q, a shell command followed by-c q,+q,-S, and an indirectexecute 'q'. All five cases produce an early query and a late response echo on the unmodified binary, and pass with this change. Adapt the existing background tests to keep checking normal startup waiting, typed and redirected input, interrupted handoff, CR-LF output, and color restoration without command-line startup commands.Validation on macOS arm64, based on
b8e10a2(Vim 9.2.1382): the Huge console build succeeds without warnings; startup, terminal-code, options, help, and code-style suites pass withTEST_NO_RETRY=1, totaling 256 passing tests and 12 platform or feature skips. The two original reproduction commands change fromechoedtonot echoed. An additional PTY check confirms that a session continuing after a startup command sends the query after the command and uses the returned background.The initial terminal-code run under
TERM=dumbhas three failures that reproduce unchanged on the baseline. The suite passes withTERM=xterm-256color. The complete Huge test suite, Tiny builds, GUI, Windows, and sanitizers were not run locally.Related to #21664.