RFR: 8282290: TextField Cursor Position one off [v2]
Karthik P K
kpk at openjdk.org
Thu Nov 16 06:54:05 UTC 2023
On Wed, 15 Nov 2023 19:47:28 GMT, Marius Hanl <mhanl at openjdk.org> wrote:
>> this might be problematic, as it uses undocumented aspect of Text/Flow.caretShape(). the current implementation returns either a single line, or two lines (moveto,lineto,moveto,lineto) in the case of split/dual caret. But this may not be true in the future! If we add a directional indicator to the caret this logic will break.
>>
>> What we may need is to invent a new API possibly that gives us more information about the caret - whether it's a single or split one, or whether it has a directionality indicator, information about the adjacent text segments (rtl,ltr), etc.
>>
>> We can keep this logic for now, to be fixed once (and if) we add the more detailed caret API.
>
> Yes, right now it is a bit magic. At least the first if can be simplified still, as `!= 4` will also handle `== 0`.
I agree with Andy here. However the first condition can be simplified without any side effects but I had seen some side effects if we remove second condition. Hence simplified the first condition as suggested above and maintained second condition as it is.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1287#discussion_r1395222766
More information about the openjfx-dev
mailing list