mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Fix money input field limit without decimal separator.
This commit is contained in:
parent
286cb74620
commit
c242a61e8c
2 changed files with 17 additions and 9 deletions
|
@ -96,7 +96,6 @@ struct SimpleFieldState {
|
|||
if (decimalPosition >= 0) {
|
||||
Assert(decimalPosition >= skip);
|
||||
decimalPosition -= skip;
|
||||
}
|
||||
if (decimalPosition > digitsLimit) {
|
||||
state = {
|
||||
.value = (state.value.mid(0, digitsLimit)
|
||||
|
@ -108,6 +107,12 @@ struct SimpleFieldState {
|
|||
: state.position),
|
||||
};
|
||||
}
|
||||
} else if (state.value.size() > digitsLimit) {
|
||||
state = {
|
||||
.value = state.value.mid(0, digitsLimit),
|
||||
.position = std::min(state.position, digitsLimit),
|
||||
};
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
|
@ -131,6 +131,9 @@ QString FillAmountAndCurrency(
|
|||
int64 amount,
|
||||
const QString ¤cy,
|
||||
bool forceStripDotZero) {
|
||||
// std::abs doesn't work on that one :/
|
||||
Expects(amount != std::numeric_limits<int64>::min());
|
||||
|
||||
const auto rule = LookupCurrencyRule(currency);
|
||||
|
||||
const auto prefix = (amount < 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue