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 number input over/underflow #236

Merged
merged 2 commits into from
Apr 28, 2024
Merged

Fix number input over/underflow #236

merged 2 commits into from
Apr 28, 2024

Conversation

TitouanReal
Copy link
Contributor

Fixes #235.

This code change makes sure to not do any operations that might overflow or underflow.

The code makes the assumption that it does not receive the widget in a broken state, ie the invariant

self.bounds.0 <= self.value <= self.bounds.1

must be true for the code to be correct. If it is, then the result after the operation will uphold the same invariant.

Such a topic is very error prone, so please feel free to try and find problems in the code I wrote.

Copy link
Collaborator

@genusistimelord genusistimelord left a comment

Choose a reason for hiding this comment

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

looks good thank you.

@genusistimelord
Copy link
Collaborator

fix the clippy issue and you should be good.

@TitouanReal
Copy link
Contributor Author

It should be fixed now.

@genusistimelord genusistimelord merged commit 8e2b738 into iced-rs:main Apr 28, 2024
2 checks passed
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.

Number input doesn't prevent overflow and underflow of the contained value
2 participants