Repository navigation
fix: make Shift+Arrow step 10x work for string steps like "1.00" and scientific notation - #763
young-tree wants to merge 1 commit into
Conversation
…scientific notation
getDecupleSteps previously appended a '0' character to the raw step value
when it had no decimal point, which is wrong when the trimmed string step
hides its point ("1.00" -> "1.000", value unchanged) or uses scientific
notation ("1e-7" -> "1e-70").
Now the step is normalized to a plain decimal string first, so digit
shifting always means multiply by 10.
Fixes react-component#761
|
@young-tree is attempting to deploy a commit to the afc163's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. Walkthrough
ChangesShift 步长处理
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk:
|
Fixes #761
Problem
getDecupleStepsappended a0character to the raw step value when it had no decimal point. Two string-step cases silently produced the same value instead of10 * step:step="1.00":trimNumber("1.00").fullStr === "1"has no point, so the raw string got a char appended ->"1.000"(still1, formatted with 3 decimals).Shift+Arrowappeared to do nothing.step="1e-7": scientific notation has no point ->"1e-70"(value off by 10^63).Fix
Normalize the step to a plain decimal string first (
1e-7->0.0000001), then do the digit shift, so it always means multiply by 10:"1.00"->"10""1e-7"->"0.000001"1->"10"(unchanged behavior)Tests
Two regression tests added in
tests/keyboard.test.tsx(string step with trailing zeros / scientific notation). Full suite: 15 suites, 192 tests passed.Summary by CodeRabbit