Repository navigation
terminal: fix type-ahead prediction incorrectly rejecting valid style sequences - #305103
Merged
Connor Peet (connor4312) merged 4 commits intoNov 3, 2026
Merged
Connor Peet (connor4312) merged 4 commits into
Connor Peet (connor4312) merged 4 commits into
Conversation
Connor Peet (connor4312)
enabled auto-merge (squash)
November 3, 2026 19:58
Dmitriy Vasyura (dmitrivMS)
approved these changes
Nov 3, 2026
Connor Peet (connor4312)
enabled auto-merge (squash)
November 3, 2026 22:19
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Anthony Kim (@anthonykim1)Matched files:
|
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.
Problem
arrayHasPrefixAt(a, ai, b)interminalTypeAheadAddon.tschecks whether arrayastarting at positionaibegins with arrayb. The comparison loop usesb[ai]instead ofb[bi]to index into the second array. Whenai > 0, this reads the wrong position inb; whenai >= b.length,b[ai]is alwaysundefinedand the check silently fails.The function is used in
TypeAheadStyle._onDidWriteSGRto match incoming SGR sequences against expected undo/apply arguments. When the match starts past index 0 in the args array, the style tracker fails to recognize its own sequences, causing incorrect style restoration during terminal type-ahead prediction.Fix
Change
b[ai]tob[bi]in the comparison loop.