Skip to content

Commit 0bd0eea

Browse files
authored
Cursor coordinates are viewport-relative (microsoft#17332)
The changeset is rather self-explanatory. Some things in the rendering code are in absolute and some things are in relative coordinates. Cursor coordinates belong to the latter. It's a bit confusing. Closes microsoft#17310 ## Validation Steps Performed * Use the GDI text renderer * Use cmd * Press and hold Enter * No more ghostly cursors ✅
1 parent 13de7c6 commit 0bd0eea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/renderer/base/renderer.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,11 @@ bool Renderer::_CheckViewportAndScroll()
432432
// The cursor may have moved out of or into the viewport. Update the .inViewport property.
433433
{
434434
const auto view = ScreenToBufferLine(srNewViewport, _currentCursorOptions.lineRendition);
435-
const auto coordCursor = _currentCursorOptions.coordCursor;
435+
auto coordCursor = _currentCursorOptions.coordCursor;
436+
437+
// `coordCursor` was stored in viewport-relative while `view` is in absolute coordinates.
438+
// --> Turn it back into the absolute coordinates with the help of the old viewport.
439+
coordCursor.y += srOldViewport.top;
436440

437441
// Note that we allow the X coordinate to be outside the left border by 1 position,
438442
// because the cursor could still be visible if the focused character is double width.

0 commit comments

Comments
 (0)