Dear Pavel:

This is not a trivial request.  Currently, there is not easy way to control 
(override) the behavior of the CodeModel with respect to line endings.  Line 
endings are not stored in the model, but they are emitted when saving/copying.

Perhaps we ought to add a dedicated property to the model (line endings: 
CR/LF/CRLF/PLATFORM?) which would allow the application to specify the behavior 
and allow the model to perform the offset calculations.

The other issue is that the CodeArea supports large models (CodeTextModel with 
a custom BasicTextModel.Content).  Computing offsets in a large model not only 
may take a long time, but also produce result that does not fit into 31 bits.  
Which means, for all intents and purposes, this functionality should be 
implemented by a custom model.

What do you think?

Cheers,
-andy



From: openjfx-dev <openjfx-dev-r...@openjdk.org> on behalf of PavelTurk 
<pavelturk2...@gmail.com>
Date: Thursday, May 22, 2025 at 05:29
To: openjfx-dev@openjdk.org <openjfx-dev@openjdk.org>
Subject: CodeArea: request to raise priority of JDK-8357405 (text length 
metrics for ContentChange)
I'd like to kindly ask for consideration in raising the priority of JDK-8357405 
about adding text length
metrics to ContentChange for removed/inserted text for CodeArea.

The reason for this request is that accurate and reliable information about 
text changes is essential
when integrating CodeArea with code processing libraries. Currently, CodeArea 
does not provide
such information.

As a result, CodeArea can only be reliably used in read-only mode at the moment 
— which severely
limits its applicability in real-world applications.

Best regards, Pavel

Reply via email to