Thx, I understand the clipboard should not hold information about collapsed state.
However why do the collapsed ranges get copied at all ? that is very surprising behaviour to have the collapsed ranges ‘exposed’ on copy/paste.
Is there a way to not include them in a copy operation ? perhaps a new marked text flag.
Rationale - Firepad adds a line ‘sentinel’ implemented as a collapsed range to the beginning of each line. This is used internally for the operation-transform model. Because of the above, copy/paste of FP text adds all the line sentinels to the clipboard which is essentially a bug when pasting in ie notepad. I am looking for a way to solve this.
Changing the internals of FP OT model is too involved for me unfortunately. Also I don’t think bookmarks will work as sentinels as it is essential for them to behave like invisible text.
“Collapsed ranges represent text”, well they represent collapsed text, which to me as a user you don’t expect to suddenly appear when you paste it somewhere else.
Also the behavior in the plunkr above is confusing. The first collapsed range is not copied (I guess because it is not ‘selected’) where as the other two do.
Basically, I am asking if it is possible to have a way to created collapsed ranges which do not get copied to the clipboard ? that would be very helpful and intuitive.
You don’t need to change your OT model, you can just change the way you create the data you feed into it. I am not really interested in adding features to work around hacks in other projects.
As for ‘intuitive’, the main use case for collapsed/replaced ranges are code folding and replacing a piece of text with an equivalent widget. Both of them require the content to be copied when selected.