mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-08 08:04:08 +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) {
|
if (decimalPosition >= 0) {
|
||||||
Assert(decimalPosition >= skip);
|
Assert(decimalPosition >= skip);
|
||||||
decimalPosition -= skip;
|
decimalPosition -= skip;
|
||||||
}
|
|
||||||
if (decimalPosition > digitsLimit) {
|
if (decimalPosition > digitsLimit) {
|
||||||
state = {
|
state = {
|
||||||
.value = (state.value.mid(0, digitsLimit)
|
.value = (state.value.mid(0, digitsLimit)
|
||||||
|
@ -108,6 +107,12 @@ struct SimpleFieldState {
|
||||||
: state.position),
|
: state.position),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
} else if (state.value.size() > digitsLimit) {
|
||||||
|
state = {
|
||||||
|
.value = state.value.mid(0, digitsLimit),
|
||||||
|
.position = std::min(state.position, digitsLimit),
|
||||||
|
};
|
||||||
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,9 @@ QString FillAmountAndCurrency(
|
||||||
int64 amount,
|
int64 amount,
|
||||||
const QString ¤cy,
|
const QString ¤cy,
|
||||||
bool forceStripDotZero) {
|
bool forceStripDotZero) {
|
||||||
|
// std::abs doesn't work on that one :/
|
||||||
|
Expects(amount != std::numeric_limits<int64>::min());
|
||||||
|
|
||||||
const auto rule = LookupCurrencyRule(currency);
|
const auto rule = LookupCurrencyRule(currency);
|
||||||
|
|
||||||
const auto prefix = (amount < 0)
|
const auto prefix = (amount < 0)
|
||||||
|
|
Loading…
Add table
Reference in a new issue