[Bug]: Terminal paste lands twice in Chromium browsers (inverse of the #8457 race)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, typescript
Research direction
The bug is in apps/web/src/terminal/ghostty/surface.ts, where pasteShortcutToken handles the race between navigator.clipboard.readText() and the native paste event. Start by examining the paste handling logic and the reference commit. Write a test to verify that pasted text is not duplicated, then implement the fix to drop the matching native paste after a successful read. Ensure a keydown clears the record to avoid swallowing later pastes.
Written by the indexing model from the issue text.
Description
In the web client (Brave, over the network), pasting into the integrated terminal often sends the text twice. I hit it constantly.
The paste shortcut starts navigator.clipboard.readText() and keeps the native paste event as a fallback (apps/web/src/terminal/ghostty/surface.ts). pasteShortcutToken only handles the native event arriving first. If the read resolves first, the native paste that follows is also sent. This is the "remaining inverse ordering" noted when #8457 was closed.
I have a small fix with a regression test in my fork: the read records the text it delivered, and the matching native paste from the same gesture is dropped. Any keydown clears the record, so a later paste is never swallowed. Reference commit: https://github.com/r4iju/t3code/commit/de8ff28dcb4fc3c1b15374d6e9c5531cb3a9a61c
Happy to open a PR if you want it.
- Dominant language
- TypeScript
- Stars
- 23.5k
- Forks
- 6.1k
- Avg merge
- 9h
- Merged PRs (30d)
- 349
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pingdotgg/t3code
-
accepted bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
accepted bug good first issue via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
accepted bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
accepted bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
bug upstream via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
All issues in pingdotgg/t3code
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
bcgov/bc-wallet-mobile#4761 · 1 comment ·
-
external-issue to-triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
area-deployment area-integrations triage:bot-seen
Difficulty 2/5 Half a day Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
refactor
Difficulty 2/5 1-3 hours Newbie friendliness 84/100