On Fri, 8 Apr 2022 10:21:22 GMT, Tejesh R <d...@openjdk.java.net> wrote:

>> getText function returned extra endOfLine when appended. The reason was in 
>> `EditorEditorKit` class, `write(Writer out, Document doc, int pos, int len)` 
>> method, where translation happens from buffer to Out(Writer Object) if 
>> endOfLine is other than '\n' ( which is '\r\n' in windows). In order to 
>> write each line till End of line, the string till '\n' is written including 
>> '\r' and again endOfLine is written which results in extra Carriage Return. 
>> To solve this issue, a Condition is added which checks if previous character 
>> to '\n' is '\r', if true then whole string except Carriage Return ('\r') is 
>> written, else whole string till before '\n' is written.
>
> Tejesh R has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Updated based on Review Comments

I am still for automating the test.

It may even be headless, I think.

src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java line 342:

> 340:                     if (array[counter] == '\n') {
> 341:                         if (counter > last) {
> 342:                             if(array[counter-1] == '\r') {

The space between if and the opening parenthesis is still missing.

The spaces around `-` are also missing.

src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java line 345:

> 343:                                 out.write(array, last, counter - last - 
> 1);
> 344:                             }
> 345:                             else {

else should be on the same line as the previous closing brace.

test/jdk/javax/swing/JTextPane/8180276/ChangeStyleAndAppend.java line 60:

> 58:                 Document doc = this.getDocument();
> 59:                 doc.insertString(doc.getLength(), s + 
> System.lineSeparator(), null);
> 60:             } catch(BadLocationException e) {

Suggestion:

            } catch (BadLocationException e) {

The should be space between `catch` keyword and the opening parenthesis.

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

Changes requested by aivanov (Reviewer).

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

Reply via email to