Fix negative inputs and numpad handling by NumberInput
Fixes #261. Fixes #333.
- Allow lone minus sign in input, mapping it to 0 - the same way as for empty input.
- Fix too eager handling of numpad keys - numpad keys are misdetected by core framework (see https://github.com/iced-rs/iced/pull/2278), this PR aligns their behaviour with
TextInput.
https://github.com/user-attachments/assets/478f494f-db33-424c-b9da-e79194a2c422
Hm, the video renders fine on my end now. Perhaps a github glitch?
This works for FP numbers no worse than before. Naive implementation (just slapping an f64 as an underlying type) won't work anyway, so it should use some numeric wrapper that can be losslessly converted to/from decimal representation. But FP is difficult anyway - remember there are +0 and -0, NaNs, infinities...
Given that "5." should parse as an f64, you'll likely be able to type floating numbers just fine. If you have a reference float wrapper code, we can check that too
Looks good, I still need to check it.
It's not exactly what I was planning but should be enough while waiting to do something better
ok once you approve it I can merge it.