On Mon, 11 Apr 2022 10:26:35 GMT, Tejesh R <d...@openjdk.java.net> wrote:

> > Is it a bug then?
> 
> It is not a bug I guess, it is as expected and as commented out about the 
> logic in `read()` method...... The bug states this statement " But if we use 
> append() first and then setText(pane.getText + newText), before every \r\n 
> another \r is added, and in output, extra blank line are added."...... In 
> windows extra \r was added because of the previous logic, it was causing an 
> extra empty line......

There will be no extra line if `System.lineSeparator()` is not used. And it 
shouldn't be used with text APIs: the text model always uses Linux/macOS style 
line ends that is `\n` only.

If you add `\r` into the text model, eventually it'll get converted to `\n` as 
specified by `DefaultEditorKit`.

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

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

Reply via email to