Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defer cursor redrawing when writing buffer #2960

Merged
merged 1 commit into from
Oct 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave behind the comment explaining why this is required (for performance reasons, we can not waste time displaying a cursor event when we know more text is coming right behind it).


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