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

Cursor coordinates are viewport-relative #17332

Merged
merged 1 commit into from
May 29, 2024
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: 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
Loading