mirror of
https://github.com/microsoft/terminal.git
synced 2026-05-18 18:56:25 +00:00
spel, more comment
This commit is contained in:
@@ -217,7 +217,7 @@ void EventsToUnicode(_Inout_ std::deque<std::unique_ptr<IInputEvent>>& inEvents,
|
||||
// because a single codepoint might have been expanded into more
|
||||
// that a single char.
|
||||
//
|
||||
// As of GH #8663, InputBuffer::Read will have pre-emptively
|
||||
// As of GH #8663, InputBuffer::Read will have preemptively
|
||||
// checked how much space each key is about to take up, and will
|
||||
// only return as many as will fit in readBuffer _after_ a call
|
||||
// to SplitToOem.
|
||||
|
||||
@@ -411,7 +411,7 @@ void InputBuffer::_ReadBuffer(_Out_ std::deque<std::unique_ptr<IInputEvent>>& ou
|
||||
}
|
||||
|
||||
// GH #8663: Before we read this key from the buffer, check that there's
|
||||
// space for it. If we're calling Read without unidoce being set, then I
|
||||
// space for it. If we're calling Read without unicode being set, then I
|
||||
// believe we're also going to try and break this key event into one key
|
||||
// for each OEM character. Problem is though, one unicode codepoint can
|
||||
// be more than two chars long. So don't just use IsGlyphFullWidth,
|
||||
|
||||
@@ -158,7 +158,7 @@ bool DirectReadData::Notify(const WaitTerminationReason TerminationReason,
|
||||
// because a single codepoint might have been expanded into more
|
||||
// that a single char.
|
||||
//
|
||||
// As of GH #8663, InputBuffer::Read will have pre-emptively
|
||||
// As of GH #8663, InputBuffer::Read will have preemptively
|
||||
// checked how much space each key is about to take up, and will
|
||||
// only return as many as will fit in readBuffer _after_ a call
|
||||
// to SplitToOem.
|
||||
|
||||
@@ -436,7 +436,7 @@ class InputBufferTests
|
||||
bool resetWaitEvent = false;
|
||||
|
||||
// GH #8663: We only insert 4 events. but we need to ask for 6 here.
|
||||
// The Raised Hand emoji is U+270B in utf16, but it's 0xE2 0x9C 0x8B in utf-8.
|
||||
// The hiragana A is U+3042 in utf16, but it turns into two chars in 932.
|
||||
Log::Comment(fmt::format(L"Codepage: {}", ServiceLocator::LocateGlobals().getConsoleInformation().CP).c_str());
|
||||
ServiceLocator::LocateGlobals().getConsoleInformation().CP = 932;
|
||||
Log::Comment(fmt::format(L"Changed to: {}", ServiceLocator::LocateGlobals().getConsoleInformation().CP).c_str());
|
||||
@@ -465,10 +465,12 @@ class InputBufferTests
|
||||
|
||||
TEST_METHOD(ReadingDbcsCharsPadsOutputArrayForEmoji)
|
||||
{
|
||||
// Basically the same test as ReadingDbcsCharsPadsOutputArray, but with
|
||||
// emoji where 1 wchar can turn into 3 chars.
|
||||
Log::Comment(L"During a utf-8 read, make sure the input buffer leaves "
|
||||
L"enough room for keys that could be expanded into more than two chars.");
|
||||
|
||||
// write a mouse event, key event, dbcs key event, mouse event
|
||||
// write a mouse event, key event, emoji key event, mouse event
|
||||
InputBuffer inputBuffer;
|
||||
const unsigned int recordInsertCount = 4;
|
||||
INPUT_RECORD inRecords[recordInsertCount];
|
||||
@@ -491,7 +493,7 @@ class InputBufferTests
|
||||
size_t eventsRead = 0;
|
||||
bool resetWaitEvent = false;
|
||||
|
||||
// GH #8663: We only insert 4 events. but we need to ask for 6 here.
|
||||
// GH #8663: We only insert 4 events. but we need to ask for 5 here.
|
||||
// The Raised Hand emoji is U+270B in utf16, but it's 0xE2 0x9C 0x8B in utf-8.
|
||||
ServiceLocator::LocateGlobals().getConsoleInformation().CP = 65001;
|
||||
|
||||
@@ -503,10 +505,13 @@ class InputBufferTests
|
||||
false,
|
||||
false);
|
||||
|
||||
// the dbcs record should have counted for two elements in
|
||||
// the array, making it so that we get less events read
|
||||
// the emoji record should have counted for three elements in
|
||||
// the array, making it so that we get less events read.
|
||||
// We'll get the mouse, the key(A), and the key(U+270B)
|
||||
VERIFY_ARE_EQUAL(3, eventsRead);
|
||||
VERIFY_ARE_EQUAL(eventsRead, outEvents.size());
|
||||
|
||||
// The events we read back here are _not_ pre-translated to the active codepage.
|
||||
for (size_t i = 0; i < eventsRead; ++i)
|
||||
{
|
||||
VERIFY_ARE_EQUAL(outEvents[i]->ToInputRecord(), inRecords[i]);
|
||||
|
||||
Reference in New Issue
Block a user