On Wed, 5 Nov 2025 00:07:14 GMT, Andy Goryachev <[email protected]> wrote:

>> modules/jfx.incubator.richtext/src/main/java/jfx/incubator/scene/control/richtext/CodeArea.java
>>  line 468:
>> 
>>> 466:      * @defaultValue null
>>> 467:      */
>>> 468:     public final ObjectProperty<LineEnding> lineEndingProperty() {
>> 
>> Shouldn't this be a property of RichTextArea?
>
> 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.

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

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

Reply via email to