From perini.davide at dpsoftware.org Sat Oct 4 16:10:58 2025 From: perini.davide at dpsoftware.org (Davide Perini) Date: Sat, 4 Oct 2025 18:10:58 +0200 Subject: WebView wv = new WebView(); throws an exception Message-ID: Hi there, I noticed recently that this code WebView wv = new WebView(); throws an exception that creates no real problem but it is a bit annoyng. The exception is thrown here: class PropertyHelper { ? ? static boolean getBooleanProperty(String var0) { ? ? ? ? try { ? ? ? ? ? ? String var1 = System.getProperty(var0); ? ? ? ? ? ? return "true".equals(var1.toLowerCase()); ? ? ? ? } catch (Exception var2) { ? ? ? ? ? ? return false; ? ? ? ? } ? ? } } If I manually set System.setProperty("javafx.sg.warn", "true"); this exception is not thrown. But why? From kevin.rushforth at oracle.com Mon Oct 6 12:38:45 2025 From: kevin.rushforth at oracle.com (Kevin Rushforth) Date: Mon, 6 Oct 2025 05:38:45 -0700 Subject: WebView wv = new WebView(); throws an exception In-Reply-To: References: Message-ID: <78649008-831e-47b9-a4f7-267fac48dd6b@oracle.com> [re-routing to openjfx-dev] Technical questions should be discussed on openjfx-dev. There isn't enough information to be sure, but you might double-check whether you are creating the WebView on the JavaFX application thread. If not, you are running into a known bug, JDK-8087718 [1]. -- Kevin [1] https://bugs.openjdk.org/browse/JDK-8087718 On 10/4/2025 9:10 AM, Davide Perini wrote: > Hi there, > > I noticed recently that this code > WebView wv = new WebView(); > throws an exception that creates no real problem but it is a bit annoyng. > > The exception is thrown here: > class PropertyHelper { > ? ? static boolean getBooleanProperty(String var0) { > ? ? ? ? try { > ? ? ? ? ? ? String var1 = System.getProperty(var0); > ? ? ? ? ? ? return "true".equals(var1.toLowerCase()); > ? ? ? ? } catch (Exception var2) { > ? ? ? ? ? ? return false; > ? ? ? ? } > ? ? } > } > > If I manually set > System.setProperty("javafx.sg.warn", "true"); > > this exception is not thrown. > > But why? > From jurgen at ivoryemr.co.za Thu Oct 30 16:35:11 2025 From: jurgen at ivoryemr.co.za (Jurgen Doll) Date: Thu, 30 Oct 2025 18:35:11 +0200 Subject: RichTextArea undo style ContentChange Message-ID: <1684C7B4-1F6C-4438-852F-8A4DCD230A1D@getmailspring.com> Hi Andy In view of your current "remove allowUndo parameter" PR, I took another look at why I requested that applyStyle and setStyle also have that parameter. Part of the reason, I have now discovered, is due to a bug in the way that undo is processed. Basically when undoing a STYLE ONLY change an event is fired where ContentChange.isEdit returns true when it should be false. To fix, I think that the UndoableChange.create() method needs a styleOnly flag (or maybe another method needs to be added for style only changes). Then when the UndoableChange.undo method is called it can invoke model.applyStyle() with appropriate values instead of model.replace() which will then trigger the correct event. Note that even with this fixed though, it might still be desirable to be able to add/remove styling with an undo parameter. The use case I have is that only user styling actions are on the undo stack but programmatic changes for spellchecking or other markup are skipped if desired. The effect this has is that when the user undoes something it's directly related to what they have just done and not what the program has done. Thanks, regards Jurgen -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy.goryachev at oracle.com Thu Oct 30 17:14:48 2025 From: andy.goryachev at oracle.com (Andy Goryachev) Date: Thu, 30 Oct 2025 17:14:48 +0000 Subject: RichTextArea undo style ContentChange In-Reply-To: <1684C7B4-1F6C-4438-852F-8A4DCD230A1D@getmailspring.com> References: <1684C7B4-1F6C-4438-852F-8A4DCD230A1D@getmailspring.com> Message-ID: Jurgen: Thanks for the feedback! The main reason I've decided to remove this parameter is that selectively disabling / enabling undo functionality messes up the internal state. Perhaps, when the application edits/styles the document on its own, it should do it in steps - for example, I noticed that Apple Notes allows the user to undo the auto-format like bulleted list (I think MS Word does a similar thing). Also, there is currently no way to coalesce undo records (see https://bugs.openjdk.org/browse/JDK-8370447 ) and no API to allow the model to customize the process. I do want to understand your use case - can you explain it in more detail please? Give me an example of the expected behavior? Thanks! -andy From: openjfx-discuss on behalf of Jurgen Doll Date: Thursday, October 30, 2025 at 09:35 To: openjfx-discuss at openjdk.org Subject: RichTextArea undo style ContentChange Hi Andy In view of your current "remove allowUndo parameter" PR, I took another look at why I requested that applyStyle and setStyle also have that parameter. Part of the reason, I have now discovered, is due to a bug in the way that undo is processed. Basically when undoing a STYLE ONLY change an event is fired where ContentChange.isEdit returns true when it should be false. To fix, I think that the UndoableChange.create() method needs a styleOnly flag (or maybe another method needs to be added for style only changes). Then when the UndoableChange.undo method is called it can invoke model.applyStyle() with appropriate values instead of model.replace() which will then trigger the correct event. Note that even with this fixed though, it might still be desirable to be able to add/remove styling with an undo parameter. The use case I have is that only user styling actions are on the undo stack but programmatic changes for spellchecking or other markup are skipped if desired. The effect this has is that when the user undoes something it's directly related to what they have just done and not what the program has done. Thanks, regards Jurgen -------------- next part -------------- An HTML attachment was scrubbed... URL: From jurgen at ivoryemr.co.za Fri Oct 31 07:01:17 2025 From: jurgen at ivoryemr.co.za (Jurgen Doll) Date: Fri, 31 Oct 2025 09:01:17 +0200 Subject: RichTextArea undo style ContentChange References: Message-ID: <486AE3A9-B514-4217-8120-327297034988@getmailspring.com> Hi Andy Just to be clear, my main purpose was to report the undo bug. It occurs when either setStyle or applyStyle are invoked and then undo is called afterwards. The problem is that ContentChange.undo invokes model.replace(....) which is incorrect in this case, where as it should be model.applyStyle(....) because the former results in an event being fired where ContentChange.isEdit returns true when it should be false. Also to be clear I have no problem with your current PR, it makes sense. I'm not advocating for stopping or changing it :-) Here's a use case for styling: imagine an editor, like an IDE maybe, that has a search function that highlights all matching words. We'd like those highlights to remain in place even if undo/redo actions are called. That is the user doesn't expect the highlights to disappear on surrounding matches if undo is invoked on their last edit. I think allowing styling to behave in this way is safe because it doesn't change the structure of the document, only it's appearance, so the structural state of the document is always consistant. Thanks, regards Jurgen On Oct 30 2025, at 7:14 pm, Andy Goryachev wrote: > Jurgen: > > Thanks for the feedback! The main reason I've decided to remove this parameter is that selectively disabling / enabling undo functionality messes up the internal state. > > Perhaps, when the application edits/styles the document on its own, it should do it in steps - for example, I noticed that Apple Notes allows the user to undo the auto-format like bulleted list (I think MS Word does a similar thing). Also, there is currently no way to coalesce undo records (see https://bugs.openjdk.org/browse/JDK-8370447 ) and no API to allow the model to customize the process. > > I do want to understand your use case - can you explain it in more detail please? Give me an example of the expected behavior? > > Thanks! > -andy > > From: openjfx-discuss on behalf of Jurgen Doll > Date: Thursday, October 30, 2025 at 09:35 > To: openjfx-discuss at openjdk.org > Subject: RichTextArea undo style ContentChange > > Hi Andy > > In view of your current "remove allowUndo parameter" PR, I took another look at why I requested that applyStyle and setStyle also have that parameter. Part of the reason, I have now discovered, is due to a bug in the way that undo is processed. > > Basically when undoing a STYLE ONLY change an event is fired where ContentChange.isEdit returns true when it should be false. To fix, I think that the UndoableChange.create() method needs a styleOnly flag (or maybe another method needs to be added for style only changes). Then when the UndoableChange.undo method is called it can invoke model.applyStyle() with appropriate values instead of model.replace() which will then trigger the correct event. > > Note that even with this fixed though, it might still be desirable to be able to add/remove styling with an undo parameter. The use case I have is that only user styling actions are on the undo stack but programmatic changes for spellchecking or other markup are skipped if desired. The effect this has is that when the user undoes something it's directly related to what they have just done and not what the program has done. > > Thanks, regards > Jurgen > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jurgen at ivoryemr.co.za Fri Oct 31 07:49:18 2025 From: jurgen at ivoryemr.co.za (Jurgen Doll) Date: Fri, 31 Oct 2025 09:49:18 +0200 Subject: RichTextArea undo style ContentChange In-Reply-To: <486AE3A9-B514-4217-8120-327297034988@getmailspring.com> References: <486AE3A9-B514-4217-8120-327297034988@getmailspring.com> Message-ID: <18BC3578-2894-44D6-9636-31AED9DF9452@getmailspring.com> Hi Andy A further note to clarify the side effect of the undo bug, where ContentChange.isEdit returns true when it should be false. In my application it revolves around spellchecking. When the user "pauses" typing, spell check runs and marks any bad words. Currently if the user invokes undo then the markup is removed (as it was the last change) but because ContentChange.isEdit returns true (instead of false) the spellcheck runs and immediately marks the bad word again. The root cause of this bug starts in StyledTextModel.applyStyle:766 where an UndoableChange object is created. The problem is that UndoableChange needs to know that this is a style change edit so that when UndoableChange.undo() is invoked it can call model.applyStyle(....) instead of model.replace(....) Could you please file a bug report for this. Thanks, regards Jurgen On Oct 31 2025, at 9:01 am, Jurgen Doll wrote: > Hi Andy > > Just to be clear, my main purpose was to report the undo bug. It occurs when either setStyle or applyStyle are invoked and then undo is called afterwards. The problem is that ContentChange.undo invokes model.replace(....) which is incorrect in this case, where as it should be model.applyStyle(....) because the former results in an event being fired where ContentChange.isEdit returns true when it should be false. > Also to be clear I have no problem with your current PR, it makes sense. I'm not advocating for stopping or changing it :-) > Here's a use case for styling: imagine an editor, like an IDE maybe, that has a search function that highlights all matching words. We'd like those highlights to remain in place even if undo/redo actions are called. That is the user doesn't expect the highlights to disappear on surrounding matches if undo is invoked on their last edit. > I think allowing styling to behave in this way is safe because it doesn't change the structure of the document, only it's appearance, so the structural state of the document is always consistant. > Thanks, regards > Jurgen > > > On Oct 30 2025, at 7:14 pm, Andy Goryachev wrote: > > Jurgen: > > > > Thanks for the feedback! The main reason I've decided to remove this parameter is that selectively disabling / enabling undo functionality messes up the internal state. > > > > Perhaps, when the application edits/styles the document on its own, it should do it in steps - for example, I noticed that Apple Notes allows the user to undo the auto-format like bulleted list (I think MS Word does a similar thing). Also, there is currently no way to coalesce undo records (see https://bugs.openjdk.org/browse/JDK-8370447 ) and no API to allow the model to customize the process. > > > > I do want to understand your use case - can you explain it in more detail please? Give me an example of the expected behavior? > > > > Thanks! > > -andy > > > > From: openjfx-discuss on behalf of Jurgen Doll > > Date: Thursday, October 30, 2025 at 09:35 > > To: openjfx-discuss at openjdk.org > > Subject: RichTextArea undo style ContentChange > > > > Hi Andy > > > > In view of your current "remove allowUndo parameter" PR, I took another look at why I requested that applyStyle and setStyle also have that parameter. Part of the reason, I have now discovered, is due to a bug in the way that undo is processed. > > > > Basically when undoing a STYLE ONLY change an event is fired where ContentChange.isEdit returns true when it should be false. To fix, I think that the UndoableChange.create() method needs a styleOnly flag (or maybe another method needs to be added for style only changes). Then when the UndoableChange.undo method is called it can invoke model.applyStyle() with appropriate values instead of model.replace() which will then trigger the correct event. > > > > Note that even with this fixed though, it might still be desirable to be able to add/remove styling with an undo parameter. The use case I have is that only user styling actions are on the undo stack but programmatic changes for spellchecking or other markup are skipped if desired. The effect this has is that when the user undoes something it's directly related to what they have just done and not what the program has done. > > > > Thanks, regards > > Jurgen > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jurgen at ivoryemr.co.za Fri Oct 31 08:40:00 2025 From: jurgen at ivoryemr.co.za (Jurgen Doll) Date: Fri, 31 Oct 2025 10:40:00 +0200 Subject: RichTextArea missing Caspian entries Message-ID: <3CCA52F5-ECBF-42FF-99F3-B44A5D0437FD@getmailspring.com> Hi Andy Just a heads up that Caspian CSS doesn't have the entries for RichTextArea etc. Thanks, regards Jurgen -------------- next part -------------- An HTML attachment was scrubbed... URL: From jurgen at ivoryemr.co.za Fri Oct 31 10:15:19 2025 From: jurgen at ivoryemr.co.za (Jurgen Doll) Date: Fri, 31 Oct 2025 12:15:19 +0200 Subject: RichTextArea RFE ContentChange Message-ID: Hi Andy This is a request to enhance ContentChange with an additional method: getPreviousSegments() Currently ContentChange reports only where something has changed. Using this one can determine the current state of the document, however determining what has actually changed is impossible. So having this extra information available would be helpful. I think this can easily be done in StyledTextModel where the previous segments can be obtained by extracting them from the freshly created UndoableChange object when calling fire?ChangeEvent(...) Thanks, regards Jurgen From jurgen at ivoryemr.co.za Fri Oct 31 11:28:19 2025 From: jurgen at ivoryemr.co.za (Jurgen Doll) Date: Fri, 31 Oct 2025 13:28:19 +0200 Subject: RichTextArea Inline Node Feedback Message-ID: <106425B0-DAE6-4186-A5F7-92B7C9B6E0EF@getmailspring.com> Hi Andy With regards to handling custom objects / inline nodes in RichTextArea, I implemented two different models to test. The one was by extending BasicTextModel and implementing my own custom Content class for it. While with the other, I took your RichTextModel and modified it to be able to handle objects implementing Supplier. For each of these I extended RichTextArea in order to add additional API to be able to append, insert, and replace custom objects. Both of these approaches generally worked fine with regards to editing and navigation. (Note I didn't handle any styling for the custom nodes through the API.) As expected though paste and undo/redo don't work due to StyledTextModel's final replace method not handling INLINE_NODE's as we've noted before. Otherwise there are just two bugs/issues that I encountered that I'll send separate emails for. I made a GitHub repository of my efforts to share with you for your reference in case you're interested. Feel free to copy/paste from it if you want. https://github.com/Jugen/RichTextAreaTest Thanks, regards Jurgen From jurgen at ivoryemr.co.za Fri Oct 31 12:29:49 2025 From: jurgen at ivoryemr.co.za (Jurgen Doll) Date: Fri, 31 Oct 2025 14:29:49 +0200 Subject: RichTextArea caret & inline node issue Message-ID: <758D030C-45F8-4B6A-B1D7-151720014D73@getmailspring.com> Hi Andy When a paragraph ends with an INLINE_NODE and one tries to go to the end of the line/paragraph (either via API or K/B end) then the caret moves to the starting position of the node and not after it. If one presses a key at this point then the typed character appears correctly after the node and the caret adjusts correctly. If I'm not mistaken, from what I can tell by stepping through the code at runtime, it looks like everything works fine until TextCell.getCaretShape:189 where TextFlow.caretShape seems to return the wrong position ? If you want a demo of the problem see either of the two demo's on https://github.com/Jugen/RichTextAreaTest Thanks, regards Jurgen From jurgen at ivoryemr.co.za Fri Oct 31 12:45:40 2025 From: jurgen at ivoryemr.co.za (Jurgen Doll) Date: Fri, 31 Oct 2025 14:45:40 +0200 Subject: RichTextArea requestLayout by inline node doesn't reach VFlow Message-ID: Hi Andy When an INLINE_NODE in RichTextArea is updated and it triggers requestLayout then the request doesn't propagate all the way up to VFlow but stops when it reaches TextCell. So if for example a Label is selected, say via a double click, and its text changes then the Label updates but the RichTextArea selection doesn't. If you want a demo of the problem see either of the two demo's on https://github.com/Jugen/RichTextAreaTest Thanks, regards Jurgen From jurgen at ivoryemr.co.za Fri Oct 31 13:39:18 2025 From: jurgen at ivoryemr.co.za (Jurgen Doll) Date: Fri, 31 Oct 2025 15:39:18 +0200 Subject: RichTextArea expose RichParagraph.getSegments Message-ID: Hi Andy In RichParagraph you have a note to make getSegments() public. It would be helpful if it was. Thanks, regards Jurgen From kevin.rushforth at oracle.com Fri Oct 31 14:52:47 2025 From: kevin.rushforth at oracle.com (Kevin Rushforth) Date: Fri, 31 Oct 2025 07:52:47 -0700 Subject: RichTextArea Inline Node Feedback In-Reply-To: <106425B0-DAE6-4186-A5F7-92B7C9B6E0EF@getmailspring.com> References: <106425B0-DAE6-4186-A5F7-92B7C9B6E0EF@getmailspring.com> Message-ID: <9fb5196e-44c1-4fd8-83a0-412f29881955@oracle.com> > Otherwise there are just two bugs/issues that I encountered that I'll > send separate emails for. Thanks! Keep the bug reports and other feedback coming. They are very much appreciated. > I made a GitHub repository of my efforts to share with you for your > reference in case you're interested. Feel free to copy/paste from it if > you want. Due to copyright and IP concerns, we cannot copy/paste code from someone's GitHub repo. If you would like to contribute sample code or show how we might modify JavaFX RichTextArea to solve a problem, you could create a Draft PR under openjdk/jfx. You would need to sign the OCA before we could take a look at it. See the contributing guidelines [1] for more information. Btw, the openjfx-dev mailing list is better for discussion of specific features like RichTextArea. (the -discuss alias is meant for general discussion of roadmap not for bugs or development) Thank you. -- Kevin [1] https://github.com/openjdk/jfx/blob/master/CONTRIBUTING.md#before-submitting-a-pull-request On 10/31/2025 4:28 AM, Jurgen Doll wrote: > Hi Andy > > With regards to handling custom objects / inline nodes in RichTextArea, > I implemented two different models to test. > > The one was by extending BasicTextModel and implementing my own custom > Content class for it. While with the other, I took your RichTextModel > and modified it to be able to handle objects implementing Supplier. > > For each of these I extended RichTextArea in order to add additional API > to be able to append, insert, and replace custom objects. > > Both of these approaches generally worked fine with regards to editing > and navigation. (Note I didn't handle any styling for the custom nodes > through the API.) > > As expected though paste and undo/redo don't work due to > StyledTextModel's final replace method not handling INLINE_NODE's as > we've noted before. > > Otherwise there are just two bugs/issues that I encountered that I'll > send separate emails for. > > I made a GitHub repository of my efforts to share with you for your > reference in case you're interested. Feel free to copy/paste from it if > you want. > > https://github.com/Jugen/RichTextAreaTest > > Thanks, regards > Jurgen > From andy.goryachev at oracle.com Fri Oct 31 15:25:50 2025 From: andy.goryachev at oracle.com (Andy Goryachev) Date: Fri, 31 Oct 2025 15:25:50 +0000 Subject: RichTextArea expose RichParagraph.getSegments In-Reply-To: References: Message-ID: Dear Jurgen: All very good feedback, thank you so much! I'll respond with a summary in the right mailing list, if you don't mind. -andy From: openjfx-discuss on behalf of Jurgen Doll Date: Friday, October 31, 2025 at 06:39 To: openjfx-discuss at openjdk.org Subject: RichTextArea expose RichParagraph.getSegments Hi Andy In RichParagraph you have a note to make getSegments() public. It would be helpful if it was. Thanks, regards Jurgen -------------- next part -------------- An HTML attachment was scrubbed... URL: