mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 00:48:23 -06:00
Merge remote-tracking branch 'openconsole/inbox' into HEAD
This commit is contained in:
commit
c70c76e041
@ -112,26 +112,16 @@ OutputCellIterator::OutputCellIterator(const std::wstring_view utf16Text, const
|
||||
// - This is an iterator over legacy colors only. The text is not modified.
|
||||
// Arguments:
|
||||
// - legacyAttrs - One legacy color item per cell
|
||||
// - unused - useless bool to change function signature for legacyAttrs constructor because the C++ compiler in
|
||||
// razzle cannot distinguish between a std::wstring_view and a std::basic_string_view<WORD>
|
||||
// NOTE: This one internally casts to wchar_t because Razzle sees WORD and wchar_t as the same type
|
||||
// despite that Visual Studio build can tell the difference.
|
||||
#pragma warning(push)
|
||||
#pragma warning(suppress : 26490)
|
||||
// Suppresses reinterpret_cast. We're only doing this because Windows doesn't understand the type difference between wchar_t and DWORD.
|
||||
// It is not worth trying to separate that out further or risking performance over this particular warning here.
|
||||
// TODO GH 2673 - Investigate real wchar_t flag in Windows and resolve this audit issue
|
||||
OutputCellIterator::OutputCellIterator(const std::basic_string_view<WORD> legacyAttrs, const bool /*unused*/) noexcept :
|
||||
OutputCellIterator::OutputCellIterator(const std::basic_string_view<WORD> legacyAttrs) noexcept :
|
||||
_mode(Mode::LegacyAttr),
|
||||
_currentView(s_GenerateViewLegacyAttr(legacyAttrs.at(0))),
|
||||
_run(std::wstring_view(reinterpret_cast<const wchar_t*>(legacyAttrs.data()), legacyAttrs.size())),
|
||||
_run(legacyAttrs),
|
||||
_attr(InvalidTextAttribute),
|
||||
_distance(0),
|
||||
_pos(0),
|
||||
_fillLimit(0)
|
||||
{
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
// Routine Description:
|
||||
// - This is an iterator over legacy cell data. We will use the unicode text and the legacy color attribute.
|
||||
@ -198,7 +188,7 @@ OutputCellIterator::operator bool() const noexcept
|
||||
}
|
||||
case Mode::LegacyAttr:
|
||||
{
|
||||
return _pos < std::get<std::wstring_view>(_run).length();
|
||||
return _pos < std::get<std::basic_string_view<WORD>>(_run).length();
|
||||
}
|
||||
default:
|
||||
FAIL_FAST_HR(E_NOTIMPL);
|
||||
@ -295,7 +285,7 @@ OutputCellIterator& OutputCellIterator::operator++()
|
||||
_pos++;
|
||||
if (operator bool())
|
||||
{
|
||||
_currentView = s_GenerateViewLegacyAttr(std::get<std::wstring_view>(_run).at(_pos));
|
||||
_currentView = s_GenerateViewLegacyAttr(std::get<std::basic_string_view<WORD>>(_run).at(_pos));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ public:
|
||||
OutputCellIterator(const CHAR_INFO& charInfo, const size_t fillLimit = 0) noexcept;
|
||||
OutputCellIterator(const std::wstring_view utf16Text);
|
||||
OutputCellIterator(const std::wstring_view utf16Text, const TextAttribute attribute);
|
||||
OutputCellIterator(const std::basic_string_view<WORD> legacyAttributes, const bool unused) noexcept;
|
||||
OutputCellIterator(const std::basic_string_view<WORD> legacyAttributes) noexcept;
|
||||
OutputCellIterator(const std::basic_string_view<CHAR_INFO> charInfos) noexcept;
|
||||
OutputCellIterator(const std::basic_string_view<OutputCell> cells);
|
||||
~OutputCellIterator() = default;
|
||||
@ -90,6 +90,7 @@ private:
|
||||
|
||||
std::variant<
|
||||
std::wstring_view,
|
||||
std::basic_string_view<WORD>,
|
||||
std::basic_string_view<CHAR_INFO>,
|
||||
std::basic_string_view<OutputCell>,
|
||||
std::monostate>
|
||||
|
||||
@ -91,7 +91,7 @@ void WriteToScreen(SCREEN_INFORMATION& screenInfo, const Viewport& region)
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
const OutputCellIterator it(attrs, true);
|
||||
const OutputCellIterator it(attrs);
|
||||
const auto done = screenInfo.Write(it, target);
|
||||
|
||||
used = done.GetCellDistance(it);
|
||||
|
||||
@ -369,7 +369,7 @@ class OutputCellIteratorTests
|
||||
const std::vector<WORD> colors{ FOREGROUND_GREEN, FOREGROUND_RED | BACKGROUND_BLUE, FOREGROUND_BLUE | FOREGROUND_INTENSITY, BACKGROUND_GREEN };
|
||||
const std::basic_string_view<WORD> view{ colors.data(), colors.size() };
|
||||
|
||||
OutputCellIterator it(view, false);
|
||||
OutputCellIterator it(view);
|
||||
|
||||
for (const auto& color : colors)
|
||||
{
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
# -------------------------------------
|
||||
|
||||
UNICODE = 1
|
||||
C_DEFINES = $(C_DEFINES) -DUNICODE -D_UNICODE
|
||||
C_DEFINES = $(C_DEFINES) -DUNICODE -D_UNICODE -DFMT_HEADER_ONLY
|
||||
|
||||
# -------------------------------------
|
||||
# CRT Configuration
|
||||
@ -16,6 +16,7 @@ C_DEFINES = $(C_DEFINES) -DUNICODE -D_UNICODE
|
||||
|
||||
USE_UNICRT = 1
|
||||
USE_MSVCRT = 1
|
||||
NO_WCHAR_T = 1 # use native wchar_t
|
||||
|
||||
USE_STL = 1
|
||||
STL_VER = STL_VER_CURRENT
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
# Preprocessor Settings
|
||||
# -------------------------------------
|
||||
|
||||
C_DEFINES = $(C_DEFINES) -DINLINE_TEST_METHOD_MARKUP -DUNIT_TESTING
|
||||
C_DEFINES = $(C_DEFINES) -DINLINE_TEST_METHOD_MARKUP -DUNIT_TESTING -DFMT_HEADER_ONLY
|
||||
|
||||
# -------------------------------------
|
||||
# Program Information
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user