Skip to content

fix(ui): separate number input precision from step size - #2331

Open
J4ck1e2000 wants to merge 1 commit into
nsgo-dev:mainfrom
J4ck1e2000:fix/issue-2263
Open

J4ck1e2000 wants to merge 1 commit into
nsgo-dev:mainfrom
J4ck1e2000:fix/issue-2263

Conversation

@J4ck1e2000

Copy link
Copy Markdown
Contributor

Summary

ui.NumberInput now accepts Precision to snap typed values independently of Step, and NoSnap to clamp without rounding. For example, Step: 0.1, Precision: 0.01 can commit and display 9.81 while still stepping by 0.1. An explicit precision stays aligned with Min; zero-value options retain the existing behavior.

Fixes #2263.

Targets

  • Shared code (base, ui)

Screenshots

No layout or styling change. The native tests assert the displayed value after editing and stepping.

Verification

  • go tool nsgo check ./ui
  • go tool nsgo test -run '^TestNumberInput' ./ui -- -count=1
  • go tool nsgo test -run '^TestNumberInput(SpinButtonAndLevels|StepsLookInvalid)$' ./base -- -count=1
  • go tool nsgo test -target macos -activate -run '^TestNumberInput(Precision(FromMin)?|NoSnap)$' ./ui (all three passed in AppKit; linked the root package through a temporary test-only import, not in this PR)

Other native targets and the full repository test suite were not run locally.

Checklist

  • Conventional Commit title.
  • English and Chinese forms guides, app-author skill reference, and changelog fragment updated.
  • No third-party code, assets, or dependency changes.

🤖 openai-codex/gpt-6.2-sol

Expose Precision and NoSnap on the styled number input while preserving coarse steps and the default format. Keep explicit precision aligned with the lower bound.

Fixes nsgo-dev#2263
@github-actions github-actions Bot added bug Something isn't working size/M documentation Improvements or additions to documentation base ui labels Nov 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

base bug Something isn't working documentation Improvements or additions to documentation size/M ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui.NumberInput: no way to turn off Snap or set Precision, so typed values always round to Step

1 participant