On Thu, 5 Jan 2023 09:49:41 GMT, Karthik P K <k...@openjdk.org> wrote:

>> When Text width was more than TextField width, the logic to update 
>> `textTranslateX` in `updateCaretOff` method was causing the issue of 
>> unexpected behavior for Right and Center alignment.
>> 
>> Made changes to update `textTranslateX` in `updateCaretOff` method only when 
>> text width is less than text field width i.e `delta` is positive. 
>> For both right and center alignments, the `textTranslateX` value calculated 
>> in `updateTextPos` method will be updated without any condition so that 
>> expected behavior is achieved for all scenarios of text width relative to 
>> text field width. 
>> 
>> Added unit tests to validate LEFT, CENTER and RIGHT alignments. RIGHT and 
>> CENTER alignment tests are expected to fail without the fix provided in this 
>> PR.
>
> Karthik P K has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Update comments

What I have observed is - this fixes the alignment issues, but breaks the 
cursor movement in case of RIGHT and CENTER alignment.

Tested using MonkeyTester application provided by Andy.
- For a Textfield, select long text and alignment to RIGHT
- In the TextField, click after text "end>" and enter text such that the string 
becomes longer than that the TextField can display
- Now, start pressing Left arrow key - so that the text cursor starts moving 
left - if we continue this key press till beginning of the string - it is 
expected that beginning of the text string is visible. Cursor never reaches 
beginning of the string with changes done in this PR.

Similar cursor movement issue is observed with CENTER alignment as well.

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

Changes requested by aghaisas (Reviewer).

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

Reply via email to