Improve the support of Narrator with parenthesis (#368)
* Modify how we manage Narrator with parenthesis and refactor right parenthesis * Optimization * remove extra spaces * take feedback into account
This commit is contained in:
@@ -390,7 +390,7 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
||||
cleared for CENTR */
|
||||
if (nullptr != m_pCalcDisplay)
|
||||
{
|
||||
m_pCalcDisplay->SetParenDisplayText(L"");
|
||||
m_pCalcDisplay->SetParenthesisNumber(0);
|
||||
m_pCalcDisplay->SetExpressionDisplay(make_shared<CalculatorVector<pair<wstring, int>>>(), make_shared<CalculatorVector<shared_ptr<IExpressionCommand>>>());
|
||||
}
|
||||
|
||||
@@ -594,7 +594,7 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
||||
// Set the "(=xx" indicator.
|
||||
if (nullptr != m_pCalcDisplay)
|
||||
{
|
||||
m_pCalcDisplay->SetParenDisplayText(m_openParenCount ? to_wstring(m_openParenCount) : L"");
|
||||
m_pCalcDisplay->SetParenthesisNumber(m_openParenCount >= 0 ? static_cast<unsigned int>(m_openParenCount) : 0);
|
||||
}
|
||||
|
||||
if (!m_bError)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
@@ -111,9 +111,9 @@ namespace CalculationManager
|
||||
/// Callback from the engine
|
||||
/// </summary>
|
||||
/// <param name="parenthesisCount">string containing the parenthesis count</param>
|
||||
void CalculatorManager::SetParenDisplayText(const wstring& parenthesisCount)
|
||||
void CalculatorManager::SetParenthesisNumber(_In_ unsigned int parenthesisCount)
|
||||
{
|
||||
m_displayCallback->SetParenDisplayText(parenthesisCount);
|
||||
m_displayCallback->SetParenthesisNumber(parenthesisCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@@ -94,7 +94,7 @@ namespace CalculationManager
|
||||
void SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const &tokens, _Inout_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const &commands) override;
|
||||
void SetMemorizedNumbers(_In_ const std::vector<std::wstring>& memorizedNumbers) override;
|
||||
void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) override;
|
||||
void SetParenDisplayText(const std::wstring& parenthesisCount) override;
|
||||
void SetParenthesisNumber(_In_ unsigned int parenthesisCount) override;
|
||||
void OnNoRightParenAdded() override;
|
||||
void DisplayPasteError();
|
||||
void MaxDigitsReached() override;
|
||||
|
@@ -12,7 +12,7 @@ public:
|
||||
virtual void SetPrimaryDisplay(const std::wstring& pszText, bool isError) = 0;
|
||||
virtual void SetIsInError(bool isInError) = 0;
|
||||
virtual void SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const &tokens, _Inout_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const &commands) = 0;
|
||||
virtual void SetParenDisplayText(const std::wstring& pszText) = 0;
|
||||
virtual void SetParenthesisNumber(_In_ unsigned int count) = 0;
|
||||
virtual void OnNoRightParenAdded() = 0;
|
||||
virtual void MaxDigitsReached() = 0; // not an error but still need to inform UI layer.
|
||||
virtual void BinaryOperatorReceived() = 0;
|
||||
|
Reference in New Issue
Block a user