Skip to content

Conversation

@0xzhzh
Copy link

@0xzhzh 0xzhzh commented Dec 7, 2025

The prior implementation assumed that registers + and * used OSC52 if and only if vim.g.clipboard.name = "OSC 52". Doing so is incorrect: a user may configure a custom clipboard provider with a different name, or set a different paste source for + or *, or even set the option to a string as shorthand, i.e., vim.g.clipboard = 'osc52'.

This implementation performs more robust checking to ensure we don't try to read from OSC52 registers by discriminating vim.g.clipboard more closely. It still checks for vim.g.clipboard.name == "OSC 52" for backwards compatibility and to provide a way for those who might use a custom paste handler that isn't exactly the nvim-provided one.

I also shorten to placeholder message of OSC 52 registers.

The prior implementation assumed that registers "+" and "*" used OSC52
if and only if vim.g.clipboard.name = "OSC 52". Doing so is incorrect:
a user may configure a custom clipboard provider with a different name,
or set a different paste source for "+" and "*", or even set the option
to a string as shorthand, i.e., vim.g.clipboard = 'osc52'.

This implementation performs more robust checking to ensure we don't try
to read from OSC52 registers by discriminating vim.g.clipboard more
closely.
This maintains backwards compatibility, plus it allows users to opt out
of register reading by setting the name to "OSC 52", e.g., if they
configure a custom paste handler that is not exactly the same function
as vim.ui.clipboard.osc52.paste() (but wraps it).
@github-actions github-actions bot added the size/m Medium PR (<50 lines changed) label Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m Medium PR (<50 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant