Summary
Adds LineEnding enum to represent 3 possible cases:
CR— Legacy Mac OS line ending, ASCII CR (0x0d)CRLF— Windows line ending, sequence of CR/LF (0x0d 0x0a)LF— macOS/Unix line ending, ASCII LF (0x0a)
The LineEnding.system() method returns the platform line ending based on the value of system line separator string System.lineSeparator().
Adds the lineEnding attribute to StyledTextModel via two methods:
- setLineEnding(LineEnding)
- getLineEnding()
Adds the same convenience methods to the RichTextArea control, which delegate to the model.
Problem
The line endings are important in the following operations:
- copy plain text to clipboard
- save plain text (or get plain text)
- IME
Solution
The solution is to provide an attribute to the base model class (StyledTextArea), as well as the convenience methods to the RichTextArea control.
Specification
See the attached diff file.
- csr of
-
JDK-8370140 RichTextArea: line endings
-
- Resolved
-