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

Fix panic on paste in TextInput after programmatic modification of contents #445

Merged
merged 3 commits into from
Jul 10, 2020

Conversation

mtkennerly
Copy link
Contributor

This fixes the panic mentioned in #443, where the end of the cursor selection might be larger than the length of the current input value.

@hecrj
Copy link
Member

hecrj commented Jul 10, 2020

Thanks for catching this!

The main issue here was that Cursor::selection was not using the Cursor::state method, which clamps the indices accordingly.

I made some changes to fix this. Let me know what you think!

@mtkennerly
Copy link
Contributor Author

Even better :D I tested your changes with my simplified example, and it's working just fine.

@hecrj hecrj added the bug Something isn't working label Jul 10, 2020
@hecrj hecrj added this to the 0.2.0 milestone Jul 10, 2020
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Let's merge then!

@hecrj hecrj merged commit 62ec03a into iced-rs:master Jul 10, 2020
@mtkennerly mtkennerly deleted the bugfix/paste-panic branch July 10, 2020 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants