mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-02-24 18:50:24 +02:00
Transfer: improve amount sanitization
This commit is contained in:
parent
d5f4d5d93f
commit
e81a589a8d
@ -182,9 +182,17 @@ Rectangle {
|
|||||||
inlineButtonText: qsTr("All") + translationManager.emptyString
|
inlineButtonText: qsTr("All") + translationManager.emptyString
|
||||||
inlineButton.onClicked: amountLine.text = "(all)"
|
inlineButton.onClicked: amountLine.text = "(all)"
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
if(amountLine.text.indexOf('.') === 0){
|
const match = amountLine.text.match(/^0+(\d.*)/);
|
||||||
amountLine.text = '0' + amountLine.text;
|
if (match) {
|
||||||
}
|
const cursorPosition = amountLine.cursorPosition;
|
||||||
|
amountLine.text = match[1];
|
||||||
|
amountLine.cursorPosition = Math.max(cursorPosition, 1) - 1;
|
||||||
|
} else if(amountLine.text.indexOf('.') === 0){
|
||||||
|
amountLine.text = '0' + amountLine.text;
|
||||||
|
if (amountLine.text.length > 2) {
|
||||||
|
amountLine.cursorPosition = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
validator: RegExpValidator {
|
validator: RegExpValidator {
|
||||||
|
Loading…
Reference in New Issue
Block a user