On Tue, 1 Oct 2024 18:07:02 GMT, Andy Goryachev <[email protected]> wrote:
>> modules/jfx.incubator.richtext/src/main/java/jfx/incubator/scene/control/richtext/RichTextArea.java
>> line 1166:
>>
>>> 1164: * This method does nothing if the model or the caret position is
>>> {@code null}.
>>> 1165: * The default implementation will attempt to copy the
>>> information first, then delete the selected text.
>>> 1166: * Any failures, such as the control being not editable, or out
>>> of memory condition, will be silently ignored.
>>
>> I see what you are getting at, but I might recommend separating normal state
>> conditions, such as "the control not being editable" from an error
>> condition, such as OOM.
>>
>> Btw, the implementation of `cut` currently throws an exception if not
>> editable, so needs to be fixed.
>
> no, it does not - RichTextAreaBehavior.cut() L1232
>
>
> } catch(Exception | OutOfMemoryError e) {
> RichUtils.provideErrorFeedback(control, e);
> }
>
>
> one may question whether we should be handling OOME here and providing a
> feedback (which currently dumps the stack trace to stderr which is not the
> best idea).
To follow up on an offline discussion, all of the key-input-mapped methods that
modify become no-ops if not editable and writable. So "cut" does nothing (i.e.,
does not do a copy) if the model is read-only or the control is not editable.
This will be more consistent with TextArea and is easier to document.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1524#discussion_r1788257173