Defer cursor redrawing when writing the buffer (#2960)

This commit is contained in:
Chester Liu 2019-10-15 12:44:52 +08:00 committed by Dustin L. Howett (MSFT)
parent b664761c79
commit c9050416f6

View file

@ -368,6 +368,10 @@ void Terminal::_WriteBuffer(const std::wstring_view& stringView)
auto& cursor = _buffer->GetCursor();
const Viewport bufferSize = _buffer->GetSize();
// Defer the cursor drawing while we are iterating the string, for a better performance.
// We can not waste time displaying a cursor event when we know more text is coming right behind it.
cursor.StartDeferDrawing();
for (size_t i = 0; i < stringView.size(); i++)
{
wchar_t wch = stringView[i];
@ -468,6 +472,8 @@ void Terminal::_WriteBuffer(const std::wstring_view& stringView)
_NotifyScrollEvent();
}
}
cursor.EndDeferDrawing();
}
void Terminal::UserScrollViewport(const int viewTop)