Skip to content
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

Call setTextKeepState instead of setText and setSelection #605

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

tomekzaw
Copy link
Collaborator

@tomekzaw tomekzaw commented Jan 30, 2025

Details

Currently, in applyNewStyles we need to store selection start and end and restore it after setText call using setSelection method.

This PR makes use of setTextKeepState https://developer.android.com/reference/android/widget/TextView#setTextKeepState(java.lang.CharSequence) which sets the text to be displayed but retains the cursor position.

Related Issues

GH_LINK

Manual Tests

Linked PRs

@tomekzaw tomekzaw requested a review from j-piasecki January 30, 2025 19:52
@tomekzaw tomekzaw merged commit 95a0d0b into main Jan 31, 2025
5 checks passed
@tomekzaw tomekzaw deleted the @tomekzaw/android-set-text-keep-state branch January 31, 2025 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants