Stop erasing the copy buffer if copying empty editor selections #1847
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.
Resolves #1843
Previously it has been the case that if you attempt to copy something in
the note editor but there is no selection then it will wipe out the
system's copy buffer. This is because we implement our own copy handler
which strips away the visual formatting of elements in the note editor.
Although we'd expect that "test" is still in our copy buffer we get the
empty string pasted in and "test" is gone.
While not really wrong or broken this is a bit jarring and it's
probably better in most cases to preserve the previous copy buffer if
we're not copying anything. We've turned the copy command into a "clear
the copy buffer" command if there's no content.
In this patch we're aborting the copy if our selection is empty and that
will preserve the existing buffer and the expected behavior.
Testing
Follow the procedure above before and after applying this patch.
Before
After