On Wed, 31 Jul 2024 15:08:44 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>> modules/jfx.incubator.richtext/src/main/java/jfx/incubator/scene/control/richtext/RichTextArea.java
>>  line 157:
>> 
>>> 155:  * @since 999 TODO
>>> 156:  */
>>> 157: public class RichTextArea extends Control {
>> 
>> The *old* `TextField` and `TextArea` controls extend `TextInputControl`.
>> 
>> I wonder whether there is a a _good_ reason not doing the same for 
>> `RichTextArea`?
>> Doing so would allow to more easily switch between one or the other.
>
> Thank you for a very good question!  
> 
> The main reason is that RichTextArea (RTA) can work with a large text model 
> which needs to be represented differently from **TextInputControl**'s simple 
> String **text** property.  Other things, like position within the text is 
> also very different, using `{paragraphIndex,charOffset}` instead of a simple 
> `int` offset.  The fact that the model is separated from the control also 
> makes it very different.
> 
> At the end, there is simply no benefit in dragging the `TextInputControl` 
> into the picture.

I was hoping to be able to easily replace one (old) control with the _new_ one. 
I mean `RichTextArea` still fulfilling the requirements of `TextInputControl`. 
Anyhow, I understand you rational not going along this path 👍

Let me provide the use-case I have in mind (which may explain better what I am 
looking for).
I would like to use/keep textfields and textareas with pure text. Anyhow, 
having the  possibility to _squiggly_ parts of the text showing spelling 
mistakes. Since I assume that loading many `RichTextArea` controls (i.e., in 
tables) will take much longer I expect to offer spelling suggestions (and 
`RichTextArea`  loading) on request only.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1524#discussion_r1701641116

Reply via email to