RFR: 8370140: RichTextArea: line endings [v6]
Kevin Rushforth
kcr at openjdk.org
Wed Nov 5 20:10:21 UTC 2025
On Wed, 5 Nov 2025 18:38:01 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> No, `RichTextArea` might have a model that has no concept of line ending, or has its own idea of line ending - that's why it's an attribute of the model rather than the property in the control.
>>
>> `CodeArea`, on the other hand, deals with plain text as an underlying data, so line ending is a property of the control, just like `font` and `tabSize`.
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1944#discussion_r2495967579
More information about the openjfx-dev
mailing list