Ah.. For some reason I populated RSTA's document using a java.util.Scanner
, even though I should always use JTextComponent's dedicated methods to do this. Not sure why I did it this way, but the implementation normalized line endings to what System.getProperty("line.separator")
returns. On windows that would be CR LF
, but since, like you say, text components only handle LF
s internally, all hell broke loose.
I think I remember experiencing difficulties when saving an loading files using using RSTA's dedicated methods. Documents got saved, but newlines appeared out of nowhere. The reason for this could be that I've so far considered using System.getProperty("line.separator") everywhere
as a good practice. It seems that I've been wrong to assume that when around text components.
BTW, I asked a question on SO
that touches on this matter. We'll see if there's a guru out there who knows the answer.