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

Fix handling of cursor position reports in passthrough mode #13109

Merged
1 commit merged into from
May 17, 2022
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
4 changes: 4 additions & 0 deletions src/host/getset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,10 @@ void ApiRoutines::GetLargestConsoleWindowSizeImpl(const SCREEN_INFORMATION& cont
position.Y < 0));
// clang-format on

// MSFT: 15813316 - Try to use this SetCursorPosition call to inherit the cursor position.
auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
RETURN_IF_FAILED(gci.GetVtIo()->SetCursorPosition(position));

RETURN_IF_NTSTATUS_FAILED(buffer.SetCursorPosition(position, true));

LOG_IF_FAILED(ConsoleImeResizeCompStrView());
Expand Down
11 changes: 3 additions & 8 deletions src/terminal/adapter/InteractDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,10 @@ bool InteractDispatch::MoveCursor(const VTInt row, const VTInt col)

const auto coordCursorShort = til::unwrap_coord(coordCursor);

// MSFT: 15813316 - Try to use this MoveCursor call to inherit the cursor position.
auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
RETURN_IF_FAILED(gci.GetVtIo()->SetCursorPosition(coordCursorShort));

// Finally, attempt to set the adjusted cursor position back into the console.
auto& cursor = _api.GetTextBuffer().GetCursor();
cursor.SetPosition(coordCursorShort);
cursor.SetHasMoved(true);
return true;
const auto api = gsl::not_null{ ServiceLocator::LocateGlobals().api };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the gsl::not_null there because of the linter?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I was just trying to get the audit build to pass. But I was thinking that it might have been preferable to put this on the api field in the Globals class, because once we start auditing more of the code base, we'll assumedly get the C26429 error everywhere the api is used.

auto& info = ServiceLocator::LocateGlobals().getConsoleInformation().GetActiveOutputBuffer();
return SUCCEEDED(api->SetConsoleCursorPositionImpl(info, coordCursorShort));
}

// Routine Description:
Expand Down