Skip to content

Switch back to our own copy-paste implementation #559

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

Open
6 tasks
pokey opened this issue Feb 13, 2022 · 0 comments
Open
6 tasks

Switch back to our own copy-paste implementation #559

pokey opened this issue Feb 13, 2022 · 0 comments
Labels
code quality Improvements to code quality enhancement New feature or request

Comments

@pokey
Copy link
Member

pokey commented Feb 13, 2022

We would like to revert #127 to give us more control over copy and paste. This way we can have a unified "bring" / "move" / "carve" / "copy" / "paste" implementation. We can also fix bug with undo stops on paste. Related to #28

We should figure out how ot use the proposed paste api once it's available:

Unfortunately as of 2023-06-12 the above API still doesn't seem to be available, so I'm not super hopeful 😕

I did a bit of digging, and it seems that VSCode adds some metadata to the clipboard entry. Note that the object includes list of strings, one per selection when copied from a multi-cursor selection

image

Unfortunately, we can't do that, because we are too sandboxed to be able to modify / access clipboard metadata. They do have an in-memory metadata store as well which they fall back to when for some reason the clipboard metadata can't be found. I think the best we could do is to implement a similar in-memory store, but the annoyance is that then if the user tries to do a Cursorless copy followed by a VSCode paste, or vice-versa, the metadata won't be found. As mentioned below, we could try to work around that by contributing our own ctrl/cmd+c/x/v keyboard bindings with a when clause that the editor is focused, but that seems a bit dicey / sketchy, and we'd def want to figure out a way to also trigger the built-in copy so that their fancy metadata isn't lost

Old idea (some stuff def still relevant):

  • Revert to our own implementation of copy/cut/paste
  • Try to leverage as much from bring/move as we can
  • Use the same implementation that vscode does with an internal clipboard per cursor copied
  • Support clipboard history.
  • Contribute our own ctrl/cmd+c/x/v keyboard bindings with a when clause that the editor is focused
  • Switch back to using mock for clipboard-based tests

Originally posted by @AndreasArvidsson in #128 (comment)

@pokey pokey added enhancement New feature or request code quality Improvements to code quality labels Mar 13, 2022
@saidelike saidelike mentioned this issue May 30, 2024
3 tasks
github-merge-queue bot pushed a commit that referenced this issue May 30, 2024
## Checklist

- [ ] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [ ] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [ ] I have not broken the cheatsheet

This should also deprecate having to solve
#559

---------

Co-authored-by: Cedric Halbronn <[email protected]>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Improvements to code quality enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants