On Wed, 24 Aug 2022 13:50:32 GMT, Ambarish Rapte <[email protected]> wrote:

> Issue:
> When Narrator is running, 
> 1. Deleting last character from `TextField` throws 
> `IllegalArgumentException`, and 
> 2. Deleting last character from `TextArea` throws `NPE`.
> 
> Fix:
> When character is deleted, we receive an offset larger by one than the 
> current text length. This scenario needs to be handled correctly.
> The change in `Text.java` fixes the NPE with TextArea, and,
> The change in `WinTextRangeProvider.java` fixes the IllegalArgumentException 
> with TextField.
> 
> To observe the issue.
> 1. Run any program with TextField and/or TextArea
> 3. Launch Windows Narrator
> 4. Delete the last character from TextField / TextArea
> 5. Observe the related Exception

I'll test this before finishing my review. I left 2 question inline.

I'll review this, but it would be helpful for someone else to as well. Maybe 
@aghaisas can also review?

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?

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

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

Reply via email to