mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 00:48:23 -06:00
Use type inference throughout the project (#12975)
#4015 requires sweeping changes in order to allow a migration of our buffer coordinates from `int16_t` to `int32_t`. This commit reduces the size of future commits by using type inference wherever possible, dropping the need to manually adjust types throughout the project later. As an added bonus this commit standardizes the alignment of cv qualifiers to be always left of the type (e.g. `const T&` instead of `T const&`). The migration to type inference with `auto` was mostly done using JetBrains Resharper with some manual intervention and the standardization of cv qualifier alignment using clang-format 14. ## References This is preparation work for #4015. ## Validation Steps Performed * Tests pass ✅
This commit is contained in:
parent
fa25dfbf7a
commit
57c3953aca
@ -11,7 +11,7 @@ AlignOperands: true
|
||||
AlignTrailingComments: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
#AllowShortLambdasOnASingleLine: Inline
|
||||
|
||||
@ -95,7 +95,7 @@ typename CharRow::const_iterator CharRow::cend() const noexcept
|
||||
// - The calculated left boundary of the internal string.
|
||||
size_t CharRow::MeasureLeft() const noexcept
|
||||
{
|
||||
const_iterator it = _data.cbegin();
|
||||
auto it = _data.cbegin();
|
||||
while (it != _data.cend() && it->IsSpace())
|
||||
{
|
||||
++it;
|
||||
@ -111,7 +111,7 @@ size_t CharRow::MeasureLeft() const noexcept
|
||||
// - The calculated right boundary of the internal string.
|
||||
size_t CharRow::MeasureRight() const
|
||||
{
|
||||
const_reverse_iterator it = _data.crbegin();
|
||||
auto it = _data.crbegin();
|
||||
while (it != _data.crend() && it->IsSpace())
|
||||
{
|
||||
++it;
|
||||
@ -132,7 +132,7 @@ void CharRow::ClearCell(const size_t column)
|
||||
// - True if there is valid text in this row. False otherwise.
|
||||
bool CharRow::ContainsText() const noexcept
|
||||
{
|
||||
for (const value_type& cell : _data)
|
||||
for (const auto& cell : _data)
|
||||
{
|
||||
if (!cell.IsSpace())
|
||||
{
|
||||
|
||||
@ -110,7 +110,7 @@ CharRowCellReference::const_iterator CharRowCellReference::end() const
|
||||
|
||||
bool operator==(const CharRowCellReference& ref, const std::vector<wchar_t>& glyph)
|
||||
{
|
||||
const DbcsAttribute& dbcsAttr = ref._cellData().DbcsAttr();
|
||||
const auto& dbcsAttr = ref._cellData().DbcsAttr();
|
||||
if (glyph.size() == 1 && dbcsAttr.IsGlyphStored())
|
||||
{
|
||||
return false;
|
||||
|
||||
@ -24,7 +24,7 @@ enum class LineRendition
|
||||
constexpr SMALL_RECT ScreenToBufferLine(const SMALL_RECT& line, const LineRendition lineRendition)
|
||||
{
|
||||
// Use shift right to quickly divide the Left and Right by 2 for double width lines.
|
||||
const auto scale = lineRendition == LineRendition::SingleWidth ? 0 : 1;
|
||||
const SHORT scale = lineRendition == LineRendition::SingleWidth ? 0 : 1;
|
||||
return { line.Left >> scale, line.Top, line.Right >> scale, line.Bottom };
|
||||
}
|
||||
|
||||
|
||||
@ -302,7 +302,7 @@ OutputCellIterator& OutputCellIterator::operator++()
|
||||
// - Reference to self after advancement.
|
||||
OutputCellIterator OutputCellIterator::operator++(int)
|
||||
{
|
||||
auto temp(*this);
|
||||
auto temp = *this;
|
||||
operator++();
|
||||
return temp;
|
||||
}
|
||||
@ -478,7 +478,7 @@ OutputCellView OutputCellIterator::s_GenerateView(const wchar_t& wch, const Text
|
||||
// - Object representing the view into this cell
|
||||
OutputCellView OutputCellIterator::s_GenerateViewLegacyAttr(const WORD& legacyAttr) noexcept
|
||||
{
|
||||
WORD cleanAttr = legacyAttr;
|
||||
auto cleanAttr = legacyAttr;
|
||||
WI_ClearAllFlags(cleanAttr, COMMON_LVB_SBCSDBCS); // don't use legacy lead/trailing byte flags for colors
|
||||
|
||||
const TextAttribute attr(cleanAttr);
|
||||
|
||||
@ -113,8 +113,8 @@ OutputCellIterator ROW::WriteCells(OutputCellIterator it, const size_t index, co
|
||||
|
||||
auto currentColor = it->TextAttr();
|
||||
uint16_t colorUses = 0;
|
||||
uint16_t colorStarts = gsl::narrow_cast<uint16_t>(index);
|
||||
uint16_t currentIndex = colorStarts;
|
||||
auto colorStarts = gsl::narrow_cast<uint16_t>(index);
|
||||
auto currentIndex = colorStarts;
|
||||
|
||||
while (it && currentIndex <= finalColumnInRow)
|
||||
{
|
||||
@ -141,7 +141,7 @@ OutputCellIterator ROW::WriteCells(OutputCellIterator it, const size_t index, co
|
||||
// Fill the text if the behavior isn't set to saying there's only a color stored in this iterator.
|
||||
if (it->TextAttrBehavior() != TextAttributeBehavior::StoredOnly)
|
||||
{
|
||||
const bool fillingLastColumn = currentIndex == finalColumnInRow;
|
||||
const auto fillingLastColumn = currentIndex == finalColumnInRow;
|
||||
|
||||
// TODO: MSFT: 19452170 - We need to ensure when writing any trailing byte that the one to the left
|
||||
// is a matching leading byte. Likewise, if we're writing a leading byte, we need to make sure we still have space in this loop
|
||||
|
||||
@ -112,10 +112,10 @@ TextAttribute TextAttribute::StripErroneousVT16VersionsOfLegacyDefaults(const Te
|
||||
// - a WORD with legacy-style attributes for this textattribute.
|
||||
WORD TextAttribute::GetLegacyAttributes() const noexcept
|
||||
{
|
||||
const BYTE fgIndex = _foreground.GetLegacyIndex(s_legacyDefaultForeground);
|
||||
const BYTE bgIndex = _background.GetLegacyIndex(s_legacyDefaultBackground);
|
||||
const auto fgIndex = _foreground.GetLegacyIndex(s_legacyDefaultForeground);
|
||||
const auto bgIndex = _background.GetLegacyIndex(s_legacyDefaultBackground);
|
||||
const WORD metaAttrs = _wAttrLegacy & META_ATTRS;
|
||||
const bool brighten = IsIntense() && _foreground.CanBeBrightened();
|
||||
const auto brighten = IsIntense() && _foreground.CanBeBrightened();
|
||||
return fgIndex | (bgIndex << 4) | metaAttrs | (brighten ? FOREGROUND_INTENSITY : 0);
|
||||
}
|
||||
|
||||
|
||||
@ -143,7 +143,7 @@ std::pair<COORD, COORD> Search::GetFoundLocation() const noexcept
|
||||
COORD Search::s_GetInitialAnchor(IUiaData& uiaData, const Direction direction)
|
||||
{
|
||||
const auto& textBuffer = uiaData.GetTextBuffer();
|
||||
const COORD textBufferEndPosition = uiaData.GetTextBufferEndPosition();
|
||||
const auto textBufferEndPosition = uiaData.GetTextBufferEndPosition();
|
||||
if (uiaData.IsSelectionActive())
|
||||
{
|
||||
// Convert the screen position of the selection anchor into an equivalent
|
||||
@ -192,7 +192,7 @@ bool Search::_FindNeedleInHaystackAt(const COORD pos, COORD& start, COORD& end)
|
||||
start = { 0 };
|
||||
end = { 0 };
|
||||
|
||||
COORD bufferPos = pos;
|
||||
auto bufferPos = pos;
|
||||
|
||||
for (const auto& needleCell : _needle)
|
||||
{
|
||||
@ -307,7 +307,7 @@ void Search::_UpdateNextPosition()
|
||||
// We put the next position to:
|
||||
// Forward: (0, 0)
|
||||
// Backward: the position of the end of the text buffer
|
||||
const COORD bufferEndPosition = _uiaData.GetTextBufferEndPosition();
|
||||
const auto bufferEndPosition = _uiaData.GetTextBufferEndPosition();
|
||||
|
||||
if (_coordNext.Y > bufferEndPosition.Y ||
|
||||
(_coordNext.Y == bufferEndPosition.Y && _coordNext.X > bufferEndPosition.X))
|
||||
|
||||
@ -91,7 +91,7 @@ const ROW& TextBuffer::GetRowByOffset(const size_t index) const
|
||||
const size_t totalRows = TotalRowCount();
|
||||
|
||||
// Rows are stored circularly, so the index you ask for is offset by the start position and mod the total of rows.
|
||||
const size_t offsetIndex = (_firstRow + index) % totalRows;
|
||||
const auto offsetIndex = (_firstRow + index) % totalRows;
|
||||
return _storage.at(offsetIndex);
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ ROW& TextBuffer::GetRowByOffset(const size_t index)
|
||||
const size_t totalRows = TotalRowCount();
|
||||
|
||||
// Rows are stored circularly, so the index you ask for is offset by the start position and mod the total of rows.
|
||||
const size_t offsetIndex = (_firstRow + index) % totalRows;
|
||||
const auto offsetIndex = (_firstRow + index) % totalRows;
|
||||
return _storage.at(offsetIndex);
|
||||
}
|
||||
|
||||
@ -201,8 +201,8 @@ TextBufferCellIterator TextBuffer::GetCellDataAt(const COORD at, const Viewport
|
||||
bool TextBuffer::_AssertValidDoubleByteSequence(const DbcsAttribute dbcsAttribute)
|
||||
{
|
||||
// To figure out if the sequence is valid, we have to look at the character that comes before the current one
|
||||
const COORD coordPrevPosition = _GetPreviousFromCursor();
|
||||
ROW& prevRow = GetRowByOffset(coordPrevPosition.Y);
|
||||
const auto coordPrevPosition = _GetPreviousFromCursor();
|
||||
auto& prevRow = GetRowByOffset(coordPrevPosition.Y);
|
||||
DbcsAttribute prevDbcsAttr;
|
||||
try
|
||||
{
|
||||
@ -214,8 +214,8 @@ bool TextBuffer::_AssertValidDoubleByteSequence(const DbcsAttribute dbcsAttribut
|
||||
return false;
|
||||
}
|
||||
|
||||
bool fValidSequence = true; // Valid until proven otherwise
|
||||
bool fCorrectableByErase = false; // Can't be corrected until proven otherwise
|
||||
auto fValidSequence = true; // Valid until proven otherwise
|
||||
auto fCorrectableByErase = false; // Can't be corrected until proven otherwise
|
||||
|
||||
// Here's the matrix of valid items:
|
||||
// N = None (single byte)
|
||||
@ -290,7 +290,7 @@ bool TextBuffer::_PrepareForDoubleByteSequence(const DbcsAttribute dbcsAttribute
|
||||
// older versions of conhost simply let pass by unflinching.
|
||||
LOG_HR_IF(E_NOT_VALID_STATE, !(_AssertValidDoubleByteSequence(dbcsAttribute))); // Shouldn't be uncorrectable sequences unless something is very wrong.
|
||||
|
||||
bool fSuccess = true;
|
||||
auto fSuccess = true;
|
||||
// Now compensate if we don't have enough space for the upcoming double byte sequence
|
||||
// We only need to compensate for leading bytes
|
||||
if (dbcsAttribute.IsLeading())
|
||||
@ -385,12 +385,12 @@ OutputCellIterator TextBuffer::WriteLine(const OutputCellIterator givenIt,
|
||||
}
|
||||
|
||||
// Get the row and write the cells
|
||||
ROW& row = GetRowByOffset(target.Y);
|
||||
auto& row = GetRowByOffset(target.Y);
|
||||
const auto newIt = row.WriteCells(givenIt, target.X, wrap, limitRight);
|
||||
|
||||
// Take the cell distance written and notify that it needs to be repainted.
|
||||
const auto written = newIt.GetCellDistance(givenIt);
|
||||
const Viewport paint = Viewport::FromDimensions(target, { gsl::narrow<SHORT>(written), 1 });
|
||||
const auto paint = Viewport::FromDimensions(target, { gsl::narrow<SHORT>(written), 1 });
|
||||
TriggerRedraw(paint);
|
||||
|
||||
return newIt;
|
||||
@ -410,19 +410,19 @@ bool TextBuffer::InsertCharacter(const std::wstring_view chars,
|
||||
const TextAttribute attr)
|
||||
{
|
||||
// Ensure consistent buffer state for double byte characters based on the character type we're about to insert
|
||||
bool fSuccess = _PrepareForDoubleByteSequence(dbcsAttribute);
|
||||
auto fSuccess = _PrepareForDoubleByteSequence(dbcsAttribute);
|
||||
|
||||
if (fSuccess)
|
||||
{
|
||||
// Get the current cursor position
|
||||
short const iRow = GetCursor().GetPosition().Y; // row stored as logical position, not array position
|
||||
short const iCol = GetCursor().GetPosition().X; // column logical and array positions are equal.
|
||||
const auto iRow = GetCursor().GetPosition().Y; // row stored as logical position, not array position
|
||||
const auto iCol = GetCursor().GetPosition().X; // column logical and array positions are equal.
|
||||
|
||||
// Get the row associated with the given logical position
|
||||
ROW& Row = GetRowByOffset(iRow);
|
||||
auto& Row = GetRowByOffset(iRow);
|
||||
|
||||
// Store character and double byte data
|
||||
CharRow& charRow = Row.GetCharRow();
|
||||
auto& charRow = Row.GetCharRow();
|
||||
|
||||
try
|
||||
{
|
||||
@ -506,7 +506,7 @@ bool TextBuffer::IncrementCursor()
|
||||
// Move the cursor one position to the right
|
||||
GetCursor().IncrementXPosition(1);
|
||||
|
||||
bool fSuccess = true;
|
||||
auto fSuccess = true;
|
||||
// If we've passed the final valid column...
|
||||
if (GetCursor().GetPosition().X > iFinalColumnIndex)
|
||||
{
|
||||
@ -527,8 +527,8 @@ bool TextBuffer::IncrementCursor()
|
||||
// - true if we successfully moved the cursor.
|
||||
bool TextBuffer::NewlineCursor()
|
||||
{
|
||||
bool fSuccess = false;
|
||||
short const iFinalRowIndex = GetSize().BottomInclusive();
|
||||
auto fSuccess = false;
|
||||
const auto iFinalRowIndex = GetSize().BottomInclusive();
|
||||
|
||||
// Reset the cursor position to 0 and move down one line
|
||||
GetCursor().SetXPosition(0);
|
||||
@ -576,7 +576,7 @@ bool TextBuffer::IncrementCircularBuffer(const bool inVtMode)
|
||||
// the current background color, but with no meta attributes set.
|
||||
fillAttributes.SetStandardErase();
|
||||
}
|
||||
const bool fSuccess = _storage.at(_firstRow).Reset(fillAttributes);
|
||||
const auto fSuccess = _storage.at(_firstRow).Reset(fillAttributes);
|
||||
if (fSuccess)
|
||||
{
|
||||
// Now proceed to increment.
|
||||
@ -618,7 +618,7 @@ COORD TextBuffer::GetLastNonSpaceCharacter(std::optional<const Microsoft::Consol
|
||||
|
||||
// If the X coordinate turns out to be -1, the row was empty, we need to search backwards for the real end of text.
|
||||
const auto viewportTop = viewport.Top();
|
||||
bool fDoBackUp = (coordEndOfText.X < 0 && coordEndOfText.Y > viewportTop); // this row is empty, and we're not at the top
|
||||
auto fDoBackUp = (coordEndOfText.X < 0 && coordEndOfText.Y > viewportTop); // this row is empty, and we're not at the top
|
||||
while (fDoBackUp)
|
||||
{
|
||||
coordEndOfText.Y--;
|
||||
@ -645,7 +645,7 @@ COORD TextBuffer::GetLastNonSpaceCharacter(std::optional<const Microsoft::Consol
|
||||
// - NOTE: Will return 0,0 if already in the top left corner
|
||||
COORD TextBuffer::_GetPreviousFromCursor() const
|
||||
{
|
||||
COORD coordPosition = GetCursor().GetPosition();
|
||||
auto coordPosition = GetCursor().GetPosition();
|
||||
|
||||
// If we're not at the left edge, simply move the cursor to the left by one
|
||||
if (coordPosition.X > 0)
|
||||
@ -826,7 +826,7 @@ void TextBuffer::SetCurrentLineRendition(const LineRendition lineRendition)
|
||||
auto fillAttrs = GetCurrentAttributes();
|
||||
fillAttrs.SetStandardErase();
|
||||
const size_t fillOffset = GetLineWidth(rowIndex);
|
||||
const size_t fillLength = GetSize().Width() - fillOffset;
|
||||
const auto fillLength = GetSize().Width() - fillOffset;
|
||||
const auto fillData = OutputCellIterator{ fillChar, fillAttrs, fillLength };
|
||||
row.WriteCells(fillData, fillOffset, false);
|
||||
// We also need to make sure the cursor is clamped within the new width.
|
||||
@ -917,7 +917,7 @@ void TextBuffer::Reset()
|
||||
const SHORT TopRowIndex = (GetFirstRowIndex() + TopRow) % currentSize.Y;
|
||||
|
||||
// rotate rows until the top row is at index 0
|
||||
for (int i = 0; i < TopRowIndex; i++)
|
||||
for (auto i = 0; i < TopRowIndex; i++)
|
||||
{
|
||||
_storage.emplace_back(std::move(_storage.front()));
|
||||
_storage.erase(_storage.begin());
|
||||
@ -1081,7 +1081,7 @@ ROW& TextBuffer::_GetFirstRow()
|
||||
// - will throw exception if called with the first row of the text buffer
|
||||
ROW& TextBuffer::_GetPrevRowNoWrap(const ROW& Row)
|
||||
{
|
||||
int prevRowIndex = Row.GetId() - 1;
|
||||
auto prevRowIndex = Row.GetId() - 1;
|
||||
if (prevRowIndex < 0)
|
||||
{
|
||||
prevRowIndex = TotalRowCount() - 1;
|
||||
@ -1167,9 +1167,9 @@ const COORD TextBuffer::GetWordStart(const COORD target, const std::wstring_view
|
||||
// - The COORD for the first character on the current/previous READABLE "word" (inclusive)
|
||||
const COORD TextBuffer::_GetWordStartForAccessibility(const COORD target, const std::wstring_view wordDelimiters) const
|
||||
{
|
||||
COORD result = target;
|
||||
auto result = target;
|
||||
const auto bufferSize = GetSize();
|
||||
bool stayAtOrigin = false;
|
||||
auto stayAtOrigin = false;
|
||||
|
||||
// ignore left boundary. Continue until readable text found
|
||||
while (_GetDelimiterClassAt(result, wordDelimiters) != DelimiterClass::RegularChar)
|
||||
@ -1212,7 +1212,7 @@ const COORD TextBuffer::_GetWordStartForAccessibility(const COORD target, const
|
||||
// - The COORD for the first character on the current word or delimiter run (stopped by the left margin)
|
||||
const COORD TextBuffer::_GetWordStartForSelection(const COORD target, const std::wstring_view wordDelimiters) const
|
||||
{
|
||||
COORD result = target;
|
||||
auto result = target;
|
||||
const auto bufferSize = GetSize();
|
||||
|
||||
const auto initialDelimiter = _GetDelimiterClassAt(result, wordDelimiters);
|
||||
@ -1284,7 +1284,7 @@ const COORD TextBuffer::GetWordEnd(const COORD target, const std::wstring_view w
|
||||
const COORD TextBuffer::_GetWordEndForAccessibility(const COORD target, const std::wstring_view wordDelimiters, const COORD limit) const
|
||||
{
|
||||
const auto bufferSize{ GetSize() };
|
||||
COORD result{ target };
|
||||
auto result{ target };
|
||||
|
||||
if (bufferSize.CompareInBounds(target, limit, true) >= 0)
|
||||
{
|
||||
@ -1341,7 +1341,7 @@ const COORD TextBuffer::_GetWordEndForSelection(const COORD target, const std::w
|
||||
return target;
|
||||
}
|
||||
|
||||
COORD result = target;
|
||||
auto result = target;
|
||||
const auto initialDelimiter = _GetDelimiterClassAt(result, wordDelimiters);
|
||||
|
||||
// expand right until we hit the right boundary or a different delimiter class
|
||||
@ -1465,7 +1465,7 @@ bool TextBuffer::MoveToPreviousWord(COORD& pos, std::wstring_view wordDelimiters
|
||||
// - pos - The COORD for the first cell of the current glyph (inclusive)
|
||||
const til::point TextBuffer::GetGlyphStart(const til::point pos, std::optional<til::point> limitOptional) const
|
||||
{
|
||||
COORD resultPos = pos.to_win32_coord();
|
||||
auto resultPos = pos.to_win32_coord();
|
||||
const auto bufferSize = GetSize();
|
||||
const auto limit{ limitOptional.value_or(til::point{ bufferSize.EndExclusive() }) };
|
||||
|
||||
@ -1493,7 +1493,7 @@ const til::point TextBuffer::GetGlyphStart(const til::point pos, std::optional<t
|
||||
// - pos - The COORD for the last cell of the current glyph (exclusive)
|
||||
const til::point TextBuffer::GetGlyphEnd(const til::point pos, bool accessibilityMode, std::optional<til::point> limitOptional) const
|
||||
{
|
||||
COORD resultPos = pos.to_win32_coord();
|
||||
auto resultPos = pos.to_win32_coord();
|
||||
const auto bufferSize = GetSize();
|
||||
const auto limit{ limitOptional.value_or(til::point{ bufferSize.EndExclusive() }) };
|
||||
|
||||
@ -1569,7 +1569,7 @@ bool TextBuffer::MoveToNextGlyph(til::point& pos, bool allowExclusiveEnd, std::o
|
||||
// - pos - The COORD for the first cell of the previous glyph (inclusive)
|
||||
bool TextBuffer::MoveToPreviousGlyph(til::point& pos, std::optional<til::point> limitOptional) const
|
||||
{
|
||||
COORD resultPos = pos.to_win32_coord();
|
||||
auto resultPos = pos.to_win32_coord();
|
||||
const auto bufferSize = GetSize();
|
||||
const auto limit{ limitOptional.value_or(til::point{ bufferSize.EndExclusive() }) };
|
||||
|
||||
@ -1582,7 +1582,7 @@ bool TextBuffer::MoveToPreviousGlyph(til::point& pos, std::optional<til::point>
|
||||
}
|
||||
|
||||
// try to move. If we can't, we're done.
|
||||
const bool success = bufferSize.DecrementInBounds(resultPos, true);
|
||||
const auto success = bufferSize.DecrementInBounds(resultPos, true);
|
||||
if (resultPos != bufferSize.EndExclusive() && GetCellDataAt(resultPos)->DbcsAttr().IsLeading())
|
||||
{
|
||||
bufferSize.DecrementInBounds(resultPos, true);
|
||||
@ -1713,10 +1713,10 @@ const TextBuffer::TextAndColor TextBuffer::GetText(const bool includeCRLF,
|
||||
const bool formatWrappedRows) const
|
||||
{
|
||||
TextAndColor data;
|
||||
const bool copyTextColor = GetAttributeColors != nullptr;
|
||||
const auto copyTextColor = GetAttributeColors != nullptr;
|
||||
|
||||
// preallocate our vectors to reduce reallocs
|
||||
size_t const rows = selectionRects.size();
|
||||
const auto rows = selectionRects.size();
|
||||
data.text.reserve(rows);
|
||||
if (copyTextColor)
|
||||
{
|
||||
@ -1729,7 +1729,7 @@ const TextBuffer::TextAndColor TextBuffer::GetText(const bool includeCRLF,
|
||||
{
|
||||
const UINT iRow = selectionRects.at(i).Top;
|
||||
|
||||
const Viewport highlight = Viewport::FromInclusive(selectionRects.at(i));
|
||||
const auto highlight = Viewport::FromInclusive(selectionRects.at(i));
|
||||
|
||||
// retrieve the data from the screen buffer
|
||||
auto it = GetCellDataAt(highlight.Origin(), highlight);
|
||||
@ -1774,7 +1774,7 @@ const TextBuffer::TextAndColor TextBuffer::GetText(const bool includeCRLF,
|
||||
}
|
||||
|
||||
// We apply formatting to rows if the row was NOT wrapped or formatting of wrapped rows is allowed
|
||||
const bool shouldFormatRow = formatWrappedRows || !GetRowByOffset(iRow).WasWrapForced();
|
||||
const auto shouldFormatRow = formatWrappedRows || !GetRowByOffset(iRow).WasWrapForced();
|
||||
|
||||
if (trimTrailingWhitespace)
|
||||
{
|
||||
@ -1806,7 +1806,7 @@ const TextBuffer::TextAndColor TextBuffer::GetText(const bool includeCRLF,
|
||||
if (copyTextColor)
|
||||
{
|
||||
// can't see CR/LF so just use black FG & BK
|
||||
COLORREF const Blackness = RGB(0x00, 0x00, 0x00);
|
||||
const auto Blackness = RGB(0x00, 0x00, 0x00);
|
||||
selectionFgAttr.push_back(Blackness);
|
||||
selectionFgAttr.push_back(Blackness);
|
||||
selectionBkAttr.push_back(Blackness);
|
||||
@ -1883,7 +1883,7 @@ std::string TextBuffer::GenHTML(const TextAndColor& rows,
|
||||
}
|
||||
|
||||
// copy text and info color from buffer
|
||||
bool hasWrittenAnyText = false;
|
||||
auto hasWrittenAnyText = false;
|
||||
std::optional<COLORREF> fgColor = std::nullopt;
|
||||
std::optional<COLORREF> bkColor = std::nullopt;
|
||||
for (size_t row = 0; row < rows.text.size(); row++)
|
||||
@ -1931,7 +1931,7 @@ std::string TextBuffer::GenHTML(const TextAndColor& rows,
|
||||
break;
|
||||
}
|
||||
|
||||
bool colorChanged = false;
|
||||
auto colorChanged = false;
|
||||
if (!fgColor.has_value() || rows.FgAttr.at(row).at(col) != fgColor.value())
|
||||
{
|
||||
fgColor = rows.FgAttr.at(row).at(col);
|
||||
@ -1990,10 +1990,10 @@ std::string TextBuffer::GenHTML(const TextAndColor& rows,
|
||||
constexpr size_t ClipboardHeaderSize = 157;
|
||||
|
||||
// these values are byte offsets from start of clipboard
|
||||
const size_t htmlStartPos = ClipboardHeaderSize;
|
||||
const size_t htmlEndPos = ClipboardHeaderSize + gsl::narrow<size_t>(htmlBuilder.tellp());
|
||||
const size_t fragStartPos = ClipboardHeaderSize + gsl::narrow<size_t>(htmlHeader.length());
|
||||
const size_t fragEndPos = htmlEndPos - HtmlFooter.length();
|
||||
const auto htmlStartPos = ClipboardHeaderSize;
|
||||
const auto htmlEndPos = ClipboardHeaderSize + gsl::narrow<size_t>(htmlBuilder.tellp());
|
||||
const auto fragStartPos = ClipboardHeaderSize + gsl::narrow<size_t>(htmlHeader.length());
|
||||
const auto fragEndPos = htmlEndPos - HtmlFooter.length();
|
||||
|
||||
// header required by HTML 0.9 format
|
||||
std::ostringstream clipHeaderBuilder;
|
||||
@ -2050,7 +2050,7 @@ std::string TextBuffer::GenRTF(const TextAndColor& rows, const int fontHeightPoi
|
||||
// keys are colors represented by COLORREF
|
||||
// values are indices of the corresponding colors in the color table
|
||||
std::unordered_map<COLORREF, int> colorMap;
|
||||
int nextColorIndex = 1; // leave 0 for the default color and start from 1.
|
||||
auto nextColorIndex = 1; // leave 0 for the default color and start from 1.
|
||||
|
||||
// RTF color table
|
||||
std::ostringstream colorTableBuilder;
|
||||
@ -2103,7 +2103,7 @@ std::string TextBuffer::GenRTF(const TextAndColor& rows, const int fontHeightPoi
|
||||
break;
|
||||
}
|
||||
|
||||
bool colorChanged = false;
|
||||
auto colorChanged = false;
|
||||
if (!fgColor.has_value() || rows.FgAttr.at(row).at(col) != fgColor.value())
|
||||
{
|
||||
fgColor = rows.FgAttr.at(row).at(col);
|
||||
@ -2120,7 +2120,7 @@ std::string TextBuffer::GenRTF(const TextAndColor& rows, const int fontHeightPoi
|
||||
{
|
||||
writeAccumulatedChars(false);
|
||||
|
||||
int bkColorIndex = 0;
|
||||
auto bkColorIndex = 0;
|
||||
if (colorMap.find(bkColor.value()) != colorMap.end())
|
||||
{
|
||||
// color already exists in the map, just retrieve the index
|
||||
@ -2137,7 +2137,7 @@ std::string TextBuffer::GenRTF(const TextAndColor& rows, const int fontHeightPoi
|
||||
bkColorIndex = nextColorIndex++;
|
||||
}
|
||||
|
||||
int fgColorIndex = 0;
|
||||
auto fgColorIndex = 0;
|
||||
if (colorMap.find(fgColor.value()) != colorMap.end())
|
||||
{
|
||||
// color already exists in the map, just retrieve the index
|
||||
@ -2234,31 +2234,31 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
const std::optional<Viewport> lastCharacterViewport,
|
||||
std::optional<std::reference_wrapper<PositionInformation>> positionInfo)
|
||||
{
|
||||
const Cursor& oldCursor = oldBuffer.GetCursor();
|
||||
Cursor& newCursor = newBuffer.GetCursor();
|
||||
const auto& oldCursor = oldBuffer.GetCursor();
|
||||
auto& newCursor = newBuffer.GetCursor();
|
||||
|
||||
// We need to save the old cursor position so that we can
|
||||
// place the new cursor back on the equivalent character in
|
||||
// the new buffer.
|
||||
const COORD cOldCursorPos = oldCursor.GetPosition();
|
||||
const COORD cOldLastChar = oldBuffer.GetLastNonSpaceCharacter(lastCharacterViewport);
|
||||
const auto cOldCursorPos = oldCursor.GetPosition();
|
||||
const auto cOldLastChar = oldBuffer.GetLastNonSpaceCharacter(lastCharacterViewport);
|
||||
|
||||
const short cOldRowsTotal = cOldLastChar.Y + 1;
|
||||
|
||||
COORD cNewCursorPos = { 0 };
|
||||
bool fFoundCursorPos = false;
|
||||
bool foundOldMutable = false;
|
||||
bool foundOldVisible = false;
|
||||
HRESULT hr = S_OK;
|
||||
auto fFoundCursorPos = false;
|
||||
auto foundOldMutable = false;
|
||||
auto foundOldVisible = false;
|
||||
auto hr = S_OK;
|
||||
// Loop through all the rows of the old buffer and reprint them into the new buffer
|
||||
short iOldRow = 0;
|
||||
for (; iOldRow < cOldRowsTotal; iOldRow++)
|
||||
{
|
||||
// Fetch the row and its "right" which is the last printable character.
|
||||
const ROW& row = oldBuffer.GetRowByOffset(iOldRow);
|
||||
const short cOldColsTotal = oldBuffer.GetLineWidth(iOldRow);
|
||||
const CharRow& charRow = row.GetCharRow();
|
||||
short iRight = gsl::narrow_cast<short>(charRow.MeasureRight());
|
||||
const auto& row = oldBuffer.GetRowByOffset(iOldRow);
|
||||
const auto cOldColsTotal = oldBuffer.GetLineWidth(iOldRow);
|
||||
const auto& charRow = row.GetCharRow();
|
||||
auto iRight = gsl::narrow_cast<short>(charRow.MeasureRight());
|
||||
|
||||
// If we're starting a new row, try and preserve the line rendition
|
||||
// from the row in the original buffer.
|
||||
@ -2348,7 +2348,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
const auto newWidth = newBuffer.GetLineWidth(newRowY);
|
||||
// Stop when we get to the end of the buffer width, or the new position
|
||||
// for inserting an attr would be past the right of the new buffer.
|
||||
for (short copyAttrCol = iOldCol;
|
||||
for (auto copyAttrCol = iOldCol;
|
||||
copyAttrCol < cOldColsTotal && newAttrColumn < newWidth;
|
||||
copyAttrCol++, newAttrColumn++)
|
||||
{
|
||||
@ -2436,7 +2436,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
// |aaaaaaaaaaaaaaaaaaa| no wrap at the end (preserved hard newline)
|
||||
// | |
|
||||
// ^ and the cursor is now here.
|
||||
const COORD coordNewCursor = newCursor.GetPosition();
|
||||
const auto coordNewCursor = newCursor.GetPosition();
|
||||
if (coordNewCursor.X == 0 && coordNewCursor.Y > 0)
|
||||
{
|
||||
if (newBuffer.GetRowByOffset(gsl::narrow_cast<size_t>(coordNewCursor.Y) - 1).WasWrapForced())
|
||||
@ -2460,7 +2460,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
iOldRow < oldHeight && newRowY < newHeight;
|
||||
iOldRow++)
|
||||
{
|
||||
const ROW& row = oldBuffer.GetRowByOffset(iOldRow);
|
||||
const auto& row = oldBuffer.GetRowByOffset(iOldRow);
|
||||
|
||||
// Optimization: Since all these rows are below the last printable char,
|
||||
// we can reasonably assume that they are filled with just spaces.
|
||||
@ -2494,9 +2494,9 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
// Advance the cursor to the same offset as before
|
||||
// get the number of newlines and spaces between the old end of text and the old cursor,
|
||||
// then advance that many newlines and chars
|
||||
int iNewlines = cOldCursorPos.Y - cOldLastChar.Y;
|
||||
const int iIncrements = cOldCursorPos.X - cOldLastChar.X;
|
||||
const COORD cNewLastChar = newBuffer.GetLastNonSpaceCharacter();
|
||||
auto iNewlines = cOldCursorPos.Y - cOldLastChar.Y;
|
||||
const auto iIncrements = cOldCursorPos.X - cOldLastChar.X;
|
||||
const auto cNewLastChar = newBuffer.GetLastNonSpaceCharacter();
|
||||
|
||||
// If the last row of the new buffer wrapped, there's going to be one less newline needed,
|
||||
// because the cursor is already on the next line
|
||||
@ -2514,7 +2514,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
}
|
||||
}
|
||||
|
||||
for (int r = 0; r < iNewlines; r++)
|
||||
for (auto r = 0; r < iNewlines; r++)
|
||||
{
|
||||
if (!newBuffer.NewlineCursor())
|
||||
{
|
||||
@ -2524,7 +2524,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
}
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
for (int c = 0; c < iIncrements - 1; c++)
|
||||
for (auto c = 0; c < iIncrements - 1; c++)
|
||||
{
|
||||
if (!newBuffer.IncrementCursor())
|
||||
{
|
||||
@ -2539,7 +2539,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// Save old cursor size before we delete it
|
||||
ULONG const ulSize = oldCursor.GetSize();
|
||||
const auto ulSize = oldCursor.GetSize();
|
||||
|
||||
// Set size back to real size as it will be taking over the rendering duties.
|
||||
newCursor.SetSize(ulSize);
|
||||
@ -2726,14 +2726,14 @@ PointTree TextBuffer::GetPatterns(const size_t firstRow, const size_t lastRow) c
|
||||
// match and the previous match, so we use the size of the prefix
|
||||
// along with the size of the match to determine the locations
|
||||
size_t prefixSize = 0;
|
||||
for (const std::vector<wchar_t> parsedGlyph : Utf16Parser::Parse(i->prefix().str()))
|
||||
for (const auto parsedGlyph : Utf16Parser::Parse(i->prefix().str()))
|
||||
{
|
||||
const std::wstring_view glyph{ parsedGlyph.data(), parsedGlyph.size() };
|
||||
prefixSize += IsGlyphFullWidth(glyph) ? 2 : 1;
|
||||
}
|
||||
const auto start = lenUpToThis + prefixSize;
|
||||
size_t matchSize = 0;
|
||||
for (const std::vector<wchar_t> parsedGlyph : Utf16Parser::Parse(i->str()))
|
||||
for (const auto parsedGlyph : Utf16Parser::Parse(i->str()))
|
||||
{
|
||||
const std::wstring_view glyph{ parsedGlyph.data(), parsedGlyph.size() };
|
||||
matchSize += IsGlyphFullWidth(glyph) ? 2 : 1;
|
||||
|
||||
@ -96,7 +96,7 @@ TextBufferCellIterator& TextBufferCellIterator::operator+=(const ptrdiff_t& move
|
||||
{
|
||||
// Note that this method is called intensively when the terminal is under heavy load.
|
||||
// We need to aggressively optimize it, comparing to the -= operator.
|
||||
ptrdiff_t move = movement;
|
||||
auto move = movement;
|
||||
if (move < 0)
|
||||
{
|
||||
// Early branching to leave the rare case to -= operator.
|
||||
@ -165,7 +165,7 @@ TextBufferCellIterator& TextBufferCellIterator::operator+=(const ptrdiff_t& move
|
||||
_attrIter += diff;
|
||||
_view.UpdateTextAttribute(*_attrIter);
|
||||
|
||||
const CharRow& charRow = _pRow->GetCharRow();
|
||||
const auto& charRow = _pRow->GetCharRow();
|
||||
_view.UpdateText(charRow.GlyphAt(newX));
|
||||
_view.UpdateDbcsAttribute(charRow.DbcsAttrAt(newX));
|
||||
_pos.X = newX;
|
||||
@ -191,7 +191,7 @@ TextBufferCellIterator& TextBufferCellIterator::operator+=(const ptrdiff_t& move
|
||||
// - Reference to self after movement.
|
||||
TextBufferCellIterator& TextBufferCellIterator::operator-=(const ptrdiff_t& movement)
|
||||
{
|
||||
ptrdiff_t move = movement;
|
||||
auto move = movement;
|
||||
if (move < 0)
|
||||
{
|
||||
return (*this) += (-move);
|
||||
@ -233,7 +233,7 @@ TextBufferCellIterator& TextBufferCellIterator::operator--()
|
||||
// - Value with previous position prior to movement.
|
||||
TextBufferCellIterator TextBufferCellIterator::operator++(int)
|
||||
{
|
||||
auto temp(*this);
|
||||
auto temp = *this;
|
||||
operator++();
|
||||
return temp;
|
||||
}
|
||||
@ -244,7 +244,7 @@ TextBufferCellIterator TextBufferCellIterator::operator++(int)
|
||||
// - Value with previous position prior to movement.
|
||||
TextBufferCellIterator TextBufferCellIterator::operator--(int)
|
||||
{
|
||||
auto temp(*this);
|
||||
auto temp = *this;
|
||||
operator--();
|
||||
return temp;
|
||||
}
|
||||
@ -257,7 +257,7 @@ TextBufferCellIterator TextBufferCellIterator::operator--(int)
|
||||
// - Value with previous position prior to movement.
|
||||
TextBufferCellIterator TextBufferCellIterator::operator+(const ptrdiff_t& movement)
|
||||
{
|
||||
auto temp(*this);
|
||||
auto temp = *this;
|
||||
temp += movement;
|
||||
return temp;
|
||||
}
|
||||
@ -270,7 +270,7 @@ TextBufferCellIterator TextBufferCellIterator::operator+(const ptrdiff_t& moveme
|
||||
// - Value with previous position prior to movement.
|
||||
TextBufferCellIterator TextBufferCellIterator::operator-(const ptrdiff_t& movement)
|
||||
{
|
||||
auto temp(*this);
|
||||
auto temp = *this;
|
||||
temp -= movement;
|
||||
return temp;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ void TextAttributeTests::TestRoundtripLegacy()
|
||||
WORD expectedLegacy = FOREGROUND_BLUE | BACKGROUND_RED;
|
||||
WORD bgOnly = expectedLegacy & BG_ATTRS;
|
||||
WORD bgShifted = bgOnly >> 4;
|
||||
BYTE bgByte = (BYTE)(bgShifted);
|
||||
auto bgByte = (BYTE)(bgShifted);
|
||||
|
||||
VERIFY_ARE_EQUAL(FOREGROUND_RED, bgByte);
|
||||
|
||||
@ -65,9 +65,9 @@ void TextAttributeTests::TestRoundtripMetaBits()
|
||||
COMMON_LVB_UNDERSCORE
|
||||
};
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(metaFlags); ++i)
|
||||
for (auto i = 0; i < ARRAYSIZE(metaFlags); ++i)
|
||||
{
|
||||
WORD flag = metaFlags[i];
|
||||
auto flag = metaFlags[i];
|
||||
WORD expectedLegacy = FOREGROUND_BLUE | BACKGROUND_RED | flag;
|
||||
WORD metaOnly = expectedLegacy & META_ATTRS;
|
||||
VERIFY_ARE_EQUAL(flag, metaOnly);
|
||||
@ -114,9 +114,9 @@ void TextAttributeTests::TestRoundtripExhaustive()
|
||||
void TextAttributeTests::TestTextAttributeColorGetters()
|
||||
{
|
||||
const auto& colorTable = _renderSettings.GetColorTable();
|
||||
const COLORREF red = RGB(255, 0, 0);
|
||||
const COLORREF faintRed = RGB(127, 0, 0);
|
||||
const COLORREF green = RGB(0, 255, 0);
|
||||
const auto red = RGB(255, 0, 0);
|
||||
const auto faintRed = RGB(127, 0, 0);
|
||||
const auto green = RGB(0, 255, 0);
|
||||
TextAttribute attr(red, green);
|
||||
|
||||
// verify that calculated foreground/background are the same as the direct
|
||||
@ -178,8 +178,8 @@ void TextAttributeTests::TestTextAttributeColorGetters()
|
||||
void TextAttributeTests::TestReverseDefaultColors()
|
||||
{
|
||||
const auto& colorTable = _renderSettings.GetColorTable();
|
||||
const COLORREF red = RGB(255, 0, 0);
|
||||
const COLORREF green = RGB(0, 255, 0);
|
||||
const auto red = RGB(255, 0, 0);
|
||||
const auto green = RGB(0, 255, 0);
|
||||
TextAttribute attr{};
|
||||
|
||||
// verify that calculated foreground/background are the same as the direct
|
||||
@ -260,9 +260,9 @@ void TextAttributeTests::TestRoundtripDefaultColors()
|
||||
void TextAttributeTests::TestIntenseAsBright()
|
||||
{
|
||||
const auto& colorTable = _renderSettings.GetColorTable();
|
||||
const COLORREF darkBlack = til::at(colorTable, 0);
|
||||
const COLORREF brightBlack = til::at(colorTable, 8);
|
||||
const COLORREF darkGreen = til::at(colorTable, 2);
|
||||
const auto darkBlack = til::at(colorTable, 0);
|
||||
const auto brightBlack = til::at(colorTable, 8);
|
||||
const auto darkGreen = til::at(colorTable, 2);
|
||||
|
||||
TextAttribute attr{};
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ void TextColorTests::TestBrightIndexColor()
|
||||
|
||||
void TextColorTests::TestRgbColor()
|
||||
{
|
||||
COLORREF myColor = RGB(7, 8, 9);
|
||||
auto myColor = RGB(7, 8, 9);
|
||||
TextColor rgbColor(myColor);
|
||||
|
||||
VERIFY_IS_FALSE(rgbColor.IsDefault());
|
||||
@ -140,7 +140,7 @@ void TextColorTests::TestRgbColor()
|
||||
|
||||
void TextColorTests::TestChangeColor()
|
||||
{
|
||||
COLORREF myColor = RGB(7, 8, 9);
|
||||
auto myColor = RGB(7, 8, 9);
|
||||
TextColor rgbColor(myColor);
|
||||
|
||||
VERIFY_IS_FALSE(rgbColor.IsDefault());
|
||||
|
||||
@ -28,7 +28,7 @@ class UnicodeStorageTests
|
||||
// verify it was stored
|
||||
auto findIt = storage._map.find(coord);
|
||||
VERIFY_ARE_NOT_EQUAL(findIt, storage._map.end());
|
||||
const std::vector<wchar_t>& newMoonGlyph = findIt->second;
|
||||
const auto& newMoonGlyph = findIt->second;
|
||||
VERIFY_ARE_EQUAL(newMoonGlyph.size(), newMoon.size());
|
||||
for (size_t i = 0; i < newMoon.size(); ++i)
|
||||
{
|
||||
@ -41,7 +41,7 @@ class UnicodeStorageTests
|
||||
// verify the glyph was overwritten
|
||||
findIt = storage._map.find(coord);
|
||||
VERIFY_ARE_NOT_EQUAL(findIt, storage._map.end());
|
||||
const std::vector<wchar_t>& fullMoonGlyph = findIt->second;
|
||||
const auto& fullMoonGlyph = findIt->second;
|
||||
VERIFY_ARE_EQUAL(fullMoonGlyph.size(), fullMoon.size());
|
||||
for (size_t i = 0; i < fullMoon.size(); ++i)
|
||||
{
|
||||
|
||||
@ -90,7 +90,7 @@ namespace SettingsModelLocalTests
|
||||
}
|
||||
|
||||
Log::Comment(L"Roundtrip Test for Color Scheme");
|
||||
Json::Value outJson{ scheme->ToJson() };
|
||||
auto outJson{ scheme->ToJson() };
|
||||
VERIFY_ARE_EQUAL(schemeObject, outJson);
|
||||
}
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ namespace SettingsModelLocalTests
|
||||
const auto commands1Json = VerifyParseSucceeded(commands1String);
|
||||
const auto commands2Json = VerifyParseSucceeded(commands2String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
{
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
@ -92,7 +92,7 @@ namespace SettingsModelLocalTests
|
||||
const auto commands2Json = VerifyParseSucceeded(commands2String);
|
||||
const auto commands3Json = VerifyParseSucceeded(commands3String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
{
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
@ -154,7 +154,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
const auto commands0Json = VerifyParseSucceeded(commands0String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
VERIFY_ARE_EQUAL(0u, warnings.size());
|
||||
@ -272,7 +272,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
const auto commands0Json = VerifyParseSucceeded(commands0String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
VERIFY_ARE_EQUAL(3u, warnings.size());
|
||||
@ -298,7 +298,7 @@ namespace SettingsModelLocalTests
|
||||
const std::string commands0String{ R"([ { "name": { "key": "DuplicateTabCommandKey"}, "command": "copy" } ])" };
|
||||
const auto commands0Json = VerifyParseSucceeded(commands0String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
{
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
@ -340,7 +340,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
const auto commands0Json = VerifyParseSucceeded(commands0String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
VERIFY_ARE_EQUAL(0u, warnings.size());
|
||||
@ -410,7 +410,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
const auto commands0Json = VerifyParseSucceeded(commands0String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
VERIFY_ARE_EQUAL(0u, warnings.size());
|
||||
@ -473,7 +473,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
const auto commands0Json = VerifyParseSucceeded(commands0String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
VERIFY_ARE_EQUAL(0u, warnings.size());
|
||||
|
||||
@ -159,7 +159,7 @@ namespace SettingsModelLocalTests
|
||||
}
|
||||
{
|
||||
// Case 2: Bad settings
|
||||
bool caughtExpectedException = false;
|
||||
auto caughtExpectedException = false;
|
||||
try
|
||||
{
|
||||
auto settings = winrt::make_self<implementation::CascadiaSettings>(settingsWithoutProfiles);
|
||||
@ -173,7 +173,7 @@ namespace SettingsModelLocalTests
|
||||
}
|
||||
{
|
||||
// Case 3: Bad settings
|
||||
bool caughtExpectedException = false;
|
||||
auto caughtExpectedException = false;
|
||||
try
|
||||
{
|
||||
auto settings = winrt::make_self<implementation::CascadiaSettings>(settingsWithEmptyProfiles);
|
||||
@ -886,7 +886,7 @@ namespace SettingsModelLocalTests
|
||||
const winrt::guid guid1{ Utils::GuidFromString(L"{6239a42c-6666-49a3-80bd-e8fdd045185c}") };
|
||||
const winrt::guid guid2{ Utils::GuidFromString(L"{2C4DE342-38B7-51CF-B940-2309A097F518}") };
|
||||
const winrt::guid fakeGuid{ Utils::GuidFromString(L"{FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF}") };
|
||||
const winrt::guid autogeneratedGuid{ implementation::Profile::_GenerateGuidForProfile(name3, L"") };
|
||||
const auto autogeneratedGuid{ implementation::Profile::_GenerateGuidForProfile(name3, L"") };
|
||||
|
||||
const auto settings = createSettings(settings0String);
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ public:
|
||||
|
||||
Json::Value root;
|
||||
std::string errs;
|
||||
const bool parseResult = reader->parse(content.data(), content.data() + content.size(), &root, &errs);
|
||||
const auto parseResult = reader->parse(content.data(), content.data() + content.size(), &root, &errs);
|
||||
VERIFY_IS_TRUE(parseResult, winrt::to_hstring(errs).c_str());
|
||||
return root;
|
||||
};
|
||||
|
||||
@ -82,9 +82,9 @@ namespace SettingsModelLocalTests
|
||||
expectedArgv.reserve(expectedArgc * 65);
|
||||
input.reserve(expectedArgc * 67);
|
||||
|
||||
for (int i = 0; i < expectedArgc; ++i)
|
||||
for (auto i = 0; i < expectedArgc; ++i)
|
||||
{
|
||||
const bool useQuotes = static_cast<bool>(rng(2));
|
||||
const auto useQuotes = static_cast<bool>(rng(2));
|
||||
// We need to ensure there is at least one character
|
||||
const auto count = static_cast<size_t>(rng(64) + 1);
|
||||
const auto ch = static_cast<wchar_t>(rng('z' - 'a' + 1) + 'a');
|
||||
|
||||
@ -199,7 +199,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_SUCCEEDED(TestData::TryGetValue(L"testPass", testPass), L"Get a commandline to test");
|
||||
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*>& rawCommands{ commandsToTest.at(testPass) };
|
||||
auto& rawCommands{ commandsToTest.at(testPass) };
|
||||
_logCommandline(rawCommands);
|
||||
|
||||
auto commandlines = AppCommandlineArgs::BuildCommands(rawCommands);
|
||||
@ -232,7 +232,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_SUCCEEDED(TestData::TryGetValue(L"testPass", testPass), L"Get a commandline to test");
|
||||
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*>& rawCommands{ commandsToTest.at(testPass) };
|
||||
auto& rawCommands{ commandsToTest.at(testPass) };
|
||||
_logCommandline(rawCommands);
|
||||
|
||||
auto commandlines = AppCommandlineArgs::BuildCommands(rawCommands);
|
||||
@ -266,7 +266,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_SUCCEEDED(TestData::TryGetValue(L"testPass", testPass), L"Get a commandline to test");
|
||||
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*>& rawCommands{ commandsToTest.at(testPass) };
|
||||
auto& rawCommands{ commandsToTest.at(testPass) };
|
||||
_logCommandline(rawCommands);
|
||||
|
||||
auto commandlines = AppCommandlineArgs::BuildCommands(rawCommands);
|
||||
@ -439,7 +439,7 @@ namespace TerminalAppLocalTests
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortForm, L"If true, use `nt` instead of `new-tab`");
|
||||
const wchar_t* subcommand = useShortForm ? L"nt" : L"new-tab";
|
||||
auto subcommand = useShortForm ? L"nt" : L"new-tab";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
@ -697,7 +697,7 @@ namespace TerminalAppLocalTests
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortForm, L"If true, use `sp` instead of `split-pane`");
|
||||
const wchar_t* subcommand = useShortForm ? L"sp" : L"split-pane";
|
||||
auto subcommand = useShortForm ? L"sp" : L"split-pane";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
@ -880,8 +880,8 @@ namespace TerminalAppLocalTests
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortFormNewTab, L"If true, use `nt` instead of `new-tab`");
|
||||
INIT_TEST_PROPERTY(bool, useShortFormSplitPane, L"If true, use `sp` instead of `split-pane`");
|
||||
const wchar_t* ntSubcommand = useShortFormNewTab ? L"nt" : L"new-tab";
|
||||
const wchar_t* spSubcommand = useShortFormSplitPane ? L"sp" : L"split-pane";
|
||||
auto ntSubcommand = useShortFormNewTab ? L"nt" : L"new-tab";
|
||||
auto spSubcommand = useShortFormSplitPane ? L"sp" : L"split-pane";
|
||||
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", ntSubcommand, L";", spSubcommand };
|
||||
@ -1009,7 +1009,7 @@ namespace TerminalAppLocalTests
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortForm, L"If true, use `ft` instead of `focus-tab`");
|
||||
const wchar_t* subcommand = useShortForm ? L"ft" : L"focus-tab";
|
||||
auto subcommand = useShortForm ? L"ft" : L"focus-tab";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
@ -1101,7 +1101,7 @@ namespace TerminalAppLocalTests
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortForm, L"If true, use `mf` instead of `move-focus`");
|
||||
const wchar_t* subcommand = useShortForm ? L"mf" : L"move-focus";
|
||||
auto subcommand = useShortForm ? L"mf" : L"move-focus";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
@ -1214,7 +1214,7 @@ namespace TerminalAppLocalTests
|
||||
|
||||
void CommandlineTest::ParseSwapPaneArgs()
|
||||
{
|
||||
const wchar_t* subcommand = L"swap-pane";
|
||||
auto subcommand = L"swap-pane";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
@ -1332,7 +1332,7 @@ namespace TerminalAppLocalTests
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortForm, L"If true, use `fp` instead of `focus-pane`");
|
||||
const wchar_t* subcommand = useShortForm ? L"fp" : L"focus-pane";
|
||||
auto subcommand = useShortForm ? L"fp" : L"focus-pane";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
@ -1765,7 +1765,7 @@ namespace TerminalAppLocalTests
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortForm, L"If true, use `sp` instead of `split-pane`");
|
||||
const wchar_t* subcommand = useShortForm ? L"sp" : L"split-pane";
|
||||
auto subcommand = useShortForm ? L"sp" : L"split-pane";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
|
||||
@ -81,7 +81,7 @@ HRESULT RunOnUIThread(const TFunction& function)
|
||||
return HRESULT_FROM_WIN32(::GetLastError());
|
||||
}
|
||||
|
||||
HRESULT invokeResult = E_FAIL;
|
||||
auto invokeResult = E_FAIL;
|
||||
|
||||
auto asyncAction = d.RunAsync(winrt::Windows::UI::Core::CoreDispatcherPriority::Normal,
|
||||
[&invokeResult, &function]() {
|
||||
@ -94,7 +94,7 @@ HRESULT RunOnUIThread(const TFunction& function)
|
||||
});
|
||||
|
||||
// Wait for the callback to complete
|
||||
HRESULT hr = completedEvent.Wait();
|
||||
auto hr = completedEvent.Wait();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return hr;
|
||||
|
||||
@ -1052,7 +1052,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(4u, page->_tabs.Size());
|
||||
|
||||
TestOnUIThread([&page]() {
|
||||
uint32_t focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
auto focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
VERIFY_ARE_EQUAL(3u, focusedIndex, L"Verify the fourth tab is the focused one");
|
||||
});
|
||||
|
||||
@ -1062,7 +1062,7 @@ namespace TerminalAppLocalTests
|
||||
});
|
||||
|
||||
TestOnUIThread([&page]() {
|
||||
uint32_t focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
auto focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
VERIFY_ARE_EQUAL(1u, focusedIndex, L"Verify the second tab is the focused one");
|
||||
});
|
||||
|
||||
@ -1088,7 +1088,7 @@ namespace TerminalAppLocalTests
|
||||
});
|
||||
|
||||
TestOnUIThread([&page]() {
|
||||
uint32_t focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
auto focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
VERIFY_ARE_EQUAL(3u, focusedIndex, L"Verify the fourth tab is the focused one");
|
||||
});
|
||||
|
||||
@ -1109,7 +1109,7 @@ namespace TerminalAppLocalTests
|
||||
});
|
||||
|
||||
TestOnUIThread([&page]() {
|
||||
uint32_t focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
auto focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
VERIFY_ARE_EQUAL(1u, focusedIndex, L"Verify the second tab is the focused one");
|
||||
});
|
||||
|
||||
@ -1121,7 +1121,7 @@ namespace TerminalAppLocalTests
|
||||
page->_SelectNextTab(true, nullptr);
|
||||
});
|
||||
TestOnUIThread([&page]() {
|
||||
uint32_t focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
auto focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
VERIFY_ARE_EQUAL(2u, focusedIndex, L"Verify the third tab is the focused one");
|
||||
});
|
||||
|
||||
@ -1133,7 +1133,7 @@ namespace TerminalAppLocalTests
|
||||
page->_SelectNextTab(true, nullptr);
|
||||
});
|
||||
TestOnUIThread([&page]() {
|
||||
uint32_t focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
auto focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
VERIFY_ARE_EQUAL(3u, focusedIndex, L"Verify the fourth tab is the focused one");
|
||||
});
|
||||
}
|
||||
@ -1244,7 +1244,7 @@ namespace TerminalAppLocalTests
|
||||
page->WindowName(args.ProposedName());
|
||||
});
|
||||
|
||||
bool windowNameChanged = false;
|
||||
auto windowNameChanged = false;
|
||||
page->PropertyChanged([&page, &windowNameChanged](auto&&, const winrt::WUX::Data::PropertyChangedEventArgs& args) mutable {
|
||||
if (args.PropertyName() == L"WindowNameForDisplay")
|
||||
{
|
||||
@ -1274,7 +1274,7 @@ namespace TerminalAppLocalTests
|
||||
page->RenameFailed();
|
||||
});
|
||||
|
||||
bool windowNameChanged = false;
|
||||
auto windowNameChanged = false;
|
||||
|
||||
page->PropertyChanged([&page, &windowNameChanged](auto&&, const winrt::WUX::Data::PropertyChangedEventArgs& args) mutable {
|
||||
if (args.PropertyName() == L"WindowNameForDisplay")
|
||||
|
||||
@ -38,7 +38,7 @@ static bool _IsGlyphWideForceNarrowFallback(const std::wstring_view /* glyph */)
|
||||
static bool _EnsureStaticInitialization()
|
||||
{
|
||||
// use C++11 magic statics to make sure we only do this once.
|
||||
static bool initialized = []() {
|
||||
static auto initialized = []() {
|
||||
// *** THIS IS A SINGLETON ***
|
||||
SetGlyphWidthFallback(_IsGlyphWideForceNarrowFallback);
|
||||
|
||||
@ -55,7 +55,7 @@ LRESULT CALLBACK HwndTerminal::HwndTerminalWndProc(
|
||||
try
|
||||
{
|
||||
#pragma warning(suppress : 26490) // Win32 APIs can only store void*, have to use reinterpret_cast
|
||||
HwndTerminal* terminal = reinterpret_cast<HwndTerminal*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
|
||||
auto terminal = reinterpret_cast<HwndTerminal*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
|
||||
|
||||
if (terminal)
|
||||
{
|
||||
@ -178,7 +178,7 @@ HwndTerminal::HwndTerminal(HWND parentHwnd) :
|
||||
{
|
||||
_EnsureStaticInitialization();
|
||||
|
||||
HINSTANCE hInstance = wil::GetModuleInstanceHandle();
|
||||
auto hInstance = wil::GetModuleInstanceHandle();
|
||||
|
||||
if (RegisterTermClass(hInstance))
|
||||
{
|
||||
@ -536,7 +536,7 @@ try
|
||||
};
|
||||
|
||||
auto lock = _terminal->LockForWriting();
|
||||
const bool altPressed = GetKeyState(VK_MENU) < 0;
|
||||
const auto altPressed = GetKeyState(VK_MENU) < 0;
|
||||
const til::size fontSize{ this->_actualFont.GetSize() };
|
||||
|
||||
this->_terminal->SetBlockSelection(altPressed);
|
||||
@ -626,7 +626,7 @@ void _stdcall TerminalClearSelection(void* terminal)
|
||||
bool _stdcall TerminalIsSelectionActive(void* terminal)
|
||||
{
|
||||
const auto publicTerminal = static_cast<const HwndTerminal*>(terminal);
|
||||
const bool selectionActive = publicTerminal->_terminal->IsSelectionActive();
|
||||
const auto selectionActive = publicTerminal->_terminal->IsSelectionActive();
|
||||
return selectionActive;
|
||||
}
|
||||
|
||||
@ -684,7 +684,7 @@ static ControlKeyStates getControlKeyState() noexcept
|
||||
bool HwndTerminal::_CanSendVTMouseInput() const noexcept
|
||||
{
|
||||
// Only allow the transit of mouse events if shift isn't pressed.
|
||||
const bool shiftPressed = GetKeyState(VK_SHIFT) < 0;
|
||||
const auto shiftPressed = GetKeyState(VK_SHIFT) < 0;
|
||||
return !shiftPressed && _focused && _terminal->IsTrackingMouseInput();
|
||||
}
|
||||
|
||||
@ -703,7 +703,7 @@ try
|
||||
wheelDelta = HIWORD(wParam);
|
||||
|
||||
// If it's a *WHEEL event, it's in screen coordinates, not window (?!)
|
||||
POINT coordsToTransform = cursorPosition.to_win32_point();
|
||||
auto coordsToTransform = cursorPosition.to_win32_point();
|
||||
ScreenToClient(_hwnd.get(), &coordsToTransform);
|
||||
cursorPosition = til::point{ coordsToTransform };
|
||||
}
|
||||
@ -849,7 +849,7 @@ void __stdcall TerminalKillFocus(void* terminal)
|
||||
// Arguments:
|
||||
// - rows - Rows of text data to copy
|
||||
// - fAlsoCopyFormatting - true if the color and formatting should also be copied, false otherwise
|
||||
HRESULT HwndTerminal::_CopyTextToSystemClipboard(const TextBuffer::TextAndColor& rows, bool const fAlsoCopyFormatting)
|
||||
HRESULT HwndTerminal::_CopyTextToSystemClipboard(const TextBuffer::TextAndColor& rows, const bool fAlsoCopyFormatting)
|
||||
try
|
||||
{
|
||||
std::wstring finalString;
|
||||
@ -861,17 +861,17 @@ try
|
||||
}
|
||||
|
||||
// allocate the final clipboard data
|
||||
const size_t cchNeeded = finalString.size() + 1;
|
||||
const size_t cbNeeded = sizeof(wchar_t) * cchNeeded;
|
||||
const auto cchNeeded = finalString.size() + 1;
|
||||
const auto cbNeeded = sizeof(wchar_t) * cchNeeded;
|
||||
wil::unique_hglobal globalHandle(GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, cbNeeded));
|
||||
RETURN_LAST_ERROR_IF_NULL(globalHandle.get());
|
||||
|
||||
PWSTR pwszClipboard = static_cast<PWSTR>(GlobalLock(globalHandle.get()));
|
||||
auto pwszClipboard = static_cast<PWSTR>(GlobalLock(globalHandle.get()));
|
||||
RETURN_LAST_ERROR_IF_NULL(pwszClipboard);
|
||||
|
||||
// The pattern gets a bit strange here because there's no good wil built-in for global lock of this type.
|
||||
// Try to copy then immediately unlock. Don't throw until after (so the hglobal won't be freed until we unlock).
|
||||
const HRESULT hr = StringCchCopyW(pwszClipboard, cchNeeded, finalString.data());
|
||||
const auto hr = StringCchCopyW(pwszClipboard, cchNeeded, finalString.data());
|
||||
GlobalUnlock(globalHandle.get());
|
||||
RETURN_IF_FAILED(hr);
|
||||
|
||||
@ -889,13 +889,13 @@ try
|
||||
if (fAlsoCopyFormatting)
|
||||
{
|
||||
const auto& fontData = _actualFont;
|
||||
int const iFontHeightPoints = fontData.GetUnscaledSize().Y; // this renderer uses points already
|
||||
const COLORREF bgColor = _terminal->GetAttributeColors({}).second;
|
||||
const int iFontHeightPoints = fontData.GetUnscaledSize().Y; // this renderer uses points already
|
||||
const auto bgColor = _terminal->GetAttributeColors({}).second;
|
||||
|
||||
std::string HTMLToPlaceOnClip = TextBuffer::GenHTML(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor);
|
||||
auto HTMLToPlaceOnClip = TextBuffer::GenHTML(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor);
|
||||
_CopyToSystemClipboard(HTMLToPlaceOnClip, L"HTML Format");
|
||||
|
||||
std::string RTFToPlaceOnClip = TextBuffer::GenRTF(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor);
|
||||
auto RTFToPlaceOnClip = TextBuffer::GenRTF(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor);
|
||||
_CopyToSystemClipboard(RTFToPlaceOnClip, L"Rich Text Format");
|
||||
}
|
||||
}
|
||||
@ -916,22 +916,22 @@ CATCH_RETURN()
|
||||
// - lpszFormat - the name of the format
|
||||
HRESULT HwndTerminal::_CopyToSystemClipboard(std::string stringToCopy, LPCWSTR lpszFormat)
|
||||
{
|
||||
const size_t cbData = stringToCopy.size() + 1; // +1 for '\0'
|
||||
const auto cbData = stringToCopy.size() + 1; // +1 for '\0'
|
||||
if (cbData)
|
||||
{
|
||||
wil::unique_hglobal globalHandleData(GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, cbData));
|
||||
RETURN_LAST_ERROR_IF_NULL(globalHandleData.get());
|
||||
|
||||
PSTR pszClipboardHTML = static_cast<PSTR>(GlobalLock(globalHandleData.get()));
|
||||
auto pszClipboardHTML = static_cast<PSTR>(GlobalLock(globalHandleData.get()));
|
||||
RETURN_LAST_ERROR_IF_NULL(pszClipboardHTML);
|
||||
|
||||
// The pattern gets a bit strange here because there's no good wil built-in for global lock of this type.
|
||||
// Try to copy then immediately unlock. Don't throw until after (so the hglobal won't be freed until we unlock).
|
||||
const HRESULT hr2 = StringCchCopyA(pszClipboardHTML, cbData, stringToCopy.data());
|
||||
const auto hr2 = StringCchCopyA(pszClipboardHTML, cbData, stringToCopy.data());
|
||||
GlobalUnlock(globalHandleData.get());
|
||||
RETURN_IF_FAILED(hr2);
|
||||
|
||||
UINT const CF_FORMAT = RegisterClipboardFormatW(lpszFormat);
|
||||
const auto CF_FORMAT = RegisterClipboardFormatW(lpszFormat);
|
||||
RETURN_LAST_ERROR_IF(0 == CF_FORMAT);
|
||||
|
||||
RETURN_LAST_ERROR_IF_NULL(SetClipboardData(CF_FORMAT, globalHandleData.get()));
|
||||
@ -953,14 +953,14 @@ void HwndTerminal::_PasteTextFromClipboard() noexcept
|
||||
return;
|
||||
}
|
||||
|
||||
HANDLE ClipboardDataHandle = GetClipboardData(CF_UNICODETEXT);
|
||||
auto ClipboardDataHandle = GetClipboardData(CF_UNICODETEXT);
|
||||
if (ClipboardDataHandle == nullptr)
|
||||
{
|
||||
CloseClipboard();
|
||||
return;
|
||||
}
|
||||
|
||||
PCWCH pwstr = static_cast<PCWCH>(GlobalLock(ClipboardDataHandle));
|
||||
auto pwstr = static_cast<PCWCH>(GlobalLock(ClipboardDataHandle));
|
||||
|
||||
_StringPaste(pwstr);
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ private:
|
||||
|
||||
void _UpdateFont(int newDpi);
|
||||
void _WriteTextToConnection(const std::wstring_view text) noexcept;
|
||||
HRESULT _CopyTextToSystemClipboard(const TextBuffer::TextAndColor& rows, bool const fAlsoCopyFormatting);
|
||||
HRESULT _CopyTextToSystemClipboard(const TextBuffer::TextAndColor& rows, const bool fAlsoCopyFormatting);
|
||||
HRESULT _CopyToSystemClipboard(std::string stringToCopy, LPCWSTR lpszFormat);
|
||||
void _PasteTextFromClipboard() noexcept;
|
||||
void _StringPaste(const wchar_t* const pData) noexcept;
|
||||
|
||||
@ -13,7 +13,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// It must be defined after CommandlineArgs.g.cpp, otherwise the compiler
|
||||
// will give you just the most impossible template errors to try and
|
||||
// decipher.
|
||||
void CommandlineArgs::Commandline(winrt::array_view<const winrt::hstring> const& value)
|
||||
void CommandlineArgs::Commandline(const winrt::array_view<const winrt::hstring>& value)
|
||||
{
|
||||
_args = { value.begin(), value.end() };
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
|
||||
winrt::hstring CurrentDirectory() { return _cwd; };
|
||||
|
||||
void Commandline(winrt::array_view<const winrt::hstring> const& value);
|
||||
void Commandline(const winrt::array_view<const winrt::hstring>& value);
|
||||
winrt::com_array<winrt::hstring> Commandline();
|
||||
|
||||
private:
|
||||
|
||||
@ -821,7 +821,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
void Monarch::_renameRequested(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const winrt::Microsoft::Terminal::Remoting::RenameRequestArgs& args)
|
||||
{
|
||||
bool successfullyRenamed = false;
|
||||
auto successfullyRenamed = false;
|
||||
|
||||
try
|
||||
{
|
||||
@ -972,7 +972,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
|
||||
bool Monarch::DoesQuakeWindowExist()
|
||||
{
|
||||
bool result = false;
|
||||
auto result = false;
|
||||
const auto func = [&](const auto& /*id*/, const auto& p) {
|
||||
if (p.WindowName() == QuakeWindowName)
|
||||
{
|
||||
|
||||
@ -86,7 +86,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// activated.
|
||||
_lastActivatedArgs = args;
|
||||
|
||||
bool successfullyNotified = false;
|
||||
auto successfullyNotified = false;
|
||||
// Raise our WindowActivated event, to let the monarch know we've been
|
||||
// activated.
|
||||
try
|
||||
@ -172,7 +172,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// - <none>
|
||||
void Peasant::RequestIdentifyWindows()
|
||||
{
|
||||
bool successfullyNotified = false;
|
||||
auto successfullyNotified = false;
|
||||
|
||||
try
|
||||
{
|
||||
@ -197,7 +197,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
|
||||
void Peasant::RequestRename(const winrt::Microsoft::Terminal::Remoting::RenameRequestArgs& args)
|
||||
{
|
||||
bool successfullyNotified = false;
|
||||
auto successfullyNotified = false;
|
||||
const auto oldName{ _WindowName };
|
||||
try
|
||||
{
|
||||
|
||||
@ -26,7 +26,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// Register with COM as a server for the Monarch class
|
||||
_registerAsMonarch();
|
||||
// Instantiate an instance of the Monarch. This may or may not be in-proc!
|
||||
bool foundMonarch = false;
|
||||
auto foundMonarch = false;
|
||||
while (!foundMonarch)
|
||||
{
|
||||
try
|
||||
@ -83,8 +83,8 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
winrt::hstring& givenName)
|
||||
{
|
||||
// these two errors are Win32 errors, convert them to HRESULTS so we can actually compare below.
|
||||
static constexpr HRESULT RPC_SERVER_UNAVAILABLE_HR = HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE);
|
||||
static constexpr HRESULT RPC_CALL_FAILED_HR = HRESULT_FROM_WIN32(RPC_S_CALL_FAILED);
|
||||
static constexpr auto RPC_SERVER_UNAVAILABLE_HR = HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE);
|
||||
static constexpr auto RPC_CALL_FAILED_HR = HRESULT_FROM_WIN32(RPC_S_CALL_FAILED);
|
||||
|
||||
// The monarch may respond back "you should be a new
|
||||
// window, with ID,name of (id, name)". Really the responses are:
|
||||
@ -101,7 +101,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// starting a defterm, and when that BP gets hit, kill the original
|
||||
// monarch, and see what happens here.
|
||||
|
||||
bool proposedCommandline = false;
|
||||
auto proposedCommandline = false;
|
||||
Remoting::ProposeCommandlineResult result{ nullptr };
|
||||
while (!proposedCommandline)
|
||||
{
|
||||
@ -113,7 +113,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// dies between now and the inspection of
|
||||
// `result.ShouldCreateWindow` below, we don't want to explode
|
||||
// (since _proposeToMonarch is not try/caught).
|
||||
Remoting::ProposeCommandlineResult outOfProcResult = _monarch.ProposeCommandline(args);
|
||||
auto outOfProcResult = _monarch.ProposeCommandline(args);
|
||||
result = winrt::make<implementation::ProposeCommandlineResult>(outOfProcResult);
|
||||
|
||||
proposedCommandline = true;
|
||||
@ -550,7 +550,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
waits[1] = _monarchWaitInterrupt.get();
|
||||
const auto peasantID = _peasant.GetID(); // safe: _peasant is in-proc.
|
||||
|
||||
bool exitThreadRequested = false;
|
||||
auto exitThreadRequested = false;
|
||||
while (!exitThreadRequested)
|
||||
{
|
||||
// At any point in all this, the current monarch might die. If it
|
||||
@ -652,7 +652,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
TraceLoggingUInt64(peasantID, "peasantID", "Our peasant ID"),
|
||||
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
|
||||
TraceLoggingKeyword(TIL_KEYWORD_TRACE));
|
||||
bool foundNewMonarch = false;
|
||||
auto foundNewMonarch = false;
|
||||
while (!foundNewMonarch)
|
||||
{
|
||||
try
|
||||
|
||||
@ -18,7 +18,7 @@ using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
ActionPaletteItem::ActionPaletteItem(Microsoft::Terminal::Settings::Model::Command const& command) :
|
||||
ActionPaletteItem::ActionPaletteItem(const Microsoft::Terminal::Settings::Model::Command& command) :
|
||||
_Command(command)
|
||||
{
|
||||
Name(command.Name());
|
||||
|
||||
@ -11,7 +11,7 @@ namespace winrt::TerminalApp::implementation
|
||||
struct ActionPaletteItem : ActionPaletteItemT<ActionPaletteItem, PaletteItem>
|
||||
{
|
||||
ActionPaletteItem() = default;
|
||||
ActionPaletteItem(Microsoft::Terminal::Settings::Model::Command const& command);
|
||||
ActionPaletteItem(const Microsoft::Terminal::Settings::Model::Command& command);
|
||||
|
||||
WINRT_PROPERTY(Microsoft::Terminal::Settings::Model::Command, Command, nullptr);
|
||||
|
||||
|
||||
@ -7,12 +7,12 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
using IXamlType = ::winrt::Windows::UI::Xaml::Markup::IXamlType;
|
||||
|
||||
IXamlType GetXamlType(::winrt::Windows::UI::Xaml::Interop::TypeName const& type)
|
||||
IXamlType GetXamlType(const ::winrt::Windows::UI::Xaml::Interop::TypeName& type)
|
||||
{
|
||||
return _appProvider.GetXamlType(type);
|
||||
}
|
||||
|
||||
IXamlType GetXamlType(::winrt::hstring const& fullName)
|
||||
IXamlType GetXamlType(const ::winrt::hstring& fullName)
|
||||
{
|
||||
return _appProvider.GetXamlType(fullName);
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ namespace winrt::TerminalApp::implementation
|
||||
/// will be used such as when the application is launched to open a specific file.
|
||||
/// </summary>
|
||||
/// <param name="e">Details about the launch request and process.</param>
|
||||
void App::OnLaunched(LaunchActivatedEventArgs const& /*e*/)
|
||||
void App::OnLaunched(const LaunchActivatedEventArgs& /*e*/)
|
||||
{
|
||||
// if this is a UWP... it means its our problem to hook up the content to the window here.
|
||||
if (_isUwp)
|
||||
|
||||
@ -12,7 +12,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
public:
|
||||
App();
|
||||
void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const&);
|
||||
void OnLaunched(const Windows::ApplicationModel::Activation::LaunchActivatedEventArgs&);
|
||||
|
||||
TerminalApp::AppLogic Logic();
|
||||
|
||||
|
||||
@ -837,7 +837,7 @@ namespace winrt::TerminalApp::implementation
|
||||
if (WindowRenamer() == nullptr)
|
||||
{
|
||||
// We need to use FindName to lazy-load this object
|
||||
if (MUX::Controls::TeachingTip tip{ FindName(L"WindowRenamer").try_as<MUX::Controls::TeachingTip>() })
|
||||
if (auto tip{ FindName(L"WindowRenamer").try_as<MUX::Controls::TeachingTip>() })
|
||||
{
|
||||
tip.Closed({ get_weak(), &TerminalPage::_FocusActiveControl });
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ AppCommandlineArgs::AppCommandlineArgs()
|
||||
// - nonzero return values are defined in CLI::ExitCodes
|
||||
int AppCommandlineArgs::ParseCommand(const Commandline& command)
|
||||
{
|
||||
const int argc = static_cast<int>(command.Argc());
|
||||
const auto argc = static_cast<int>(command.Argc());
|
||||
|
||||
// Stash a pointer to the current Commandline instance we're parsing.
|
||||
// When we're trying to parse the commandline for a new-tab/split-pane
|
||||
@ -809,7 +809,7 @@ void AppCommandlineArgs::_addCommandsForArg(std::vector<Commandline>& commands,
|
||||
else
|
||||
{
|
||||
// Harder case: There was a match.
|
||||
const bool matchedFirstChar = match.position(0) == 0;
|
||||
const auto matchedFirstChar = match.position(0) == 0;
|
||||
// If the match was at the beginning of the string, then the
|
||||
// next arg should be "", since there was no content before the
|
||||
// delimiter. Otherwise, add one, since the regex will include
|
||||
@ -1013,7 +1013,7 @@ int AppCommandlineArgs::ParseArgs(const winrt::Microsoft::Terminal::Settings::Mo
|
||||
// Convert the commandline into an array of args with
|
||||
// CommandLineToArgvW, similar to how the app typically does when
|
||||
// called from the commandline.
|
||||
int argc = 0;
|
||||
auto argc = 0;
|
||||
wil::unique_any<LPWSTR*, decltype(&::LocalFree), ::LocalFree> argv{ CommandLineToArgvW(args.Commandline().c_str(), &argc) };
|
||||
if (argv)
|
||||
{
|
||||
|
||||
@ -18,8 +18,8 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
AppKeyBindings() = default;
|
||||
|
||||
bool TryKeyChord(winrt::Microsoft::Terminal::Control::KeyChord const& kc);
|
||||
bool IsKeyChordExplicitlyUnbound(winrt::Microsoft::Terminal::Control::KeyChord const& kc);
|
||||
bool TryKeyChord(const winrt::Microsoft::Terminal::Control::KeyChord& kc);
|
||||
bool IsKeyChordExplicitlyUnbound(const winrt::Microsoft::Terminal::Control::KeyChord& kc);
|
||||
|
||||
void SetDispatch(const winrt::TerminalApp::ShortcutActionDispatch& dispatch);
|
||||
void SetActionMap(const Microsoft::Terminal::Settings::Model::IActionMapView& actionMap);
|
||||
|
||||
@ -122,10 +122,10 @@ static Documents::Run _BuildErrorRun(const winrt::hstring& text, const ResourceD
|
||||
textRun.Text(text);
|
||||
|
||||
// Color the text red (light theme) or yellow (dark theme) based on the system theme
|
||||
winrt::IInspectable key = winrt::box_value(L"ErrorTextBrush");
|
||||
auto key = winrt::box_value(L"ErrorTextBrush");
|
||||
if (resources.HasKey(key))
|
||||
{
|
||||
winrt::IInspectable g = resources.Lookup(key);
|
||||
auto g = resources.Lookup(key);
|
||||
auto brush = g.try_as<winrt::Windows::UI::Xaml::Media::Brush>();
|
||||
textRun.Foreground(brush);
|
||||
}
|
||||
@ -601,7 +601,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
winrt::Windows::Foundation::Size proposedSize{};
|
||||
|
||||
const float scale = static_cast<float>(dpi) / static_cast<float>(USER_DEFAULT_SCREEN_DPI);
|
||||
const auto scale = static_cast<float>(dpi) / static_cast<float>(USER_DEFAULT_SCREEN_DPI);
|
||||
if (const auto layout = _root->LoadPersistedLayout(_settings))
|
||||
{
|
||||
if (layout.InitialSize())
|
||||
@ -781,7 +781,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - S_OK if we successfully parsed the settings, otherwise an appropriate HRESULT.
|
||||
[[nodiscard]] HRESULT AppLogic::_TryLoadSettings() noexcept
|
||||
{
|
||||
HRESULT hr = E_FAIL;
|
||||
auto hr = E_FAIL;
|
||||
|
||||
try
|
||||
{
|
||||
@ -1354,7 +1354,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// now.
|
||||
if (parsedTarget.empty())
|
||||
{
|
||||
int32_t windowId = WindowingBehaviorUseNew;
|
||||
auto windowId = WindowingBehaviorUseNew;
|
||||
switch (windowingBehavior)
|
||||
{
|
||||
case WindowingMode::UseNew:
|
||||
@ -1375,7 +1375,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// window's ID:
|
||||
try
|
||||
{
|
||||
int32_t windowId = ::base::saturated_cast<int32_t>(std::stoi(parsedTarget));
|
||||
auto windowId = ::base::saturated_cast<int32_t>(std::stoi(parsedTarget));
|
||||
|
||||
// If the user provides _any_ negative number, then treat it as
|
||||
// -1, for "use a new window".
|
||||
|
||||
@ -67,9 +67,9 @@ HSL ColorHelper::RgbToHsl(const winrt::Windows::UI::Color& color)
|
||||
|
||||
// three decimal places after the comma ought
|
||||
// to be enough for everybody - Bill Gates, 1981
|
||||
float finalH = std::roundf(h * 60);
|
||||
float finalS = std::roundf(s * 1000) / 1000;
|
||||
float finalL = std::roundf(l * 1000) / 1000;
|
||||
auto finalH = std::roundf(h * 60);
|
||||
auto finalS = std::roundf(s * 1000) / 1000;
|
||||
auto finalL = std::roundf(l * 1000) / 1000;
|
||||
|
||||
return HSL{ finalH, finalS, finalL };
|
||||
}
|
||||
@ -264,6 +264,6 @@ float ColorHelper::GetLuminance(const winrt::Windows::UI::Color& color)
|
||||
{
|
||||
B = std::pow(((BsRGB + 0.055f) / 1.055f), 2.4f);
|
||||
}
|
||||
float luminance = (0.2126f * R) + (0.7152f * G) + (0.0722f * B);
|
||||
auto luminance = (0.2126f * R) + (0.7152f * G) + (0.0722f * B);
|
||||
return std::roundf(luminance * 10000) / 10000.f;
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - sender: the rectangle that got clicked
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void ColorPickupFlyout::ColorButton_Click(IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const&)
|
||||
void ColorPickupFlyout::ColorButton_Click(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
{
|
||||
auto button{ sender.as<Windows::UI::Xaml::Controls::Button>() };
|
||||
auto rectClr{ button.Background().as<Windows::UI::Xaml::Media::SolidColorBrush>() };
|
||||
@ -46,7 +46,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void ColorPickupFlyout::ClearColorButton_Click(IInspectable const&, Windows::UI::Xaml::RoutedEventArgs const&)
|
||||
void ColorPickupFlyout::ClearColorButton_Click(const IInspectable&, const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
{
|
||||
_ColorClearedHandlers();
|
||||
Hide();
|
||||
@ -60,7 +60,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void ColorPickupFlyout::ShowColorPickerButton_Click(Windows::Foundation::IInspectable const&, Windows::UI::Xaml::RoutedEventArgs const&)
|
||||
void ColorPickupFlyout::ShowColorPickerButton_Click(const Windows::Foundation::IInspectable&, const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
{
|
||||
auto visibility = customColorPanel().Visibility();
|
||||
if (visibility == winrt::Windows::UI::Xaml::Visibility::Collapsed)
|
||||
@ -80,7 +80,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void ColorPickupFlyout::CustomColorButton_Click(Windows::Foundation::IInspectable const&, Windows::UI::Xaml::RoutedEventArgs const&)
|
||||
void ColorPickupFlyout::CustomColorButton_Click(const Windows::Foundation::IInspectable&, const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
{
|
||||
auto color = customColorPicker().Color();
|
||||
_ColorSelectedHandlers(color);
|
||||
|
||||
@ -7,10 +7,10 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
ColorPickupFlyout();
|
||||
|
||||
void ColorButton_Click(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void ShowColorPickerButton_Click(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void CustomColorButton_Click(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void ClearColorButton_Click(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void ColorButton_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void ShowColorPickerButton_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void CustomColorButton_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void ClearColorButton_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void ColorPicker_ColorChanged(const Microsoft::UI::Xaml::Controls::ColorPicker&, const Microsoft::UI::Xaml::Controls::ColorChangedEventArgs& args);
|
||||
|
||||
WINRT_CALLBACK(ColorCleared, TerminalApp::ColorClearedArgs);
|
||||
|
||||
@ -18,7 +18,7 @@ using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
CommandLinePaletteItem::CommandLinePaletteItem(winrt::hstring const& commandLine) :
|
||||
CommandLinePaletteItem::CommandLinePaletteItem(const winrt::hstring& commandLine) :
|
||||
_CommandLine(commandLine)
|
||||
{
|
||||
Name(commandLine);
|
||||
|
||||
@ -11,7 +11,7 @@ namespace winrt::TerminalApp::implementation
|
||||
struct CommandLinePaletteItem : CommandLinePaletteItemT<CommandLinePaletteItem, PaletteItem>
|
||||
{
|
||||
CommandLinePaletteItem() = default;
|
||||
CommandLinePaletteItem(winrt::hstring const& commandLine);
|
||||
CommandLinePaletteItem(const winrt::hstring& commandLine);
|
||||
|
||||
WINRT_PROPERTY(winrt::hstring, CommandLine);
|
||||
};
|
||||
|
||||
@ -119,7 +119,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void CommandPalette::SelectNextItem(const bool moveDown)
|
||||
{
|
||||
auto selected = _filteredActionsView().SelectedIndex();
|
||||
const int numItems = ::base::saturated_cast<int>(_filteredActionsView().Items().Size());
|
||||
const auto numItems = ::base::saturated_cast<int>(_filteredActionsView().Items().Size());
|
||||
|
||||
// Do not try to select an item if
|
||||
// - the list is empty
|
||||
@ -262,8 +262,8 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void CommandPalette::_previewKeyDownHandler(IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e)
|
||||
void CommandPalette::_previewKeyDownHandler(const IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
const auto key = e.OriginalKey();
|
||||
const auto scanCode = e.KeyStatus().ScanCode;
|
||||
@ -411,8 +411,8 @@ namespace winrt::TerminalApp::implementation
|
||||
return handled;
|
||||
}
|
||||
|
||||
void CommandPalette::_keyUpHandler(IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e)
|
||||
void CommandPalette::_keyUpHandler(const IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
if (_currentMode == CommandPaletteMode::TabSwitchMode)
|
||||
{
|
||||
@ -453,8 +453,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <unused>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_rootPointerPressed(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::Input::PointerRoutedEventArgs const& /*e*/)
|
||||
void CommandPalette::_rootPointerPressed(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Input::PointerRoutedEventArgs& /*e*/)
|
||||
{
|
||||
if (Visibility() != Visibility::Collapsed)
|
||||
{
|
||||
@ -476,8 +476,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <unused>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_lostFocusHandler(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::RoutedEventArgs const& /*args*/)
|
||||
void CommandPalette::_lostFocusHandler(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& /*args*/)
|
||||
{
|
||||
const auto flyout = _searchBox().ContextFlyout();
|
||||
if (flyout && flyout.IsOpen())
|
||||
@ -511,8 +511,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - e: the PointerRoutedEventArgs that we want to mark as handled
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_backdropPointerPressed(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e)
|
||||
void CommandPalette::_backdropPointerPressed(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e)
|
||||
{
|
||||
e.Handled(true);
|
||||
}
|
||||
@ -525,8 +525,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - e: an ItemClickEventArgs who's ClickedItem() will be the command that was clicked on.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_listItemClicked(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::Controls::ItemClickEventArgs const& e)
|
||||
void CommandPalette::_listItemClicked(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Controls::ItemClickEventArgs& e)
|
||||
{
|
||||
const auto selectedCommand = e.ClickedItem();
|
||||
if (const auto filteredCommand = selectedCommand.try_as<winrt::TerminalApp::FilteredCommand>())
|
||||
@ -543,8 +543,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - sender: the button that got clicked
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_moveBackButtonClicked(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::RoutedEventArgs const&)
|
||||
void CommandPalette::_moveBackButtonClicked(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
{
|
||||
_PreviewActionHandlers(*this, nullptr);
|
||||
_nestedActionStack.Clear();
|
||||
@ -628,7 +628,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - command: the Command to dispatch. This might be null.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_dispatchCommand(winrt::TerminalApp::FilteredCommand const& filteredCommand)
|
||||
void CommandPalette::_dispatchCommand(const winrt::TerminalApp::FilteredCommand& filteredCommand)
|
||||
{
|
||||
if (_currentMode == CommandPaletteMode::CommandlineMode)
|
||||
{
|
||||
@ -724,7 +724,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - filteredCommand - Selected filtered command - might be null
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_switchToTab(winrt::TerminalApp::FilteredCommand const& filteredCommand)
|
||||
void CommandPalette::_switchToTab(const winrt::TerminalApp::FilteredCommand& filteredCommand)
|
||||
{
|
||||
if (filteredCommand)
|
||||
{
|
||||
@ -744,7 +744,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - filteredCommand - Selected filtered command - might be null
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_dispatchCommandline(winrt::TerminalApp::FilteredCommand const& command)
|
||||
void CommandPalette::_dispatchCommandline(const winrt::TerminalApp::FilteredCommand& command)
|
||||
{
|
||||
const auto filteredCommand = command ? command : _buildCommandLineCommand(winrt::hstring(_getTrimmedInput()));
|
||||
if (filteredCommand.has_value())
|
||||
@ -804,8 +804,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <unused>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_filterTextChanged(IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::RoutedEventArgs const& /*args*/)
|
||||
void CommandPalette::_filterTextChanged(const IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& /*args*/)
|
||||
{
|
||||
if (_currentMode == CommandPaletteMode::CommandlineMode)
|
||||
{
|
||||
@ -906,7 +906,7 @@ namespace winrt::TerminalApp::implementation
|
||||
_actionMap = actionMap;
|
||||
}
|
||||
|
||||
void CommandPalette::SetCommands(Collections::IVector<Command> const& actions)
|
||||
void CommandPalette::SetCommands(const Collections::IVector<Command>& actions)
|
||||
{
|
||||
_allCommands.Clear();
|
||||
for (const auto& action : actions)
|
||||
@ -934,8 +934,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_bindTabs(
|
||||
Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase> const& source,
|
||||
Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand> const& target)
|
||||
const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase>& source,
|
||||
const Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand>& target)
|
||||
{
|
||||
target.Clear();
|
||||
for (const auto& tab : source)
|
||||
@ -946,13 +946,13 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void CommandPalette::SetTabs(Collections::IObservableVector<TabBase> const& tabs, Collections::IObservableVector<TabBase> const& mruTabs)
|
||||
void CommandPalette::SetTabs(const Collections::IObservableVector<TabBase>& tabs, const Collections::IObservableVector<TabBase>& mruTabs)
|
||||
{
|
||||
_bindTabs(tabs, _tabActions);
|
||||
_bindTabs(mruTabs, _mruTabActions);
|
||||
}
|
||||
|
||||
void CommandPalette::EnableCommandPaletteMode(CommandPaletteLaunchMode const launchMode)
|
||||
void CommandPalette::EnableCommandPaletteMode(const CommandPaletteLaunchMode launchMode)
|
||||
{
|
||||
const auto mode = (launchMode == CommandPaletteLaunchMode::CommandLine) ?
|
||||
CommandPaletteMode::CommandlineMode :
|
||||
@ -1088,11 +1088,11 @@ namespace winrt::TerminalApp::implementation
|
||||
// This allows WinUI to nicely animate the ListView as it changes.
|
||||
for (uint32_t i = 0; i < _filteredActions.Size() && i < actions.size(); i++)
|
||||
{
|
||||
for (uint32_t j = i; j < _filteredActions.Size(); j++)
|
||||
for (auto j = i; j < _filteredActions.Size(); j++)
|
||||
{
|
||||
if (_filteredActions.GetAt(j).Item() == actions[i].Item())
|
||||
{
|
||||
for (uint32_t k = i; k < j; k++)
|
||||
for (auto k = i; k < j; k++)
|
||||
{
|
||||
_filteredActions.RemoveAt(i);
|
||||
}
|
||||
@ -1174,8 +1174,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_choosingItemContainer(
|
||||
Windows::UI::Xaml::Controls::ListViewBase const& /*sender*/,
|
||||
Windows::UI::Xaml::Controls::ChoosingItemContainerEventArgs const& args)
|
||||
const Windows::UI::Xaml::Controls::ListViewBase& /*sender*/,
|
||||
const Windows::UI::Xaml::Controls::ChoosingItemContainerEventArgs& args)
|
||||
{
|
||||
const auto dataTemplate = _itemTemplateSelector.SelectTemplate(args.Item());
|
||||
const auto itemContainer = args.ItemContainer();
|
||||
@ -1223,8 +1223,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_containerContentChanging(
|
||||
Windows::UI::Xaml::Controls::ListViewBase const& /*sender*/,
|
||||
Windows::UI::Xaml::Controls::ContainerContentChangingEventArgs const& args)
|
||||
const Windows::UI::Xaml::Controls::ListViewBase& /*sender*/,
|
||||
const Windows::UI::Xaml::Controls::ContainerContentChangingEventArgs& args)
|
||||
{
|
||||
const auto itemContainer = args.ItemContainer();
|
||||
if (args.InRecycleQueue() && itemContainer && itemContainer.ContentTemplate())
|
||||
|
||||
@ -29,8 +29,8 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::FilteredCommand> FilteredActions();
|
||||
|
||||
void SetCommands(Windows::Foundation::Collections::IVector<Microsoft::Terminal::Settings::Model::Command> const& actions);
|
||||
void SetTabs(Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase> const& tabs, Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase> const& mruTabs);
|
||||
void SetCommands(const Windows::Foundation::Collections::IVector<Microsoft::Terminal::Settings::Model::Command>& actions);
|
||||
void SetTabs(const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase>& tabs, const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase>& mruTabs);
|
||||
void SetActionMap(const Microsoft::Terminal::Settings::Model::IActionMapView& actionMap);
|
||||
|
||||
bool OnDirectKeyEvent(const uint32_t vkey, const uint8_t scanCode, const bool down);
|
||||
@ -71,28 +71,28 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
bool _lastFilterTextWasEmpty{ true };
|
||||
|
||||
void _filterTextChanged(Windows::Foundation::IInspectable const& sender,
|
||||
Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void _previewKeyDownHandler(Windows::Foundation::IInspectable const& sender,
|
||||
Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e);
|
||||
void _filterTextChanged(const Windows::Foundation::IInspectable& sender,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void _previewKeyDownHandler(const Windows::Foundation::IInspectable& sender,
|
||||
const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
|
||||
void _keyUpHandler(Windows::Foundation::IInspectable const& sender,
|
||||
Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e);
|
||||
void _keyUpHandler(const Windows::Foundation::IInspectable& sender,
|
||||
const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
|
||||
void _selectedCommandChanged(Windows::Foundation::IInspectable const& sender,
|
||||
Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void _selectedCommandChanged(const Windows::Foundation::IInspectable& sender,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
|
||||
void _updateUIForStackChange();
|
||||
|
||||
void _rootPointerPressed(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);
|
||||
void _rootPointerPressed(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e);
|
||||
|
||||
void _lostFocusHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void _lostFocusHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
|
||||
void _backdropPointerPressed(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);
|
||||
void _backdropPointerPressed(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e);
|
||||
|
||||
void _listItemClicked(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Controls::ItemClickEventArgs const& e);
|
||||
void _listItemClicked(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Controls::ItemClickEventArgs& e);
|
||||
|
||||
void _moveBackButtonClicked(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const&);
|
||||
void _moveBackButtonClicked(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs&);
|
||||
|
||||
void _updateFilteredActions();
|
||||
|
||||
@ -114,14 +114,14 @@ namespace winrt::TerminalApp::implementation
|
||||
Microsoft::Terminal::Settings::Model::TabSwitcherMode _tabSwitcherMode;
|
||||
uint32_t _switcherStartIdx;
|
||||
|
||||
void _bindTabs(Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase> const& source, Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand> const& target);
|
||||
void _bindTabs(const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase>& source, const Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand>& target);
|
||||
void _anchorKeyUpHandler();
|
||||
|
||||
winrt::Windows::UI::Xaml::Controls::ListView::SizeChanged_revoker _sizeChangedRevoker;
|
||||
|
||||
void _dispatchCommand(winrt::TerminalApp::FilteredCommand const& command);
|
||||
void _dispatchCommandline(winrt::TerminalApp::FilteredCommand const& command);
|
||||
void _switchToTab(winrt::TerminalApp::FilteredCommand const& command);
|
||||
void _dispatchCommand(const winrt::TerminalApp::FilteredCommand& command);
|
||||
void _dispatchCommandline(const winrt::TerminalApp::FilteredCommand& command);
|
||||
void _switchToTab(const winrt::TerminalApp::FilteredCommand& command);
|
||||
static std::optional<winrt::TerminalApp::FilteredCommand> _buildCommandLineCommand(const winrt::hstring& commandLine);
|
||||
|
||||
void _dismissPalette();
|
||||
@ -134,8 +134,8 @@ namespace winrt::TerminalApp::implementation
|
||||
static void _updateRecentCommands(const winrt::hstring& command);
|
||||
::TerminalApp::AppCommandlineArgs _appArgs;
|
||||
|
||||
void _choosingItemContainer(Windows::UI::Xaml::Controls::ListViewBase const& sender, Windows::UI::Xaml::Controls::ChoosingItemContainerEventArgs const& args);
|
||||
void _containerContentChanging(Windows::UI::Xaml::Controls::ListViewBase const& sender, Windows::UI::Xaml::Controls::ContainerContentChangingEventArgs const& args);
|
||||
void _choosingItemContainer(const Windows::UI::Xaml::Controls::ListViewBase& sender, const Windows::UI::Xaml::Controls::ChoosingItemContainerEventArgs& args);
|
||||
void _containerContentChanging(const Windows::UI::Xaml::Controls::ListViewBase& sender, const Windows::UI::Xaml::Controls::ContainerContentChangingEventArgs& args);
|
||||
winrt::TerminalApp::PaletteItemTemplateSelector _itemTemplateSelector{ nullptr };
|
||||
std::unordered_map<Windows::UI::Xaml::DataTemplate, std::unordered_set<Windows::UI::Xaml::Controls::Primitives::SelectorItem>> _listViewItemsCache;
|
||||
Windows::UI::Xaml::DataTemplate _listItemTemplate;
|
||||
|
||||
@ -27,8 +27,8 @@ const std::vector<std::string>& Commandline::Args() const
|
||||
void Commandline::AddArg(const std::wstring& nextArg)
|
||||
{
|
||||
// Attempt to convert '\;' in the arg to just '\', removing the escaping
|
||||
std::wstring modifiedArg{ nextArg };
|
||||
size_t pos = modifiedArg.find(EscapedDelimiter, 0);
|
||||
auto modifiedArg{ nextArg };
|
||||
auto pos = modifiedArg.find(EscapedDelimiter, 0);
|
||||
while (pos != std::string::npos)
|
||||
{
|
||||
modifiedArg.replace(pos, EscapedDelimiter.length(), Delimiter);
|
||||
|
||||
@ -39,17 +39,17 @@ namespace winrt::Microsoft::TerminalApp::implementation
|
||||
|
||||
_wrappedConnection.Start();
|
||||
}
|
||||
void WriteInput(hstring const& data)
|
||||
void WriteInput(const hstring& data)
|
||||
{
|
||||
_pairedTap->_PrintInput(data);
|
||||
_wrappedConnection.WriteInput(data);
|
||||
}
|
||||
void Resize(uint32_t rows, uint32_t columns) { _wrappedConnection.Resize(rows, columns); }
|
||||
void Close() { _wrappedConnection.Close(); }
|
||||
winrt::event_token TerminalOutput(TerminalOutputHandler const& args) { return _wrappedConnection.TerminalOutput(args); };
|
||||
void TerminalOutput(winrt::event_token const& token) noexcept { _wrappedConnection.TerminalOutput(token); };
|
||||
winrt::event_token StateChanged(TypedEventHandler<ITerminalConnection, IInspectable> const& handler) { return _wrappedConnection.StateChanged(handler); };
|
||||
void StateChanged(winrt::event_token const& token) noexcept { _wrappedConnection.StateChanged(token); };
|
||||
winrt::event_token TerminalOutput(const TerminalOutputHandler& args) { return _wrappedConnection.TerminalOutput(args); };
|
||||
void TerminalOutput(const winrt::event_token& token) noexcept { _wrappedConnection.TerminalOutput(token); };
|
||||
winrt::event_token StateChanged(const TypedEventHandler<ITerminalConnection, IInspectable>& handler) { return _wrappedConnection.StateChanged(handler); };
|
||||
void StateChanged(const winrt::event_token& token) noexcept { _wrappedConnection.StateChanged(token); };
|
||||
ConnectionState State() const noexcept { return _wrappedConnection.State(); }
|
||||
|
||||
private:
|
||||
@ -78,7 +78,7 @@ namespace winrt::Microsoft::TerminalApp::implementation
|
||||
_start.count_down();
|
||||
}
|
||||
|
||||
void DebugTapConnection::WriteInput(hstring const& data)
|
||||
void DebugTapConnection::WriteInput(const hstring& data)
|
||||
{
|
||||
// If the user types into the tap side, forward it to the input side
|
||||
if (auto strongInput{ _inputSide.get() })
|
||||
|
||||
@ -16,7 +16,7 @@ namespace winrt::Microsoft::TerminalApp::implementation
|
||||
void Initialize(const Windows::Foundation::Collections::ValueSet& /*settings*/){};
|
||||
~DebugTapConnection();
|
||||
void Start();
|
||||
void WriteInput(hstring const& data);
|
||||
void WriteInput(const hstring& data);
|
||||
void Resize(uint32_t rows, uint32_t columns);
|
||||
void Close();
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ConnectionState State() const noexcept;
|
||||
|
||||
@ -18,20 +18,20 @@ namespace winrt::TerminalApp::implementation
|
||||
// - value: the input object to attempt to convert into a Visibility.
|
||||
// Return Value:
|
||||
// - Visible if the object was a string and wasn't the empty string.
|
||||
Foundation::IInspectable EmptyStringVisibilityConverter::Convert(Foundation::IInspectable const& value,
|
||||
Windows::UI::Xaml::Interop::TypeName const& /* targetType */,
|
||||
Foundation::IInspectable const& /* parameter */,
|
||||
hstring const& /* language */)
|
||||
Foundation::IInspectable EmptyStringVisibilityConverter::Convert(const Foundation::IInspectable& value,
|
||||
const Windows::UI::Xaml::Interop::TypeName& /* targetType */,
|
||||
const Foundation::IInspectable& /* parameter */,
|
||||
const hstring& /* language */)
|
||||
{
|
||||
const auto& name = winrt::unbox_value_or<hstring>(value, L"");
|
||||
return winrt::box_value(name.empty() ? Visibility::Collapsed : Visibility::Visible);
|
||||
}
|
||||
|
||||
// unused for one-way bindings
|
||||
Foundation::IInspectable EmptyStringVisibilityConverter::ConvertBack(Foundation::IInspectable const& /* value */,
|
||||
Windows::UI::Xaml::Interop::TypeName const& /* targetType */,
|
||||
Foundation::IInspectable const& /* parameter */,
|
||||
hstring const& /* language */)
|
||||
Foundation::IInspectable EmptyStringVisibilityConverter::ConvertBack(const Foundation::IInspectable& /* value */,
|
||||
const Windows::UI::Xaml::Interop::TypeName& /* targetType */,
|
||||
const Foundation::IInspectable& /* parameter */,
|
||||
const hstring& /* language */)
|
||||
{
|
||||
throw hresult_not_implemented();
|
||||
}
|
||||
|
||||
@ -8,15 +8,15 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
EmptyStringVisibilityConverter() = default;
|
||||
|
||||
Windows::Foundation::IInspectable Convert(Windows::Foundation::IInspectable const& value,
|
||||
Windows::UI::Xaml::Interop::TypeName const& targetType,
|
||||
Windows::Foundation::IInspectable const& parameter,
|
||||
hstring const& language);
|
||||
Windows::Foundation::IInspectable Convert(const Windows::Foundation::IInspectable& value,
|
||||
const Windows::UI::Xaml::Interop::TypeName& targetType,
|
||||
const Windows::Foundation::IInspectable& parameter,
|
||||
const hstring& language);
|
||||
|
||||
Windows::Foundation::IInspectable ConvertBack(Windows::Foundation::IInspectable const& value,
|
||||
Windows::UI::Xaml::Interop::TypeName const& targetType,
|
||||
Windows::Foundation::IInspectable const& parameter,
|
||||
hstring const& language);
|
||||
Windows::Foundation::IInspectable ConvertBack(const Windows::Foundation::IInspectable& value,
|
||||
const Windows::UI::Xaml::Interop::TypeName& targetType,
|
||||
const Windows::Foundation::IInspectable& parameter,
|
||||
const hstring& language);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
// This class is a wrapper of PaletteItem, that is used as an item of a filterable list in CommandPalette.
|
||||
// It manages a highlighted text that is computed by matching search filter characters to item name
|
||||
FilteredCommand::FilteredCommand(winrt::TerminalApp::PaletteItem const& item) :
|
||||
FilteredCommand::FilteredCommand(const winrt::TerminalApp::PaletteItem& item) :
|
||||
_Item(item),
|
||||
_Filter(L""),
|
||||
_Weight(0)
|
||||
@ -39,7 +39,7 @@ namespace winrt::TerminalApp::implementation
|
||||
});
|
||||
}
|
||||
|
||||
void FilteredCommand::UpdateFilter(winrt::hstring const& filter)
|
||||
void FilteredCommand::UpdateFilter(const winrt::hstring& filter)
|
||||
{
|
||||
// If the filter was not changed we want to prevent the re-computation of matching
|
||||
// that might result in triggering a notification event
|
||||
@ -74,7 +74,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
const auto segments = winrt::single_threaded_observable_vector<winrt::TerminalApp::HighlightedTextSegment>();
|
||||
auto commandName = _Item.Name();
|
||||
bool isProcessingMatchedSegment = false;
|
||||
auto isProcessingMatchedSegment = false;
|
||||
uint32_t nextOffsetToReport = 0;
|
||||
uint32_t currentOffset = 0;
|
||||
|
||||
@ -191,8 +191,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - the relative weight of this match
|
||||
int FilteredCommand::_computeWeight()
|
||||
{
|
||||
int result = 0;
|
||||
bool isNextSegmentWordBeginning = true;
|
||||
auto result = 0;
|
||||
auto isNextSegmentWordBeginning = true;
|
||||
|
||||
for (const auto& segment : _HighlightedName.Segments())
|
||||
{
|
||||
@ -225,7 +225,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - other: another instance of FilteredCommand interface
|
||||
// Return Value:
|
||||
// - Returns true if the first is "bigger" (aka should appear first)
|
||||
int FilteredCommand::Compare(winrt::TerminalApp::FilteredCommand const& first, winrt::TerminalApp::FilteredCommand const& second)
|
||||
int FilteredCommand::Compare(const winrt::TerminalApp::FilteredCommand& first, const winrt::TerminalApp::FilteredCommand& second)
|
||||
{
|
||||
auto firstWeight{ first.Weight() };
|
||||
auto secondWeight{ second.Weight() };
|
||||
|
||||
@ -17,11 +17,11 @@ namespace winrt::TerminalApp::implementation
|
||||
struct FilteredCommand : FilteredCommandT<FilteredCommand>
|
||||
{
|
||||
FilteredCommand() = default;
|
||||
FilteredCommand(winrt::TerminalApp::PaletteItem const& item);
|
||||
FilteredCommand(const winrt::TerminalApp::PaletteItem& item);
|
||||
|
||||
void UpdateFilter(winrt::hstring const& filter);
|
||||
void UpdateFilter(const winrt::hstring& filter);
|
||||
|
||||
static int Compare(winrt::TerminalApp::FilteredCommand const& first, winrt::TerminalApp::FilteredCommand const& second);
|
||||
static int Compare(const winrt::TerminalApp::FilteredCommand& first, const winrt::TerminalApp::FilteredCommand& second);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::TerminalApp::PaletteItem, Item, _PropertyChangedHandlers, nullptr);
|
||||
|
||||
@ -18,13 +18,13 @@ using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
HighlightedTextSegment::HighlightedTextSegment(winrt::hstring const& textSegment, bool isHighlighted) :
|
||||
HighlightedTextSegment::HighlightedTextSegment(const winrt::hstring& textSegment, bool isHighlighted) :
|
||||
_TextSegment(textSegment),
|
||||
_IsHighlighted(isHighlighted)
|
||||
{
|
||||
}
|
||||
|
||||
HighlightedText::HighlightedText(Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment> const& segments) :
|
||||
HighlightedText::HighlightedText(const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment>& segments) :
|
||||
_Segments(segments)
|
||||
{
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ namespace winrt::TerminalApp::implementation
|
||||
struct HighlightedTextSegment : HighlightedTextSegmentT<HighlightedTextSegment>
|
||||
{
|
||||
HighlightedTextSegment() = default;
|
||||
HighlightedTextSegment(winrt::hstring const& text, bool isHighlighted);
|
||||
HighlightedTextSegment(const winrt::hstring& text, bool isHighlighted);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, TextSegment, _PropertyChangedHandlers);
|
||||
@ -23,7 +23,7 @@ namespace winrt::TerminalApp::implementation
|
||||
struct HighlightedText : HighlightedTextT<HighlightedText>
|
||||
{
|
||||
HighlightedText() = default;
|
||||
HighlightedText(Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment> const& segments);
|
||||
HighlightedText(const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment>& segments);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment>, Segments, _PropertyChangedHandlers);
|
||||
|
||||
@ -54,7 +54,7 @@ namespace winrt::TerminalApp::implementation
|
||||
return winrt::unbox_value<winrt::TerminalApp::HighlightedText>(GetValue(_textProperty));
|
||||
}
|
||||
|
||||
void HighlightedTextControl::Text(winrt::TerminalApp::HighlightedText const& value)
|
||||
void HighlightedTextControl::Text(const winrt::TerminalApp::HighlightedText& value)
|
||||
{
|
||||
SetValue(_textProperty, winrt::box_value(value));
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - o - dependency object that was modified, expected to be an instance of this control
|
||||
// - e - event arguments of the property changed event fired by the event system upon Text property change.
|
||||
// The new value is expected to be an instance of HighlightedText
|
||||
void HighlightedTextControl::_onTextChanged(DependencyObject const& o, DependencyPropertyChangedEventArgs const& e)
|
||||
void HighlightedTextControl::_onTextChanged(const DependencyObject& o, const DependencyPropertyChangedEventArgs& e)
|
||||
{
|
||||
const auto control = o.try_as<winrt::TerminalApp::HighlightedTextControl>();
|
||||
const auto highlightedText = e.NewValue().try_as<winrt::TerminalApp::HighlightedText>();
|
||||
|
||||
@ -16,13 +16,13 @@ namespace winrt::TerminalApp::implementation
|
||||
static Windows::UI::Xaml::DependencyProperty TextProperty();
|
||||
|
||||
winrt::TerminalApp::HighlightedText Text();
|
||||
void Text(winrt::TerminalApp::HighlightedText const& value);
|
||||
void Text(const winrt::TerminalApp::HighlightedText& value);
|
||||
|
||||
Windows::UI::Xaml::Controls::TextBlock TextView();
|
||||
|
||||
private:
|
||||
static Windows::UI::Xaml::DependencyProperty _textProperty;
|
||||
static void _onTextChanged(Windows::UI::Xaml::DependencyObject const& o, Windows::UI::Xaml::DependencyPropertyChangedEventArgs const& e);
|
||||
static void _onTextChanged(const Windows::UI::Xaml::DependencyObject& o, const Windows::UI::Xaml::DependencyPropertyChangedEventArgs& e);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -66,19 +66,19 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
// These event handlers simply forward each buttons click events up to the
|
||||
// events we've exposed.
|
||||
void MinMaxCloseControl::_MinimizeClick(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
||||
RoutedEventArgs const& e)
|
||||
void MinMaxCloseControl::_MinimizeClick(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const RoutedEventArgs& e)
|
||||
{
|
||||
_MinimizeClickHandlers(*this, e);
|
||||
}
|
||||
|
||||
void MinMaxCloseControl::_MaximizeClick(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
||||
RoutedEventArgs const& e)
|
||||
void MinMaxCloseControl::_MaximizeClick(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const RoutedEventArgs& e)
|
||||
{
|
||||
_MaximizeClickHandlers(*this, e);
|
||||
}
|
||||
void MinMaxCloseControl::_CloseClick(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
||||
RoutedEventArgs const& e)
|
||||
void MinMaxCloseControl::_CloseClick(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const RoutedEventArgs& e)
|
||||
{
|
||||
_CloseClickHandlers(*this, e);
|
||||
}
|
||||
|
||||
@ -21,12 +21,12 @@ namespace winrt::TerminalApp::implementation
|
||||
void PressButton(CaptionButton button);
|
||||
void ReleaseButtons();
|
||||
|
||||
void _MinimizeClick(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void _MaximizeClick(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void _CloseClick(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void _MinimizeClick(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _MaximizeClick(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _CloseClick(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
|
||||
TYPED_EVENT(MinimizeClick, TerminalApp::MinMaxCloseControl, winrt::Windows::UI::Xaml::RoutedEventArgs);
|
||||
TYPED_EVENT(MaximizeClick, TerminalApp::MinMaxCloseControl, winrt::Windows::UI::Xaml::RoutedEventArgs);
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
Windows::UI::Xaml::DataTemplate PaletteItemTemplateSelector::SelectTemplateCore(winrt::Windows::Foundation::IInspectable const& item, winrt::Windows::UI::Xaml::DependencyObject const& /*container*/)
|
||||
Windows::UI::Xaml::DataTemplate PaletteItemTemplateSelector::SelectTemplateCore(const winrt::Windows::Foundation::IInspectable& item, const winrt::Windows::UI::Xaml::DependencyObject& /*container*/)
|
||||
{
|
||||
return SelectTemplateCore(item);
|
||||
}
|
||||
@ -22,7 +22,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - item - an instance of filtered command to render
|
||||
// Return Value:
|
||||
// - data template to use for rendering
|
||||
Windows::UI::Xaml::DataTemplate PaletteItemTemplateSelector::SelectTemplateCore(winrt::Windows::Foundation::IInspectable const& item)
|
||||
Windows::UI::Xaml::DataTemplate PaletteItemTemplateSelector::SelectTemplateCore(const winrt::Windows::Foundation::IInspectable& item)
|
||||
{
|
||||
if (const auto filteredCommand{ item.try_as<winrt::TerminalApp::FilteredCommand>() })
|
||||
{
|
||||
|
||||
@ -11,8 +11,8 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
PaletteItemTemplateSelector() = default;
|
||||
|
||||
Windows::UI::Xaml::DataTemplate SelectTemplateCore(winrt::Windows::Foundation::IInspectable const&, winrt::Windows::UI::Xaml::DependencyObject const&);
|
||||
Windows::UI::Xaml::DataTemplate SelectTemplateCore(winrt::Windows::Foundation::IInspectable const&);
|
||||
Windows::UI::Xaml::DataTemplate SelectTemplateCore(const winrt::Windows::Foundation::IInspectable&, const winrt::Windows::UI::Xaml::DependencyObject&);
|
||||
Windows::UI::Xaml::DataTemplate SelectTemplateCore(const winrt::Windows::Foundation::IInspectable&);
|
||||
|
||||
WINRT_PROPERTY(winrt::Windows::UI::Xaml::DataTemplate, TabItemTemplate);
|
||||
WINRT_PROPERTY(winrt::Windows::UI::Xaml::DataTemplate, NestedItemTemplate);
|
||||
|
||||
@ -289,14 +289,14 @@ bool Pane::_Resize(const ResizeDirection& direction)
|
||||
return false;
|
||||
}
|
||||
|
||||
float amount = .05f;
|
||||
auto amount = .05f;
|
||||
if (direction == ResizeDirection::Right || direction == ResizeDirection::Down)
|
||||
{
|
||||
amount = -amount;
|
||||
}
|
||||
|
||||
// Make sure we're not making a pane explode here by resizing it to 0 characters.
|
||||
const bool changeWidth = _splitState == SplitState::Vertical;
|
||||
const auto changeWidth = _splitState == SplitState::Vertical;
|
||||
|
||||
const Size actualSize{ gsl::narrow_cast<float>(_root.ActualWidth()),
|
||||
gsl::narrow_cast<float>(_root.ActualHeight()) };
|
||||
@ -336,8 +336,8 @@ bool Pane::ResizePane(const ResizeDirection& direction)
|
||||
// If it is, and the requested resize direction matches our separator, then
|
||||
// we're the pane that needs to adjust its separator.
|
||||
// If our separator is the wrong direction, then we can't handle it.
|
||||
const bool firstIsFocused = _firstChild->_lastActive;
|
||||
const bool secondIsFocused = _secondChild->_lastActive;
|
||||
const auto firstIsFocused = _firstChild->_lastActive;
|
||||
const auto secondIsFocused = _secondChild->_lastActive;
|
||||
if (firstIsFocused || secondIsFocused)
|
||||
{
|
||||
return _Resize(direction);
|
||||
@ -504,7 +504,7 @@ std::shared_ptr<Pane> Pane::NextPane(const std::shared_ptr<Pane> targetPane)
|
||||
|
||||
std::shared_ptr<Pane> firstLeaf = nullptr;
|
||||
std::shared_ptr<Pane> nextPane = nullptr;
|
||||
bool foundTarget = false;
|
||||
auto foundTarget = false;
|
||||
|
||||
auto foundNext = WalkTree([&](auto pane) {
|
||||
// If we are a parent pane we don't want to move to one of our children
|
||||
@ -566,7 +566,7 @@ std::shared_ptr<Pane> Pane::PreviousPane(const std::shared_ptr<Pane> targetPane)
|
||||
}
|
||||
|
||||
std::shared_ptr<Pane> lastLeaf = nullptr;
|
||||
bool foundTarget = false;
|
||||
auto foundTarget = false;
|
||||
|
||||
WalkTree([&](auto pane) {
|
||||
if (pane == targetPane)
|
||||
@ -639,8 +639,8 @@ bool Pane::SwapPanes(std::shared_ptr<Pane> first, std::shared_ptr<Pane> second)
|
||||
|
||||
// Recurse through the tree to find the parent panes of each pane that is
|
||||
// being swapped.
|
||||
std::shared_ptr<Pane> firstParent = _FindParentOfPane(first);
|
||||
std::shared_ptr<Pane> secondParent = _FindParentOfPane(second);
|
||||
auto firstParent = _FindParentOfPane(first);
|
||||
auto secondParent = _FindParentOfPane(second);
|
||||
|
||||
// We should have found either no elements, or both elements.
|
||||
// If we only found one parent then the pane SwapPane was called on did not
|
||||
@ -1138,10 +1138,10 @@ void Pane::_ControlWarningBellHandler(const winrt::Windows::Foundation::IInspect
|
||||
// - <unused>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void Pane::_ControlGotFocusHandler(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
RoutedEventArgs const& /* args */)
|
||||
void Pane::_ControlGotFocusHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const RoutedEventArgs& /* args */)
|
||||
{
|
||||
FocusState f = FocusState::Programmatic;
|
||||
auto f = FocusState::Programmatic;
|
||||
if (const auto o = sender.try_as<winrt::Windows::UI::Xaml::Controls::Control>())
|
||||
{
|
||||
f = o.FocusState();
|
||||
@ -1153,8 +1153,8 @@ void Pane::_ControlGotFocusHandler(winrt::Windows::Foundation::IInspectable cons
|
||||
// - Called when our control loses focus. We'll use this to trigger our LostFocus
|
||||
// callback. The tab that's hosting us should have registered a callback which
|
||||
// can be used to update its own internal focus state
|
||||
void Pane::_ControlLostFocusHandler(winrt::Windows::Foundation::IInspectable const& /* sender */,
|
||||
RoutedEventArgs const& /* args */)
|
||||
void Pane::_ControlLostFocusHandler(const winrt::Windows::Foundation::IInspectable& /* sender */,
|
||||
const RoutedEventArgs& /* args */)
|
||||
{
|
||||
_LostFocusHandlers(shared_from_this());
|
||||
}
|
||||
@ -1244,7 +1244,7 @@ TermControl Pane::GetLastFocusedTerminalControl()
|
||||
{
|
||||
if (_lastActive)
|
||||
{
|
||||
std::shared_ptr<Pane> pane = shared_from_this();
|
||||
auto pane = shared_from_this();
|
||||
while (const auto p = pane->_parentChildPath.lock())
|
||||
{
|
||||
if (p->_IsLeaf())
|
||||
@ -1552,7 +1552,7 @@ void Pane::_CloseChild(const bool closeFirst, const bool isDetaching)
|
||||
|
||||
// If we were a parent pane, and we pointed into the now closed child
|
||||
// clear it. We will set it to something else later if
|
||||
bool usedToFocusClosedChildsTerminal = false;
|
||||
auto usedToFocusClosedChildsTerminal = false;
|
||||
if (const auto prev = _parentChildPath.lock())
|
||||
{
|
||||
if (closedChild == prev)
|
||||
@ -1772,7 +1772,7 @@ winrt::fire_and_forget Pane::_CloseChildRoutine(const bool closeFirst)
|
||||
const auto animationsEnabledInApp = Media::Animation::Timeline::AllowDependentAnimations();
|
||||
|
||||
// GH#7252: If either child is zoomed, just skip the animation. It won't work.
|
||||
const bool eitherChildZoomed = pane->_firstChild->_zoomed || pane->_secondChild->_zoomed;
|
||||
const auto eitherChildZoomed = pane->_firstChild->_zoomed || pane->_secondChild->_zoomed;
|
||||
// If animations are disabled, just skip this and go straight to
|
||||
// _CloseChild. Curiously, the pane opening animation doesn't need this,
|
||||
// and will skip straight to Completed when animations are disabled, but
|
||||
@ -1787,7 +1787,7 @@ winrt::fire_and_forget Pane::_CloseChildRoutine(const bool closeFirst)
|
||||
|
||||
auto removedChild = closeFirst ? _firstChild : _secondChild;
|
||||
auto remainingChild = closeFirst ? _secondChild : _firstChild;
|
||||
const bool splitWidth = _splitState == SplitState::Vertical;
|
||||
const auto splitWidth = _splitState == SplitState::Vertical;
|
||||
|
||||
Size removedOriginalSize{
|
||||
::base::saturated_cast<float>(removedChild->_root.ActualWidth()),
|
||||
@ -2075,7 +2075,7 @@ void Pane::_SetupEntranceAnimation()
|
||||
const auto animationsEnabledInOS = uiSettings.AnimationsEnabled();
|
||||
const auto animationsEnabledInApp = Media::Animation::Timeline::AllowDependentAnimations();
|
||||
|
||||
const bool splitWidth = _splitState == SplitState::Vertical;
|
||||
const auto splitWidth = _splitState == SplitState::Vertical;
|
||||
const auto totalSize = splitWidth ? _root.ActualWidth() : _root.ActualHeight();
|
||||
// If we don't have a size yet, it's likely that we're in startup, or we're
|
||||
// being executed as a sequence of actions. In that case, just skip the
|
||||
@ -2254,7 +2254,7 @@ std::optional<std::optional<SplitDirection>> Pane::PreCalculateCanSplit(const st
|
||||
const auto secondPercent = splitSize;
|
||||
// If this pane is the pane we're looking for, use
|
||||
// the available space to calculate which direction to split in.
|
||||
const Size minSize = _GetMinSize();
|
||||
const auto minSize = _GetMinSize();
|
||||
|
||||
if (splitType == SplitDirection::Automatic)
|
||||
{
|
||||
@ -2290,19 +2290,19 @@ std::optional<std::optional<SplitDirection>> Pane::PreCalculateCanSplit(const st
|
||||
// If this pane is a parent, calculate how much space our children will
|
||||
// be able to use, and recurse into them.
|
||||
|
||||
const bool isVerticalSplit = _splitState == SplitState::Vertical;
|
||||
const float firstWidth = isVerticalSplit ?
|
||||
(availableSpace.Width * _desiredSplitPosition) - PaneBorderSize :
|
||||
const auto isVerticalSplit = _splitState == SplitState::Vertical;
|
||||
const auto firstWidth = isVerticalSplit ?
|
||||
(availableSpace.Width * _desiredSplitPosition) - PaneBorderSize :
|
||||
availableSpace.Width;
|
||||
const auto secondWidth = isVerticalSplit ?
|
||||
(availableSpace.Width - firstWidth) - PaneBorderSize :
|
||||
availableSpace.Width;
|
||||
const float secondWidth = isVerticalSplit ?
|
||||
(availableSpace.Width - firstWidth) - PaneBorderSize :
|
||||
availableSpace.Width;
|
||||
const float firstHeight = !isVerticalSplit ?
|
||||
(availableSpace.Height * _desiredSplitPosition) - PaneBorderSize :
|
||||
const auto firstHeight = !isVerticalSplit ?
|
||||
(availableSpace.Height * _desiredSplitPosition) - PaneBorderSize :
|
||||
availableSpace.Height;
|
||||
const auto secondHeight = !isVerticalSplit ?
|
||||
(availableSpace.Height - firstHeight) - PaneBorderSize :
|
||||
availableSpace.Height;
|
||||
const float secondHeight = !isVerticalSplit ?
|
||||
(availableSpace.Height - firstHeight) - PaneBorderSize :
|
||||
availableSpace.Height;
|
||||
|
||||
const auto firstResult = _firstChild->PreCalculateCanSplit(target, splitType, splitSize, { firstWidth, firstHeight });
|
||||
return firstResult.has_value() ? firstResult : _secondChild->PreCalculateCanSplit(target, splitType, splitSize, { secondWidth, secondHeight });
|
||||
@ -2359,8 +2359,8 @@ bool Pane::ToggleSplitOrientation()
|
||||
|
||||
// If a parent pane is focused, or if one of its children are a leaf and is
|
||||
// focused then switch the split orientation on the current pane.
|
||||
const bool firstIsFocused = _firstChild->_IsLeaf() && _firstChild->_lastActive;
|
||||
const bool secondIsFocused = _secondChild->_IsLeaf() && _secondChild->_lastActive;
|
||||
const auto firstIsFocused = _firstChild->_IsLeaf() && _firstChild->_lastActive;
|
||||
const auto secondIsFocused = _secondChild->_IsLeaf() && _secondChild->_lastActive;
|
||||
if (_lastActive || firstIsFocused || secondIsFocused)
|
||||
{
|
||||
// Switch the split orientation
|
||||
@ -2739,7 +2739,7 @@ Pane::SnapChildrenSizeResult Pane::_CalcSnappedChildrenSizes(const bool widthOrH
|
||||
// size, but it doesn't seem to be beneficial.
|
||||
|
||||
auto sizeTree = _CreateMinSizeTree(widthOrHeight);
|
||||
LayoutSizeNode lastSizeTree{ sizeTree };
|
||||
auto lastSizeTree{ sizeTree };
|
||||
|
||||
while (sizeTree.size < fullSize)
|
||||
{
|
||||
@ -2802,7 +2802,7 @@ Pane::SnapSizeResult Pane::_CalcSnappedDimension(const bool widthOrHeight, const
|
||||
return { minDimension, minDimension };
|
||||
}
|
||||
|
||||
float lower = _control.SnapDimensionToGrid(widthOrHeight, dimension);
|
||||
auto lower = _control.SnapDimensionToGrid(widthOrHeight, dimension);
|
||||
if (widthOrHeight)
|
||||
{
|
||||
lower += WI_IsFlagSet(_borders, Borders::Left) ? PaneBorderSize : 0;
|
||||
@ -3091,7 +3091,7 @@ void Pane::_SetupResources()
|
||||
const auto unfocusedBorderBrushKey = winrt::box_value(L"UnfocusedBorderBrush");
|
||||
if (res.HasKey(unfocusedBorderBrushKey))
|
||||
{
|
||||
winrt::Windows::Foundation::IInspectable obj = res.Lookup(unfocusedBorderBrushKey);
|
||||
auto obj = res.Lookup(unfocusedBorderBrushKey);
|
||||
s_unfocusedBorderBrush = obj.try_as<winrt::Windows::UI::Xaml::Media::SolidColorBrush>();
|
||||
}
|
||||
else
|
||||
|
||||
@ -278,12 +278,12 @@ private:
|
||||
void _Focus();
|
||||
void _FocusFirstChild();
|
||||
void _ControlConnectionStateChangedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& /*args*/);
|
||||
void _ControlWarningBellHandler(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::Foundation::IInspectable const& e);
|
||||
void _ControlGotFocusHandler(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void _ControlLostFocusHandler(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void _ControlWarningBellHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::Foundation::IInspectable& e);
|
||||
void _ControlGotFocusHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _ControlLostFocusHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
|
||||
std::pair<float, float> _CalcChildrenSizes(const float fullSize) const;
|
||||
SnapChildrenSizeResult _CalcSnappedChildrenSizes(const bool widthOrHeight, const float fullSize) const;
|
||||
|
||||
@ -36,7 +36,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// remove the TextBox from the UI tree, then the following KeyUp
|
||||
// will bubble to the NewTabButton, which we don't want to have
|
||||
// happen.
|
||||
HeaderRenamerTextBox().KeyUp([&](auto&&, Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e) {
|
||||
HeaderRenamerTextBox().KeyUp([&](auto&&, const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e) {
|
||||
if (_receivedKeyDown)
|
||||
{
|
||||
if (e.OriginalKey() == Windows::System::VirtualKey::Enter)
|
||||
@ -94,8 +94,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Event handler for when the rename box loses focus
|
||||
// - When the rename box loses focus, we send a request for the title change depending
|
||||
// on whether the rename was cancelled
|
||||
void TabHeaderControl::RenameBoxLostFocusHandler(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::RoutedEventArgs const& /*e*/)
|
||||
void TabHeaderControl::RenameBoxLostFocusHandler(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& /*e*/)
|
||||
{
|
||||
// If the context menu associated with the renamer text box is open we know it gained the focus.
|
||||
// In this case we ignore this event (we will regain the focus once the menu will be closed).
|
||||
|
||||
@ -14,8 +14,8 @@ namespace winrt::TerminalApp::implementation
|
||||
TabHeaderControl();
|
||||
void BeginRename();
|
||||
|
||||
void RenameBoxLostFocusHandler(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void RenameBoxLostFocusHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
|
||||
bool InRename();
|
||||
|
||||
|
||||
@ -81,8 +81,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// case above with the _maybeElevate call.
|
||||
_CreateNewTabFromPane(_MakePane(newTerminalArgs, false, existingConnection));
|
||||
|
||||
const uint32_t tabCount = _tabs.Size();
|
||||
const bool usedManualProfile = (newTerminalArgs != nullptr) &&
|
||||
const auto tabCount = _tabs.Size();
|
||||
const auto usedManualProfile = (newTerminalArgs != nullptr) &&
|
||||
(newTerminalArgs.ProfileIndex() != nullptr ||
|
||||
newTerminalArgs.Profile().empty());
|
||||
|
||||
@ -287,7 +287,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Never show the tab row when we're fullscreen. Otherwise:
|
||||
// Show tabs when there's more than 1, or the user has chosen to always
|
||||
// show the tab bar.
|
||||
const bool isVisible = (!_isFullscreen && !_isInFocusMode) &&
|
||||
const auto isVisible = (!_isFullscreen && !_isInFocusMode) &&
|
||||
(_settings.GlobalSettings().ShowTabsInTitlebar() ||
|
||||
(_tabs.Size() > 1) ||
|
||||
_settings.GlobalSettings().AlwaysShowTabs());
|
||||
@ -449,7 +449,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
if (tab.ReadOnly())
|
||||
{
|
||||
ContentDialogResult warningResult = co_await _ShowCloseReadOnlyDialog();
|
||||
auto warningResult = co_await _ShowCloseReadOnlyDialog();
|
||||
|
||||
// If the user didn't explicitly click on close tab - leave
|
||||
if (warningResult != ContentDialogResult::Primary)
|
||||
@ -574,7 +574,7 @@ namespace winrt::TerminalApp::implementation
|
||||
const auto tabSwitchMode = customTabSwitcherMode ? customTabSwitcherMode.Value() : _settings.GlobalSettings().TabSwitcherMode();
|
||||
if (tabSwitchMode == TabSwitcherMode::Disabled)
|
||||
{
|
||||
uint32_t tabCount = _tabs.Size();
|
||||
auto tabCount = _tabs.Size();
|
||||
// Wraparound math. By adding tabCount and then calculating
|
||||
// modulo tabCount, we clamp the values to the range [0,
|
||||
// tabCount) while still supporting moving leftward from 0 to
|
||||
@ -743,7 +743,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
if (pane->ContainsReadOnly())
|
||||
{
|
||||
ContentDialogResult warningResult = co_await _ShowCloseReadOnlyDialog();
|
||||
auto warningResult = co_await _ShowCloseReadOnlyDialog();
|
||||
|
||||
// If the user didn't explicitly click on close tab - leave
|
||||
if (warningResult != ContentDialogResult::Primary)
|
||||
@ -937,7 +937,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
void TerminalPage::_UpdateTabIndices()
|
||||
{
|
||||
const uint32_t size = _tabs.Size();
|
||||
const auto size = _tabs.Size();
|
||||
for (uint32_t i = 0; i < size; ++i)
|
||||
{
|
||||
auto tab{ _tabs.GetAt(i) };
|
||||
|
||||
@ -19,7 +19,7 @@ using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
TabPaletteItem::TabPaletteItem(winrt::TerminalApp::TabBase const& tab) :
|
||||
TabPaletteItem::TabPaletteItem(const winrt::TerminalApp::TabBase& tab) :
|
||||
_tab(tab)
|
||||
{
|
||||
Name(tab.Title());
|
||||
|
||||
@ -11,7 +11,7 @@ namespace winrt::TerminalApp::implementation
|
||||
struct TabPaletteItem : TabPaletteItemT<TabPaletteItem, PaletteItem>
|
||||
{
|
||||
TabPaletteItem() = default;
|
||||
TabPaletteItem(winrt::TerminalApp::TabBase const& tab);
|
||||
TabPaletteItem(const winrt::TerminalApp::TabBase& tab);
|
||||
|
||||
winrt::TerminalApp::TabBase Tab() const noexcept
|
||||
{
|
||||
|
||||
@ -30,7 +30,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Bound in the Xaml editor to the [+] button.
|
||||
// Arguments:
|
||||
// <unused>
|
||||
void TabRowControl::OnNewTabButtonClick(IInspectable const&, Controls::SplitButtonClickEventArgs const&)
|
||||
void TabRowControl::OnNewTabButtonClick(const IInspectable&, const Controls::SplitButtonClickEventArgs&)
|
||||
{
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Bound in Drag&Drop of the Xaml editor to the [+] button.
|
||||
// Arguments:
|
||||
// <unused>
|
||||
void TabRowControl::OnNewTabButtonDrop(IInspectable const&, winrt::Windows::UI::Xaml::DragEventArgs const&)
|
||||
void TabRowControl::OnNewTabButtonDrop(const IInspectable&, const winrt::Windows::UI::Xaml::DragEventArgs&)
|
||||
{
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Arguments:
|
||||
// - <unused>
|
||||
// - e: DragEventArgs which hold the items
|
||||
void TabRowControl::OnNewTabButtonDragOver(IInspectable const&, winrt::Windows::UI::Xaml::DragEventArgs const& e)
|
||||
void TabRowControl::OnNewTabButtonDragOver(const IInspectable&, const winrt::Windows::UI::Xaml::DragEventArgs& e)
|
||||
{
|
||||
// We can only handle drag/dropping StorageItems (files).
|
||||
// If the format on the clipboard is anything else, returning
|
||||
|
||||
@ -13,9 +13,9 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
TabRowControl();
|
||||
|
||||
void OnNewTabButtonClick(Windows::Foundation::IInspectable const& sender, Microsoft::UI::Xaml::Controls::SplitButtonClickEventArgs const& args);
|
||||
void OnNewTabButtonDrop(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::DragEventArgs const& e);
|
||||
void OnNewTabButtonDragOver(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::DragEventArgs const& e);
|
||||
void OnNewTabButtonClick(const Windows::Foundation::IInspectable& sender, const Microsoft::UI::Xaml::Controls::SplitButtonClickEventArgs& args);
|
||||
void OnNewTabButtonDrop(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::DragEventArgs& e);
|
||||
void OnNewTabButtonDragOver(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::DragEventArgs& e);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(bool, ShowElevationShield, _PropertyChangedHandlers, false);
|
||||
|
||||
@ -129,7 +129,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// use C++11 magic statics to make sure we only do this once.
|
||||
// This won't change over the lifetime of the application
|
||||
|
||||
static const bool isElevated = []() {
|
||||
static const auto isElevated = []() {
|
||||
// *** THIS IS A SINGLETON ***
|
||||
auto result = false;
|
||||
|
||||
@ -166,7 +166,7 @@ namespace winrt::TerminalApp::implementation
|
||||
const auto darkKey = winrt::box_value(L"Dark");
|
||||
const auto tabViewBackgroundKey = winrt::box_value(L"TabViewBackground");
|
||||
|
||||
for (auto const& dictionary : res.MergedDictionaries())
|
||||
for (const auto& dictionary : res.MergedDictionaries())
|
||||
{
|
||||
// Don't change MUX resources
|
||||
if (dictionary.Source())
|
||||
@ -174,7 +174,7 @@ namespace winrt::TerminalApp::implementation
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto const& kvPair : dictionary.ThemeDictionaries())
|
||||
for (const auto& kvPair : dictionary.ThemeDictionaries())
|
||||
{
|
||||
const auto themeDictionary = kvPair.Value().as<winrt::Windows::UI::Xaml::ResourceDictionary>();
|
||||
|
||||
@ -232,7 +232,7 @@ namespace winrt::TerminalApp::implementation
|
||||
page->_OpenNewTerminalViaDropdown(NewTerminalArgs());
|
||||
}
|
||||
});
|
||||
_newTabButton.Drop([weakThis{ get_weak() }](Windows::Foundation::IInspectable const&, winrt::Windows::UI::Xaml::DragEventArgs e) {
|
||||
_newTabButton.Drop([weakThis{ get_weak() }](const Windows::Foundation::IInspectable&, winrt::Windows::UI::Xaml::DragEventArgs e) {
|
||||
if (auto page{ weakThis.get() })
|
||||
{
|
||||
page->NewTerminalByDrop(e);
|
||||
@ -603,7 +603,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// back once we're done. This looks weird though, because we have to set
|
||||
// up the scope_exit _first_. We'll release the scope_exit if we don't
|
||||
// actually need it.
|
||||
std::wstring originalCwd{ wil::GetCurrentDirectoryW<std::wstring>() };
|
||||
auto originalCwd{ wil::GetCurrentDirectoryW<std::wstring>() };
|
||||
auto restoreCwd = wil::scope_exit([&originalCwd]() {
|
||||
// ignore errors, we'll just power on through. We'd rather do
|
||||
// something rather than fail silently if the directory doesn't
|
||||
@ -791,8 +791,8 @@ namespace winrt::TerminalApp::implementation
|
||||
auto actionMap = _settings.ActionMap();
|
||||
const auto defaultProfileGuid = _settings.GlobalSettings().DefaultProfile();
|
||||
// the number of profiles should not change in the loop for this to work
|
||||
auto const profileCount = gsl::narrow_cast<int>(_settings.ActiveProfiles().Size());
|
||||
for (int profileIndex = 0; profileIndex < profileCount; profileIndex++)
|
||||
const auto profileCount = gsl::narrow_cast<int>(_settings.ActiveProfiles().Size());
|
||||
for (auto profileIndex = 0; profileIndex < profileCount; profileIndex++)
|
||||
{
|
||||
const auto profile = _settings.ActiveProfiles().GetAt(profileIndex);
|
||||
auto profileMenuItem = WUX::Controls::MenuFlyoutItem{};
|
||||
@ -957,10 +957,10 @@ namespace winrt::TerminalApp::implementation
|
||||
void TerminalPage::_OpenNewTerminalViaDropdown(const NewTerminalArgs newTerminalArgs)
|
||||
{
|
||||
// if alt is pressed, open a pane
|
||||
const CoreWindow window = CoreWindow::GetForCurrentThread();
|
||||
const auto window = CoreWindow::GetForCurrentThread();
|
||||
const auto rAltState = window.GetKeyState(VirtualKey::RightMenu);
|
||||
const auto lAltState = window.GetKeyState(VirtualKey::LeftMenu);
|
||||
const bool altPressed = WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) ||
|
||||
const auto altPressed = WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) ||
|
||||
WI_IsFlagSet(rAltState, CoreVirtualKeyStates::Down);
|
||||
|
||||
const auto shiftState{ window.GetKeyState(VirtualKey::Shift) };
|
||||
@ -978,11 +978,11 @@ namespace winrt::TerminalApp::implementation
|
||||
WI_IsFlagSet(lCtrlState, CoreVirtualKeyStates::Down) };
|
||||
|
||||
// Check for DebugTap
|
||||
bool debugTap = this->_settings.GlobalSettings().DebugFeaturesEnabled() &&
|
||||
auto debugTap = this->_settings.GlobalSettings().DebugFeaturesEnabled() &&
|
||||
WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) &&
|
||||
WI_IsFlagSet(rAltState, CoreVirtualKeyStates::Down);
|
||||
|
||||
const bool dispatchToElevatedWindow = ctrlPressed && !IsElevated();
|
||||
const auto dispatchToElevatedWindow = ctrlPressed && !IsElevated();
|
||||
|
||||
if ((shiftPressed || dispatchToElevatedWindow) && !debugTap)
|
||||
{
|
||||
@ -1051,7 +1051,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
TerminalConnection::ITerminalConnection connection{ nullptr };
|
||||
|
||||
winrt::guid connectionType = profile.ConnectionType();
|
||||
auto connectionType = profile.ConnectionType();
|
||||
winrt::guid sessionGuid{};
|
||||
|
||||
if (connectionType == TerminalConnection::AzureConnection::ConnectionType() &&
|
||||
@ -1080,7 +1080,7 @@ namespace winrt::TerminalApp::implementation
|
||||
else
|
||||
{
|
||||
// profile is guaranteed to exist here
|
||||
std::wstring guidWString = Utils::GuidToString(profile.Guid());
|
||||
auto guidWString = Utils::GuidToString(profile.Guid());
|
||||
|
||||
StringMap envMap{};
|
||||
envMap.Insert(L"WT_PROFILE_ID", guidWString);
|
||||
@ -1101,11 +1101,11 @@ namespace winrt::TerminalApp::implementation
|
||||
// construction, because the connection might not spawn the child
|
||||
// process until later, on another thread, after we've already
|
||||
// restored the CWD to it's original value.
|
||||
winrt::hstring newWorkingDirectory{ settings.StartingDirectory() };
|
||||
auto newWorkingDirectory{ settings.StartingDirectory() };
|
||||
if (newWorkingDirectory.size() == 0 || newWorkingDirectory.size() == 1 &&
|
||||
!(newWorkingDirectory[0] == L'~' || newWorkingDirectory[0] == L'/'))
|
||||
{ // We only want to resolve the new WD against the CWD if it doesn't look like a Linux path (see GH#592)
|
||||
std::wstring cwdString{ wil::GetCurrentDirectoryW<std::wstring>() };
|
||||
auto cwdString{ wil::GetCurrentDirectoryW<std::wstring>() };
|
||||
std::filesystem::path cwd{ cwdString };
|
||||
cwd /= settings.StartingDirectory().c_str();
|
||||
newWorkingDirectory = winrt::hstring{ cwd.wstring() };
|
||||
@ -1151,12 +1151,12 @@ namespace winrt::TerminalApp::implementation
|
||||
void TerminalPage::_SettingsButtonOnClick(const IInspectable&,
|
||||
const RoutedEventArgs&)
|
||||
{
|
||||
const CoreWindow window = CoreWindow::GetForCurrentThread();
|
||||
const auto window = CoreWindow::GetForCurrentThread();
|
||||
|
||||
// check alt state
|
||||
const auto rAltState{ window.GetKeyState(VirtualKey::RightMenu) };
|
||||
const auto lAltState{ window.GetKeyState(VirtualKey::LeftMenu) };
|
||||
const bool altPressed{ WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) ||
|
||||
const auto altPressed{ WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) ||
|
||||
WI_IsFlagSet(rAltState, CoreVirtualKeyStates::Down) };
|
||||
|
||||
// check shift state
|
||||
@ -1213,7 +1213,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - e: the KeyRoutedEventArgs containing info about the keystroke.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_KeyDownHandler(Windows::Foundation::IInspectable const& /*sender*/, Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e)
|
||||
void TerminalPage::_KeyDownHandler(const Windows::Foundation::IInspectable& /*sender*/, const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
const auto keyStatus = e.KeyStatus();
|
||||
const auto vkey = gsl::narrow_cast<WORD>(e.OriginalKey());
|
||||
@ -1293,7 +1293,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - The Microsoft::Terminal::Core::ControlKeyStates representing the modifier key states.
|
||||
ControlKeyStates TerminalPage::_GetPressedModifierKeys() noexcept
|
||||
{
|
||||
const CoreWindow window = CoreWindow::GetForCurrentThread();
|
||||
const auto window = CoreWindow::GetForCurrentThread();
|
||||
// DONT USE
|
||||
// != CoreVirtualKeyStates::None
|
||||
// OR
|
||||
@ -1580,7 +1580,7 @@ namespace winrt::TerminalApp::implementation
|
||||
if (!_displayingCloseDialog)
|
||||
{
|
||||
_displayingCloseDialog = true;
|
||||
ContentDialogResult warningResult = co_await _ShowQuitDialog();
|
||||
auto warningResult = co_await _ShowQuitDialog();
|
||||
_displayingCloseDialog = false;
|
||||
|
||||
if (warningResult != ContentDialogResult::Primary)
|
||||
@ -1642,7 +1642,7 @@ namespace winrt::TerminalApp::implementation
|
||||
WindowLayout layout{};
|
||||
layout.TabLayout(winrt::single_threaded_vector<ActionAndArgs>(std::move(actions)));
|
||||
|
||||
LaunchMode mode = LaunchMode::DefaultMode;
|
||||
auto mode = LaunchMode::DefaultMode;
|
||||
WI_SetFlagIf(mode, LaunchMode::FullscreenMode, _isFullscreen);
|
||||
WI_SetFlagIf(mode, LaunchMode::FocusMode, _isInFocusMode);
|
||||
WI_SetFlagIf(mode, LaunchMode::MaximizedMode, _isMaximized);
|
||||
@ -1650,8 +1650,8 @@ namespace winrt::TerminalApp::implementation
|
||||
layout.LaunchMode({ mode });
|
||||
|
||||
// Only save the content size because the tab size will be added on load.
|
||||
const float contentWidth = ::base::saturated_cast<float>(_tabContent.ActualWidth());
|
||||
const float contentHeight = ::base::saturated_cast<float>(_tabContent.ActualHeight());
|
||||
const auto contentWidth = ::base::saturated_cast<float>(_tabContent.ActualWidth());
|
||||
const auto contentHeight = ::base::saturated_cast<float>(_tabContent.ActualHeight());
|
||||
const winrt::Windows::Foundation::Size windowSize{ contentWidth, contentHeight };
|
||||
|
||||
layout.InitialSize(windowSize);
|
||||
@ -1674,7 +1674,7 @@ namespace winrt::TerminalApp::implementation
|
||||
!_displayingCloseDialog)
|
||||
{
|
||||
_displayingCloseDialog = true;
|
||||
ContentDialogResult warningResult = co_await _ShowCloseWarningDialog();
|
||||
auto warningResult = co_await _ShowCloseWarningDialog();
|
||||
_displayingCloseDialog = false;
|
||||
|
||||
if (warningResult != ContentDialogResult::Primary)
|
||||
@ -1833,8 +1833,8 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
return;
|
||||
}
|
||||
const float contentWidth = ::base::saturated_cast<float>(_tabContent.ActualWidth());
|
||||
const float contentHeight = ::base::saturated_cast<float>(_tabContent.ActualHeight());
|
||||
const auto contentWidth = ::base::saturated_cast<float>(_tabContent.ActualWidth());
|
||||
const auto contentHeight = ::base::saturated_cast<float>(_tabContent.ActualHeight());
|
||||
const winrt::Windows::Foundation::Size availableSpace{ contentWidth, contentHeight };
|
||||
|
||||
const auto realSplitType = tab.PreCalculateCanSplit(splitDirection, splitSize, availableSpace);
|
||||
@ -2044,12 +2044,12 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
co_await wil::resume_foreground(Dispatcher(), CoreDispatcherPriority::High);
|
||||
|
||||
DataPackage dataPack = DataPackage();
|
||||
auto dataPack = DataPackage();
|
||||
dataPack.RequestedOperation(DataPackageOperation::Copy);
|
||||
|
||||
// The EventArgs.Formats() is an override for the global setting "copyFormatting"
|
||||
// iff it is set
|
||||
bool useGlobal = copiedData.Formats() == nullptr;
|
||||
auto useGlobal = copiedData.Formats() == nullptr;
|
||||
auto copyFormats = useGlobal ?
|
||||
_settings.GlobalSettings().CopyFormatting() :
|
||||
copiedData.Formats().Value();
|
||||
@ -2099,7 +2099,7 @@ namespace winrt::TerminalApp::implementation
|
||||
fire_and_forget TerminalPage::_PasteFromClipboardHandler(const IInspectable /*sender*/,
|
||||
const PasteFromClipboardEventArgs eventArgs)
|
||||
{
|
||||
const DataPackageView data = Clipboard::GetContent();
|
||||
const auto data = Clipboard::GetContent();
|
||||
|
||||
// This will switch the execution of the function to a background (not
|
||||
// UI) thread. This is IMPORTANT, because the getting the clipboard data
|
||||
@ -2116,10 +2116,10 @@ namespace winrt::TerminalApp::implementation
|
||||
// Windows Explorer's "Copy address" menu item stores a StorageItem in the clipboard, and no text.
|
||||
else if (data.Contains(StandardDataFormats::StorageItems()))
|
||||
{
|
||||
Windows::Foundation::Collections::IVectorView<Windows::Storage::IStorageItem> items = co_await data.GetStorageItemsAsync();
|
||||
auto items = co_await data.GetStorageItemsAsync();
|
||||
if (items.Size() > 0)
|
||||
{
|
||||
Windows::Storage::IStorageItem item = items.GetAt(0);
|
||||
auto item = items.GetAt(0);
|
||||
text = item.Path();
|
||||
}
|
||||
}
|
||||
@ -2141,7 +2141,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
// If the requesting terminal is in bracketed paste mode, then we don't need to warn about a multi-line paste.
|
||||
bool warnMultiLine = _settings.GlobalSettings().WarnAboutMultiLinePaste() &&
|
||||
auto warnMultiLine = _settings.GlobalSettings().WarnAboutMultiLinePaste() &&
|
||||
!eventArgs.BracketedPasteEnabled();
|
||||
if (warnMultiLine)
|
||||
{
|
||||
@ -2151,7 +2151,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
constexpr const std::size_t minimumSizeForWarning = 1024 * 5; // 5 KiB
|
||||
const bool warnLargeText = text.size() > minimumSizeForWarning &&
|
||||
const auto warnLargeText = text.size() > minimumSizeForWarning &&
|
||||
_settings.GlobalSettings().WarnAboutLargePaste();
|
||||
|
||||
if (warnMultiLine || warnLargeText)
|
||||
@ -2165,7 +2165,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// The vertical offset on the scrollbar does not reset automatically, so reset it manually
|
||||
ClipboardContentScrollViewer().ScrollToVerticalOffset(0);
|
||||
|
||||
ContentDialogResult warningResult = ContentDialogResult::Primary;
|
||||
auto warningResult = ContentDialogResult::Primary;
|
||||
if (warnMultiLine)
|
||||
{
|
||||
warningResult = co_await _ShowMultiLinePasteWarningDialog();
|
||||
@ -2272,7 +2272,7 @@ namespace winrt::TerminalApp::implementation
|
||||
co_await wil::resume_foreground(Dispatcher());
|
||||
if (auto page = weakThis.get())
|
||||
{
|
||||
winrt::hstring message = eventArgs.Message();
|
||||
auto message = eventArgs.Message();
|
||||
|
||||
winrt::hstring title;
|
||||
|
||||
@ -2487,10 +2487,10 @@ namespace winrt::TerminalApp::implementation
|
||||
TerminalConnection::ITerminalConnection debugConnection{ nullptr };
|
||||
if (_settings.GlobalSettings().DebugFeaturesEnabled())
|
||||
{
|
||||
const CoreWindow window = CoreWindow::GetForCurrentThread();
|
||||
const auto window = CoreWindow::GetForCurrentThread();
|
||||
const auto rAltState = window.GetKeyState(VirtualKey::RightMenu);
|
||||
const auto lAltState = window.GetKeyState(VirtualKey::LeftMenu);
|
||||
const bool bothAltsPressed = WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) &&
|
||||
const auto bothAltsPressed = WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) &&
|
||||
WI_IsFlagSet(rAltState, CoreVirtualKeyStates::Down);
|
||||
if (bothAltsPressed)
|
||||
{
|
||||
@ -2637,7 +2637,7 @@ namespace winrt::TerminalApp::implementation
|
||||
IVectorView<Profile> profiles,
|
||||
IMapView<winrt::hstring, ColorScheme> schemes)
|
||||
{
|
||||
IVector<SettingsLoadWarnings> warnings{ winrt::single_threaded_vector<SettingsLoadWarnings>() };
|
||||
auto warnings{ winrt::single_threaded_vector<SettingsLoadWarnings>() };
|
||||
|
||||
std::vector<ColorScheme> sortedSchemes;
|
||||
sortedSchemes.reserve(schemes.Size());
|
||||
@ -2650,7 +2650,7 @@ namespace winrt::TerminalApp::implementation
|
||||
sortedSchemes.end(),
|
||||
_compareSchemeNames);
|
||||
|
||||
IMap<winrt::hstring, Command> copyOfCommands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto copyOfCommands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
for (const auto& nameAndCommand : commandsToExpand)
|
||||
{
|
||||
copyOfCommands.Insert(nameAndCommand.Key(), nameAndCommand.Value());
|
||||
@ -2673,9 +2673,9 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
void TerminalPage::_UpdateCommandsForPalette()
|
||||
{
|
||||
IMap<winrt::hstring, Command> copyOfCommands = _ExpandCommands(_settings.GlobalSettings().ActionMap().NameMap(),
|
||||
_settings.ActiveProfiles().GetView(),
|
||||
_settings.GlobalSettings().ColorSchemes());
|
||||
auto copyOfCommands = _ExpandCommands(_settings.GlobalSettings().ActionMap().NameMap(),
|
||||
_settings.ActiveProfiles().GetView(),
|
||||
_settings.GlobalSettings().ColorSchemes());
|
||||
|
||||
_recursiveUpdateCommandKeybindingLabels(_settings, copyOfCommands.GetView());
|
||||
|
||||
@ -2815,7 +2815,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
void TerminalPage::SetFocusMode(const bool inFocusMode)
|
||||
{
|
||||
const bool newInFocusMode = inFocusMode;
|
||||
const auto newInFocusMode = inFocusMode;
|
||||
if (newInFocusMode != FocusMode())
|
||||
{
|
||||
_isInFocusMode = newInFocusMode;
|
||||
@ -2862,13 +2862,13 @@ namespace winrt::TerminalApp::implementation
|
||||
void TerminalPage::_SetNewTabButtonColor(const Windows::UI::Color& color, const Windows::UI::Color& accentColor)
|
||||
{
|
||||
// TODO GH#3327: Look at what to do with the tab button when we have XAML theming
|
||||
bool IsBrightColor = ColorHelper::IsBrightColor(color);
|
||||
bool isLightAccentColor = ColorHelper::IsBrightColor(accentColor);
|
||||
auto IsBrightColor = ColorHelper::IsBrightColor(color);
|
||||
auto isLightAccentColor = ColorHelper::IsBrightColor(accentColor);
|
||||
winrt::Windows::UI::Color pressedColor{};
|
||||
winrt::Windows::UI::Color hoverColor{};
|
||||
winrt::Windows::UI::Color foregroundColor{};
|
||||
const float hoverColorAdjustment = 5.f;
|
||||
const float pressedColorAdjustment = 7.f;
|
||||
const auto hoverColorAdjustment = 5.f;
|
||||
const auto pressedColorAdjustment = 7.f;
|
||||
|
||||
if (IsBrightColor)
|
||||
{
|
||||
@ -2952,7 +2952,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// See also GH#5741
|
||||
if (res.HasKey(defaultBackgroundKey))
|
||||
{
|
||||
winrt::Windows::Foundation::IInspectable obj = res.Lookup(defaultBackgroundKey);
|
||||
auto obj = res.Lookup(defaultBackgroundKey);
|
||||
backgroundBrush = obj.try_as<winrt::Windows::UI::Xaml::Media::SolidColorBrush>();
|
||||
}
|
||||
else
|
||||
@ -2962,7 +2962,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
if (res.HasKey(defaultForegroundKey))
|
||||
{
|
||||
winrt::Windows::Foundation::IInspectable obj = res.Lookup(defaultForegroundKey);
|
||||
auto obj = res.Lookup(defaultForegroundKey);
|
||||
foregroundBrush = obj.try_as<winrt::Windows::UI::Xaml::Media::SolidColorBrush>();
|
||||
}
|
||||
else
|
||||
@ -3089,7 +3089,7 @@ namespace winrt::TerminalApp::implementation
|
||||
if (!Dispatcher().HasThreadAccess())
|
||||
{
|
||||
til::latch latch{ 1 };
|
||||
HRESULT finalVal = S_OK;
|
||||
auto finalVal = S_OK;
|
||||
|
||||
Dispatcher().RunAsync(CoreDispatcherPriority::Normal, [&]() {
|
||||
finalVal = _OnNewConnection(connection);
|
||||
@ -3345,7 +3345,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - The warning message, including the OS-localized service name.
|
||||
winrt::hstring TerminalPage::KeyboardServiceDisabledText()
|
||||
{
|
||||
const winrt::hstring serviceName{ _getTabletServiceName() };
|
||||
const auto serviceName{ _getTabletServiceName() };
|
||||
const winrt::hstring text{ fmt::format(std::wstring_view(RS_(L"KeyboardServiceWarningText")), serviceName) };
|
||||
return text;
|
||||
}
|
||||
@ -3429,7 +3429,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// create the toast for it.
|
||||
if (page->_windowIdToast == nullptr)
|
||||
{
|
||||
if (MUX::Controls::TeachingTip tip{ page->FindName(L"WindowIdToast").try_as<MUX::Controls::TeachingTip>() })
|
||||
if (auto tip{ page->FindName(L"WindowIdToast").try_as<MUX::Controls::TeachingTip>() })
|
||||
{
|
||||
page->_windowIdToast = std::make_shared<Toast>(tip);
|
||||
// Make sure to use the weak ref when setting up this
|
||||
@ -3456,8 +3456,8 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
winrt::fire_and_forget TerminalPage::WindowName(const winrt::hstring& value)
|
||||
{
|
||||
const bool oldIsQuakeMode = IsQuakeWindow();
|
||||
const bool changed = _WindowName != value;
|
||||
const auto oldIsQuakeMode = IsQuakeWindow();
|
||||
const auto changed = _WindowName != value;
|
||||
if (changed)
|
||||
{
|
||||
_WindowName = value;
|
||||
@ -3564,7 +3564,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// create the toast for it.
|
||||
if (page->_windowRenameFailedToast == nullptr)
|
||||
{
|
||||
if (MUX::Controls::TeachingTip tip{ page->FindName(L"RenameFailedToast").try_as<MUX::Controls::TeachingTip>() })
|
||||
if (auto tip{ page->FindName(L"RenameFailedToast").try_as<MUX::Controls::TeachingTip>() })
|
||||
{
|
||||
page->_windowRenameFailedToast = std::make_shared<Toast>(tip);
|
||||
// Make sure to use the weak ref when setting up this
|
||||
@ -3628,7 +3628,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_WindowRenamerKeyDown(const IInspectable& /*sender*/,
|
||||
winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e)
|
||||
const winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
const auto key = e.OriginalKey();
|
||||
if (key == Windows::System::VirtualKey::Enter)
|
||||
@ -3645,7 +3645,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_WindowRenamerKeyUp(const IInspectable& sender,
|
||||
winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e)
|
||||
const winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
const auto key = e.OriginalKey();
|
||||
if (key == Windows::System::VirtualKey::Enter && _renamerPressedEnter)
|
||||
@ -3712,7 +3712,7 @@ namespace winrt::TerminalApp::implementation
|
||||
exePath.replace_filename(L"elevate-shim.exe");
|
||||
|
||||
// Build the commandline to pass to wt for this set of NewTerminalArgs
|
||||
std::wstring cmdline{
|
||||
auto cmdline{
|
||||
fmt::format(L"new-tab {}", newTerminalArgs.ToCommandline().c_str())
|
||||
};
|
||||
|
||||
@ -3753,8 +3753,8 @@ namespace winrt::TerminalApp::implementation
|
||||
const Profile& profile)
|
||||
{
|
||||
// Try to handle auto-elevation
|
||||
const bool requestedElevation = controlSettings.DefaultSettings().Elevate();
|
||||
const bool currentlyElevated = IsElevated();
|
||||
const auto requestedElevation = controlSettings.DefaultSettings().Elevate();
|
||||
const auto currentlyElevated = IsElevated();
|
||||
|
||||
// We aren't elevated, but we want to be.
|
||||
if (requestedElevation && !currentlyElevated)
|
||||
|
||||
@ -244,7 +244,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void _AboutButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
void _ThirdPartyNoticesOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
|
||||
void _KeyDownHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e);
|
||||
void _KeyDownHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
static ::Microsoft::Terminal::Core::ControlKeyStates _GetPressedModifierKeys() noexcept;
|
||||
static void _ClearKeyboardState(const WORD vkey, const WORD scanCode) noexcept;
|
||||
void _HookupKeyBindings(const Microsoft::Terminal::Settings::Model::IActionMapView& actionMap) noexcept;
|
||||
@ -417,8 +417,8 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
void _WindowRenamerActionClick(const IInspectable& sender, const IInspectable& eventArgs);
|
||||
void _RequestWindowRename(const winrt::hstring& newName);
|
||||
void _WindowRenamerKeyDown(const IInspectable& sender, winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e);
|
||||
void _WindowRenamerKeyUp(const IInspectable& sender, winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e);
|
||||
void _WindowRenamerKeyDown(const IInspectable& sender, const winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
void _WindowRenamerKeyUp(const IInspectable& sender, const winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
|
||||
void _UpdateTeachingTipTheme(winrt::Windows::UI::Xaml::FrameworkElement element);
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Removes the bell indicator from the tab header
|
||||
// Arguments:
|
||||
// - sender, e: not used
|
||||
void TerminalTab::_BellIndicatorTimerTick(Windows::Foundation::IInspectable const& /*sender*/, Windows::Foundation::IInspectable const& /*e*/)
|
||||
void TerminalTab::_BellIndicatorTimerTick(const Windows::Foundation::IInspectable& /*sender*/, const Windows::Foundation::IInspectable& /*e*/)
|
||||
{
|
||||
ShowBellIndicator(false);
|
||||
// Just do a sanity check that the timer still exists before we stop it
|
||||
@ -1372,7 +1372,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
auto tab{ ptrTab };
|
||||
|
||||
std::optional<winrt::Windows::UI::Color> currentColor = tab->GetTabColor();
|
||||
auto currentColor = tab->GetTabColor();
|
||||
if (currentColor.has_value())
|
||||
{
|
||||
tab->_ApplyTabColor(currentColor.value());
|
||||
|
||||
@ -145,7 +145,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void _Setup();
|
||||
|
||||
std::optional<Windows::UI::Xaml::DispatcherTimer> _bellIndicatorTimer;
|
||||
void _BellIndicatorTimerTick(Windows::Foundation::IInspectable const& sender, Windows::Foundation::IInspectable const& e);
|
||||
void _BellIndicatorTimerTick(const Windows::Foundation::IInspectable& sender, const Windows::Foundation::IInspectable& e);
|
||||
|
||||
void _MakeTabViewItem() override;
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
// Divide by three, since we know there are only three buttons. When
|
||||
// Windows 12 comes along and adds another, we can update this /s
|
||||
static double width{ MinMaxCloseControl().ActualWidth() / 3.0 };
|
||||
static auto width{ MinMaxCloseControl().ActualWidth() / 3.0 };
|
||||
return width;
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
POINT point1 = {};
|
||||
::GetCursorPos(&point1);
|
||||
const LPARAM lParam = MAKELPARAM(point1.x, point1.y);
|
||||
const auto lParam = MAKELPARAM(point1.x, point1.y);
|
||||
WINDOWPLACEMENT placement = { sizeof(placement) };
|
||||
::GetWindowPlacement(_window, &placement);
|
||||
if (placement.showCmd == SW_SHOWNORMAL)
|
||||
@ -73,17 +73,17 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void TitlebarControl::Maximize_Click(winrt::Windows::Foundation::IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::RoutedEventArgs const& /*e*/)
|
||||
void TitlebarControl::Maximize_Click(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::Windows::UI::Xaml::RoutedEventArgs& /*e*/)
|
||||
{
|
||||
_OnMaximizeOrRestore(HTMAXBUTTON);
|
||||
}
|
||||
|
||||
void TitlebarControl::DragBar_DoubleTapped(winrt::Windows::Foundation::IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::Input::DoubleTappedRoutedEventArgs const& /*e*/)
|
||||
void TitlebarControl::DragBar_DoubleTapped(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::Windows::UI::Xaml::Input::DoubleTappedRoutedEventArgs& /*e*/)
|
||||
{
|
||||
_OnMaximizeOrRestore(HTCAPTION);
|
||||
}
|
||||
|
||||
void TitlebarControl::Minimize_Click(winrt::Windows::Foundation::IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::RoutedEventArgs const& /*e*/)
|
||||
void TitlebarControl::Minimize_Click(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::Windows::UI::Xaml::RoutedEventArgs& /*e*/)
|
||||
{
|
||||
if (_window)
|
||||
{
|
||||
@ -91,7 +91,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void TitlebarControl::Close_Click(winrt::Windows::Foundation::IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::RoutedEventArgs const& /*e*/)
|
||||
void TitlebarControl::Close_Click(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::Windows::UI::Xaml::RoutedEventArgs& /*e*/)
|
||||
{
|
||||
::PostMessage(_window, WM_SYSCOMMAND, SC_CLOSE, 0);
|
||||
}
|
||||
|
||||
@ -21,12 +21,12 @@ namespace winrt::TerminalApp::implementation
|
||||
void Content(IInspectable content);
|
||||
|
||||
void SetWindowVisualState(WindowVisualState visualState);
|
||||
void Root_SizeChanged(const IInspectable& sender, Windows::UI::Xaml::SizeChangedEventArgs const& e);
|
||||
void Root_SizeChanged(const IInspectable& sender, const Windows::UI::Xaml::SizeChangedEventArgs& e);
|
||||
|
||||
void Minimize_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void Maximize_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void Close_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void DragBar_DoubleTapped(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Input::DoubleTappedRoutedEventArgs const& e);
|
||||
void Minimize_Click(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void Maximize_Click(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void Close_Click(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void DragBar_DoubleTapped(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::Input::DoubleTappedRoutedEventArgs& e);
|
||||
|
||||
private:
|
||||
void _OnMaximizeOrRestore(byte flag);
|
||||
|
||||
@ -25,7 +25,7 @@ std::optional<std::wstring_view> ConsoleInputReader::Read()
|
||||
while (_convertedString.empty())
|
||||
{
|
||||
_buffer.resize(BufferSize);
|
||||
BOOL succeeded =
|
||||
auto succeeded =
|
||||
ReadConsoleInputW(_handle, _buffer.data(), gsl::narrow_cast<DWORD>(_buffer.size()), &readCount);
|
||||
if (!succeeded)
|
||||
{
|
||||
|
||||
@ -76,8 +76,8 @@ int wmain(int /*argc*/, wchar_t** /*argv*/)
|
||||
winrt::init_apartment(winrt::apartment_type::single_threaded);
|
||||
|
||||
DWORD inputMode{}, outputMode{};
|
||||
HANDLE conIn{ GetStdHandle(STD_INPUT_HANDLE) }, conOut{ GetStdHandle(STD_OUTPUT_HANDLE) };
|
||||
UINT codepage{ GetConsoleCP() }, outputCodepage{ GetConsoleOutputCP() };
|
||||
auto conIn{ GetStdHandle(STD_INPUT_HANDLE) }, conOut{ GetStdHandle(STD_OUTPUT_HANDLE) };
|
||||
auto codepage{ GetConsoleCP() }, outputCodepage{ GetConsoleOutputCP() };
|
||||
|
||||
RETURN_IF_WIN32_BOOL_FALSE(GetConsoleMode(conIn, &inputMode));
|
||||
RETURN_IF_WIN32_BOOL_FALSE(GetConsoleMode(conOut, &outputMode));
|
||||
|
||||
@ -121,7 +121,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
nullptr,
|
||||
0,
|
||||
[](LPVOID lpParameter) noexcept {
|
||||
AzureConnection* const pInstance = static_cast<AzureConnection*>(lpParameter);
|
||||
const auto pInstance = static_cast<AzureConnection*>(lpParameter);
|
||||
if (pInstance)
|
||||
{
|
||||
return pInstance->_OutputThread();
|
||||
@ -173,7 +173,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
// - handles the different possible inputs in the different states
|
||||
// Arguments:
|
||||
// the user's input
|
||||
void AzureConnection::WriteInput(hstring const& data)
|
||||
void AzureConnection::WriteInput(const hstring& data)
|
||||
{
|
||||
// We read input while connected AND connecting.
|
||||
if (!_isStateOneOf(ConnectionState::Connected, ConnectionState::Connecting))
|
||||
@ -429,7 +429,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
// - helper function to get the stored credentials (if any) and let the user choose what to do next
|
||||
void AzureConnection::_RunAccessState()
|
||||
{
|
||||
bool oldVersionEncountered = false;
|
||||
auto oldVersionEncountered = false;
|
||||
auto vault = PasswordVault();
|
||||
winrt::Windows::Foundation::Collections::IVectorView<PasswordCredential> credList;
|
||||
// FindAllByResource throws an exception if there are no credentials stored under the given resource so we wrap it in a try-catch block
|
||||
@ -444,7 +444,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
return;
|
||||
}
|
||||
|
||||
int numTenants{ 0 };
|
||||
auto numTenants{ 0 };
|
||||
_tenantList.clear();
|
||||
for (const auto& entry : credList)
|
||||
{
|
||||
@ -484,7 +484,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
_WriteStringWithNewline(_formatResWithColoredUserInputOptions(USES_RESOURCE(L"AzureNewLogin"), USES_RESOURCE(L"AzureUserEntry_NewLogin")));
|
||||
_WriteStringWithNewline(_formatResWithColoredUserInputOptions(USES_RESOURCE(L"AzureRemoveStored"), USES_RESOURCE(L"AzureUserEntry_RemoveStored")));
|
||||
|
||||
int selectedTenant{ -1 };
|
||||
auto selectedTenant{ -1 };
|
||||
do
|
||||
{
|
||||
auto maybeTenantSelection = _ReadUserInput(InputMode::Line);
|
||||
@ -584,7 +584,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
const auto expiresIn = std::stoi(deviceCodeResponse.at(L"expires_in").as_string());
|
||||
|
||||
// Wait for user authentication and obtain the access/refresh tokens
|
||||
json::value authenticatedResponse = _WaitForUser(devCode, pollInterval, expiresIn);
|
||||
auto authenticatedResponse = _WaitForUser(devCode, pollInterval, expiresIn);
|
||||
_accessToken = authenticatedResponse.at(L"access_token").as_string();
|
||||
_refreshToken = authenticatedResponse.at(L"refresh_token").as_string();
|
||||
|
||||
@ -615,13 +615,13 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
void AzureConnection::_RunTenantChoiceState()
|
||||
{
|
||||
auto numTenants = gsl::narrow<int>(_tenantList.size());
|
||||
for (int i = 0; i < numTenants; i++)
|
||||
for (auto i = 0; i < numTenants; i++)
|
||||
{
|
||||
_WriteStringWithNewline(_formatTenant(i, til::at(_tenantList, i)));
|
||||
}
|
||||
_WriteStringWithNewline(RS_(L"AzureEnterTenant"));
|
||||
|
||||
int selectedTenant{ -1 };
|
||||
auto selectedTenant{ -1 };
|
||||
do
|
||||
{
|
||||
auto maybeTenantSelection = _ReadUserInput(InputMode::Line);
|
||||
|
||||
@ -25,7 +25,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
void Initialize(const Windows::Foundation::Collections::ValueSet& settings);
|
||||
|
||||
void Start();
|
||||
void WriteInput(hstring const& data);
|
||||
void WriteInput(const hstring& data);
|
||||
void Resize(uint32_t rows, uint32_t columns);
|
||||
void Close();
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
{
|
||||
ConnectionInformation::ConnectionInformation(hstring const& className,
|
||||
ConnectionInformation::ConnectionInformation(const hstring& className,
|
||||
const Windows::Foundation::Collections::ValueSet& settings) :
|
||||
_ClassName{ className },
|
||||
_Settings{ settings }
|
||||
@ -33,7 +33,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 26490)
|
||||
// C++/WinRT just loves it's void**, nothing we can do here _except_ reinterpret_cast
|
||||
::IInspectable** raw = reinterpret_cast<::IInspectable**>(pointer);
|
||||
auto raw = reinterpret_cast<::IInspectable**>(pointer);
|
||||
#pragma warning(pop)
|
||||
|
||||
// RoActivateInstance() will try to create an instance of the object,
|
||||
|
||||
@ -22,7 +22,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
{
|
||||
struct ConnectionInformation : ConnectionInformationT<ConnectionInformation>
|
||||
{
|
||||
ConnectionInformation(hstring const& className,
|
||||
ConnectionInformation(const hstring& className,
|
||||
const Windows::Foundation::Collections::ValueSet& settings);
|
||||
|
||||
static TerminalConnection::ITerminalConnection CreateConnection(TerminalConnection::ConnectionInformation info);
|
||||
|
||||
@ -85,7 +85,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
nullptr,
|
||||
nullptr));
|
||||
|
||||
std::wstring cmdline{ wil::ExpandEnvironmentStringsW<std::wstring>(_commandline.c_str()) }; // mutable copy -- required for CreateProcessW
|
||||
auto cmdline{ wil::ExpandEnvironmentStringsW<std::wstring>(_commandline.c_str()) }; // mutable copy -- required for CreateProcessW
|
||||
|
||||
Utils::EnvironmentVariableMapW environment;
|
||||
auto zeroEnvMap = wil::scope_exit([&]() noexcept {
|
||||
@ -103,7 +103,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
|
||||
{
|
||||
// Convert connection Guid to string and ignore the enclosing '{}'.
|
||||
std::wstring wsGuid{ Utils::GuidToString(_guid) };
|
||||
auto wsGuid{ Utils::GuidToString(_guid) };
|
||||
wsGuid.pop_back();
|
||||
|
||||
const auto guidSubStr = std::wstring_view{ wsGuid }.substr(1);
|
||||
@ -152,7 +152,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
|
||||
RETURN_IF_FAILED(Utils::EnvironmentMapToEnvironmentStringsW(environment, newEnvVars));
|
||||
|
||||
LPWCH lpEnvironment = newEnvVars.empty() ? nullptr : newEnvVars.data();
|
||||
auto lpEnvironment = newEnvVars.empty() ? nullptr : newEnvVars.data();
|
||||
|
||||
// If we have a startingTitle, create a mutable character buffer to add
|
||||
// it to the STARTUPINFO.
|
||||
@ -164,7 +164,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
}
|
||||
|
||||
auto [newCommandLine, newStartingDirectory] = Utils::MangleStartingDirectoryForWSL(cmdline, _startingDirectory);
|
||||
const wchar_t* const startingDirectory = newStartingDirectory.size() > 0 ? newStartingDirectory.c_str() : nullptr;
|
||||
const auto startingDirectory = newStartingDirectory.size() > 0 ? newStartingDirectory.c_str() : nullptr;
|
||||
|
||||
RETURN_IF_WIN32_BOOL_FALSE(CreateProcessW(
|
||||
nullptr,
|
||||
@ -225,10 +225,10 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
Windows::Foundation::Collections::ValueSet ConptyConnection::CreateSettings(const winrt::hstring& cmdline,
|
||||
const winrt::hstring& startingDirectory,
|
||||
const winrt::hstring& startingTitle,
|
||||
Windows::Foundation::Collections::IMapView<hstring, hstring> const& environment,
|
||||
const Windows::Foundation::Collections::IMapView<hstring, hstring>& environment,
|
||||
uint32_t rows,
|
||||
uint32_t columns,
|
||||
winrt::guid const& guid)
|
||||
const winrt::guid& guid)
|
||||
{
|
||||
Windows::Foundation::Collections::ValueSet vs{};
|
||||
|
||||
@ -345,7 +345,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
nullptr,
|
||||
0,
|
||||
[](LPVOID lpParameter) noexcept {
|
||||
ConptyConnection* const pInstance = static_cast<ConptyConnection*>(lpParameter);
|
||||
const auto pInstance = static_cast<ConptyConnection*>(lpParameter);
|
||||
if (pInstance)
|
||||
{
|
||||
return pInstance->_OutputThread();
|
||||
@ -362,7 +362,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
|
||||
_clientExitWait.reset(CreateThreadpoolWait(
|
||||
[](PTP_CALLBACK_INSTANCE /*callbackInstance*/, PVOID context, PTP_WAIT /*wait*/, TP_WAIT_RESULT /*waitResult*/) noexcept {
|
||||
ConptyConnection* const pInstance = static_cast<ConptyConnection*>(context);
|
||||
const auto pInstance = static_cast<ConptyConnection*>(context);
|
||||
if (pInstance)
|
||||
{
|
||||
pInstance->_ClientTerminated();
|
||||
@ -450,7 +450,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
}
|
||||
CATCH_LOG()
|
||||
|
||||
void ConptyConnection::WriteInput(hstring const& data)
|
||||
void ConptyConnection::WriteInput(const hstring& data)
|
||||
{
|
||||
if (!_isConnected())
|
||||
{
|
||||
@ -459,7 +459,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
|
||||
// convert from UTF-16LE to UTF-8 as ConPty expects UTF-8
|
||||
// TODO GH#3378 reconcile and unify UTF-8 converters
|
||||
std::string str = winrt::to_string(data);
|
||||
auto str = winrt::to_string(data);
|
||||
LOG_IF_WIN32_BOOL_FALSE(WriteFile(_inPipe.get(), str.c_str(), (DWORD)str.length(), nullptr, nullptr));
|
||||
}
|
||||
|
||||
@ -595,7 +595,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
// else we call convertUTF8ChunkToUTF16 with an empty string_view to convert possible remaining partials to U+FFFD
|
||||
}
|
||||
|
||||
const HRESULT result{ til::u8u16(std::string_view{ _buffer.data(), read }, _u16Str, _u8State) };
|
||||
const auto result{ til::u8u16(std::string_view{ _buffer.data(), read }, _u16Str, _u8State) };
|
||||
if (FAILED(result))
|
||||
{
|
||||
if (_isStateAtOrBeyond(ConnectionState::Closing))
|
||||
@ -640,8 +640,8 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
|
||||
static winrt::event<NewConnectionHandler> _newConnectionHandlers;
|
||||
|
||||
winrt::event_token ConptyConnection::NewConnection(NewConnectionHandler const& handler) { return _newConnectionHandlers.add(handler); };
|
||||
void ConptyConnection::NewConnection(winrt::event_token const& token) { _newConnectionHandlers.remove(token); };
|
||||
winrt::event_token ConptyConnection::NewConnection(const NewConnectionHandler& handler) { return _newConnectionHandlers.add(handler); };
|
||||
void ConptyConnection::NewConnection(const winrt::event_token& token) { _newConnectionHandlers.remove(token); };
|
||||
|
||||
HRESULT ConptyConnection::NewHandoff(HANDLE in, HANDLE out, HANDLE signal, HANDLE ref, HANDLE server, HANDLE client) noexcept
|
||||
try
|
||||
|
||||
@ -31,7 +31,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
static winrt::fire_and_forget final_release(std::unique_ptr<ConptyConnection> connection);
|
||||
|
||||
void Start();
|
||||
void WriteInput(hstring const& data);
|
||||
void WriteInput(const hstring& data);
|
||||
void Resize(uint32_t rows, uint32_t columns);
|
||||
void Close() noexcept;
|
||||
void ClearBuffer();
|
||||
@ -43,16 +43,16 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
static void StartInboundListener();
|
||||
static void StopInboundListener();
|
||||
|
||||
static winrt::event_token NewConnection(NewConnectionHandler const& handler);
|
||||
static void NewConnection(winrt::event_token const& token);
|
||||
static winrt::event_token NewConnection(const NewConnectionHandler& handler);
|
||||
static void NewConnection(const winrt::event_token& token);
|
||||
|
||||
static Windows::Foundation::Collections::ValueSet CreateSettings(const winrt::hstring& cmdline,
|
||||
const winrt::hstring& startingDirectory,
|
||||
const winrt::hstring& startingTitle,
|
||||
Windows::Foundation::Collections::IMapView<hstring, hstring> const& environment,
|
||||
const Windows::Foundation::Collections::IMapView<hstring, hstring>& environment,
|
||||
uint32_t rows,
|
||||
uint32_t columns,
|
||||
winrt::guid const& guid);
|
||||
const winrt::guid& guid);
|
||||
|
||||
WINRT_CALLBACK(TerminalOutput, TerminalOutputHandler);
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
{
|
||||
}
|
||||
|
||||
void EchoConnection::WriteInput(hstring const& data)
|
||||
void EchoConnection::WriteInput(const hstring& data)
|
||||
{
|
||||
std::wstringstream prettyPrint;
|
||||
for (const auto& wch : data)
|
||||
|
||||
@ -12,7 +12,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
EchoConnection() noexcept;
|
||||
|
||||
void Start() noexcept;
|
||||
void WriteInput(hstring const& data);
|
||||
void WriteInput(const hstring& data);
|
||||
void Resize(uint32_t rows, uint32_t columns) noexcept;
|
||||
void Close() noexcept;
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
static bool _EnsureStaticInitialization()
|
||||
{
|
||||
// use C++11 magic statics to make sure we only do this once.
|
||||
static bool initialized = []() {
|
||||
static auto initialized = []() {
|
||||
// *** THIS IS A SINGLETON ***
|
||||
SetGlyphWidthFallback(_IsGlyphWideForceNarrowFallback);
|
||||
|
||||
@ -706,8 +706,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// concerned with initialization process. Value forwarded to event handler.
|
||||
void ControlCore::_updateFont(const bool initialUpdate)
|
||||
{
|
||||
const int newDpi = static_cast<int>(static_cast<double>(USER_DEFAULT_SCREEN_DPI) *
|
||||
_compositionScale);
|
||||
const auto newDpi = static_cast<int>(static_cast<double>(USER_DEFAULT_SCREEN_DPI) *
|
||||
_compositionScale);
|
||||
|
||||
_terminal->SetFontInfo(_actualFont);
|
||||
|
||||
@ -844,7 +844,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
|
||||
// If this function succeeds with S_FALSE, then the terminal didn't
|
||||
// actually change size. No need to notify the connection of this no-op.
|
||||
const HRESULT hr = _terminal->UserResize({ vp.Width(), vp.Height() });
|
||||
const auto hr = _terminal->UserResize({ vp.Width(), vp.Height() });
|
||||
if (SUCCEEDED(hr) && hr != S_FALSE)
|
||||
{
|
||||
_connection.Resize(vp.Height(), vp.Width());
|
||||
@ -890,7 +890,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
_refreshSizeUnderLock();
|
||||
}
|
||||
|
||||
void ControlCore::SetSelectionAnchor(til::point const& position)
|
||||
void ControlCore::SetSelectionAnchor(const til::point& position)
|
||||
{
|
||||
auto lock = _terminal->LockForWriting();
|
||||
_terminal->SetSelectionAnchor(position.to_win32_coord());
|
||||
@ -900,7 +900,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - Sets selection's end position to match supplied cursor position, e.g. while mouse dragging.
|
||||
// Arguments:
|
||||
// - position: the point in terminal coordinates (in cells, not pixels)
|
||||
void ControlCore::SetEndSelectionPoint(til::point const& position)
|
||||
void ControlCore::SetEndSelectionPoint(const til::point& position)
|
||||
{
|
||||
if (!_terminal->IsSelectionActive())
|
||||
{
|
||||
@ -1261,17 +1261,17 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
return;
|
||||
}
|
||||
|
||||
const Search::Direction direction = goForward ?
|
||||
Search::Direction::Forward :
|
||||
Search::Direction::Backward;
|
||||
const auto direction = goForward ?
|
||||
Search::Direction::Forward :
|
||||
Search::Direction::Backward;
|
||||
|
||||
const Search::Sensitivity sensitivity = caseSensitive ?
|
||||
Search::Sensitivity::CaseSensitive :
|
||||
Search::Sensitivity::CaseInsensitive;
|
||||
const auto sensitivity = caseSensitive ?
|
||||
Search::Sensitivity::CaseSensitive :
|
||||
Search::Sensitivity::CaseInsensitive;
|
||||
|
||||
::Search search(*GetUiaData(), text.c_str(), direction, sensitivity);
|
||||
auto lock = _terminal->LockForWriting();
|
||||
const bool foundMatch{ search.FindNext() };
|
||||
const auto foundMatch{ search.FindNext() };
|
||||
if (foundMatch)
|
||||
{
|
||||
_terminal->SetBlockSelection(false);
|
||||
@ -1423,7 +1423,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// handle ALT key
|
||||
_terminal->SetBlockSelection(altEnabled);
|
||||
|
||||
::Terminal::SelectionExpansion mode = ::Terminal::SelectionExpansion::Char;
|
||||
auto mode = ::Terminal::SelectionExpansion::Char;
|
||||
if (numberOfClicks == 1)
|
||||
{
|
||||
mode = ::Terminal::SelectionExpansion::Char;
|
||||
|
||||
@ -147,8 +147,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
bool HasSelection() const;
|
||||
bool CopyOnSelect() const;
|
||||
Windows::Foundation::Collections::IVector<winrt::hstring> SelectedText(bool trimTrailingWhitespace) const;
|
||||
void SetSelectionAnchor(til::point const& position);
|
||||
void SetEndSelectionPoint(til::point const& position);
|
||||
void SetSelectionAnchor(const til::point& position);
|
||||
void SetEndSelectionPoint(const til::point& position);
|
||||
|
||||
void Search(const winrt::hstring& text,
|
||||
const bool goForward,
|
||||
|
||||
@ -198,7 +198,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
const ::Microsoft::Terminal::Core::ControlKeyStates modifiers,
|
||||
const Core::Point pixelPosition)
|
||||
{
|
||||
const til::point terminalPosition = _getTerminalPosition(til::point{ pixelPosition });
|
||||
const auto terminalPosition = _getTerminalPosition(til::point{ pixelPosition });
|
||||
|
||||
const auto altEnabled = modifiers.IsAltPressed();
|
||||
const auto shiftEnabled = modifiers.IsShiftPressed();
|
||||
@ -239,7 +239,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
_lastMouseClickPosNoSelection = pixelPosition;
|
||||
}
|
||||
}
|
||||
const bool isOnOriginalPosition = _lastMouseClickPosNoSelection == pixelPosition;
|
||||
const auto isOnOriginalPosition = _lastMouseClickPosNoSelection == pixelPosition;
|
||||
|
||||
_core->LeftClickOnTerminal(terminalPosition,
|
||||
multiClickMapper,
|
||||
@ -281,7 +281,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
const Core::Point pixelPosition,
|
||||
const bool pointerPressedInBounds)
|
||||
{
|
||||
const til::point terminalPosition = _getTerminalPosition(til::point{ pixelPosition });
|
||||
const auto terminalPosition = _getTerminalPosition(til::point{ pixelPosition });
|
||||
|
||||
// Short-circuit isReadOnly check to avoid warning dialog
|
||||
if (focused && !_core->IsInReadOnlyMode() && _canSendVTMouseInput(modifiers))
|
||||
@ -367,7 +367,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
const ::Microsoft::Terminal::Core::ControlKeyStates modifiers,
|
||||
const Core::Point pixelPosition)
|
||||
{
|
||||
const til::point terminalPosition = _getTerminalPosition(til::point{ pixelPosition });
|
||||
const auto terminalPosition = _getTerminalPosition(til::point{ pixelPosition });
|
||||
// Short-circuit isReadOnly check to avoid warning dialog
|
||||
if (!_core->IsInReadOnlyMode() && _canSendVTMouseInput(modifiers))
|
||||
{
|
||||
@ -377,7 +377,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
|
||||
// Only a left click release when copy on select is active should perform a copy.
|
||||
// Right clicks and middle clicks should not need to do anything when released.
|
||||
const bool isLeftMouseRelease = pointerUpdateKind == WM_LBUTTONUP;
|
||||
const auto isLeftMouseRelease = pointerUpdateKind == WM_LBUTTONUP;
|
||||
|
||||
if (_core->CopyOnSelect() &&
|
||||
isLeftMouseRelease &&
|
||||
@ -411,7 +411,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
const Core::Point pixelPosition,
|
||||
const Control::MouseButtonState buttonState)
|
||||
{
|
||||
const til::point terminalPosition = _getTerminalPosition(til::point{ pixelPosition });
|
||||
const auto terminalPosition = _getTerminalPosition(til::point{ pixelPosition });
|
||||
|
||||
// Short-circuit isReadOnly check to avoid warning dialog.
|
||||
//
|
||||
@ -496,23 +496,23 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// underneath us. We wouldn't know - we don't want the overhead of
|
||||
// another ScrollPositionChanged handler. If the scrollbar should be
|
||||
// somewhere other than where it is currently, then start from that row.
|
||||
const int currentInternalRow = ::base::saturated_cast<int>(::std::round(_internalScrollbarPosition));
|
||||
const int currentCoreRow = _core->ScrollOffset();
|
||||
const double currentOffset = currentInternalRow == currentCoreRow ?
|
||||
_internalScrollbarPosition :
|
||||
currentCoreRow;
|
||||
const auto currentInternalRow = ::base::saturated_cast<int>(::std::round(_internalScrollbarPosition));
|
||||
const auto currentCoreRow = _core->ScrollOffset();
|
||||
const auto currentOffset = currentInternalRow == currentCoreRow ?
|
||||
_internalScrollbarPosition :
|
||||
currentCoreRow;
|
||||
|
||||
// negative = down, positive = up
|
||||
// However, for us, the signs are flipped.
|
||||
// With one of the precision mice, one click is always a multiple of 120 (WHEEL_DELTA),
|
||||
// but the "smooth scrolling" mode results in non-int values
|
||||
const double rowDelta = mouseDelta / (-1.0 * WHEEL_DELTA);
|
||||
const auto rowDelta = mouseDelta / (-1.0 * WHEEL_DELTA);
|
||||
|
||||
// WHEEL_PAGESCROLL is a Win32 constant that represents the "scroll one page
|
||||
// at a time" setting. If we ignore it, we will scroll a truly absurd number
|
||||
// of rows.
|
||||
const double rowsToScroll{ _rowsToScroll == WHEEL_PAGESCROLL ? ::base::saturated_cast<double>(_core->ViewHeight()) : _rowsToScroll };
|
||||
double newValue = (rowsToScroll * rowDelta) + (currentOffset);
|
||||
const auto rowsToScroll{ _rowsToScroll == WHEEL_PAGESCROLL ? ::base::saturated_cast<double>(_core->ViewHeight()) : _rowsToScroll };
|
||||
auto newValue = (rowsToScroll * rowDelta) + (currentOffset);
|
||||
|
||||
// Update the Core's viewport position, and raise a
|
||||
// ScrollPositionChanged event to update the scrollbar
|
||||
@ -552,7 +552,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// If the new scrollbar position, rounded to an int, is at a different
|
||||
// row, then actually update the scroll position in the core, and raise
|
||||
// a ScrollPositionChanged to inform the control.
|
||||
int viewTop = ::base::saturated_cast<int>(::std::round(_internalScrollbarPosition));
|
||||
auto viewTop = ::base::saturated_cast<int>(::std::round(_internalScrollbarPosition));
|
||||
if (viewTop != _core->ScrollOffset())
|
||||
{
|
||||
_core->UserScrollViewport(viewTop);
|
||||
|
||||
@ -204,11 +204,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
{
|
||||
// transfer ownership of UiaTextRanges to this new vector
|
||||
auto providers = SafeArrayToOwningVector<::Microsoft::Terminal::TermControlUiaTextRange>(textRanges);
|
||||
int count = gsl::narrow<int>(providers.size());
|
||||
auto count = gsl::narrow<int>(providers.size());
|
||||
|
||||
std::vector<XamlAutomation::ITextRangeProvider> vec;
|
||||
vec.reserve(count);
|
||||
for (int i = 0; i < count; i++)
|
||||
for (auto i = 0; i < count; i++)
|
||||
{
|
||||
if (auto xutr = _CreateXamlUiaTextRange(providers[i].detach()))
|
||||
{
|
||||
|
||||
@ -12,7 +12,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
{
|
||||
static VirtualKeyModifiers modifiersFromBooleans(bool ctrl, bool alt, bool shift, bool win)
|
||||
{
|
||||
VirtualKeyModifiers modifiers = VirtualKeyModifiers::None;
|
||||
auto modifiers = VirtualKeyModifiers::None;
|
||||
WI_SetFlagIf(modifiers, VirtualKeyModifiers::Control, ctrl);
|
||||
WI_SetFlagIf(modifiers, VirtualKeyModifiers::Menu, alt);
|
||||
WI_SetFlagIf(modifiers, VirtualKeyModifiers::Shift, shift);
|
||||
|
||||
@ -58,11 +58,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - e: event data
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void SearchBoxControl::TextBoxKeyDown(winrt::Windows::Foundation::IInspectable const& /*sender*/, Input::KeyRoutedEventArgs const& e)
|
||||
void SearchBoxControl::TextBoxKeyDown(const winrt::Windows::Foundation::IInspectable& /*sender*/, const Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
if (e.OriginalKey() == winrt::Windows::System::VirtualKey::Enter)
|
||||
{
|
||||
auto const state = CoreWindow::GetForCurrentThread().GetKeyState(winrt::Windows::System::VirtualKey::Shift);
|
||||
const auto state = CoreWindow::GetForCurrentThread().GetKeyState(winrt::Windows::System::VirtualKey::Shift);
|
||||
if (WI_IsFlagSet(state, CoreVirtualKeyStates::Down))
|
||||
{
|
||||
_SearchHandlers(TextBox().Text(), !_GoForward(), _CaseSensitive());
|
||||
@ -84,8 +84,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - e: event data
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void SearchBoxControl::_KeyDownHandler(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Input::KeyRoutedEventArgs const& e)
|
||||
void SearchBoxControl::_KeyDownHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
if (e.OriginalKey() == winrt::Windows::System::VirtualKey::Escape)
|
||||
{
|
||||
@ -116,7 +116,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - text: string value to populate in the TextBox
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void SearchBoxControl::PopulateTextbox(winrt::hstring const& text)
|
||||
void SearchBoxControl::PopulateTextbox(const winrt::hstring& text)
|
||||
{
|
||||
if (TextBox())
|
||||
{
|
||||
@ -151,7 +151,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - e: not used
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void SearchBoxControl::GoBackwardClicked(winrt::Windows::Foundation::IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
|
||||
void SearchBoxControl::GoBackwardClicked(const winrt::Windows::Foundation::IInspectable& /*sender*/, const RoutedEventArgs& /*e*/)
|
||||
{
|
||||
GoBackwardButton().IsChecked(true);
|
||||
if (GoForwardButton().IsChecked())
|
||||
@ -172,7 +172,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - e: not used
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void SearchBoxControl::GoForwardClicked(winrt::Windows::Foundation::IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
|
||||
void SearchBoxControl::GoForwardClicked(const winrt::Windows::Foundation::IInspectable& /*sender*/, const RoutedEventArgs& /*e*/)
|
||||
{
|
||||
GoForwardButton().IsChecked(true);
|
||||
if (GoBackwardButton().IsChecked())
|
||||
@ -192,7 +192,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - e: event data
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void SearchBoxControl::CloseClick(winrt::Windows::Foundation::IInspectable const& /*sender*/, RoutedEventArgs const& e)
|
||||
void SearchBoxControl::CloseClick(const winrt::Windows::Foundation::IInspectable& /*sender*/, const RoutedEventArgs& e)
|
||||
{
|
||||
_ClosedHandlers(*this, e);
|
||||
}
|
||||
@ -205,7 +205,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - e: event data
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void SearchBoxControl::_CharacterHandler(winrt::Windows::Foundation::IInspectable const& /*sender*/, Input::CharacterReceivedRoutedEventArgs const& e)
|
||||
void SearchBoxControl::_CharacterHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/, const Input::CharacterReceivedRoutedEventArgs& e)
|
||||
{
|
||||
e.Handled(true);
|
||||
}
|
||||
|
||||
@ -25,15 +25,15 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
{
|
||||
SearchBoxControl();
|
||||
|
||||
void TextBoxKeyDown(winrt::Windows::Foundation::IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e);
|
||||
void TextBoxKeyDown(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
|
||||
void SetFocusOnTextbox();
|
||||
void PopulateTextbox(winrt::hstring const& text);
|
||||
void PopulateTextbox(const winrt::hstring& text);
|
||||
bool ContainsFocus();
|
||||
|
||||
void GoBackwardClicked(winrt::Windows::Foundation::IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::RoutedEventArgs const& /*e*/);
|
||||
void GoForwardClicked(winrt::Windows::Foundation::IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::RoutedEventArgs const& /*e*/);
|
||||
void CloseClick(winrt::Windows::Foundation::IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void GoBackwardClicked(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::Windows::UI::Xaml::RoutedEventArgs& /*e*/);
|
||||
void GoForwardClicked(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::Windows::UI::Xaml::RoutedEventArgs& /*e*/);
|
||||
void CloseClick(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
|
||||
WINRT_CALLBACK(Search, SearchHandler);
|
||||
TYPED_EVENT(Closed, Control::SearchBoxControl, Windows::UI::Xaml::RoutedEventArgs);
|
||||
@ -43,8 +43,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
|
||||
bool _GoForward();
|
||||
bool _CaseSensitive();
|
||||
void _KeyDownHandler(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e);
|
||||
void _CharacterHandler(winrt::Windows::Foundation::IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::Input::CharacterReceivedRoutedEventArgs const& e);
|
||||
void _KeyDownHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
void _CharacterHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::Windows::UI::Xaml::Input::CharacterReceivedRoutedEventArgs& e);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -146,8 +146,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
_CurrentCursorPositionHandlers(*this, *cursorArgs);
|
||||
const til::point cursorPos{ til::math::flooring, cursorArgs->CurrentPosition() };
|
||||
|
||||
const double actualCanvasWidth{ Canvas().ActualWidth() };
|
||||
const double actualTextBlockHeight{ TextBlock().ActualHeight() };
|
||||
const auto actualCanvasWidth{ Canvas().ActualWidth() };
|
||||
const auto actualTextBlockHeight{ TextBlock().ActualHeight() };
|
||||
const auto actualWindowBounds{ CoreWindow::GetForCurrentThread().Bounds() };
|
||||
|
||||
if (_currentTerminalCursorPos == cursorPos &&
|
||||
@ -184,10 +184,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
|
||||
// Convert text buffer cursor position to client coordinate position
|
||||
// within the window. This point is in _pixels_
|
||||
const til::point clientCursorPos{ _currentTerminalCursorPos * fontSize };
|
||||
const auto clientCursorPos{ _currentTerminalCursorPos * fontSize };
|
||||
|
||||
// Get scale factor for view
|
||||
const double scaleFactor = DisplayInformation::GetForCurrentView().RawPixelsPerViewPixel();
|
||||
const auto scaleFactor = DisplayInformation::GetForCurrentView().RawPixelsPerViewPixel();
|
||||
|
||||
const til::point clientCursorInDips{ til::math::flooring, clientCursorPos.x / scaleFactor, clientCursorPos.y / scaleFactor };
|
||||
|
||||
@ -197,7 +197,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
|
||||
// calculate FontSize in pixels from Points
|
||||
const double fontSizePx = (fontSize.height * 72) / USER_DEFAULT_SCREEN_DPI;
|
||||
const double unscaledFontSizePx = fontSizePx / scaleFactor;
|
||||
const auto unscaledFontSizePx = fontSizePx / scaleFactor;
|
||||
|
||||
// Make sure to unscale the font size to correct for DPI! XAML needs
|
||||
// things in DIPs, and the fontSize is in pixels.
|
||||
@ -229,13 +229,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
|
||||
// The controlAbsoluteOrigin is the origin of the control relative to
|
||||
// the origin of the displays. THIS IS IN DIPs
|
||||
const til::point controlAbsoluteOrigin{ windowOrigin + controlOrigin };
|
||||
const auto controlAbsoluteOrigin{ windowOrigin + controlOrigin };
|
||||
|
||||
// Convert the control origin to pixels
|
||||
const til::point scaledFrameOrigin = til::point{ til::math::flooring, controlAbsoluteOrigin.x * scaleFactor, controlAbsoluteOrigin.y * scaleFactor };
|
||||
const auto scaledFrameOrigin = til::point{ til::math::flooring, controlAbsoluteOrigin.x * scaleFactor, controlAbsoluteOrigin.y * scaleFactor };
|
||||
|
||||
// Get the location of the cursor in the display, in pixels.
|
||||
til::point screenCursorPos{ scaledFrameOrigin + clientCursorPos };
|
||||
auto screenCursorPos{ scaledFrameOrigin + clientCursorPos };
|
||||
|
||||
// GH #5007 - make sure to account for wrapping the IME composition at
|
||||
// the right side of the viewport.
|
||||
@ -264,7 +264,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - args: CoreTextLayoutRequestedEventArgs to be updated with position information.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TSFInputControl::_layoutRequestedHandler(CoreTextEditContext sender, CoreTextLayoutRequestedEventArgs const& args)
|
||||
void TSFInputControl::_layoutRequestedHandler(CoreTextEditContext sender, const CoreTextLayoutRequestedEventArgs& args)
|
||||
{
|
||||
auto request = args.Request();
|
||||
|
||||
@ -285,7 +285,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - args: CoreTextCompositionStartedEventArgs. Not used in method.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TSFInputControl::_compositionStartedHandler(CoreTextEditContext sender, CoreTextCompositionStartedEventArgs const& /*args*/)
|
||||
void TSFInputControl::_compositionStartedHandler(CoreTextEditContext sender, const CoreTextCompositionStartedEventArgs& /*args*/)
|
||||
{
|
||||
_inComposition = true;
|
||||
}
|
||||
@ -298,7 +298,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - args: CoreTextCompositionCompletedEventArgs. Not used in method.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TSFInputControl::_compositionCompletedHandler(CoreTextEditContext sender, CoreTextCompositionCompletedEventArgs const& /*args*/)
|
||||
void TSFInputControl::_compositionCompletedHandler(CoreTextEditContext sender, const CoreTextCompositionCompletedEventArgs& /*args*/)
|
||||
{
|
||||
_inComposition = false;
|
||||
|
||||
@ -319,7 +319,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - object: CoreTextCompositionStartedEventArgs. Not used in method.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TSFInputControl::_focusRemovedHandler(CoreTextEditContext sender, winrt::Windows::Foundation::IInspectable const& /*object*/)
|
||||
void TSFInputControl::_focusRemovedHandler(CoreTextEditContext sender, const winrt::Windows::Foundation::IInspectable& /*object*/)
|
||||
{
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - args: CoreTextTextRequestedEventArgs to be updated with requested range text.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TSFInputControl::_textRequestedHandler(CoreTextEditContext sender, CoreTextTextRequestedEventArgs const& args)
|
||||
void TSFInputControl::_textRequestedHandler(CoreTextEditContext sender, const CoreTextTextRequestedEventArgs& args)
|
||||
{
|
||||
// the range the TSF wants to know about
|
||||
const auto range = args.Request().Range();
|
||||
@ -358,7 +358,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - args: CoreTextSelectionRequestedEventArgs for providing data for the SelectionRequested event. Not used in method.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TSFInputControl::_selectionRequestedHandler(CoreTextEditContext sender, CoreTextSelectionRequestedEventArgs const& /*args*/)
|
||||
void TSFInputControl::_selectionRequestedHandler(CoreTextEditContext sender, const CoreTextSelectionRequestedEventArgs& /*args*/)
|
||||
{
|
||||
}
|
||||
|
||||
@ -372,7 +372,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - args: CoreTextSelectionUpdatingEventArgs for providing data for the SelectionUpdating event. Not used in method.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TSFInputControl::_selectionUpdatingHandler(CoreTextEditContext sender, CoreTextSelectionUpdatingEventArgs const& /*args*/)
|
||||
void TSFInputControl::_selectionUpdatingHandler(CoreTextEditContext sender, const CoreTextSelectionUpdatingEventArgs& /*args*/)
|
||||
{
|
||||
}
|
||||
|
||||
@ -384,7 +384,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - args: CoreTextTextUpdatingEventArgs contains new text to update buffer with.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TSFInputControl::_textUpdatingHandler(CoreTextEditContext sender, CoreTextTextUpdatingEventArgs const& args)
|
||||
void TSFInputControl::_textUpdatingHandler(CoreTextEditContext sender, const CoreTextTextUpdatingEventArgs& args)
|
||||
{
|
||||
const auto incomingText = args.Text();
|
||||
const auto range = args.Range();
|
||||
@ -467,7 +467,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - args: CoreTextFormatUpdatingEventArgs Provides data for the FormatUpdating event. Not used in method.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TSFInputControl::_formatUpdatingHandler(CoreTextEditContext sender, CoreTextFormatUpdatingEventArgs const& /*args*/)
|
||||
void TSFInputControl::_formatUpdatingHandler(CoreTextEditContext sender, const CoreTextFormatUpdatingEventArgs& /*args*/)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,15 +48,15 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
WINRT_CALLBACK(CompositionCompleted, Control::CompositionCompletedEventArgs);
|
||||
|
||||
private:
|
||||
void _layoutRequestedHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, winrt::Windows::UI::Text::Core::CoreTextLayoutRequestedEventArgs const& args);
|
||||
void _compositionStartedHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, winrt::Windows::UI::Text::Core::CoreTextCompositionStartedEventArgs const& args);
|
||||
void _compositionCompletedHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, winrt::Windows::UI::Text::Core::CoreTextCompositionCompletedEventArgs const& args);
|
||||
void _focusRemovedHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, winrt::Windows::Foundation::IInspectable const& object);
|
||||
void _selectionRequestedHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, winrt::Windows::UI::Text::Core::CoreTextSelectionRequestedEventArgs const& args);
|
||||
void _textRequestedHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, winrt::Windows::UI::Text::Core::CoreTextTextRequestedEventArgs const& args);
|
||||
void _selectionUpdatingHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, winrt::Windows::UI::Text::Core::CoreTextSelectionUpdatingEventArgs const& args);
|
||||
void _textUpdatingHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, winrt::Windows::UI::Text::Core::CoreTextTextUpdatingEventArgs const& args);
|
||||
void _formatUpdatingHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, winrt::Windows::UI::Text::Core::CoreTextFormatUpdatingEventArgs const& args);
|
||||
void _layoutRequestedHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, const winrt::Windows::UI::Text::Core::CoreTextLayoutRequestedEventArgs& args);
|
||||
void _compositionStartedHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, const winrt::Windows::UI::Text::Core::CoreTextCompositionStartedEventArgs& args);
|
||||
void _compositionCompletedHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, const winrt::Windows::UI::Text::Core::CoreTextCompositionCompletedEventArgs& args);
|
||||
void _focusRemovedHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, const winrt::Windows::Foundation::IInspectable& object);
|
||||
void _selectionRequestedHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, const winrt::Windows::UI::Text::Core::CoreTextSelectionRequestedEventArgs& args);
|
||||
void _textRequestedHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, const winrt::Windows::UI::Text::Core::CoreTextTextRequestedEventArgs& args);
|
||||
void _selectionUpdatingHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, const winrt::Windows::UI::Text::Core::CoreTextSelectionUpdatingEventArgs& args);
|
||||
void _textUpdatingHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, const winrt::Windows::UI::Text::Core::CoreTextTextUpdatingEventArgs& args);
|
||||
void _formatUpdatingHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, const winrt::Windows::UI::Text::Core::CoreTextFormatUpdatingEventArgs& args);
|
||||
|
||||
winrt::Windows::UI::Text::Core::CoreTextEditContext::TextRequested_revoker _textRequestedRevoker;
|
||||
winrt::Windows::UI::Text::Core::CoreTextEditContext::SelectionRequested_revoker _selectionRequestedRevoker;
|
||||
|
||||
@ -222,7 +222,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TermControl::_CloseSearchBoxControl(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
RoutedEventArgs const& /*args*/)
|
||||
const RoutedEventArgs& /*args*/)
|
||||
{
|
||||
_searchBox->Visibility(Visibility::Collapsed);
|
||||
|
||||
@ -630,7 +630,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
|
||||
if (auto control{ weakThis.get() })
|
||||
{
|
||||
const HANDLE chainHandle = reinterpret_cast<HANDLE>(control->_core.SwapChainHandle());
|
||||
const auto chainHandle = reinterpret_cast<HANDLE>(control->_core.SwapChainHandle());
|
||||
_AttachDxgiSwapChainToXaml(chainHandle);
|
||||
}
|
||||
}
|
||||
@ -772,7 +772,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
}
|
||||
|
||||
// Set up blinking attributes
|
||||
BOOL animationsEnabled = TRUE;
|
||||
auto animationsEnabled = TRUE;
|
||||
SystemParametersInfoW(SPI_GETCLIENTAREAANIMATION, 0, &animationsEnabled, 0);
|
||||
if (animationsEnabled && blinkTime != INFINITE)
|
||||
{
|
||||
@ -812,8 +812,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
return true;
|
||||
}
|
||||
|
||||
void TermControl::_CharacterHandler(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Input::CharacterReceivedRoutedEventArgs const& e)
|
||||
void TermControl::_CharacterHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Input::CharacterReceivedRoutedEventArgs& e)
|
||||
{
|
||||
if (_IsClosing())
|
||||
{
|
||||
@ -832,7 +832,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
modifiers |= ControlKeyStates::EnhancedKey;
|
||||
}
|
||||
|
||||
const bool handled = _core.SendCharEvent(ch, scanCode, modifiers);
|
||||
const auto handled = _core.SendCharEvent(ch, scanCode, modifiers);
|
||||
e.Handled(handled);
|
||||
}
|
||||
|
||||
@ -866,7 +866,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// Or do so for alt+space; only send to terminal when explicitly unbound
|
||||
// That is part of #GH7125
|
||||
auto bindings{ _core.Settings().KeyBindings() };
|
||||
bool isUnbound = false;
|
||||
auto isUnbound = false;
|
||||
const KeyChord kc = {
|
||||
modifiers.IsCtrlPressed(),
|
||||
modifiers.IsAltPressed(),
|
||||
@ -886,7 +886,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
}
|
||||
}
|
||||
|
||||
const bool sendToTerminal = vkey == VK_F7 || (vkey == VK_SPACE && isUnbound);
|
||||
const auto sendToTerminal = vkey == VK_F7 || (vkey == VK_SPACE && isUnbound);
|
||||
|
||||
if (!handled && sendToTerminal)
|
||||
{
|
||||
@ -900,19 +900,19 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
return handled;
|
||||
}
|
||||
|
||||
void TermControl::_KeyDownHandler(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Input::KeyRoutedEventArgs const& e)
|
||||
void TermControl::_KeyDownHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
_KeyHandler(e, true);
|
||||
}
|
||||
|
||||
void TermControl::_KeyUpHandler(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Input::KeyRoutedEventArgs const& e)
|
||||
void TermControl::_KeyUpHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
_KeyHandler(e, false);
|
||||
}
|
||||
|
||||
void TermControl::_KeyHandler(Input::KeyRoutedEventArgs const& e, const bool keyDown)
|
||||
void TermControl::_KeyHandler(const Input::KeyRoutedEventArgs& e, const bool keyDown)
|
||||
{
|
||||
// If the current focused element is a child element of searchbox,
|
||||
// we do not send this event up to terminal
|
||||
@ -1079,7 +1079,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
const ControlKeyStates modifiers,
|
||||
const bool keyDown)
|
||||
{
|
||||
const CoreWindow window = CoreWindow::GetForCurrentThread();
|
||||
const auto window = CoreWindow::GetForCurrentThread();
|
||||
|
||||
if (vkey == VK_ESCAPE ||
|
||||
vkey == VK_RETURN)
|
||||
@ -1129,8 +1129,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// Arguments:
|
||||
// - sender: the XAML element responding to the pointer input
|
||||
// - args: event data
|
||||
void TermControl::_PointerPressedHandler(Windows::Foundation::IInspectable const& sender,
|
||||
Input::PointerRoutedEventArgs const& args)
|
||||
void TermControl::_PointerPressedHandler(const Windows::Foundation::IInspectable& sender,
|
||||
const Input::PointerRoutedEventArgs& args)
|
||||
{
|
||||
if (_IsClosing())
|
||||
{
|
||||
@ -1184,8 +1184,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// Arguments:
|
||||
// - sender: not used
|
||||
// - args: event data
|
||||
void TermControl::_PointerMovedHandler(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Input::PointerRoutedEventArgs const& args)
|
||||
void TermControl::_PointerMovedHandler(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Input::PointerRoutedEventArgs& args)
|
||||
{
|
||||
if (_IsClosing())
|
||||
{
|
||||
@ -1225,11 +1225,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// SwapChainPanel, not the entire control. If they drag out of
|
||||
// the bounds of the text, into the padding, we still what that
|
||||
// to auto-scroll
|
||||
const double cursorBelowBottomDist = cursorPosition.Y - SwapChainPanel().Margin().Top - SwapChainPanel().ActualHeight();
|
||||
const double cursorAboveTopDist = -1 * cursorPosition.Y + SwapChainPanel().Margin().Top;
|
||||
const auto cursorBelowBottomDist = cursorPosition.Y - SwapChainPanel().Margin().Top - SwapChainPanel().ActualHeight();
|
||||
const auto cursorAboveTopDist = -1 * cursorPosition.Y + SwapChainPanel().Margin().Top;
|
||||
|
||||
constexpr double MinAutoScrollDist = 2.0; // Arbitrary value
|
||||
double newAutoScrollVelocity = 0.0;
|
||||
constexpr auto MinAutoScrollDist = 2.0; // Arbitrary value
|
||||
auto newAutoScrollVelocity = 0.0;
|
||||
if (cursorBelowBottomDist > MinAutoScrollDist)
|
||||
{
|
||||
newAutoScrollVelocity = _GetAutoScrollSpeed(cursorBelowBottomDist);
|
||||
@ -1266,8 +1266,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// Arguments:
|
||||
// - sender: the XAML element responding to the pointer input
|
||||
// - args: event data
|
||||
void TermControl::_PointerReleasedHandler(Windows::Foundation::IInspectable const& sender,
|
||||
Input::PointerRoutedEventArgs const& args)
|
||||
void TermControl::_PointerReleasedHandler(const Windows::Foundation::IInspectable& sender,
|
||||
const Input::PointerRoutedEventArgs& args)
|
||||
{
|
||||
if (_IsClosing())
|
||||
{
|
||||
@ -1310,8 +1310,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// it to call _DoMouseWheel, see _DoMouseWheel for more details.
|
||||
// Arguments:
|
||||
// - args: the event args containing information about t`he mouse wheel event.
|
||||
void TermControl::_MouseWheelHandler(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Input::PointerRoutedEventArgs const& args)
|
||||
void TermControl::_MouseWheelHandler(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Input::PointerRoutedEventArgs& args)
|
||||
{
|
||||
if (_IsClosing())
|
||||
{
|
||||
@ -1402,8 +1402,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
_core.AdjustFontSize(fontSizeDelta);
|
||||
}
|
||||
|
||||
void TermControl::_ScrollbarChangeHandler(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Controls::Primitives::RangeBaseValueChangedEventArgs const& args)
|
||||
void TermControl::_ScrollbarChangeHandler(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Controls::Primitives::RangeBaseValueChangedEventArgs& args)
|
||||
{
|
||||
if (_isInternalScrollBarUpdate || _IsClosing())
|
||||
{
|
||||
@ -1430,7 +1430,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - args: pointer data (i.e.: mouse, touch)
|
||||
// Return Value:
|
||||
// - true if we successfully capture the pointer, false otherwise.
|
||||
bool TermControl::_CapturePointer(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& args)
|
||||
bool TermControl::_CapturePointer(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& args)
|
||||
{
|
||||
IUIElement uielem;
|
||||
if (sender.try_as(uielem))
|
||||
@ -1448,7 +1448,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - args: pointer data (i.e.: mouse, touch)
|
||||
// Return Value:
|
||||
// - true if we release capture of the pointer, false otherwise.
|
||||
bool TermControl::_ReleasePointerCapture(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& args)
|
||||
bool TermControl::_ReleasePointerCapture(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& args)
|
||||
{
|
||||
IUIElement uielem;
|
||||
if (sender.try_as(uielem))
|
||||
@ -1466,7 +1466,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - pointerPoint: info about pointer that causes auto scroll. Pointer's position
|
||||
// is later used to update selection.
|
||||
// - scrollVelocity: target velocity of scrolling in characters / sec
|
||||
void TermControl::_TryStartAutoScroll(Windows::UI::Input::PointerPoint const& pointerPoint, const double scrollVelocity)
|
||||
void TermControl::_TryStartAutoScroll(const Windows::UI::Input::PointerPoint& pointerPoint, const double scrollVelocity)
|
||||
{
|
||||
// Allow only one pointer at the time
|
||||
if (!_autoScrollingPointerPoint ||
|
||||
@ -1516,8 +1516,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// selecting outside it (to 'follow' the cursor).
|
||||
// Arguments:
|
||||
// - none
|
||||
void TermControl::_UpdateAutoScroll(Windows::Foundation::IInspectable const& /* sender */,
|
||||
Windows::Foundation::IInspectable const& /* e */)
|
||||
void TermControl::_UpdateAutoScroll(const Windows::Foundation::IInspectable& /* sender */,
|
||||
const Windows::Foundation::IInspectable& /* e */)
|
||||
{
|
||||
if (_autoScrollVelocity != 0)
|
||||
{
|
||||
@ -1525,8 +1525,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
|
||||
if (_lastAutoScrollUpdateTime)
|
||||
{
|
||||
static constexpr double microSecPerSec = 1000000.0;
|
||||
const double deltaTime = std::chrono::duration_cast<std::chrono::microseconds>(timeNow - *_lastAutoScrollUpdateTime).count() / microSecPerSec;
|
||||
static constexpr auto microSecPerSec = 1000000.0;
|
||||
const auto deltaTime = std::chrono::duration_cast<std::chrono::microseconds>(timeNow - *_lastAutoScrollUpdateTime).count() / microSecPerSec;
|
||||
ScrollBar().Value(ScrollBar().Value() + _autoScrollVelocity * deltaTime);
|
||||
|
||||
if (_autoScrollingPointerPoint)
|
||||
@ -1544,8 +1544,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - enable accessibility notifications for this TermControl
|
||||
// - start blinking the cursor when the window is focused
|
||||
// - update the number of lines to scroll to the value set in the system
|
||||
void TermControl::_GotFocusHandler(Windows::Foundation::IInspectable const& /* sender */,
|
||||
RoutedEventArgs const& /* args */)
|
||||
void TermControl::_GotFocusHandler(const Windows::Foundation::IInspectable& /* sender */,
|
||||
const RoutedEventArgs& /* args */)
|
||||
{
|
||||
if (_IsClosing())
|
||||
{
|
||||
@ -1600,8 +1600,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - Event handler for the LostFocus event. This is used to...
|
||||
// - disable accessibility notifications for this TermControl
|
||||
// - hide and stop blinking the cursor when the window loses focus.
|
||||
void TermControl::_LostFocusHandler(Windows::Foundation::IInspectable const& /* sender */,
|
||||
RoutedEventArgs const& /* args */)
|
||||
void TermControl::_LostFocusHandler(const Windows::Foundation::IInspectable& /* sender */,
|
||||
const RoutedEventArgs& /* args */)
|
||||
{
|
||||
if (_IsClosing())
|
||||
{
|
||||
@ -1645,8 +1645,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// terminal buffers to match the new visible size.
|
||||
// Arguments:
|
||||
// - e: a SizeChangedEventArgs with the new dimensions of the SwapChainPanel
|
||||
void TermControl::_SwapChainSizeChanged(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
||||
SizeChangedEventArgs const& e)
|
||||
void TermControl::_SwapChainSizeChanged(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const SizeChangedEventArgs& e)
|
||||
{
|
||||
if (!_initializedTerminal || _IsClosing())
|
||||
{
|
||||
@ -1689,8 +1689,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// Arguments:
|
||||
// - sender: The SwapChainPanel who's DPI changed. This is our _swapchainPanel.
|
||||
// - args: This param is unused in the CompositionScaleChanged event.
|
||||
void TermControl::_SwapChainScaleChanged(Windows::UI::Xaml::Controls::SwapChainPanel const& sender,
|
||||
Windows::Foundation::IInspectable const& /*args*/)
|
||||
void TermControl::_SwapChainScaleChanged(const Windows::UI::Xaml::Controls::SwapChainPanel& sender,
|
||||
const Windows::Foundation::IInspectable& /*args*/)
|
||||
{
|
||||
const auto scaleX = sender.CompositionScaleX();
|
||||
|
||||
@ -1702,8 +1702,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// Arguments:
|
||||
// - sender: not used
|
||||
// - e: not used
|
||||
void TermControl::_CursorTimerTick(Windows::Foundation::IInspectable const& /* sender */,
|
||||
Windows::Foundation::IInspectable const& /* e */)
|
||||
void TermControl::_CursorTimerTick(const Windows::Foundation::IInspectable& /* sender */,
|
||||
const Windows::Foundation::IInspectable& /* e */)
|
||||
{
|
||||
if (!_IsClosing())
|
||||
{
|
||||
@ -1716,8 +1716,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// Arguments:
|
||||
// - sender: not used
|
||||
// - e: not used
|
||||
void TermControl::_BlinkTimerTick(Windows::Foundation::IInspectable const& /* sender */,
|
||||
Windows::Foundation::IInspectable const& /* e */)
|
||||
void TermControl::_BlinkTimerTick(const Windows::Foundation::IInspectable& /* sender */,
|
||||
const Windows::Foundation::IInspectable& /* e */)
|
||||
{
|
||||
if (!_IsClosing())
|
||||
{
|
||||
@ -1729,7 +1729,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - Sets selection's end position to match supplied cursor position, e.g. while mouse dragging.
|
||||
// Arguments:
|
||||
// - cursorPosition: in pixels, relative to the origin of the control
|
||||
void TermControl::_SetEndSelectionPointAtCursor(Windows::Foundation::Point const& cursorPosition)
|
||||
void TermControl::_SetEndSelectionPointAtCursor(const Windows::Foundation::Point& cursorPosition)
|
||||
{
|
||||
_interactivity.SetEndSelectionPoint(_toTerminalOrigin(cursorPosition).to_core_point());
|
||||
}
|
||||
@ -1880,7 +1880,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// caller knows what monitor the control is about to appear on.
|
||||
// Return Value:
|
||||
// - a size containing the requested dimensions in pixels.
|
||||
winrt::Windows::Foundation::Size TermControl::GetProposedDimensions(IControlSettings const& settings, const uint32_t dpi)
|
||||
winrt::Windows::Foundation::Size TermControl::GetProposedDimensions(const IControlSettings& settings, const uint32_t dpi)
|
||||
{
|
||||
// If the settings have negative or zero row or column counts, ignore those counts.
|
||||
// (The lower TerminalCore layer also has upper bounds as well, but at this layer
|
||||
@ -1911,7 +1911,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// caller knows what monitor the control is about to appear on.
|
||||
// Return Value:
|
||||
// - a size containing the requested dimensions in pixels.
|
||||
winrt::Windows::Foundation::Size TermControl::GetProposedDimensions(IControlSettings const& settings, const uint32_t dpi, const winrt::Windows::Foundation::Size& initialSizeInChars)
|
||||
winrt::Windows::Foundation::Size TermControl::GetProposedDimensions(const IControlSettings& settings, const uint32_t dpi, const winrt::Windows::Foundation::Size& initialSizeInChars)
|
||||
{
|
||||
const auto cols = ::base::saturated_cast<int>(initialSizeInChars.Width);
|
||||
const auto rows = ::base::saturated_cast<int>(initialSizeInChars.Height);
|
||||
@ -2026,7 +2026,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// this method. In that case, we'll need to pre-calculate the font
|
||||
// width, before we actually have a renderer or swapchain.
|
||||
const winrt::Windows::Foundation::Size minSize{ 1, 1 };
|
||||
const double scaleFactor = DisplayInformation::GetForCurrentView().RawPixelsPerViewPixel();
|
||||
const auto scaleFactor = DisplayInformation::GetForCurrentView().RawPixelsPerViewPixel();
|
||||
const auto dpi = ::base::saturated_cast<uint32_t>(USER_DEFAULT_SCREEN_DPI * scaleFactor);
|
||||
return GetProposedDimensions(_core.Settings(), dpi, minSize);
|
||||
}
|
||||
@ -2056,7 +2056,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
}
|
||||
|
||||
const auto gridSize = dimension - nonTerminalArea;
|
||||
const int cells = static_cast<int>(gridSize / fontDimension);
|
||||
const auto cells = static_cast<int>(gridSize / fontDimension);
|
||||
return cells * fontDimension + nonTerminalArea;
|
||||
}
|
||||
|
||||
@ -2072,7 +2072,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - Windows::UI::Xaml::Thickness object
|
||||
Windows::UI::Xaml::Thickness TermControl::ParseThicknessFromPadding(const hstring padding)
|
||||
{
|
||||
const wchar_t singleCharDelim = L',';
|
||||
const auto singleCharDelim = L',';
|
||||
std::wstringstream tokenStream(padding.c_str());
|
||||
std::wstring token;
|
||||
uint8_t paddingPropIndex = 0;
|
||||
@ -2125,7 +2125,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - The Microsoft::Terminal::Core::ControlKeyStates representing the modifier key states.
|
||||
ControlKeyStates TermControl::_GetPressedModifierKeys() noexcept
|
||||
{
|
||||
const CoreWindow window = CoreWindow::GetForCurrentThread();
|
||||
const auto window = CoreWindow::GetForCurrentThread();
|
||||
// DONT USE
|
||||
// != CoreVirtualKeyStates::None
|
||||
// OR
|
||||
@ -2198,7 +2198,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
const til::size marginsInDips{ til::math::rounding, GetPadding().Left, GetPadding().Top };
|
||||
|
||||
// This point is the location of the cursor within the actual grid of characters, in DIPs
|
||||
const til::point relativeToMarginInDIPs = cursorPosInDIPs - marginsInDips;
|
||||
const auto relativeToMarginInDIPs = cursorPosInDIPs - marginsInDips;
|
||||
|
||||
// Convert it to pixels
|
||||
const auto scale = SwapChainPanel().CompositionScaleX();
|
||||
@ -2303,7 +2303,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
{
|
||||
try
|
||||
{
|
||||
Windows::Foundation::Uri link{ co_await e.DataView().GetApplicationLinkAsync() };
|
||||
auto link{ co_await e.DataView().GetApplicationLinkAsync() };
|
||||
_core.PasteText(link.AbsoluteUri());
|
||||
}
|
||||
CATCH_LOG();
|
||||
@ -2312,7 +2312,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
{
|
||||
try
|
||||
{
|
||||
Windows::Foundation::Uri link{ co_await e.DataView().GetWebLinkAsync() };
|
||||
auto link{ co_await e.DataView().GetWebLinkAsync() };
|
||||
_core.PasteText(link.AbsoluteUri());
|
||||
}
|
||||
CATCH_LOG();
|
||||
@ -2424,8 +2424,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - e: The DragEventArgs from the DragOver event
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TermControl::_DragOverHandler(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
DragEventArgs const& e)
|
||||
void TermControl::_DragOverHandler(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const DragEventArgs& e)
|
||||
{
|
||||
if (_IsClosing())
|
||||
{
|
||||
@ -2500,7 +2500,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
|
||||
// Method Description:
|
||||
// - Responds to the Click event on the button that will re-enable the renderer.
|
||||
void TermControl::_RenderRetryButton_Click(IInspectable const& /*sender*/, IInspectable const& /*args*/)
|
||||
void TermControl::_RenderRetryButton_Click(const IInspectable& /*sender*/, const IInspectable& /*args*/)
|
||||
{
|
||||
// It's already loaded if we get here, so just hide it.
|
||||
RendererFailedNotice().Visibility(Visibility::Collapsed);
|
||||
@ -2587,8 +2587,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void TermControl::_BellLightOff(Windows::Foundation::IInspectable const& /* sender */,
|
||||
Windows::Foundation::IInspectable const& /* e */)
|
||||
void TermControl::_BellLightOff(const Windows::Foundation::IInspectable& /* sender */,
|
||||
const Windows::Foundation::IInspectable& /* e */)
|
||||
{
|
||||
if (_bellLightTimer)
|
||||
{
|
||||
@ -2625,8 +2625,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// Arguments:
|
||||
// - sender: not used
|
||||
// - args: event data
|
||||
void TermControl::_PointerExitedHandler(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::Input::PointerRoutedEventArgs const& /*e*/)
|
||||
void TermControl::_PointerExitedHandler(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Input::PointerRoutedEventArgs& /*e*/)
|
||||
{
|
||||
_core.ClearHoveredCell();
|
||||
}
|
||||
@ -2662,9 +2662,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
const til::size marginsInDips{ til::math::rounding, GetPadding().Left, GetPadding().Top };
|
||||
const til::point startPos{ lastHoveredCell.Value() };
|
||||
const til::size fontSize{ til::math::rounding, _core.FontSize() };
|
||||
const til::point posInPixels{ startPos * fontSize };
|
||||
const auto posInPixels{ startPos * fontSize };
|
||||
const til::point posInDIPs{ til::math::flooring, posInPixels.x / scale, posInPixels.y / scale };
|
||||
const til::point locationInDIPs{ posInDIPs + marginsInDips };
|
||||
const auto locationInDIPs{ posInDIPs + marginsInDips };
|
||||
|
||||
// Move the border to the top left corner of the cell
|
||||
OverlayCanvas().SetLeft(HyperlinkTooltipBorder(), locationInDIPs.x - offset.x);
|
||||
|
||||
@ -79,7 +79,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
void _AttachDxgiSwapChainToXaml(HANDLE swapChainHandle);
|
||||
winrt::fire_and_forget _RendererEnteredErrorState(IInspectable sender, IInspectable args);
|
||||
|
||||
void _RenderRetryButton_Click(IInspectable const& button, IInspectable const& args);
|
||||
void _RenderRetryButton_Click(const IInspectable& button, const IInspectable& args);
|
||||
winrt::fire_and_forget _RendererWarning(IInspectable sender,
|
||||
Control::RendererWarningArgs args);
|
||||
|
||||
@ -96,8 +96,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
Windows::UI::Xaml::Automation::Peers::AutomationPeer OnCreateAutomationPeer();
|
||||
const Windows::UI::Xaml::Thickness GetPadding();
|
||||
|
||||
static Windows::Foundation::Size GetProposedDimensions(IControlSettings const& settings, const uint32_t dpi);
|
||||
static Windows::Foundation::Size GetProposedDimensions(IControlSettings const& settings, const uint32_t dpi, const winrt::Windows::Foundation::Size& initialSizeInChars);
|
||||
static Windows::Foundation::Size GetProposedDimensions(const IControlSettings& settings, const uint32_t dpi);
|
||||
static Windows::Foundation::Size GetProposedDimensions(const IControlSettings& settings, const uint32_t dpi, const winrt::Windows::Foundation::Size& initialSizeInChars);
|
||||
|
||||
void BellLightOn();
|
||||
|
||||
@ -213,47 +213,47 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
|
||||
bool _InitializeTerminal();
|
||||
void _SetFontSize(int fontSize);
|
||||
void _TappedHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs const& e);
|
||||
void _KeyDownHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e);
|
||||
void _KeyUpHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e);
|
||||
void _CharacterHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::CharacterReceivedRoutedEventArgs const& e);
|
||||
void _PointerPressedHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);
|
||||
void _PointerMovedHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);
|
||||
void _PointerReleasedHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);
|
||||
void _PointerExitedHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);
|
||||
void _MouseWheelHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);
|
||||
void _ScrollbarChangeHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs const& e);
|
||||
void _TappedHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::TappedRoutedEventArgs& e);
|
||||
void _KeyDownHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
void _KeyUpHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
void _CharacterHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::CharacterReceivedRoutedEventArgs& e);
|
||||
void _PointerPressedHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e);
|
||||
void _PointerMovedHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e);
|
||||
void _PointerReleasedHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e);
|
||||
void _PointerExitedHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e);
|
||||
void _MouseWheelHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e);
|
||||
void _ScrollbarChangeHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs& e);
|
||||
|
||||
void _GotFocusHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void _LostFocusHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void _GotFocusHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _LostFocusHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
|
||||
winrt::fire_and_forget _DragDropHandler(Windows::Foundation::IInspectable sender, Windows::UI::Xaml::DragEventArgs e);
|
||||
void _DragOverHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::DragEventArgs const& e);
|
||||
void _DragOverHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::DragEventArgs& e);
|
||||
|
||||
winrt::fire_and_forget _HyperlinkHandler(Windows::Foundation::IInspectable sender, Control::OpenHyperlinkEventArgs e);
|
||||
|
||||
void _CursorTimerTick(Windows::Foundation::IInspectable const& sender, Windows::Foundation::IInspectable const& e);
|
||||
void _BlinkTimerTick(Windows::Foundation::IInspectable const& sender, Windows::Foundation::IInspectable const& e);
|
||||
void _BellLightOff(Windows::Foundation::IInspectable const& sender, Windows::Foundation::IInspectable const& e);
|
||||
void _CursorTimerTick(const Windows::Foundation::IInspectable& sender, const Windows::Foundation::IInspectable& e);
|
||||
void _BlinkTimerTick(const Windows::Foundation::IInspectable& sender, const Windows::Foundation::IInspectable& e);
|
||||
void _BellLightOff(const Windows::Foundation::IInspectable& sender, const Windows::Foundation::IInspectable& e);
|
||||
|
||||
void _SetEndSelectionPointAtCursor(Windows::Foundation::Point const& cursorPosition);
|
||||
void _SetEndSelectionPointAtCursor(const Windows::Foundation::Point& cursorPosition);
|
||||
|
||||
void _SwapChainSizeChanged(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::SizeChangedEventArgs const& e);
|
||||
void _SwapChainScaleChanged(Windows::UI::Xaml::Controls::SwapChainPanel const& sender, Windows::Foundation::IInspectable const& args);
|
||||
void _SwapChainSizeChanged(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::SizeChangedEventArgs& e);
|
||||
void _SwapChainScaleChanged(const Windows::UI::Xaml::Controls::SwapChainPanel& sender, const Windows::Foundation::IInspectable& args);
|
||||
|
||||
void _TerminalTabColorChanged(const std::optional<til::color> color);
|
||||
|
||||
void _ScrollPositionChanged(const IInspectable& sender, const Control::ScrollPositionChangedArgs& args);
|
||||
winrt::fire_and_forget _CursorPositionChanged(const IInspectable& sender, const IInspectable& args);
|
||||
|
||||
bool _CapturePointer(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);
|
||||
bool _ReleasePointerCapture(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);
|
||||
bool _CapturePointer(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e);
|
||||
bool _ReleasePointerCapture(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e);
|
||||
|
||||
void _TryStartAutoScroll(Windows::UI::Input::PointerPoint const& pointerPoint, const double scrollVelocity);
|
||||
void _TryStartAutoScroll(const Windows::UI::Input::PointerPoint& pointerPoint, const double scrollVelocity);
|
||||
void _TryStopAutoScroll(const uint32_t pointerId);
|
||||
void _UpdateAutoScroll(Windows::Foundation::IInspectable const& sender, Windows::Foundation::IInspectable const& e);
|
||||
void _UpdateAutoScroll(const Windows::Foundation::IInspectable& sender, const Windows::Foundation::IInspectable& e);
|
||||
|
||||
void _KeyHandler(Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e, const bool keyDown);
|
||||
void _KeyHandler(const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e, const bool keyDown);
|
||||
static ::Microsoft::Terminal::Core::ControlKeyStates _GetPressedModifierKeys() noexcept;
|
||||
bool _TryHandleKeyBinding(const WORD vkey, const WORD scanCode, ::Microsoft::Terminal::Core::ControlKeyStates modifiers) const;
|
||||
static void _ClearKeyboardState(const WORD vkey, const WORD scanCode) noexcept;
|
||||
@ -263,7 +263,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
double _GetAutoScrollSpeed(double cursorDistanceFromBorder) const;
|
||||
|
||||
void _Search(const winrt::hstring& text, const bool goForward, const bool caseSensitive);
|
||||
void _CloseSearchBoxControl(const winrt::Windows::Foundation::IInspectable& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void _CloseSearchBoxControl(const winrt::Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
|
||||
// TSFInputControl Handlers
|
||||
void _CompositionCompleted(winrt::hstring text);
|
||||
|
||||
@ -39,7 +39,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// this enables delaying composition object creation until it's actually necessary.
|
||||
// Arguments:
|
||||
// - newElement: unused
|
||||
void VisualBellLight::OnConnected(UIElement const& /* newElement */)
|
||||
void VisualBellLight::OnConnected(const UIElement& /* newElement */)
|
||||
{
|
||||
if (!CompositionLight())
|
||||
{
|
||||
@ -54,7 +54,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - Disposes of composition resources when no longer in use
|
||||
// Arguments:
|
||||
// - oldElement: unused
|
||||
void VisualBellLight::OnDisconnected(UIElement const& /* oldElement */)
|
||||
void VisualBellLight::OnDisconnected(const UIElement& /* oldElement */)
|
||||
{
|
||||
if (CompositionLight())
|
||||
{
|
||||
@ -67,7 +67,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
return VisualBellLight::GetIdStatic();
|
||||
}
|
||||
|
||||
void VisualBellLight::OnIsTargetChanged(DependencyObject const& d, DependencyPropertyChangedEventArgs const& e)
|
||||
void VisualBellLight::OnIsTargetChanged(const DependencyObject& d, const DependencyPropertyChangedEventArgs& e)
|
||||
{
|
||||
const auto uielem{ d.try_as<UIElement>() };
|
||||
const auto brush{ d.try_as<Brush>() };
|
||||
|
||||
@ -15,20 +15,20 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
|
||||
static Windows::UI::Xaml::DependencyProperty IsTargetProperty() { return _IsTargetProperty; }
|
||||
|
||||
static bool GetIsTarget(Windows::UI::Xaml::DependencyObject const& target)
|
||||
static bool GetIsTarget(const Windows::UI::Xaml::DependencyObject& target)
|
||||
{
|
||||
return winrt::unbox_value<bool>(target.GetValue(_IsTargetProperty));
|
||||
}
|
||||
|
||||
static void SetIsTarget(Windows::UI::Xaml::DependencyObject const& target, bool value)
|
||||
static void SetIsTarget(const Windows::UI::Xaml::DependencyObject& target, bool value)
|
||||
{
|
||||
target.SetValue(_IsTargetProperty, winrt::box_value(value));
|
||||
}
|
||||
|
||||
void OnConnected(Windows::UI::Xaml::UIElement const& newElement);
|
||||
void OnDisconnected(Windows::UI::Xaml::UIElement const& oldElement);
|
||||
void OnConnected(const Windows::UI::Xaml::UIElement& newElement);
|
||||
void OnDisconnected(const Windows::UI::Xaml::UIElement& oldElement);
|
||||
|
||||
static void OnIsTargetChanged(Windows::UI::Xaml::DependencyObject const& d, Windows::UI::Xaml::DependencyPropertyChangedEventArgs const& e);
|
||||
static void OnIsTargetChanged(const Windows::UI::Xaml::DependencyObject& d, const Windows::UI::Xaml::DependencyPropertyChangedEventArgs& e);
|
||||
|
||||
inline static winrt::hstring GetIdStatic()
|
||||
{
|
||||
|
||||
@ -163,13 +163,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
THROW_IF_FAILED(SafeArrayGetLBound(pReturnVal, 1, &lBound));
|
||||
THROW_IF_FAILED(SafeArrayGetUBound(pReturnVal, 1, &uBound));
|
||||
|
||||
long count = uBound - lBound + 1;
|
||||
auto count = uBound - lBound + 1;
|
||||
|
||||
std::vector<double> vec;
|
||||
vec.reserve(count);
|
||||
for (int i = 0; i < count; i++)
|
||||
for (auto i = 0; i < count; i++)
|
||||
{
|
||||
double element = pVals[i];
|
||||
auto element = pVals[i];
|
||||
vec.push_back(element);
|
||||
}
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ Terminal::Terminal() :
|
||||
{
|
||||
return;
|
||||
}
|
||||
std::wstring wstr = _KeyEventsToText(inEventsToWrite);
|
||||
auto wstr = _KeyEventsToText(inEventsToWrite);
|
||||
_pfnWriteInput(wstr);
|
||||
};
|
||||
|
||||
@ -177,13 +177,13 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance)
|
||||
const til::color newCursorColor{ appearance.CursorColor() };
|
||||
_renderSettings.SetColorTableEntry(TextColor::CURSOR_COLOR, newCursorColor);
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
for (auto i = 0; i < 16; i++)
|
||||
{
|
||||
_renderSettings.SetColorTableEntry(i, til::color{ appearance.GetColorTableEntry(i) });
|
||||
}
|
||||
_renderSettings.MakeAdjustedColorArray();
|
||||
|
||||
CursorType cursorShape = CursorType::VerticalBar;
|
||||
auto cursorShape = CursorType::VerticalBar;
|
||||
switch (appearance.CursorShape())
|
||||
{
|
||||
case CursorStyle::Underscore:
|
||||
@ -266,13 +266,13 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance)
|
||||
COORD bufferSize{ viewportSize.X, newBufferHeight };
|
||||
|
||||
// This will be used to determine where the viewport should be in the new buffer.
|
||||
const short oldViewportTop = _mutableViewport.Top();
|
||||
short newViewportTop = oldViewportTop;
|
||||
short newVisibleTop = ::base::saturated_cast<short>(_VisibleStartIndex());
|
||||
const auto oldViewportTop = _mutableViewport.Top();
|
||||
auto newViewportTop = oldViewportTop;
|
||||
auto newVisibleTop = ::base::saturated_cast<short>(_VisibleStartIndex());
|
||||
|
||||
// If the original buffer had _no_ scroll offset, then we should be at the
|
||||
// bottom in the new buffer as well. Track that case now.
|
||||
const bool originalOffsetWasZero = _scrollOffset == 0;
|
||||
const auto originalOffsetWasZero = _scrollOffset == 0;
|
||||
|
||||
// skip any drawing updates that might occur until we swap _buffer with the new buffer or if we exit early.
|
||||
_mainBuffer->GetCursor().StartDeferDrawing();
|
||||
@ -353,10 +353,10 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance)
|
||||
// * Where the bottom of the text in the new buffer is (and using that to
|
||||
// calculate another proposed top location).
|
||||
|
||||
const COORD newCursorPos = newTextBuffer->GetCursor().GetPosition();
|
||||
const auto newCursorPos = newTextBuffer->GetCursor().GetPosition();
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 26496) // cpp core checks wants this const, but it's assigned immediately below...
|
||||
COORD newLastChar = newCursorPos;
|
||||
auto newLastChar = newCursorPos;
|
||||
try
|
||||
{
|
||||
newLastChar = newTextBuffer->GetLastNonSpaceCharacter();
|
||||
@ -367,10 +367,10 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance)
|
||||
const auto maxRow = std::max(newLastChar.Y, newCursorPos.Y);
|
||||
|
||||
const short proposedTopFromLastLine = ::base::ClampAdd(::base::ClampSub(maxRow, viewportSize.Y), 1);
|
||||
const short proposedTopFromScrollback = newViewportTop;
|
||||
const auto proposedTopFromScrollback = newViewportTop;
|
||||
|
||||
short proposedTop = std::max(proposedTopFromLastLine,
|
||||
proposedTopFromScrollback);
|
||||
auto proposedTop = std::max(proposedTopFromLastLine,
|
||||
proposedTopFromScrollback);
|
||||
|
||||
// If we're using the new location of the old top line to place the
|
||||
// viewport, we might need to make an adjustment to it.
|
||||
@ -478,7 +478,7 @@ void Terminal::WritePastedText(std::wstring_view stringView)
|
||||
auto option = ::Microsoft::Console::Utils::FilterOption::CarriageReturnNewline |
|
||||
::Microsoft::Console::Utils::FilterOption::ControlCodes;
|
||||
|
||||
std::wstring filtered = ::Microsoft::Console::Utils::FilterStringForPaste(stringView, option);
|
||||
auto filtered = ::Microsoft::Console::Utils::FilterStringForPaste(stringView, option);
|
||||
if (IsXtermBracketedPasteModeEnabled())
|
||||
{
|
||||
filtered.insert(0, L"\x1b[200~");
|
||||
@ -990,8 +990,8 @@ Viewport Terminal::_GetVisibleViewport() const noexcept
|
||||
// viewport's size hasn't been updated yet. In that case, use the
|
||||
// temporarily stashed _altBufferSize instead.
|
||||
const COORD origin{ 0, gsl::narrow<short>(_VisibleStartIndex()) };
|
||||
const COORD size{ _inAltBuffer() ? _altBufferSize.to_win32_coord() :
|
||||
_mutableViewport.Dimensions() };
|
||||
const auto size{ _inAltBuffer() ? _altBufferSize.to_win32_coord() :
|
||||
_mutableViewport.Dimensions() };
|
||||
return Viewport::FromDimensions(origin,
|
||||
size);
|
||||
}
|
||||
@ -1015,8 +1015,8 @@ void Terminal::_WriteBuffer(const std::wstring_view& stringView)
|
||||
for (size_t i = 0; i < stringView.size(); i++)
|
||||
{
|
||||
const auto wch = stringView.at(i);
|
||||
const COORD cursorPosBefore = cursor.GetPosition();
|
||||
COORD proposedCursorPosition = cursorPosBefore;
|
||||
const auto cursorPosBefore = cursor.GetPosition();
|
||||
auto proposedCursorPosition = cursorPosBefore;
|
||||
|
||||
// TODO: MSFT 21006766
|
||||
// This is not great but I need it demoable. Fix by making a buffer stream writer.
|
||||
@ -1078,7 +1078,7 @@ void Terminal::_AdjustCursorPosition(const COORD proposedPosition)
|
||||
#pragma warning(suppress : 26496) // cpp core checks wants this const but it's modified below.
|
||||
auto proposedCursorPosition = proposedPosition;
|
||||
auto& cursor = _activeBuffer().GetCursor();
|
||||
const Viewport bufferSize = _activeBuffer().GetSize();
|
||||
const auto bufferSize = _activeBuffer().GetSize();
|
||||
|
||||
// If we're about to scroll past the bottom of the buffer, instead cycle the
|
||||
// buffer.
|
||||
@ -1129,7 +1129,7 @@ void Terminal::_AdjustCursorPosition(const COORD proposedPosition)
|
||||
// Obviously, don't need to do this in the alt buffer.
|
||||
if (!_inAltBuffer())
|
||||
{
|
||||
bool updatedViewport = false;
|
||||
auto updatedViewport = false;
|
||||
const auto scrollAmount = std::max(0, proposedCursorPosition.Y - _mutableViewport.BottomInclusive());
|
||||
if (scrollAmount > 0)
|
||||
{
|
||||
@ -1152,7 +1152,7 @@ void Terminal::_AdjustCursorPosition(const COORD proposedPosition)
|
||||
// scroll if...
|
||||
// - no selection is active
|
||||
// - viewport is already at the bottom
|
||||
const bool scrollToOutput = !IsSelectionActive() && _scrollOffset == 0;
|
||||
const auto scrollToOutput = !IsSelectionActive() && _scrollOffset == 0;
|
||||
|
||||
_scrollOffset = scrollToOutput ? 0 : _scrollOffset + scrollAmount + newRows;
|
||||
|
||||
|
||||
@ -372,8 +372,8 @@ void Terminal::SetColorAliasIndex(const ColorAlias alias, const size_t tableInde
|
||||
// - <none>
|
||||
void Terminal::SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle)
|
||||
{
|
||||
CursorType finalCursorType = CursorType::Legacy;
|
||||
bool shouldBlink = false;
|
||||
auto finalCursorType = CursorType::Legacy;
|
||||
auto shouldBlink = false;
|
||||
|
||||
switch (cursorStyle)
|
||||
{
|
||||
@ -576,7 +576,7 @@ void Terminal::PushGraphicsRendition(const VTParameters options)
|
||||
// - <none>
|
||||
void Terminal::PopGraphicsRendition()
|
||||
{
|
||||
const TextAttribute current = _activeBuffer().GetCurrentAttributes();
|
||||
const auto current = _activeBuffer().GetCurrentAttributes();
|
||||
_activeBuffer().SetCurrentAttributes(_sgrStack.Pop(current));
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user