diff --git a/src/renderer/uia/UiaRenderer.cpp b/src/renderer/uia/UiaRenderer.cpp index 68c03b707..8aabf3df7 100644 --- a/src/renderer/uia/UiaRenderer.cpp +++ b/src/renderer/uia/UiaRenderer.cpp @@ -68,12 +68,21 @@ UiaEngine::UiaEngine(IUiaEventDispatcher* dispatcher) : // Arguments: // - pcoordCursor - the new position of the cursor // Return Value: -// - S_FALSE -[[nodiscard]] HRESULT UiaEngine::InvalidateCursor(const COORD* const /*pcoordCursor*/) noexcept +// - S_OK +[[nodiscard]] HRESULT UiaEngine::InvalidateCursor(const COORD* const pcoordCursor) noexcept +try { - _cursorChanged = true; - return S_FALSE; + RETURN_HR_IF_NULL(E_INVALIDARG, pcoordCursor); + + // check if cursor moved + if (*pcoordCursor != _prevCursorPos) + { + _prevCursorPos = *pcoordCursor; + _cursorChanged = true; + } + return S_OK; } +CATCH_RETURN(); // Routine Description: // - Invalidates a rectangle describing a pixel area on the display @@ -246,7 +255,6 @@ UiaEngine::UiaEngine(IUiaEventDispatcher* dispatcher) : _selectionChanged = false; _textBufferChanged = false; _cursorChanged = false; - _prevSelection.clear(); _isPainting = false; return S_OK; diff --git a/src/renderer/uia/UiaRenderer.hpp b/src/renderer/uia/UiaRenderer.hpp index 3f7ced8e3..f4a011a52 100644 --- a/src/renderer/uia/UiaRenderer.hpp +++ b/src/renderer/uia/UiaRenderer.hpp @@ -88,5 +88,6 @@ namespace Microsoft::Console::Render Microsoft::Console::Types::IUiaEventDispatcher* _dispatcher; std::vector _prevSelection; + til::point _prevCursorPos; }; }