mirror of
https://github.com/bitcoin-core/gui-qml.git
synced 2026-12-02 07:42:38 +00:00
qml: Accept the locale's decimal comma in amount and fee fields #1140
No reviewers
Labels
No labels
Android
Bug
Build system
Design suggestion
Doc
Needs design review
Needs rebase
Stage
UX
Up for grabs
Upstream
Wallet
duplicate
enhancement
good first issue
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin-core/gui-qml!1140
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/decimal-comma-amount-input"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The amount and custom fee rate fields refused a comma or a leading period, but kept the digits typed after it. The result was a different valid value with no error:
0,02became 2 BTC in Send and Receive (saved into the payment request and its QR code), and.5was paid as 5 sat/vB.Where the locale uses a decimal comma, a comma is now accepted as the decimal point and stored as a period. Elsewhere a comma groups thousands and is still refused, so
1,000keeps meaning one thousand. Only the comma is replaced, so the undo history is kept.BitcoinAmount::sanitize()follows the same rule instead of dropping the comma. The custom fee rate also accepts an empty whole part, so.5is 0.5 sat/vB, as in Bitcoin-Qt.Unit and QML tests cover typed and pasted commas in both locale kinds, undo after the comma,
sanitize(), and.5and.in the fee rate parser.Fixes #1081
Fixes #1130
🔵 Suggestion · Decimal-comma functional coverage stops before Review and broadcast
The real-wallet test checks the
1,5fee estimate but never the paid fee; preparation coverage for1,5and.5uses a mock wallet, leaving these repaired input forms without end-to-end payment coverage.Location: test/functional/qml_test_decimal_comma.py:60 (head).
Review coverage was incomplete.
Reviewed:
8622eddfac9d· Review reportI ran into a paste issue on the Send page with
de_DEand BTC selected:1,23456789to the clipboard987I get
9.87 BTChere, while I’d expect1.23456789 BTC. Looks like the decimal point ends up being inserted into the old987value.Beyond this specific issue, modifying the text inside the edit handler feels fragile to me, since validation can run halfway through the change. Perhaps we should rethink how normalization and validation work together here.
I retested with
de_DEand BTC selected. Pasting1,23456789over987now gives the right amount, and Ctrl+Z brings back987.One thing I like about #1142 is that Send and Receive share a C++ parser, so the rules for inputs like
0,02live in one place.