Skip to content

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

Merged
hecrj merged 3 commits into
iced-rs:masterfrom
mtkennerly:bugfix/paste-panic
Jul 10, 2020
Merged

Fix panic on paste in TextInput after programmatic modification of contents#445
hecrj merged 3 commits into
iced-rs:masterfrom
mtkennerly:bugfix/paste-panic

Conversation

@mtkennerly
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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