Skip to content

Commit

Permalink
Defer cursor redrawing when writing buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
skyline75489 committed Oct 12, 2019
1 parent abf3ee5 commit 7c6bf96
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cascadia/TerminalCore/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,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];
Expand Down Expand Up @@ -463,6 +467,8 @@ void Terminal::_WriteBuffer(const std::wstring_view& stringView)
_NotifyScrollEvent();
}
}

cursor.EndDeferDrawing();
}

void Terminal::UserScrollViewport(const int viewTop)
Expand Down

0 comments on commit 7c6bf96

Please sign in to comment.