RFR: 8180276: JTextPane getText return extra when mixed with methods of Document [v5]

Alexey Ivanov aivanov at openjdk.java.net
Mon Apr 11 10:13:45 UTC 2022


On Mon, 11 Apr 2022 04:56:08 GMT, Tejesh R <duke at openjdk.java.net> wrote:

> > What happens if you add `\r` to an arbitrary location in text?
> > What happens if you read in such a text?
> 
> It doesn't matter, since the data is appended only if '\n' is present when EndofLine is '\r\n'......

I'm not as sure… Well, yes, the text will be written out like expected and `\r` character will be preserved. Yet when such a text will be read in, the stranded `\r` will be converted to `\n` which will create an unexpected line break. Or am I wrong?

-------------

PR: https://git.openjdk.java.net/jdk/pull/8122



More information about the client-libs-dev mailing list