mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-19 18:11:39 -05:00
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.
This commit is contained in:
@@ -197,7 +197,7 @@ function Invoke-OpenConsoleTests()
|
||||
{
|
||||
$OpenConsolePlatform = 'Win32'
|
||||
}
|
||||
$OpenConsolePath = "$env:OpenConsoleroot\bin\$OpenConsolePlatform\$Configuration\OpenConsole.exe"
|
||||
$OpenConsolePath = "$root\bin\$OpenConsolePlatform\$Configuration\OpenConsole.exe"
|
||||
$TaefExePath = "$root\packages\Microsoft.Taef.10.60.210621002\build\Binaries\$Platform\te.exe"
|
||||
$BinDir = "$root\bin\$OpenConsolePlatform\$Configuration"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user