<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Dear Jurgen:</div>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);">
<span style="font-size: 12pt;">To follow up this conversation, after giving it some more thought, I think this change would be problematic - but for a different reason. The segments in UndoableChange are only available in a model that supports undo. If the
model does not support undo/redo functionality, we don't have the </span><span style="font-size: 16px; background-color: rgb(255, 255, 255);">UndoableChange and related segments, and I don't want to generate them.</span></div>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);"><br>
</span></div>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">Assuming that you absolutely cannot support your requirements with the existing APIs, and there is no reasonable workaround, the only possibility I see is to remove the final keyword from StyledTextModel applyStyle()
and replace() methods. The at least you can intercept these calls and do the required processing there.</span></div>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);"><br>
</span></div>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">I still not sure what the use case is for that though - don't you want to always process the updated document? What is your use case?</span></div>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks,</div>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
-andy</div>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="mail-editor-reference-message-container">
<div class="ms-outlook-mobile-reference-message skipProofing">
<meta name="Generator" content="Microsoft Exchange Server">
</div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="text-align: left; padding: 3pt 0in 0in; border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) currentcolor currentcolor; font-family: Aptos; font-size: 12pt; color: black;">
<b>From: </b>Jurgen Doll <jurgen@ivoryemr.co.za><br>
<b>Date: </b>Tuesday, November 4, 2025 at 01:40<br>
<b>To: </b>Andy Goryachev <andy.goryachev@oracle.com><br>
<b>Cc: </b>openjfx-dev <openjfx-dev@openjdk.org><br>
<b>Subject: </b>Re: [External] : Re: RichTextArea Feedback<br>
<br>
</div>
<div class="PlainText" style="font-size: 11pt;">Hi Andy<br>
<br>
> This might get complicated - while that might work for an in-memory<br>
> model, it will be very complicated in the case of a large virtualized model.<br>
<br>
I don't see how it's complicated, and I don't think the model matters.<br>
As far as I can see the changes required are quite straightforward.<br>
<br>
Here's a brief outline: In StyledTextModel, in both the applyStyle:766<br>
and replace(...,StyledInput):663 methods there's the line:<br>
UndoableChange ch = ...<br>
<br>
Then a little further down in both of these methods there's a<br>
fireStyleChangeEvent and fireChangeEvent line respectively which will<br>
now each get an extra parameter, something like:<br>
fire(Style)ChangeEvent(..., ch.getUndoSegments());<br>
<br>
This extra parameter is a StyledSegment[] which is then passed on to<br>
ContentChange where it's made available via something like: getPreviousSegments()<br>
<br>
That's it :-) If I've missed the complicated part please let me know.<br>
<br>
Thanks, regards<br>
Jurgen<br>
<br>
<br>
On Nov 3 2025, at 8:59 pm, Andy Goryachev <andy.goryachev@oracle.com> wrote:<br>
<br>
> Right, sorry, missed that one.<br>
> <br>
> This might get complicated - while that might work for an in-memory<br>
> model, it will be very complicated in the case of a large virtualized model.<br>
> <br>
> An alternative might be to remove 'final' from replace(StyleResolver<br>
> resolver, TextPos start, TextPos end, StyledInput input), or to allow<br>
> a callback before the actual changes are made.<br>
> <br>
> I am not sure about the use case for this though. If you simply want<br>
> to do a syntax or spelling check highlighter, you might need to keep a<br>
> separate data structure that allows one to do, for example, a partial<br>
> update, or to get the plain text from the model, or something else entirely.<br>
> <br>
> -andy<br>
> <br>
> <br>
> From: Jurgen Doll <jurgen@ivoryemr.co.za><br>
> Date: Monday, November 3, 2025 at 00:36<br>
> To: Andy Goryachev <andy.goryachev@oracle.com><br>
> Subject: [External] : Re: RichTextArea Feedback<br>
> <br>
> Hi Andy<br>
> <br>
>> Did I miss anything? Please let me know. #2<br>
> <br>
> Also, the RFE regarding ContentChange:<br>
> This is a request to enhance ContentChange with an additional method: getPreviousSegments()<br>
> <br>
> Currently ContentChange reports only where something has changed.<br>
> Using this one can determine the current state of the document, however<br>
> determining what has actually changed is impossible. So having this<br>
> extra information available would be helpful.<br>
> <br>
> I think this can easily be done in StyledTextModel where the previous<br>
> segments can be obtained by extracting them from the freshly created<br>
> UndoableChange object when calling fire?ChangeEvent(...)<br>
> <br>
> Thanks, regards<br>
> Jurgen<br>
</div>
</div>
</body>
</html>