[codex] Fix long-line keyword highlight lockup#1864
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21373fc67f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (block) { | ||
| cache.set(startY, block); | ||
| } | ||
| if (startY < 0) return null; |
There was a problem hiding this comment.
Cache capped wrapped-start misses
When the viewport is in the middle of an oversized soft-wrapped block, findWrappedBlockStart returns -1 and this early return bypasses the per-refresh wrappedBlockCache, so every line in the viewport plus overscan repeats the full capped backward walk. In a narrow split pane the cap is still thousands of rows (TERMINAL_AUX_LONG_LINE_SCAN_LIMIT_CHARS / cols), which leaves the large-line lockup path doing O(renderedLines * maxRows) buffer reads on each refresh instead of caching the miss once.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed by caching capped wrapped-block misses for the current refresh and tightening the regression test so repeated capped backward walks fail the check.
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Root cause
The terminal turns a huge single output line into thousands of soft-wrapped screen rows. After long-line pressure clears, keyword highlighting could repeatedly walk backward through the entire wrapped block while trying to build cross-line highlight context, which can lock the UI.
Addresses #1847.
Tests