Skip to content

fix: parseOsc correctly reports ClipboardEvent selection on base64 failure#116

Open
masterkeysrd wants to merge 1 commit into
charmbracelet:mainfrom
masterkeysrd:main
Open

fix: parseOsc correctly reports ClipboardEvent selection on base64 failure#116
masterkeysrd wants to merge 1 commit into
charmbracelet:mainfrom
masterkeysrd:main

Conversation

@masterkeysrd

Copy link
Copy Markdown

Previously, the OSC 52 parser used strings.Split, which could corrupt the payload if the base64 content contained semicolons. It also required a non-empty selection code, so empty selections silently dropped the event, and on invalid base64 it returned the raw, un-decoded string as the content instead of an empty string — causing the wrong selection and content to be reported in ClipboardEvent.

Before passing an empty clipboard event

Screenshot 2026-05-25 at 1 25 32 PM

After my changes, now the base64 is correctly populated in the Clipboard Event

Screenshot 2026-05-25 at 1 28 47 PM
  • I have read CONTRIBUTING.md.
  • I have created a discussion that was approved by a maintainer (for new features).

…ilure

Previously, the OSC 52 parser used strings.Split which could corrupt the payload if the base64 content contained semicolons. It also required a non-empty selection code, so empty selections silently dropped the event, and on invalid base64 it returned the raw un-decoded string as the content instead of an empty string — causing the wrong selection and content to be reported in ClipboardEvent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant