RFR: 8178368: Right alignment of text fields and alignment of prompt text works incorrectly

Karthik P K kpk at openjdk.org
Fri Feb 24 20:02:24 UTC 2023


On Fri, 24 Feb 2023 19:25:47 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

> I think the condition to select one behavior or the other might be whether all the text fits in the visible area. If it does - use existing logic. If it does not - shift the text to the right.

Yes this approach can be used. But I think there is no need to change anything in `updateCaretOff` or `updateTextPos` methods.
This behavior exists only in RIGHT alignment because of the code present in `scrollAfterDelete` method. In this method, LEFT and CENTER alignments cases have same block of code and only RIGHT alignment has different case statement. Just to check the behavior, I applied LEFT and CENTER alignment code  to RIGHT alignment as well in this method and observed that the RIGHT alignment behavior changed to the expected one without any side effects. But I'm yet to figure out why exactly there is separate case for RIGHT alignment.

> 
> Question: should we fix this as part of this PR (is it easy enough?) or does it warrant a separate Bug/RFE?

I think once we figure out why exactly there is separate case for RIGHT alignment in `scrollAfterDelete` method, we can decide if this can be fixed in this PR or we should create separate bug.

Also I did quick check in HTML and JTextField. In both, text scrolls to the right when we click on the first visible character and start typing.

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

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


More information about the openjfx-dev mailing list