On Tue, 9 May 2023 18:43:07 GMT, Andy Goryachev <ango...@openjdk.org> wrote:
> There is one question whether it's possible to always initialize > HitInfo.insertionIndex and remove the secondary computation from > HitInfo.getInsertionIndex() > > I am not clear under which conditions it is not possible to initialize, and > whether subsequent HitInfo.getInsertionIndex() would produce a meaningful > result. > I think it should be possible to initialize insertionIndex always in `getHitInfo()` method. Only scenario now it is not getting initialized is when `lineIndex >= getLineCount()` is true and we don't check for text runs further and initialize `charIndex` using `getCharCount()` method. I'm not completely clear if removing the `insertionIndex` calculation from `HitInfo.getInsertionIndex()` wouldn't cause any issue. So kept that as well. Like you mentioned, this can be considered in a separate RFE I think. ------------- PR Comment: https://git.openjdk.org/jfx/pull/1091#issuecomment-1543388818