On Mon, 23 Jun 2025 17:40:42 GMT, Abhishek Kumar <abhis...@openjdk.org> wrote:

>getBeforeIndex method should return null only if the passed index parameter is 
>less than 0 and greater than the text's length.

I am not sure about the statement above. I think the check should take care of 
the direction, which is -1 in your case. This is actually properly handled by 
the code below(in t he same method you changed):

                    if (index + direction < model.getLength() &&
                        index + direction >= 0) {
                        return model.getText(index + direction, 1);
                    }

The code you added also affects WORD and SENTENCE cases. I suggest covering 
those with a test as well.

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

PR Comment: https://git.openjdk.org/jdk/pull/25941#issuecomment-2998264339

Reply via email to