Skip to content

Commit

Permalink
Cursor coordinates are viewport-relative (#17332)
Browse files Browse the repository at this point in the history
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 #17310

## Validation Steps Performed
* Use the GDI text renderer
* Use cmd
* Press and hold Enter
* No more ghostly cursors ✅
  • Loading branch information
lhecker authored May 29, 2024
1 parent 13de7c6 commit 0bd0eea
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/renderer/base/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,11 @@ bool Renderer::_CheckViewportAndScroll()
// The cursor may have moved out of or into the viewport. Update the .inViewport property.
{
const auto view = ScreenToBufferLine(srNewViewport, _currentCursorOptions.lineRendition);
const auto coordCursor = _currentCursorOptions.coordCursor;
auto coordCursor = _currentCursorOptions.coordCursor;

// `coordCursor` was stored in viewport-relative while `view` is in absolute coordinates.
// --> Turn it back into the absolute coordinates with the help of the old viewport.
coordCursor.y += srOldViewport.top;

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

0 comments on commit 0bd0eea

Please sign in to comment.