RFR: 8282290: TextField Cursor Position one off [v2]
Karthik P K
kpk at openjdk.org
Thu Nov 16 06:54:04 UTC 2023
> The change listener on caretPositionProperty() was not getting invoked on replacing the content with same text as there was no change in caret position. Since the textProperty invalidation sets the forward bias to true by default, incorrect caret position was calculated when the same text was replaced after clicking on the trailing edge of last character or empty space in the TextField.
>
> Since caretShapeProperty invalidation listener gets invoked without changing the caret position, updating the caretBiasProperty on this listener solves the issue.
>
> Since the caret position value will be same when the caret is present after the last character or before the last character, it can not be validated using unit test.
> The fix can be validated using MonkeyTester.
> Steps to select TextField option in Monkey Tester.
>
> - Open the MonkeyTester app and select TextField from the left option pane.
> - Select Short from Text selection option and click on the TextField to bring it into focus.
> - Select all using cmd(ctrl) + a and copy using cmd(ctrl) + c
> - Click on empty space in the TextField after the present content.
> - Select all again using the keyboard shortcut and paste using cmd(ctrl) + v
> - The caret should be displayed after the last character. Without the fix caret gets displayed before the last character.
Karthik P K has updated the pull request incrementally with one additional commit since the last revision:
Code review
-------------
Changes:
- all: https://git.openjdk.org/jfx/pull/1287/files
- new: https://git.openjdk.org/jfx/pull/1287/files/306487cd..79f2fe82
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jfx&pr=1287&range=01
- incr: https://webrevs.openjdk.org/?repo=jfx&pr=1287&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jfx/pull/1287.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/1287/head:pull/1287
PR: https://git.openjdk.org/jfx/pull/1287
More information about the openjfx-dev
mailing list