Repository navigation
Read the clipboard at paste time, and empty it when its file closes, 1.11.0 - #122
Merged
Merged
Conversation
A Cut or a Copy now keeps which entries it took, and a paste asks their document for them as they are then, the way the Data Explorer in MATLAB resolves its clipboard. An edit made between a Cut and its paste used to be lost: the paste wrote the value from the moment of the Cut and then removed the edited original. - Each document registers a reader beside its source deleter (registers.registerSourceReader). It finds each taken entry again by its origin token (a MAT-file variable), its uuid (a dictionary entry, through a rename), or its name in its section, and takes it again as a copy does (clipboardAction.readTaken). A cut's delete then names the entry as it is now, so a renamed original moves under its new name. - An entry no longer there is skipped and named: "Not pasted: ..." when others landed (also a warning), "Nothing to paste: ..." when none did, which empties the clipboard (transfer.goneMessage). - Closing a document's last table empties a clipboard taken from it, Copy or Cut, and tells every table (registers.closeSource). A cut no longer pastes after its source closed and leaves the original behind. - A MAT-file reload carries each uniquely named variable's token to the variable of that name, so a Copy made before an outside change still finds it. - A drag is unchanged: nothing can edit between its start and its drop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A Cut or a Copy now keeps which entries it took, and Paste reads them from their file as they are at that moment. This is how the Data Explorer in MATLAB resolves its clipboard. Before, the paste wrote the value from the moment of the Cut or Copy. So Cut, edit the cut entry, Paste wrote the old value and removed the edited original: the edit ended up nowhere, and a save wrote the old value.
Reader per document: each engine (binary and JSON dictionaries, MAT-file / model workspace) registers a reader next to its source deleter (
registerSourceReader). The reader finds each taken entry again and takes it again as a copy does (readTaken):A cut's delete then names the entry as it is now, so a renamed original moves under its new name.
Entries gone by the paste: skipped and named.
Not pasted: "x" is no longer in a.sldd.(also a warning that stays).Nothing to paste: "x" is no longer in a.sldd., and the clipboard is emptied.Closing a file: when its last table closes, a clipboard taken from it (Copy or Cut) is emptied and every table is told (
closeSource). A Cut no longer pastes after its source closed while leaving the original behind.MAT-file reload: an outside change reads the variables again as new nodes. Each uniquely named variable keeps its token, so a Copy made before the reload still finds it.
Drag: unchanged. Nothing can edit between a drag's start and its drop.
Tests
test/lateClipboard.test.ts(registers and transfer) and alateCopy.test.tsper engine: Cut/Copy then an edit, a text-view edit (JSON), a rename, a delete, a reload (MAT), and closing the source.npm run verifypasses (7556 tests).Follow-ups
test-integration/suite/crossDocumentMove.test.tspins the old closed-tab result. It changes with the pin bump to v1.11.0.Bumps view to 1.11.0 (new exports
SourceRead,SourceReader,goneMessage).