Skip to content

TextInput::cursor_position and anchor_position are not up-to-date after changing TextInput::text #331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tronical opened this issue Jul 19, 2021 · 0 comments · May be fixed by #8479
Open
Labels
a:text Text rendering, fonts, Text input (mS,bF)

Comments

@tronical
Copy link
Member

It's possible to programmatically replace the text using the text property and for example shorten it. A cursor that was previously placed at the end of the text should now report an adjusted position via the API - the same applies to the anchor.

Note: cursor_position and anchor_position are not documented right now, but they are accessible (and used by the tests).

@tronical tronical added the bug Something isn't working label Jul 19, 2021
tronical added a commit that referenced this issue Jul 19, 2021
When replacing the text, it may happen that the cursor position becomes outdated.
As per #331 we should make sure that this is handled also on an API level,
but this patch at least avoids the panic triggered by using editing.
tronical added a commit that referenced this issue Jul 19, 2021
When replacing the text, it may happen that the cursor position becomes outdated.
As per #331 we should make sure that this is handled also on an API level,
but this patch at least avoids the panic triggered by using editing.
@ogoffart ogoffart added the a:text Text rendering, fonts, Text input (mS,bF) label Jul 13, 2023
@ogoffart ogoffart removed the bug Something isn't working label May 7, 2025
@ogoffart ogoffart marked this as a duplicate of #8147 May 19, 2025
tronical added a commit that referenced this issue May 19, 2025
… reporting wrong values when the text changes

Bite the bullet and use a proxy property with a binding.

Fixes #331
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:text Text rendering, fonts, Text input (mS,bF)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants