RFR: 8370140: RichTextArea: line endings [v6]

Andy Goryachev angorya at openjdk.org
Wed Nov 5 20:23:19 UTC 2025


On Wed, 5 Nov 2025 20:08:01 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Unlike `font` and `tabSize`, the `lineEnding` property is used when exporting to an external format where you want line endings, which also applies to RichTextArea. This is done implicitly by various operations (copy/paste/export) or explicitly when calling `getText`. I realize that `getText` is not currently a public method in `RichTextArea`, but I understand is likely to be proposed in the future. Once you add that method to the public API it will seem odd that users of CodeArea set the property in the control, but users of RichTextArea itself would need to set it in the model.
>> 
>> Do you still think it belongs in the `CodeArea` subclass? I suppose it can be moved to the superclass later, if needed (without breaking anything), but I at least want you to think through all the issues.
>
> Actually, I thought of a bigger concern. Having a writable attribute in both the control and the model is not going to give coherent results in the case where you have more than one view on the same model. So you might need to rethink the idea of having a writable property on the view (the control) while also having state (via a writable attribute) on the model.

Good point!
What do you think we should do then?

I should probably move the setter and getter to the RichTextArea class then, and remove the property altogether.

Any custom UI can always create its own property for line ending and deal with the model directly.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1944#discussion_r2496008024


More information about the openjfx-dev mailing list