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 winrt event triggering #10685

Merged
2 commits merged into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions src/buffer/out/cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@ void Cursor::StartDeferDrawing() noexcept
_fDeferCursorRedraw = true;
}

bool Cursor::IsDeferDrawing() noexcept
{
return _fDeferCursorRedraw;
}

void Cursor::EndDeferDrawing() noexcept
{
if (_fHaveDeferredCursorRedraw)
Expand Down
1 change: 1 addition & 0 deletions src/buffer/out/cursor.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Cursor final
const COLORREF GetColor() const noexcept;

void StartDeferDrawing() noexcept;
bool IsDeferDrawing() noexcept;
void EndDeferDrawing() noexcept;

void SetHasMoved(const bool fHasMoved) noexcept;
Expand Down
7 changes: 6 additions & 1 deletion src/cascadia/TerminalCore/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,12 @@ void Terminal::_AdjustCursorPosition(const COORD proposedPosition)
_buffer->GetRenderTarget().TriggerScroll(&delta);
}

_NotifyTerminalCursorPositionChanged();
// Firing the CursorPositionChanged event is very expensive so we try not to do that when
// the cursor does not need to be redrawn.
if (!cursor.IsDeferDrawing())
{
_NotifyTerminalCursorPositionChanged();
}
}

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