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.
In my early PR #6 I didn't consider multiline cursors. This expands any empty selections to the whole line's range, but only if that matches the default copy behaviour.
The code for getting the expanded selections has become a bit more involved specifically to cover the case where there are 2 or more selections on the same line and there is an empty selection after another selection (empty or not). In that case, the empty selection is ignored. If the empty selection is the first selection on a line, default copy behaviour copies the entire line, a line break, and then the proceeding selection.
For example (selections denoted via comment below the line):
In this case, where the empty selection was placed after
c
, it will be ignored. The sorting of selections is required to cover the case where the empty selection atc
was placed before the other selection