mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 00:48:23 -06:00
bodgy: inline FillRow in FillTextBuffer to work around DD-2413379 (#18971)
Something about FillRow tickles the compiler and causes it to ICE during LTCG. See DD-2413379 for more. DevCom: https://developercommunity.visualstudio.com/t/VS-2022-1714-p11-cannot-complete-a-bui/10864784
This commit is contained in:
parent
c594fcc91b
commit
3acb3d510b
@ -216,7 +216,43 @@ public:
|
|||||||
for (til::CoordType iRow = 0; iRow < cRowsToFill; iRow++)
|
for (til::CoordType iRow = 0; iRow < cRowsToFill; iRow++)
|
||||||
{
|
{
|
||||||
ROW& row = textBuffer.GetMutableRowByOffset(iRow);
|
ROW& row = textBuffer.GetMutableRowByOffset(iRow);
|
||||||
FillRow(&row, iRow & 1);
|
|
||||||
|
// fill a row
|
||||||
|
// - Each row is populated with L"AB\u304bC\u304dDE "
|
||||||
|
// - 7 characters, 6 spaces. 13 total
|
||||||
|
// - The characters take up first 9 columns. (The wide glyphs take up 2 columns each)
|
||||||
|
// - か = \x304b, き = \x304d
|
||||||
|
|
||||||
|
uint16_t column = 0;
|
||||||
|
for (const auto& ch : std::wstring_view{ L"AB\u304bC\u304dDE " })
|
||||||
|
{
|
||||||
|
const uint16_t width = ch >= 0x80 ? 2 : 1;
|
||||||
|
row.ReplaceCharacters(column, width, { &ch, 1 });
|
||||||
|
column += width;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A = bright red on dark gray
|
||||||
|
// This string starts at index 0
|
||||||
|
auto Attr = TextAttribute(FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY);
|
||||||
|
row.SetAttrToEnd(0, Attr);
|
||||||
|
|
||||||
|
// BかC = dark gold on bright blue
|
||||||
|
// This string starts at index 1
|
||||||
|
Attr = TextAttribute(FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY);
|
||||||
|
row.SetAttrToEnd(1, Attr);
|
||||||
|
|
||||||
|
// き = bright white on dark purple
|
||||||
|
// This string starts at index 5
|
||||||
|
Attr = TextAttribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_BLUE);
|
||||||
|
row.SetAttrToEnd(5, Attr);
|
||||||
|
|
||||||
|
// DE = black on dark green
|
||||||
|
// This string starts at index 7
|
||||||
|
Attr = TextAttribute(BACKGROUND_GREEN);
|
||||||
|
row.SetAttrToEnd(7, Attr);
|
||||||
|
|
||||||
|
// odd rows forced a wrap
|
||||||
|
row.SetWrapForced(iRow & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
textBuffer.GetCursor().SetYPosition(cRowsToFill);
|
textBuffer.GetCursor().SetYPosition(cRowsToFill);
|
||||||
@ -233,51 +269,4 @@ private:
|
|||||||
FontInfo m_pFontInfo;
|
FontInfo m_pFontInfo;
|
||||||
std::unique_ptr<TextBuffer> m_backupTextBufferInfo;
|
std::unique_ptr<TextBuffer> m_backupTextBufferInfo;
|
||||||
std::unique_ptr<INPUT_READ_HANDLE_DATA> m_readHandle;
|
std::unique_ptr<INPUT_READ_HANDLE_DATA> m_readHandle;
|
||||||
|
|
||||||
void FillRow(ROW* pRow, bool wrapForced)
|
|
||||||
{
|
|
||||||
// fill a row
|
|
||||||
// - Each row is populated with L"AB\u304bC\u304dDE "
|
|
||||||
// - 7 characters, 6 spaces. 13 total
|
|
||||||
// - The characters take up first 9 columns. (The wide glyphs take up 2 columns each)
|
|
||||||
// - か = \x304b, き = \x304d
|
|
||||||
|
|
||||||
uint16_t column = 0;
|
|
||||||
for (const auto& ch : std::wstring_view{ L"AB\u304bC\u304dDE " })
|
|
||||||
{
|
|
||||||
const uint16_t width = ch >= 0x80 ? 2 : 1;
|
|
||||||
pRow->ReplaceCharacters(column, width, { &ch, 1 });
|
|
||||||
column += width;
|
|
||||||
}
|
|
||||||
|
|
||||||
// A = bright red on dark gray
|
|
||||||
// This string starts at index 0
|
|
||||||
auto Attr = TextAttribute(FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY);
|
|
||||||
pRow->SetAttrToEnd(0, Attr);
|
|
||||||
|
|
||||||
// BかC = dark gold on bright blue
|
|
||||||
// This string starts at index 1
|
|
||||||
Attr = TextAttribute(FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY);
|
|
||||||
pRow->SetAttrToEnd(1, Attr);
|
|
||||||
|
|
||||||
// き = bright white on dark purple
|
|
||||||
// This string starts at index 5
|
|
||||||
Attr = TextAttribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_BLUE);
|
|
||||||
pRow->SetAttrToEnd(5, Attr);
|
|
||||||
|
|
||||||
// DE = black on dark green
|
|
||||||
// This string starts at index 7
|
|
||||||
Attr = TextAttribute(BACKGROUND_GREEN);
|
|
||||||
pRow->SetAttrToEnd(7, Attr);
|
|
||||||
|
|
||||||
// odd rows forced a wrap
|
|
||||||
if (wrapForced)
|
|
||||||
{
|
|
||||||
pRow->SetWrapForced(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pRow->SetWrapForced(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user