Skip to content

fix(terminal): defer keyword scroll refresh while Enter is pending - #2880

Draft
netcatty-bot wants to merge 2 commits into
mainfrom
cursor/issue-2879-31446551895
Draft

fix(terminal): defer keyword scroll refresh while Enter is pending#2880
netcatty-bot wants to merge 2 commits into
mainfrom
cursor/issue-2879-31446551895

Conversation

@netcatty-bot

Copy link
Copy Markdown
Collaborator

Summary

  • Restore Enter-pending protection so onScroll during the Ubuntu RTT gap (before onWriteParsed) no longer takes the immediate user-scroll keyword path.
  • While Enter output is pending, mark the viewport dirty instead of synchronously rescanning; cancel any queued scroll refresh when Enter is pressed.
  • When the Enter protection window clears, trigger a debounced write refresh so deferred viewport motion (including user scroll during the window) still catches up.
  • Add a regression test for idle Enter + scroll-before-writeParsed after a prior write cleared lastRenderRange.

Why

v1.1.77 claimed to fix keyword highlight flicker on Enter (#2805), but the persistence rewrite dropped the earlier enterInputPending scroll guard. After a normal write refresh, lastRenderRange is null and lastWriteAt goes stale at an idle prompt, so Ubuntu 24.04 echo that emits onScroll before onWriteParsed was again classified as user scroll and synchronously rescanned the viewport — flashing still-visible keyword decorations.

Changes

  • components/terminal/keywordHighlight.ts: restore Enter-time scroll deferral + idle-clear catch-up.
  • components/terminal/keywordHighlight.test.ts: cover the idle Enter / pre-writeParsed scroll race.

Testing

  • node --test --import tsx components/terminal/keywordHighlight.test.ts (47 passed)
  • Manual (unverified here): Settings → Terminal → Keyword Highlighting on; SSH to Ubuntu 24.04; press Enter at an idle prompt and confirm existing highlights do not flash.

Fixes #2879

Automation

  • Automated implement pass
  • Review gate: @codex review (own/bot PRs only)
  • Draft until Codex reports clean findings

@netcatty-bot netcatty-bot added automation:bot-pr PR created or owned by Cursor automation automation:codex-loop Own/bot PR waiting on Codex review↔fix loop triage Touched by Cursor automation labels Aug 11, 2026
@binaricat

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 315e596e08

ℹ️ 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".

Comment on lines +727 to +728
this.markVisibleRangeDirty();
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bound Enter-pending scroll suppression without output

When the remote PTY produces no write after Enter—for example, with echo disabled or a stalled connection—onWriteParsed never runs. enterInputPending is set by onData, but its only clear timer is armed inside onWriteParsed, so this new early return suppresses every subsequent user-scroll refresh indefinitely. Newly revealed scrollback lines therefore remain unscanned and unhighlighted until unrelated output arrives; arm a fallback timer from onData or otherwise time-bound this guard.

Useful? React with 👍 / 👎.

@binaricat

Copy link
Copy Markdown
Owner

@codex review

Repository owner deleted a comment from binaricat Aug 11, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 4935066e53

ℹ️ 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".

@netcatty-bot
netcatty-bot marked this pull request as ready for review August 11, 2026 01:16
@netcatty-bot netcatty-bot added automation:codex-clean Last Codex review reported clean and removed automation:codex-loop Own/bot PR waiting on Codex review↔fix loop labels Aug 11, 2026
@netcatty-bot

Copy link
Copy Markdown
Collaborator Author

Codex reported no major issues. This PR is marked ready for human review/merge.

@netcatty-bot
netcatty-bot marked this pull request as draft August 11, 2026 03:11
@netcatty-bot netcatty-bot removed the automation:codex-clean Last Codex review reported clean label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation:bot-pr PR created or owned by Cursor automation triage Touched by Cursor automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 连接Ubuntu24.04lts的情况下,回车之后高亮的关键字还是会闪

2 participants