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

Tejesh R duke at openjdk.java.net
Fri Apr 8 08:52:56 UTC 2022


On Fri, 8 Apr 2022 08:38:20 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> Tejesh R has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Java coding style fix
>
> src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java line 350:
> 
>> 348:                             }
>> 349:                         }
>> 350:                         out.write(endOfLine);
> 
> It seems in windows, we use EndOfLineStringProperty property as
> [CRLF](https://github.com/openjdk/jdk/blob/f1b6e3ea16f06bc57e8e905fb115650e6c4ad98f/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java#L286)
> and `endOfLine ` is using the above property `EndOfLineStringProperty` so 
> when you write out.write(endOfLine) will it not write \r\n again?

Yes, Write function copies string without endOfLine, and endOfLine is appended to it after the whole string is copied. 
Before also it was copying string without endOfLine which included '\r', now this logic copies string characters before '\r' and then appends endOfLine.

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

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



More information about the client-libs-dev mailing list