Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix termcode yank/paste #12142

Closed
wants to merge 1 commit into from

Conversation

rcgoodfellow
Copy link

#10839 broke the termcode clipboard implementation.

Previously termcode relied on the stateful FallbackProvider implementation of the ClipboardProvider trait to capture buffer data for yank/paste. Now that FallbackProvider is gone and ClipboardProvider is a stateless enum, yank/paste fails to function.

This PR re-introduces some of the FallbackProvider machinery in a new TermcodeProvider structure within the ClipboardProvider::Termcode enum. This allows yank/paste to work again. Because the overarching context in which clipboard providers now run is from a DynAccess type direct mutation is not possible, so I've put the mutable bits in a mutex (required instead of a RefCell as this code path is called from a threaded context).

@the-mikedavis
Copy link
Member

Can you describe the issue with the termcode provider after #10839? The refactor in #10839 eliminated statefulness from the providers themselves since the Registers type already stores yanks and we shouldn't be reintroducing that statefulness.

@the-mikedavis
Copy link
Member

Ah actually I see the problem. #10839 introduced an error enum with a ReadingNotSupported variant for providers like termcode that can't read. We just need to handle that in read_from_clipboard and use the saved values instead.

the-mikedavis added a commit that referenced this pull request Dec 2, 2024
This fixes reading from the clipboard when using the termcode provider.
Reading isn't implemented for the termcode provider so `get_contents`
returns `ClipboardError::ReadingNotSupported`. `read_from_clipboard`
needs to recognize this case and use the saved values instead of
emitting an error log and returning nothing.

Follow-up of #10839
Also see #12142
@the-mikedavis
Copy link
Member

I pushed a change to cover that case - could you rebuild master and give the termcode provider another try?

@rcgoodfellow
Copy link
Author

Yup - that fixed it. Thanks!

GladkihEgor pushed a commit to GladkihEgor/helix that referenced this pull request Jan 4, 2025
This fixes reading from the clipboard when using the termcode provider.
Reading isn't implemented for the termcode provider so `get_contents`
returns `ClipboardError::ReadingNotSupported`. `read_from_clipboard`
needs to recognize this case and use the saved values instead of
emitting an error log and returning nothing.

Follow-up of helix-editor#10839
Also see helix-editor#12142
diucicd pushed a commit to diucicd/helix that referenced this pull request Jan 8, 2025
This fixes reading from the clipboard when using the termcode provider.
Reading isn't implemented for the termcode provider so `get_contents`
returns `ClipboardError::ReadingNotSupported`. `read_from_clipboard`
needs to recognize this case and use the saved values instead of
emitting an error log and returning nothing.

Follow-up of helix-editor#10839
Also see helix-editor#12142
rmburg pushed a commit to rmburg/helix that referenced this pull request Jan 20, 2025
This fixes reading from the clipboard when using the termcode provider.
Reading isn't implemented for the termcode provider so `get_contents`
returns `ClipboardError::ReadingNotSupported`. `read_from_clipboard`
needs to recognize this case and use the saved values instead of
emitting an error log and returning nothing.

Follow-up of helix-editor#10839
Also see helix-editor#12142
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.

2 participants