On Wed, 24 Aug 2022 14:21:44 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

>> Ambarish Rapte has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   change the fix for TextArea Exception
>
> modules/javafx.graphics/src/main/java/javafx/scene/text/Text.java line 1990:
> 
>> 1988:                 int offset = (Integer)parameters[0];
>> 1989:                 TextLine[] lines = getTextLayout().getLines();
>> 1990:                 if (offset > getTextInternal().length()) return 
>> lines.length;
> 
> A couple questions:
> 
> 1. This will return an offset that represents the position just past the end 
> of the list of lines. I presume this is OK?
> 2. The `LINE_START` and `LINE_END` cases also can return null. Should a 
> similar fix be applied for those cases?

When rechecked it looks wrong to change the return value/type. At several 
instances the return value `null` is used to assume that the control is 
`TextField`.
1. 
https://github.com/openjdk/jfx/blob/f95f09f5af561e3a6f3804a4f54aff83e9d2bb0b/modules/javafx.graphics/src/main/java/com/sun/glass/ui/win/WinTextRangeProvider.java#L183
2. 
https://github.com/openjdk/jfx/blob/f95f09f5af561e3a6f3804a4f54aff83e9d2bb0b/modules/javafx.graphics/src/main/java/com/sun/glass/ui/win/WinTextRangeProvider.java#L197

So changed to an alternative way of passing correct offset: If start(offset) is 
larger than length of text then pass length of text.

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

PR: https://git.openjdk.org/jfx/pull/884

Reply via email to