From 8343a4632e2ec67230fd95453c9713c62dfc077a Mon Sep 17 00:00:00 2001 From: Rudy Huyn Date: Wed, 6 Mar 2019 23:27:43 -0800 Subject: [PATCH] Reject text from clipboard when it contains a dot and the local decimal separator is not one --- src/CalcViewModel/Common/CopyPasteManager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CalcViewModel/Common/CopyPasteManager.cpp b/src/CalcViewModel/Common/CopyPasteManager.cpp index c8f9c5f0..28507e1b 100644 --- a/src/CalcViewModel/Common/CopyPasteManager.cpp +++ b/src/CalcViewModel/Common/CopyPasteManager.cpp @@ -136,6 +136,13 @@ String^ CopyPasteManager::ValidatePasteExpression(String^ pastedText, ViewMode m wstring pasteExpression = pastedText->Data(); + // Reject strings with '.' when the local decimal separator is different + wchar_t decimalSeparator = LocalizationSettings::GetInstance().GetDecimalSeparator(); + if (decimalSeparator != '.' && pasteExpression.find('.') != std::string::npos) + { + return StringReference(PasteErrorString); + } + // Get english translated expression String^ englishString = LocalizationSettings::GetInstance().GetEnglishValueFromLocalizedDigits(pasteExpression);