Copying rectangular selections into rectangular selections can produce odd results since 8.6.1
-
I reported this:
As described in my comment there, I believe it would be simple to restore the pre-8.6.1 behavior for pasting into rectangular selections (without affecting pasting into multiple selections). I could offer a pull request for that.
I’m just wondering if folks have any opinions about it:
-
Is there any reason to want the new behavior when pasting into rectangular selections (as opposed to multiple selections)?
-
Is there something better than the old, Scintilla-default behavior? (I describe that in the linked report.) At first I thought there was, but the more time I spend trying to define what it is, the more I become convinced there isn’t.
-
-
For what it’s worth, here’s my best try (until I think of another wrinkle) as to how it should work:
-
These points apply when the clipboard contains more than one line and the current selection is a rectangular or thin selection. Other cases are not affected.
-
Pasting into a rectangular selections always treats each line of the clipboard as corresponding to a new line in the selection. It doesn’t matter whether the original was an ordinary stream selection, a multiple selection or a rectangular selection.
-
The paste affects the lesser of the number of lines in the clipboard and the number of lines in the selection. If there are more lines in the clipboard than in the selection, they are ignored; if there are more lines in the selection than in the clipboard, the excess lines are left alone (not deleted, as they are now).
-
If the rectangular selection is zero-width (or is a thin selection), each line of the clipboard is pasted as-is into the corresponding line of the selection.
-
If the rectangular selection is not zero-width, the clipboard lines are blank-padded to match the length of the longest line in the clipboard, except that if the selection in a line ends at or after (i.e., in virtual space) the end of a line, the replacement text is not padded; and if the selection in a line ends with a tab character, the replacement text is not padded, and the final tab character is retained unless the replacement text also ends with a tab character.
-
If the rectangular selection was zero-width, the same selection remains after the paste.
-
If the rectangular selection was not zero-width, after the paste create a zero-width rectangular selection at the right boundary of the pasted content. (This will included retained tabs or virtual space as needed.)
But even I think that’s too complicated, and bound to have unforeseen problems. I might implement it as an option in my plugin, but I think it’s unrealistic as a part of the main program.
-