fixed divide by 0 padding issue

This commit is contained in:
Justin 2024-10-03 17:05:06 -04:00
Родитель 6ece807db8
Коммит 7a9fd80997
2 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -185,12 +185,12 @@ StandardCalculatorViewModel::StandardCalculatorViewModel()
AreProgrammerRadixOperatorsVisible = false;
}
String ^ StandardCalculatorViewModel::LocalizeDisplayValue(_In_ wstring const& displayValue)
String ^ StandardCalculatorViewModel::LocalizeDisplayValue(_In_ wstring const& displayValue, _In_ bool isError = false)
{
wstring result(displayValue);
// Adds leading padding 0's to Programmer Mode's Binary Display
if (IsProgrammer && CurrentRadixType == NumberBase::BinBase)
if (IsProgrammer && CurrentRadixType == NumberBase::BinBase && !isError)
{
result = AddPadding(result);
}
@ -244,7 +244,7 @@ String ^ StandardCalculatorViewModel::GetNarratorStringReadRawNumbers(_In_ Strin
void StandardCalculatorViewModel::SetPrimaryDisplay(_In_ String ^ displayStringValue, _In_ bool isError)
{
String ^ localizedDisplayStringValue = LocalizeDisplayValue(displayStringValue->Data());
String ^ localizedDisplayStringValue = LocalizeDisplayValue(displayStringValue->Data(), isError);
// Set this variable before the DisplayValue is modified, Otherwise the DisplayValue will
// not match what the narrator is saying

Просмотреть файл

@ -371,7 +371,7 @@ namespace CalculatorApp
Platform::String ^ m_selectedExpressionLastData;
Common::DisplayExpressionToken ^ m_selectedExpressionToken;
Platform::String ^ LocalizeDisplayValue(_In_ std::wstring const& displayValue);
Platform::String ^ LocalizeDisplayValue(_In_ std::wstring const& displayValue, _In_ bool isError);
Platform::String
^ CalculateNarratorDisplayValue(_In_ std::wstring const& displayValue, _In_ Platform::String ^ localizedDisplayValue);
CalculatorApp::ViewModel::Common::Automation::NarratorAnnouncement ^ GetDisplayUpdatedNarratorAnnouncement();