mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-06 13:11:09 -07:00
Refactor CopyPasteManager (#1918)
Get the object reference and use that instead of accessing the array twice to get the object
This commit is contained in:
parent
3d8576bad6
commit
68c7159c87
1 changed files with 9 additions and 13 deletions
|
@ -288,9 +288,8 @@ bool CopyPasteManager::ExpressionRegExMatch(
|
||||||
}
|
}
|
||||||
else if (mode == ViewMode::Programmer)
|
else if (mode == ViewMode::Programmer)
|
||||||
{
|
{
|
||||||
patterns.assign(
|
auto pattern = &programmerModePatterns[static_cast<int>(programmerNumberBase) - static_cast<int>(NumberBase::HexBase)];
|
||||||
programmerModePatterns[(int)programmerNumberBase - (int)NumberBase::HexBase].begin(),
|
patterns.assign(pattern->begin(), pattern->end());
|
||||||
programmerModePatterns[(int)programmerNumberBase - (int)NumberBase::HexBase].end());
|
|
||||||
}
|
}
|
||||||
else if (modeType == CategoryGroupType::Converter)
|
else if (modeType == CategoryGroupType::Converter)
|
||||||
{
|
{
|
||||||
|
@ -505,18 +504,15 @@ ULONG32 CopyPasteManager::StandardScientificOperandLength(Platform::String ^ ope
|
||||||
const bool hasDecimal = operandWstring.find('.') != wstring::npos;
|
const bool hasDecimal = operandWstring.find('.') != wstring::npos;
|
||||||
auto length = operandWstring.length();
|
auto length = operandWstring.length();
|
||||||
|
|
||||||
if (hasDecimal)
|
if (hasDecimal && length >= 2)
|
||||||
{
|
{
|
||||||
if (length >= 2)
|
if ((operandWstring[0] == L'0') && (operandWstring[1] == L'.'))
|
||||||
{
|
{
|
||||||
if ((operandWstring[0] == L'0') && (operandWstring[1] == L'.'))
|
length -= 2;
|
||||||
{
|
}
|
||||||
length -= 2;
|
else
|
||||||
}
|
{
|
||||||
else
|
length -= 1;
|
||||||
{
|
|
||||||
length -= 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue