If you use a custom line separator, say \r\n
, you can get the string back with the expected line separator by using state.doc.sliceString(from, to, state.lineBreak)
which is great. And it also seems like the insertNewline
uses state.lineBreak
which is great.
If you document then contains a single “newline”, in this case the full document would be \r\n
, there should be two characters. The length of the document should be 2, but it is 1. This casues issues when you’re trying to do something like coordsAtPos(2)
.
Is this intentional? Do you have any suggestion on a workaround?