-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix various Read/WriteConsoleOutput bugs (#17567)
Split off from #17510: * `Viewport::Clamp` used `std::clamp` to calculate the intersection between two rectangles. That works for exclusive rectangles, because `.left == .right` indicates an empty rectangle. But `Viewport` is an inclusive one, and so `.left == .right` is non-empty. For instance, if the to-be-clamped rect is fully outside the bounding rect, the result is a 1x1 viewport. In effect this meant that `Viewport::Clamp` never clamped so far. * The `targetArea < targetBuffer.size()` check is the wrong way around. It should be `targetArea > targetBuffer.size()`. * The `sourceSize` and `targetSize` checks are incorrect, because the rectangles may be non-empty but outside the valid bounding rect. * If these sizes were empty, we'd return the requested rectangle which is a regression since conhost v1 and violates the API contract. * The `sourceRect` emptiness check is incorrect, because the clamping logic before it doesn't actually clamp to the bounding rect. * The entire clamping and iteration logic is just overall too complex.
- Loading branch information
Showing
6 changed files
with
89 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.