From a233b18d74b3da5f709349dd4d2954e7c334dddb Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Tue, 29 Apr 2025 15:23:23 -0500 Subject: [PATCH 1/7] Port OSS consumption changes from OS PR !12826284 (#18853) sources and sources.dep goo mostly. --- src/audio/midi/lib/sources.dep | 2 +- src/buffer/out/lib/sources.dep | 2 +- src/buffer/out/ut_textbuffer/sources.dep | 2 +- src/host/exe/sources.dep | 2 +- src/host/ft_host/sources.dep | 2 +- src/host/lib/sources.dep | 2 +- src/host/ut_host/sources.dep | 2 +- src/host/ut_lib/sources.dep | 2 +- src/interactivity/base/lib/sources.dep | 2 +- src/interactivity/onecore/lib/sources.dep | 2 +- src/interactivity/win32/lib/sources.dep | 2 +- src/interactivity/win32/sources.inc | 1 + src/interactivity/win32/ut_interactivity_win32/sources.dep | 2 +- src/project.inc | 7 +++---- src/project.unittest.inc | 2 +- src/propsheet/sources | 1 + src/propsheet/sources.dep | 2 +- src/propslib/sources.dep | 2 +- src/renderer/base/lib/sources.dep | 2 +- src/renderer/gdi/lib/sources.dep | 2 +- src/renderer/wddmcon/lib/sources.dep | 2 +- src/server/lib/sources.dep | 2 +- src/terminal/adapter/lib/sources.dep | 2 +- src/terminal/adapter/ut_adapter/sources.dep | 2 +- src/terminal/input/lib/sources.dep | 2 +- src/terminal/parser/ft_fuzzer/sources | 4 ++-- src/terminal/parser/ft_fuzzer/sources.dep | 2 +- src/terminal/parser/ft_fuzzwrapper/sources.dep | 2 +- src/terminal/parser/lib/sources.dep | 2 +- src/terminal/parser/ut_parser/sources.dep | 2 +- src/til/ut_til/sources.dep | 2 +- src/tools/vtpipeterm/sources | 1 + src/tsf/sources.dep | 2 +- src/types/lib/sources.dep | 2 +- src/types/ut_types/sources.dep | 2 +- 35 files changed, 38 insertions(+), 36 deletions(-) diff --git a/src/audio/midi/lib/sources.dep b/src/audio/midi/lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/audio/midi/lib/sources.dep +++ b/src/audio/midi/lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/buffer/out/lib/sources.dep b/src/buffer/out/lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/buffer/out/lib/sources.dep +++ b/src/buffer/out/lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/buffer/out/ut_textbuffer/sources.dep b/src/buffer/out/ut_textbuffer/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/buffer/out/ut_textbuffer/sources.dep +++ b/src/buffer/out/ut_textbuffer/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/host/exe/sources.dep b/src/host/exe/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/host/exe/sources.dep +++ b/src/host/exe/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/host/ft_host/sources.dep b/src/host/ft_host/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/host/ft_host/sources.dep +++ b/src/host/ft_host/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/host/lib/sources.dep b/src/host/lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/host/lib/sources.dep +++ b/src/host/lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/host/ut_host/sources.dep b/src/host/ut_host/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/host/ut_host/sources.dep +++ b/src/host/ut_host/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/host/ut_lib/sources.dep b/src/host/ut_lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/host/ut_lib/sources.dep +++ b/src/host/ut_lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/interactivity/base/lib/sources.dep b/src/interactivity/base/lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/interactivity/base/lib/sources.dep +++ b/src/interactivity/base/lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/interactivity/onecore/lib/sources.dep b/src/interactivity/onecore/lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/interactivity/onecore/lib/sources.dep +++ b/src/interactivity/onecore/lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/interactivity/win32/lib/sources.dep b/src/interactivity/win32/lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/interactivity/win32/lib/sources.dep +++ b/src/interactivity/win32/lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/interactivity/win32/sources.inc b/src/interactivity/win32/sources.inc index f816c285db..cd35ffc408 100644 --- a/src/interactivity/win32/sources.inc +++ b/src/interactivity/win32/sources.inc @@ -60,4 +60,5 @@ INCLUDES = \ ..; \ TARGETLIBS = \ + $(TARGETLIBS) \ $(ONECORE_EXTERNAL_SDK_LIB_VPATH_L)\onecore.lib \ diff --git a/src/interactivity/win32/ut_interactivity_win32/sources.dep b/src/interactivity/win32/ut_interactivity_win32/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/interactivity/win32/ut_interactivity_win32/sources.dep +++ b/src/interactivity/win32/ut_interactivity_win32/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/project.inc b/src/project.inc index 1d86343d9c..152aca2717 100644 --- a/src/project.inc +++ b/src/project.inc @@ -4,16 +4,16 @@ # ------------------------------------- # Pull our dependencies from vcpkg. This includes gsl - if you run into errors -# from a missing gsl, make sure you go build onecore/window/vcpkg first. +# from a missing gsl or fmt, make sure you go build .../console/vcpkg first. -!include $(PROJECT_ROOT)\vcpkg\consume.inc +!include $(PROJECT_ROOT)\core\console\vcpkg\consume.inc # ------------------------------------- # Preprocessor Settings # ------------------------------------- UNICODE = 1 -C_DEFINES = $(C_DEFINES) -DUNICODE -D_UNICODE -DFMT_HEADER_ONLY -D__INSIDE_WINDOWS -DBUILD_ONECORE_INTERACTIVITY +C_DEFINES = $(C_DEFINES) -DUNICODE -D_UNICODE -D__INSIDE_WINDOWS -DBUILD_ONECORE_INTERACTIVITY # ------------------------------------- # CRT Configuration @@ -50,7 +50,6 @@ INCLUDES= \ $(CONSOLE_SRC_PATH)\inc; \ $(CONSOLE_SRC_PATH)\..\..\inc; \ $(CONSOLE_SRC_PATH)\..\oss\chromium; \ - $(CONSOLE_SRC_PATH)\..\oss\fmt\include; \ $(CONSOLE_SRC_PATH)\..\oss\interval_tree; \ $(CONSOLE_SRC_PATH)\..\oss\pcg\include; \ $(MINWIN_INTERNAL_PRIV_SDK_INC_PATH_L); \ diff --git a/src/project.unittest.inc b/src/project.unittest.inc index 8d625b78e8..13b0caa9f4 100644 --- a/src/project.unittest.inc +++ b/src/project.unittest.inc @@ -9,7 +9,7 @@ # Preprocessor Settings # ------------------------------------- -C_DEFINES = $(C_DEFINES) -DINLINE_TEST_METHOD_MARKUP -DUNIT_TESTING -DFMT_HEADER_ONLY +C_DEFINES = $(C_DEFINES) -DINLINE_TEST_METHOD_MARKUP -DUNIT_TESTING # ------------------------------------- # Program Information diff --git a/src/propsheet/sources b/src/propsheet/sources index 033d3a5396..84bf81282e 100644 --- a/src/propsheet/sources +++ b/src/propsheet/sources @@ -78,6 +78,7 @@ INCLUDES = \ ..\host; \ TARGETLIBS = \ + $(TARGETLIBS) \ $(ONECORE_EXTERNAL_SDK_LIB_VPATH_L)\onecore.lib \ $(ONECORE_EXTERNAL_SDK_LIB_VPATH_L)\onecoreuap.lib \ $(ONECORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\onecore_internal.lib \ diff --git a/src/propsheet/sources.dep b/src/propsheet/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/propsheet/sources.dep +++ b/src/propsheet/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/propslib/sources.dep b/src/propslib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/propslib/sources.dep +++ b/src/propslib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/renderer/base/lib/sources.dep b/src/renderer/base/lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/renderer/base/lib/sources.dep +++ b/src/renderer/base/lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/renderer/gdi/lib/sources.dep b/src/renderer/gdi/lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/renderer/gdi/lib/sources.dep +++ b/src/renderer/gdi/lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/renderer/wddmcon/lib/sources.dep b/src/renderer/wddmcon/lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/renderer/wddmcon/lib/sources.dep +++ b/src/renderer/wddmcon/lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/server/lib/sources.dep b/src/server/lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/server/lib/sources.dep +++ b/src/server/lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/terminal/adapter/lib/sources.dep b/src/terminal/adapter/lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/terminal/adapter/lib/sources.dep +++ b/src/terminal/adapter/lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/terminal/adapter/ut_adapter/sources.dep b/src/terminal/adapter/ut_adapter/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/terminal/adapter/ut_adapter/sources.dep +++ b/src/terminal/adapter/ut_adapter/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/terminal/input/lib/sources.dep b/src/terminal/input/lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/terminal/input/lib/sources.dep +++ b/src/terminal/input/lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/terminal/parser/ft_fuzzer/sources b/src/terminal/parser/ft_fuzzer/sources index a8c508a25d..c0dfad9134 100644 --- a/src/terminal/parser/ft_fuzzer/sources +++ b/src/terminal/parser/ft_fuzzer/sources @@ -3,7 +3,7 @@ # - Console Virtual Terminal Parser Fuzzer # ------------------------------------- -!include $(PROJECT_ROOT)\vcpkg\consume.inc +!include ..\..\..\..\..\vcpkg\consume.inc # This program will generate fuzz input for the parsing engine # and is to be used in conjunction with the fuzz wrapper tool. @@ -47,6 +47,7 @@ C_DEFINES = $(C_DEFINES) -DUNICODE -D_UNICODE USE_STD_CPP20 = 1 MSC_WARNING_LEVEL = /W4 /WX +USER_C_FLAGS = $(USER_C_FLAGS) /Zc:preprocessor /fp:contract /utf-8 # ------------------------------------- # Build System Settings @@ -68,7 +69,6 @@ SOURCES = \ INCLUDES = \ ..\..\..\inc; \ $(CONSOLE_SRC_PATH)\..\oss\chromium; \ - $(CONSOLE_SRC_PATH)\..\oss\fmt\include; \ $(CONSOLE_SRC_PATH)\..\oss\interval_tree; \ $(INCLUDES) \ diff --git a/src/terminal/parser/ft_fuzzer/sources.dep b/src/terminal/parser/ft_fuzzer/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/terminal/parser/ft_fuzzer/sources.dep +++ b/src/terminal/parser/ft_fuzzer/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/terminal/parser/ft_fuzzwrapper/sources.dep b/src/terminal/parser/ft_fuzzwrapper/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/terminal/parser/ft_fuzzwrapper/sources.dep +++ b/src/terminal/parser/ft_fuzzwrapper/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/terminal/parser/lib/sources.dep b/src/terminal/parser/lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/terminal/parser/lib/sources.dep +++ b/src/terminal/parser/lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/terminal/parser/ut_parser/sources.dep b/src/terminal/parser/ut_parser/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/terminal/parser/ut_parser/sources.dep +++ b/src/terminal/parser/ut_parser/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/til/ut_til/sources.dep b/src/til/ut_til/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/til/ut_til/sources.dep +++ b/src/til/ut_til/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/tools/vtpipeterm/sources b/src/tools/vtpipeterm/sources index f19c0fe1ca..ecbc0bfcfd 100644 --- a/src/tools/vtpipeterm/sources +++ b/src/tools/vtpipeterm/sources @@ -18,6 +18,7 @@ USE_NATIVE_EH = 1 C_DEFINES=-DUNICODE -D__INSIDE_WINDOWS TARGETLIBS=\ + $(TARGETLIBS) \ $(MINWIN_EXTERNAL_SDK_LIB_PATH_L)\ntdll.lib \ $(ONECORE_EXTERNAL_SDK_LIB_VPATH_L)\onecore.lib diff --git a/src/tsf/sources.dep b/src/tsf/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/tsf/sources.dep +++ b/src/tsf/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/types/lib/sources.dep b/src/types/lib/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/types/lib/sources.dep +++ b/src/types/lib/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ diff --git a/src/types/ut_types/sources.dep b/src/types/ut_types/sources.dep index bc61c95c6b..fce1139651 100644 --- a/src/types/ut_types/sources.dep +++ b/src/types/ut_types/sources.dep @@ -1,3 +1,3 @@ BUILD_PASS1_CONSUMES= \ - onecore\windows\vcpkg|PASS1 \ + onecore\windows\core\console\vcpkg|PASS1 \ From 0568173abab4150d167dcced3994c99356dfc5cd Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Tue, 29 Apr 2025 15:37:56 -0500 Subject: [PATCH 2/7] wpf: strong-name sign Microsoft.Terminal.Wpf (#18836) This requires us to delay-sign the assembly with a public key (the snk file), and then later submit it for strong naming. This is separate from code signing, and has to take place before it. The snk file does not contain any private key material. This cannot merge until we are approved to use this new signing "key code". --- .github/actions/spelling/expect/expect.txt | 1 + build/config/272MSSharedLibSN2048.snk | Bin 0 -> 288 bytes build/config/esrp.build.batch.wpfdotnet.json | 14 ++++++++++++++ .../WpfTerminalControl/WpfTerminalControl.csproj | 6 ++++++ 4 files changed, 21 insertions(+) create mode 100644 build/config/272MSSharedLibSN2048.snk diff --git a/.github/actions/spelling/expect/expect.txt b/.github/actions/spelling/expect/expect.txt index 4356e36eae..f80ab40840 100644 --- a/.github/actions/spelling/expect/expect.txt +++ b/.github/actions/spelling/expect/expect.txt @@ -1679,6 +1679,7 @@ SMARTQUOTE SMTO snapcx snapcy +snk SOLIDBOX Solutiondir somefile diff --git a/build/config/272MSSharedLibSN2048.snk b/build/config/272MSSharedLibSN2048.snk new file mode 100644 index 0000000000000000000000000000000000000000..bd766f84a23ac0323c0589df14827e0644f6a6ae GIT binary patch literal 288 zcmZQjVPN2CU|S-K)3KPh!7d@_#`srQ0`kon`?5?=gWH literal 0 HcmV?d00001 diff --git a/build/config/esrp.build.batch.wpfdotnet.json b/build/config/esrp.build.batch.wpfdotnet.json index 0699353f64..316aa70116 100644 --- a/build/config/esrp.build.batch.wpfdotnet.json +++ b/build/config/esrp.build.batch.wpfdotnet.json @@ -6,6 +6,20 @@ ], "SigningInfo": { "Operations": [ + { + "KeyCode": "CP-233904-SN", + "OperationSetCode": "StrongNameSign", + "ToolName": "sign", + "ToolVersion": "1.0", + "Parameters": [] + }, + { + "KeyCode": "CP-233904-SN", + "OperationSetCode": "StrongNameVerify", + "ToolName": "sign", + "ToolVersion": "1.0", + "Parameters": [] + }, { "KeyCode": "CP-230012", "OperationSetCode": "SigntoolSign", diff --git a/src/cascadia/WpfTerminalControl/WpfTerminalControl.csproj b/src/cascadia/WpfTerminalControl/WpfTerminalControl.csproj index 6581f1478b..8a299b5c05 100644 --- a/src/cascadia/WpfTerminalControl/WpfTerminalControl.csproj +++ b/src/cascadia/WpfTerminalControl/WpfTerminalControl.csproj @@ -15,6 +15,12 @@ 0.1 + + true + true + ..\..\..\build\config\272MSSharedLibSN2048.snk + + true From 08e76da3a1687a1303733406b684a9a6ab523acb Mon Sep 17 00:00:00 2001 From: James Holderness Date: Wed, 30 Apr 2025 00:15:38 +0100 Subject: [PATCH 3/7] Fix two image erasure bugs (#18855) This PR fixes two cases where image content wasn't correctly erased when overwritten. 1. When legacy console APIs fill an area of the buffer using a starting coordinate and a length, the affected area could potentially wrap over multiple rows, but we were only erasing the overwritten image content on the first affected row. 2. When copying an area of the buffer with text content over another area that contained image content, the image in the target area would sometimes not be erased, because we ignored the `_eraseCells` return value which indicated that the image slice needed to be removed. ## References and Relevant Issues The original code was from the Sixel implementation in PR #17421. ## Validation Steps Performed I've manually verified that these two cases are now working as expected. ## PR Checklist - [x] Closes #18568 --- src/buffer/out/ImageSlice.cpp | 31 +++++++++++++++++++++---------- src/buffer/out/ImageSlice.hpp | 2 +- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/buffer/out/ImageSlice.cpp b/src/buffer/out/ImageSlice.cpp index 65809e58a0..3500eaf0a5 100644 --- a/src/buffer/out/ImageSlice.cpp +++ b/src/buffer/out/ImageSlice.cpp @@ -186,18 +186,20 @@ bool ImageSlice::_copyCells(const ImageSlice& srcSlice, const til::CoordType src } // The used destination before and after the written area must be erased. - if (dstUsedBegin < dstWriteBegin) + // If this results in the entire range being erased, we return true to let + // the caller know that the slice should be deleted. + if (dstUsedBegin < dstWriteBegin && _eraseCells(dstUsedBegin, dstWriteBegin)) { - _eraseCells(dstUsedBegin, dstWriteBegin); + return true; } - if (dstUsedEnd > dstWriteEnd) + if (dstUsedEnd > dstWriteEnd && _eraseCells(dstWriteEnd, dstUsedEnd)) { - _eraseCells(dstWriteEnd, dstUsedEnd); + return true; } - // If the beginning column is now not less than the end, that means the - // content has been entirely erased, so we return true to let the caller - // know that the slice should be deleted. + // At this point, if the beginning column is not less than the end, that + // means this was an empty slice into which nothing was copied, so we can + // again return true to let the caller know it should be deleted. return _columnBegin >= _columnEnd; } @@ -210,10 +212,19 @@ void ImageSlice::EraseBlock(TextBuffer& buffer, const til::rect rect) } } -void ImageSlice::EraseCells(TextBuffer& buffer, const til::point at, const size_t distance) +void ImageSlice::EraseCells(TextBuffer& buffer, const til::point at, const til::CoordType distance) { - auto& row = buffer.GetMutableRowByOffset(at.y); - EraseCells(row, at.x, gsl::narrow_cast(at.x + distance)); + auto x = at.x; + auto y = at.y; + auto distanceRemaining = distance; + while (distanceRemaining > 0) + { + auto& row = buffer.GetMutableRowByOffset(y); + EraseCells(row, x, x + distanceRemaining); + distanceRemaining -= (static_cast(row.size()) - x); + x = 0; + y++; + } } void ImageSlice::EraseCells(ROW& row, const til::CoordType columnBegin, const til::CoordType columnEnd) diff --git a/src/buffer/out/ImageSlice.hpp b/src/buffer/out/ImageSlice.hpp index 87244abe78..14c0b314ae 100644 --- a/src/buffer/out/ImageSlice.hpp +++ b/src/buffer/out/ImageSlice.hpp @@ -41,7 +41,7 @@ public: static void CopyRow(const ROW& srcRow, ROW& dstRow); static void CopyCells(const ROW& srcRow, const til::CoordType srcColumn, ROW& dstRow, const til::CoordType dstColumnBegin, const til::CoordType dstColumnEnd); static void EraseBlock(TextBuffer& buffer, const til::rect rect); - static void EraseCells(TextBuffer& buffer, const til::point at, const size_t distance); + static void EraseCells(TextBuffer& buffer, const til::point at, const til::CoordType distance); static void EraseCells(ROW& row, const til::CoordType columnBegin, const til::CoordType columnEnd); private: From 34b8ed3575ef4620ac21cb27749016698488ab81 Mon Sep 17 00:00:00 2001 From: James Holderness Date: Thu, 1 May 2025 19:28:44 +0100 Subject: [PATCH 4/7] Account for custom cell sizes in launch size calculation (#18862) When calculating the initial terminal window size, we weren't taking into account the line height and cell width settings, so the resulting number of rows and columns didn't match the requested launch size. Verification: Manually verified that the window is now correctly sized when using a custom line height and cell width. Closes #18582 --- src/cascadia/TerminalControl/TermControl.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 60833fdd92..7118c7a868 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -2825,6 +2825,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation const auto fontSize = settings.FontSize(); const auto fontWeight = settings.FontWeight(); const auto fontFace = settings.FontFace(); + const auto cellWidth = CSSLengthPercentage::FromString(settings.CellWidth().c_str()); + const auto cellHeight = CSSLengthPercentage::FromString(settings.CellHeight().c_str()); const auto scrollState = settings.ScrollState(); const auto padding = settings.Padding(); @@ -2836,6 +2838,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation // not, but DX doesn't use that info at all. // The Codepage is additionally not actually used by the DX engine at all. FontInfoDesired desiredFont{ fontFace, 0, fontWeight.Weight, fontSize, CP_UTF8 }; + desiredFont.SetCellSize(cellWidth, cellHeight); FontInfo actualFont{ fontFace, 0, fontWeight.Weight, desiredFont.GetEngineSize(), CP_UTF8, false }; // Create a DX engine and initialize it with our font and DPI. We'll From 58092f142f0264a3bc5766bf53129aead4ae3c8b Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Fri, 2 May 2025 14:27:28 -0500 Subject: [PATCH 5/7] Bring back changes required to build conhost-1.24 in Windows (#18856) --- .github/actions/spelling/allow/apis.txt | 1 + src/host/sources.inc | 8 +++++--- src/host/sources.test.inc | 3 --- src/host/ut_host/sources | 3 --- src/interactivity/win32/ut_interactivity_win32/sources | 8 +++++--- src/project.unittest.inc | 1 + src/terminal/adapter/ut_adapter/sources | 8 +++++--- src/terminal/parser/ft_fuzzer/sources | 2 ++ src/terminal/parser/ft_fuzzwrapper/sources | 1 + src/terminal/parser/ut_parser/sources | 8 +++++--- src/tools/vtpipeterm/main.cpp | 8 ++++++++ src/tools/vtpipeterm/sources | 6 +++++- src/types/ut_types/sources | 1 + 13 files changed, 39 insertions(+), 19 deletions(-) diff --git a/.github/actions/spelling/allow/apis.txt b/.github/actions/spelling/allow/apis.txt index f7671d04f4..9be081bc2b 100644 --- a/.github/actions/spelling/allow/apis.txt +++ b/.github/actions/spelling/allow/apis.txt @@ -222,6 +222,7 @@ Stubless Subheader Subpage syscall +syscolors SYSTEMBACKDROP TABROW TASKBARCREATED diff --git a/src/host/sources.inc b/src/host/sources.inc index e8c540fd80..c080c15ce7 100644 --- a/src/host/sources.inc +++ b/src/host/sources.inc @@ -132,7 +132,7 @@ TARGETLIBS = \ $(ONECOREUAP_EXTERNAL_SDK_LIB_PATH)\dxgi.lib \ $(ONECOREUAP_EXTERNAL_SDK_LIB_PATH)\d3d11.lib \ $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\api-ms-win-mm-playsound-l1.lib \ - $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-imm-l1-1-0.lib \ + $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-imm-l1.lib \ $(ONECORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-dwmapi-ext-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-gdi-dc-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-gdi-dc-create-l1.lib \ @@ -160,12 +160,14 @@ TARGETLIBS = \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-sysparams-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-window-ext-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-winstamin-l1.lib \ + $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-syscolors-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-shell-shell32-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-uxtheme-themes-l1.lib \ $(ONECORESHELL_INTERNAL_LIB_VPATH_L)\api-ms-win-shell-dataobject-l1.lib \ $(ONECORESHELL_INTERNAL_LIB_VPATH_L)\api-ms-win-shell-namespace-l1.lib \ $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-uiacore-l1.lib \ $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-usp10-l1.lib \ + $(ONECORE_EXTERNAL_SDK_LIB_PATH)\ntdll.lib \ $(WINCORE_OBJ_PATH)\console\open\src\host\lib\$(O)\conhostv2.lib \ $(WINCORE_OBJ_PATH)\console\conint\$(O)\conint.lib \ $(WINCORE_OBJ_PATH)\console\open\src\buffer\out\lib\$(O)\conbufferout.lib \ @@ -177,7 +179,6 @@ TARGETLIBS = \ $(WINCORE_OBJ_PATH)\console\open\src\audio\midi\lib\$(O)\ConAudioMidi.lib \ $(WINCORE_OBJ_PATH)\console\open\src\renderer\base\lib\$(O)\ConRenderBase.lib \ $(WINCORE_OBJ_PATH)\console\open\src\renderer\gdi\lib\$(O)\ConRenderGdi.lib \ - $(WINCORE_OBJ_PATH)\console\open\src\renderer\vt\lib\$(O)\ConRenderVt.lib \ $(WINCORE_OBJ_PATH)\console\open\src\renderer\wddmcon\lib\$(O)\ConRenderWddmCon.lib \ $(WINCORE_OBJ_PATH)\console\open\src\server\lib\$(O)\ConServer.lib \ $(WINCORE_OBJ_PATH)\console\open\src\interactivity\base\lib\$(O)\ConInteractivityBaseLib.lib \ @@ -196,7 +197,7 @@ DELAYLOAD = \ api-ms-win-core-com-l1.dll; \ api-ms-win-core-registry-l2.dll; \ api-ms-win-mm-playsound-l1.dll; \ - ext-ms-win-imm-l1-1-0.lib; \ + ext-ms-win-imm-l1.dll; \ api-ms-win-shcore-obsolete-l1.dll; \ api-ms-win-shcore-scaling-l1.dll; \ api-ms-win-shell-dataobject-l1.dll; \ @@ -229,6 +230,7 @@ DELAYLOAD = \ ext-ms-win-rtcore-ntuser-sysparams-l1.dll; \ ext-ms-win-rtcore-ntuser-window-ext-l1.dll; \ ext-ms-win-rtcore-ntuser-winstamin-l1.dll; \ + ext-ms-win-rtcore-ntuser-syscolors-l1.dll; \ ext-ms-win-shell-shell32-l1.dll; \ ext-ms-win-uiacore-l1.dll; \ ext-ms-win-uxtheme-themes-l1.dll; \ diff --git a/src/host/sources.test.inc b/src/host/sources.test.inc index 7d49665c33..6fd7ff7412 100644 --- a/src/host/sources.test.inc +++ b/src/host/sources.test.inc @@ -24,10 +24,7 @@ INCLUDES = \ ..\..\inc\test; \ $(ONECORESDKTOOLS_INTERNAL_INC_PATH_L)\wextest\cue; \ -# prepend the ConRenderVt.Unittest.lib, so that it's linked before the non-ut version. - TARGETLIBS = \ - $(WINCORE_OBJ_PATH)\console\open\src\renderer\vt\ut_lib\$(O)\ConRenderVt.Unittest.lib \ $(TARGETLIBS) \ $(ONECORESDKTOOLS_INTERNAL_LIB_PATH_L)\WexTest\Cue\Wex.Common.lib \ $(ONECORESDKTOOLS_INTERNAL_LIB_PATH_L)\WexTest\Cue\Wex.Logger.lib \ diff --git a/src/host/ut_host/sources b/src/host/ut_host/sources index b690477830..d8da9ec993 100644 --- a/src/host/ut_host/sources +++ b/src/host/ut_host/sources @@ -41,10 +41,7 @@ INCLUDES = \ ..\..\inc\test; \ $(ONECORESDKTOOLS_INTERNAL_INC_PATH_L)\wextest\cue; \ -# prepend the ConRenderVt.Unittest.lib, so that it's linked before the non-ut version. - TARGETLIBS = \ - $(WINCORE_OBJ_PATH)\console\open\src\renderer\vt\ut_lib\$(O)\ConRenderVt.Unittest.lib \ $(WINCORE_OBJ_PATH)\console\open\src\host\ut_lib\$(O)\ConhostV2.Unittest.lib \ $(TARGETLIBS) \ $(ONECORESDKTOOLS_INTERNAL_LIB_PATH_L)\WexTest\Cue\Wex.Common.lib \ diff --git a/src/interactivity/win32/ut_interactivity_win32/sources b/src/interactivity/win32/ut_interactivity_win32/sources index 1822bf5179..55eaa847fc 100644 --- a/src/interactivity/win32/ut_interactivity_win32/sources +++ b/src/interactivity/win32/ut_interactivity_win32/sources @@ -50,7 +50,7 @@ TARGETLIBS = \ $(ONECOREUAP_EXTERNAL_SDK_LIB_PATH)\dxgi.lib \ $(ONECOREUAP_EXTERNAL_SDK_LIB_PATH)\propsys.lib \ $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\api-ms-win-mm-playsound-l1.lib \ - $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-imm-l1-1-0.lib \ + $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-imm-l1.lib \ $(ONECORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-dwmapi-ext-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-gdi-dc-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-gdi-dc-create-l1.lib \ @@ -76,12 +76,14 @@ TARGETLIBS = \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-sysparams-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-window-ext-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-winstamin-l1.lib \ + $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-syscolors-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-shell-shell32-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-uxtheme-themes-l1.lib \ $(ONECORESHELL_INTERNAL_LIB_VPATH_L)\api-ms-win-shell-dataobject-l1.lib \ $(ONECORESHELL_INTERNAL_LIB_VPATH_L)\api-ms-win-shell-namespace-l1.lib \ $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-uiacore-l1.lib \ $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-usp10-l1.lib \ + $(ONECORE_EXTERNAL_SDK_LIB_PATH)\ntdll.lib \ $(WINCORE_OBJ_PATH)\console\conint\$(O)\conint.lib \ $(WINCORE_OBJ_PATH)\console\open\src\buffer\out\lib\$(O)\conbufferout.lib \ $(WINCORE_OBJ_PATH)\console\open\src\host\lib\$(O)\conhostv2.lib \ @@ -93,7 +95,6 @@ TARGETLIBS = \ $(WINCORE_OBJ_PATH)\console\open\src\audio\midi\lib\$(O)\ConAudioMidi.lib \ $(WINCORE_OBJ_PATH)\console\open\src\renderer\base\lib\$(O)\ConRenderBase.lib \ $(WINCORE_OBJ_PATH)\console\open\src\renderer\gdi\lib\$(O)\ConRenderGdi.lib \ - $(WINCORE_OBJ_PATH)\console\open\src\renderer\vt\lib\$(O)\ConRenderVt.lib \ $(WINCORE_OBJ_PATH)\console\open\src\renderer\wddmcon\lib\$(O)\ConRenderWddmCon.lib \ $(WINCORE_OBJ_PATH)\console\open\src\server\lib\$(O)\ConServer.lib \ $(WINCORE_OBJ_PATH)\console\open\src\interactivity\base\lib\$(O)\ConInteractivityBaseLib.lib \ @@ -112,7 +113,7 @@ DELAYLOAD = \ OLEAUT32.dll; \ icu.dll; \ api-ms-win-mm-playsound-l1.dll; \ - ext-ms-win-imm-l1-1-0.lib; \ + ext-ms-win-imm-l1.dll; \ api-ms-win-shcore-scaling-l1.dll; \ api-ms-win-shell-dataobject-l1.dll; \ api-ms-win-shell-namespace-l1.dll; \ @@ -143,6 +144,7 @@ DELAYLOAD = \ ext-ms-win-rtcore-ntuser-sysparams-l1.dll; \ ext-ms-win-rtcore-ntuser-window-ext-l1.dll; \ ext-ms-win-rtcore-ntuser-winstamin-l1.dll; \ + ext-ms-win-rtcore-ntuser-syscolors-l1.dll; \ ext-ms-win-shell-shell32-l1.dll; \ ext-ms-win-uiacore-l1.dll; \ ext-ms-win-uxtheme-themes-l1.dll; \ diff --git a/src/project.unittest.inc b/src/project.unittest.inc index 13b0caa9f4..a4f5daf4bb 100644 --- a/src/project.unittest.inc +++ b/src/project.unittest.inc @@ -32,6 +32,7 @@ INCLUDES = \ TARGETLIBS = \ $(TARGETLIBS) \ $(ONECORE_EXTERNAL_SDK_LIB_VPATH_L)\onecore.lib \ + $(ONECORE_EXTERNAL_SDK_LIB_PATH)\ntdll.lib \ $(ONECORESDKTOOLS_INTERNAL_LIB_PATH_L)\WexTest\Cue\Wex.Common.lib \ $(ONECORESDKTOOLS_INTERNAL_LIB_PATH_L)\WexTest\Cue\Wex.Logger.lib \ $(ONECORESDKTOOLS_INTERNAL_LIB_PATH_L)\WexTest\Cue\Te.Common.lib \ diff --git a/src/terminal/adapter/ut_adapter/sources b/src/terminal/adapter/ut_adapter/sources index 6f4eb322a2..2fe3c59699 100644 --- a/src/terminal/adapter/ut_adapter/sources +++ b/src/terminal/adapter/ut_adapter/sources @@ -48,7 +48,7 @@ TARGETLIBS = \ $(ONECOREUAP_EXTERNAL_SDK_LIB_PATH)\d3d11.lib \ $(ONECOREUAP_EXTERNAL_SDK_LIB_PATH)\d3dcompiler.lib \ $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\api-ms-win-mm-playsound-l1.lib \ - $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-imm-l1-1-0.lib \ + $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-imm-l1.lib \ $(ONECORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-dwmapi-ext-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-gdi-dc-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-gdi-dc-create-l1.lib \ @@ -73,12 +73,14 @@ TARGETLIBS = \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-sysparams-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-window-ext-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-winstamin-l1.lib \ + $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-syscolors-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-shell-shell32-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-uxtheme-themes-l1.lib \ $(ONECORESHELL_INTERNAL_LIB_VPATH_L)\api-ms-win-shell-dataobject-l1.lib \ $(ONECORESHELL_INTERNAL_LIB_VPATH_L)\api-ms-win-shell-namespace-l1.lib \ $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-uiacore-l1.lib \ $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-usp10-l1.lib \ + $(ONECORE_EXTERNAL_SDK_LIB_PATH)\ntdll.lib \ $(WINCORE_OBJ_PATH)\console\conint\$(O)\conint.lib \ $(WINCORE_OBJ_PATH)\console\open\src\buffer\out\lib\$(O)\conbufferout.lib \ $(WINCORE_OBJ_PATH)\console\open\src\host\lib\$(O)\conhostv2.lib \ @@ -91,7 +93,6 @@ TARGETLIBS = \ $(WINCORE_OBJ_PATH)\console\open\src\renderer\base\lib\$(O)\ConRenderBase.lib \ $(WINCORE_OBJ_PATH)\console\open\src\renderer\gdi\lib\$(O)\ConRenderGdi.lib \ $(WINCORE_OBJ_PATH)\console\open\src\renderer\wddmcon\lib\$(O)\ConRenderWddmCon.lib \ - $(WINCORE_OBJ_PATH)\console\open\src\renderer\vt\lib\$(O)\ConRenderVt.lib \ $(WINCORE_OBJ_PATH)\console\open\src\server\lib\$(O)\ConServer.lib \ $(WINCORE_OBJ_PATH)\console\open\src\interactivity\base\lib\$(O)\ConInteractivityBaseLib.lib \ $(WINCORE_OBJ_PATH)\console\open\src\interactivity\win32\lib\$(O)\ConInteractivityWin32Lib.lib \ @@ -107,7 +108,7 @@ DELAYLOAD = \ OLEAUT32.dll; \ icu.dll; \ api-ms-win-mm-playsound-l1.dll; \ - ext-ms-win-imm-l1-1-0.lib; \ + ext-ms-win-imm-l1.dll; \ api-ms-win-shcore-scaling-l1.dll; \ api-ms-win-shell-dataobject-l1.dll; \ api-ms-win-shell-namespace-l1.dll; \ @@ -137,6 +138,7 @@ DELAYLOAD = \ ext-ms-win-rtcore-ntuser-sysparams-l1.dll; \ ext-ms-win-rtcore-ntuser-window-ext-l1.dll; \ ext-ms-win-rtcore-ntuser-winstamin-l1.dll; \ + ext-ms-win-rtcore-ntuser-syscolors-l1.dll; \ ext-ms-win-shell-shell32-l1.dll; \ ext-ms-win-uiacore-l1.dll; \ ext-ms-win-uxtheme-themes-l1.dll; \ diff --git a/src/terminal/parser/ft_fuzzer/sources b/src/terminal/parser/ft_fuzzer/sources index c0dfad9134..c221ac9c0c 100644 --- a/src/terminal/parser/ft_fuzzer/sources +++ b/src/terminal/parser/ft_fuzzer/sources @@ -27,6 +27,8 @@ TEST_CODE = 1 USE_UNICRT = 1 USE_MSVCRT = 1 +NO_WCHAR_T = 1 # use native wchar_t +USE_CXX17_STD_BYTE = 1 # Windows disables std::byte by default... USE_STL = 1 STL_VER = STL_VER_CURRENT diff --git a/src/terminal/parser/ft_fuzzwrapper/sources b/src/terminal/parser/ft_fuzzwrapper/sources index 1753a400e3..73df7091e4 100644 --- a/src/terminal/parser/ft_fuzzwrapper/sources +++ b/src/terminal/parser/ft_fuzzwrapper/sources @@ -60,6 +60,7 @@ INCLUDES = \ TARGETLIBS = \ $(TARGETLIBS) \ + $(ONECORE_EXTERNAL_SDK_LIB_PATH)\ntdll.lib \ $(ONECORE_EXTERNAL_SDK_LIB_VPATH_L)\onecore.lib \ $(OBJ_PATH)\..\lib\$(O)\ConTermParser.lib \ $(OBJ_PATH)\..\..\..\types\lib\$(O)\ConTypes.lib \ diff --git a/src/terminal/parser/ut_parser/sources b/src/terminal/parser/ut_parser/sources index fcc2178953..fd4e09dc3b 100644 --- a/src/terminal/parser/ut_parser/sources +++ b/src/terminal/parser/ut_parser/sources @@ -38,7 +38,7 @@ TARGETLIBS = \ $(ONECOREUAP_EXTERNAL_SDK_LIB_PATH)\d3d11.lib \ $(ONECOREUAP_EXTERNAL_SDK_LIB_PATH)\d3dcompiler.lib \ $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\api-ms-win-mm-playsound-l1.lib \ - $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-imm-l1-1-0.lib \ + $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-imm-l1.lib \ $(ONECORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-dwmapi-ext-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-gdi-dc-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-gdi-dc-create-l1.lib \ @@ -63,12 +63,14 @@ TARGETLIBS = \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-sysparams-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-window-ext-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-winstamin-l1.lib \ + $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-rtcore-ntuser-syscolors-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-shell-shell32-l1.lib \ $(MINCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-uxtheme-themes-l1.lib \ $(ONECORESHELL_INTERNAL_LIB_VPATH_L)\api-ms-win-shell-dataobject-l1.lib \ $(ONECORESHELL_INTERNAL_LIB_VPATH_L)\api-ms-win-shell-namespace-l1.lib \ $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-uiacore-l1.lib \ $(MODERNCORE_INTERNAL_PRIV_SDK_LIB_VPATH_L)\ext-ms-win-usp10-l1.lib \ + $(ONECORE_EXTERNAL_SDK_LIB_PATH)\ntdll.lib \ $(WINCORE_OBJ_PATH)\console\conint\$(O)\conint.lib \ $(CONSOLE_OBJ_PATH)\buffer\out\lib\$(O)\conbufferout.lib \ $(CONSOLE_OBJ_PATH)\host\lib\$(O)\conhostv2.lib \ @@ -80,7 +82,6 @@ TARGETLIBS = \ $(CONSOLE_OBJ_PATH)\renderer\base\lib\$(O)\ConRenderBase.lib \ $(CONSOLE_OBJ_PATH)\renderer\gdi\lib\$(O)\ConRenderGdi.lib \ $(CONSOLE_OBJ_PATH)\renderer\wddmcon\lib\$(O)\ConRenderWddmCon.lib \ - $(CONSOLE_OBJ_PATH)\renderer\vt\lib\$(O)\ConRenderVt.lib \ $(CONSOLE_OBJ_PATH)\audio\midi\lib\$(O)\ConAudioMidi.lib \ $(CONSOLE_OBJ_PATH)\server\lib\$(O)\ConServer.lib \ $(CONSOLE_OBJ_PATH)\interactivity\base\lib\$(O)\ConInteractivityBaseLib.lib \ @@ -98,7 +99,7 @@ DELAYLOAD = \ OLEAUT32.dll; \ icu.dll; \ api-ms-win-mm-playsound-l1.dll; \ - ext-ms-win-imm-l1-1-0.lib; \ + ext-ms-win-imm-l1.dll; \ api-ms-win-shcore-scaling-l1.dll; \ api-ms-win-shell-dataobject-l1.dll; \ api-ms-win-shell-namespace-l1.dll; \ @@ -129,6 +130,7 @@ DELAYLOAD = \ ext-ms-win-rtcore-ntuser-sysparams-l1.dll; \ ext-ms-win-rtcore-ntuser-window-ext-l1.dll; \ ext-ms-win-rtcore-ntuser-winstamin-l1.dll; \ + ext-ms-win-rtcore-ntuser-syscolors-l1.dll; \ ext-ms-win-shell-shell32-l1.dll; \ ext-ms-win-uiacore-l1.dll; \ ext-ms-win-usp10-l1.dll; \ diff --git a/src/tools/vtpipeterm/main.cpp b/src/tools/vtpipeterm/main.cpp index fa79b0b9cf..3117f7aaaa 100644 --- a/src/tools/vtpipeterm/main.cpp +++ b/src/tools/vtpipeterm/main.cpp @@ -1,12 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN +#endif #define NOMINMAX #include +#ifndef __INSIDE_WINDOWS #define CONPTY_IMPEXP #include +#else // Building inside Windows, just use the kernel32 ones. +#define ConptyCreatePseudoConsole CreatePseudoConsole +#define ConptyReleasePseudoConsole ReleasePseudoConsole +#define ConptyResizePseudoConsole ResizePseudoConsole +#endif #include diff --git a/src/tools/vtpipeterm/sources b/src/tools/vtpipeterm/sources index ecbc0bfcfd..5fec40ebba 100644 --- a/src/tools/vtpipeterm/sources +++ b/src/tools/vtpipeterm/sources @@ -1,3 +1,6 @@ +!include $(PROJECT_ROOT)\core\console\vcpkg\consume.inc + +USE_STD_CPP20 = 1 MSC_WARNING_LEVEL=/W4 /WX @@ -20,7 +23,8 @@ C_DEFINES=-DUNICODE -D__INSIDE_WINDOWS TARGETLIBS=\ $(TARGETLIBS) \ $(MINWIN_EXTERNAL_SDK_LIB_PATH_L)\ntdll.lib \ - $(ONECORE_EXTERNAL_SDK_LIB_VPATH_L)\onecore.lib + $(ONECORE_EXTERNAL_SDK_LIB_VPATH_L)\onecore.lib \ + $(WINCORE_OBJ_PATH)\console\open\src\types\lib\$(O)\ConTypes.lib \ SOURCES=main.cpp \ diff --git a/src/types/ut_types/sources b/src/types/ut_types/sources index f5741649fe..e2fe087a64 100644 --- a/src/types/ut_types/sources +++ b/src/types/ut_types/sources @@ -25,6 +25,7 @@ INCLUDES = \ TARGETLIBS = \ $(WINCORE_OBJ_PATH)\console\open\src\types\lib\$(O)\ConTypes.lib \ + $(ONECORE_EXTERNAL_SDK_LIB_PATH)\ntdll.lib \ $(TARGETLIBS) \ # ------------------------------------- From 865f5e52397025cfb21f40871bfaf04d85a44986 Mon Sep 17 00:00:00 2001 From: James Holderness Date: Fri, 2 May 2025 23:36:45 +0100 Subject: [PATCH 6/7] Fix SGR mouse movement reports (#18864) According to the documentation, the final character of an SGR mouse report is meant to be `M` for a button press and `m` for a button release. However it isn't clear what the final character should be for motion events, and we were using an `m` if there weren't any buttons held down at the time, while all other terminals used an `M`, regardless of the button state. This PR updates our implementation to match what everyone else is doing, since our interpretation of the spec was causing problems for some apps. ## Validation Steps Performed I've manually tested the new behavior in Vttest, and confirmed that our mouse reports now match Xterm more closely, and I've tested with v0.42.0 of Zellij, which was previous glitching badly in Windows Terminal, but now works correctly. I've also updated our unit tests for the SGR mouse mode to reflect the correct report format. Closes #18712 --- .../adapter/ut_adapter/MouseInputTest.cpp | 23 ++++++--------- src/terminal/input/mouseInput.cpp | 29 ++++++++----------- src/terminal/input/terminalInput.hpp | 2 +- 3 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/terminal/adapter/ut_adapter/MouseInputTest.cpp b/src/terminal/adapter/ut_adapter/MouseInputTest.cpp index f3df50a0a6..fe39b86630 100644 --- a/src/terminal/adapter/ut_adapter/MouseInputTest.cpp +++ b/src/terminal/adapter/ut_adapter/MouseInputTest.cpp @@ -99,7 +99,7 @@ public: TerminalInput::StringType str; str.append(std::wstring_view{ buffer }); - str[str.size() - 1] = IsButtonDown(uiButton) ? L'M' : L'm'; + str[str.size() - 1] = IsButtonUp(uiButton) ? L'm' : L'M'; return str; } @@ -182,23 +182,18 @@ public: return result; } - bool IsButtonDown(unsigned int uiButton) + bool IsButtonUp(unsigned int uiButton) { - auto fIsDown = false; switch (uiButton) { - case WM_LBUTTONDBLCLK: - case WM_LBUTTONDOWN: - case WM_RBUTTONDOWN: - case WM_RBUTTONDBLCLK: - case WM_MBUTTONDOWN: - case WM_MBUTTONDBLCLK: - case WM_MOUSEWHEEL: - case WM_MOUSEHWHEEL: - fIsDown = true; - break; + case WM_LBUTTONUP: + case WM_RBUTTONUP: + case WM_MBUTTONUP: + case WM_XBUTTONUP: + return true; + default: + return false; } - return fIsDown; } /* From winuser.h - Needed to manually specify the test properties diff --git a/src/terminal/input/mouseInput.cpp b/src/terminal/input/mouseInput.cpp index 596df0360e..c36ce160b4 100644 --- a/src/terminal/input/mouseInput.cpp +++ b/src/terminal/input/mouseInput.cpp @@ -63,24 +63,19 @@ static constexpr bool _isWheelMsg(const unsigned int buttonCode) noexcept } // Routine Description: -// - Determines if the input windows message code describes a button press -// (either down or doubleclick) +// - Determines if the input windows message code describes a button release // Parameters: // - button - the message to decode. // Return value: -// - true if button is a button down event -static constexpr bool _isButtonDown(const unsigned int button) noexcept +// - true if button is a button up event +static constexpr bool _isButtonUp(const unsigned int button) noexcept { switch (button) { - case WM_LBUTTONDBLCLK: - case WM_LBUTTONDOWN: - case WM_RBUTTONDOWN: - case WM_RBUTTONDBLCLK: - case WM_MBUTTONDOWN: - case WM_MBUTTONDBLCLK: - case WM_MOUSEWHEEL: - case WM_MOUSEHWHEEL: + case WM_LBUTTONUP: + case WM_RBUTTONUP: + case WM_MBUTTONUP: + case WM_XBUTTONUP: return true; default: return false; @@ -372,7 +367,7 @@ TerminalInput::OutputType TerminalInput::HandleMouse(const til::point position, // then we want to handle hovers with WM_MOUSEMOVE. // However, if we're dragging (WM_MOUSEMOVE with a button pressed), // then use that pressed button instead. - return _GenerateSGRSequence(position, physicalButtonPressed ? realButton : button, _isButtonDown(realButton), isHover, modifierKeyState, delta); + return _GenerateSGRSequence(position, physicalButtonPressed ? realButton : button, _isButtonUp(button), isHover, modifierKeyState, delta); } else { @@ -463,18 +458,18 @@ TerminalInput::OutputType TerminalInput::_GenerateUtf8Sequence(const til::point // Parameters: // - position - The windows coordinates (top,left = 0,0) of the mouse event // - button - the message to decode. WM_MOUSEMOVE is used for mouse hovers with no buttons pressed. -// - isDown - true if a mouse button was pressed. +// - isRelease - true if a mouse button was released. // - isHover - true if the sequence is generated in response to a mouse hover // - modifierKeyState - the modifier keys pressed with this button // - delta - the amount that the scroll wheel changed (should be 0 unless button is a WM_MOUSE*WHEEL) // - ppwchSequence - On success, where to put the pointer to the generated sequence // - pcchLength - On success, where to put the length of the generated sequence -TerminalInput::OutputType TerminalInput::_GenerateSGRSequence(const til::point position, const unsigned int button, const bool isDown, const bool isHover, const short modifierKeyState, const short delta) +TerminalInput::OutputType TerminalInput::_GenerateSGRSequence(const til::point position, const unsigned int button, const bool isRelease, const bool isHover, const short modifierKeyState, const short delta) { // Format for SGR events is: - // "\x1b[<%d;%d;%d;%c", xButton, x+1, y+1, fButtonDown? 'M' : 'm' + // "\x1b[<%d;%d;%d;%c", xButton, x+1, y+1, isRelease? 'm' : 'M' const auto xbutton = _windowsButtonToSGREncoding(button, isHover, modifierKeyState, delta); - return fmt::format(FMT_COMPILE(L"{}<{};{};{}{}"), _csi, xbutton, position.x + 1, position.y + 1, isDown ? L'M' : L'm'); + return fmt::format(FMT_COMPILE(L"{}<{};{};{}{}"), _csi, xbutton, position.x + 1, position.y + 1, isRelease ? L'm' : L'M'); } // Routine Description: diff --git a/src/terminal/input/terminalInput.hpp b/src/terminal/input/terminalInput.hpp index 4048826956..d9570cc9cc 100644 --- a/src/terminal/input/terminalInput.hpp +++ b/src/terminal/input/terminalInput.hpp @@ -109,7 +109,7 @@ namespace Microsoft::Console::VirtualTerminal #pragma region MouseInput [[nodiscard]] OutputType _GenerateDefaultSequence(til::point position, unsigned int button, bool isHover, short modifierKeyState, short delta); [[nodiscard]] OutputType _GenerateUtf8Sequence(til::point position, unsigned int button, bool isHover, short modifierKeyState, short delta); - [[nodiscard]] OutputType _GenerateSGRSequence(til::point position, unsigned int button, bool isDown, bool isHover, short modifierKeyState, short delta); + [[nodiscard]] OutputType _GenerateSGRSequence(til::point position, unsigned int button, bool isRelease, bool isHover, short modifierKeyState, short delta); [[nodiscard]] OutputType _makeAlternateScrollOutput(short delta) const; From 06f736bebe84eda0c34b935a875eebe031a899b7 Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Fri, 2 May 2025 18:30:52 -0500 Subject: [PATCH 7/7] wpf: use the new TSF implementation (#18861) This fixes two issues in the WPF terminal control: - The emoji picker and other IME candidate windows didn't show up in the right place - Submitting an emoji via the emoji picker would result in two win32 input mode events with a VK of 65535 and the surrogate pair halves. I am not sure I did the right thing with the thread TSF handle... --- src/cascadia/TerminalControl/HwndTerminal.cpp | 84 +++++++++++++++++++ src/cascadia/TerminalControl/HwndTerminal.hpp | 22 +++++ 2 files changed, 106 insertions(+) diff --git a/src/cascadia/TerminalControl/HwndTerminal.cpp b/src/cascadia/TerminalControl/HwndTerminal.cpp index d2aa1e1796..3cb02ee547 100644 --- a/src/cascadia/TerminalControl/HwndTerminal.cpp +++ b/src/cascadia/TerminalControl/HwndTerminal.cpp @@ -19,6 +19,79 @@ using namespace ::Microsoft::Terminal::Core; static LPCWSTR term_window_class = L"HwndTerminalClass"; +STDMETHODIMP HwndTerminal::TsfDataProvider::QueryInterface(REFIID, void**) noexcept +{ + return E_NOTIMPL; +} + +ULONG STDMETHODCALLTYPE HwndTerminal::TsfDataProvider::AddRef() noexcept +{ + return 1; +} + +ULONG STDMETHODCALLTYPE HwndTerminal::TsfDataProvider::Release() noexcept +{ + return 1; +} + +HWND HwndTerminal::TsfDataProvider::GetHwnd() +{ + return _terminal->GetHwnd(); +} + +RECT HwndTerminal::TsfDataProvider::GetViewport() +{ + const auto hwnd = GetHwnd(); + + RECT rc; + GetClientRect(hwnd, &rc); + + // https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getclientrect + // > The left and top members are zero. The right and bottom members contain the width and height of the window. + // --> We can turn the client rect into a screen-relative rect by adding the left/top position. + ClientToScreen(hwnd, reinterpret_cast(&rc)); + rc.right += rc.left; + rc.bottom += rc.top; + + return rc; +} + +RECT HwndTerminal::TsfDataProvider::GetCursorPosition() +{ + // Convert from columns/rows to pixels. + til::point cursorPos; + til::size fontSize; + { + const auto lock = _terminal->_terminal->LockForReading(); + cursorPos = _terminal->_terminal->GetCursorPosition(); // measured in terminal cells + fontSize = _terminal->_actualFont.GetSize(); // measured in pixels, not DIP + } + POINT ptSuggestion = { + .x = cursorPos.x * fontSize.width, + .y = cursorPos.y * fontSize.height, + }; + + ClientToScreen(GetHwnd(), &ptSuggestion); + + // Final measurement should be in pixels + return { + .left = ptSuggestion.x, + .top = ptSuggestion.y, + .right = ptSuggestion.x + fontSize.width, + .bottom = ptSuggestion.y + fontSize.height, + }; +} + +void HwndTerminal::TsfDataProvider::HandleOutput(std::wstring_view text) +{ + _terminal->_WriteTextToConnection(text); +} + +Microsoft::Console::Render::Renderer* HwndTerminal::TsfDataProvider::GetRenderer() +{ + return _terminal->_renderer.get(); +} + // This magic flag is "documented" at https://msdn.microsoft.com/en-us/library/windows/desktop/ms646301(v=vs.85).aspx // "If the high-order bit is 1, the key is down; otherwise, it is up." static constexpr short KeyPressed{ gsl::narrow_cast(0x8000) }; @@ -242,6 +315,7 @@ try { // As a rule, detach resources from the Terminal before shutting them down. // This ensures that teardown is reentrant. + _tsfHandle = {}; // Shut down the renderer (and therefore the thread) before we implode _renderer.reset(); @@ -941,6 +1015,16 @@ void __stdcall TerminalSetFocus(void* terminal) { LOG_IF_FAILED(uiaEngine->Enable()); } + publicTerminal->_FocusTSF(); +} + +void HwndTerminal::_FocusTSF() noexcept +{ + if (!_tsfHandle) + { + _tsfHandle = Microsoft::Console::TSF::Handle::Create(); + _tsfHandle.AssociateFocus(&_tsfDataProvider); + } } void __stdcall TerminalKillFocus(void* terminal) diff --git a/src/cascadia/TerminalControl/HwndTerminal.hpp b/src/cascadia/TerminalControl/HwndTerminal.hpp index 8ecd32df02..350727f12a 100644 --- a/src/cascadia/TerminalControl/HwndTerminal.hpp +++ b/src/cascadia/TerminalControl/HwndTerminal.hpp @@ -6,6 +6,7 @@ #include "../../buffer/out/textBuffer.hpp" #include "../../renderer/inc/FontInfoDesired.hpp" #include "../../types/IControlAccessibilityInfo.h" +#include "../../tsf/Handle.h" namespace Microsoft::Console::Render::Atlas { @@ -85,6 +86,21 @@ public: static LRESULT CALLBACK HwndTerminalWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) noexcept; private: + struct TsfDataProvider : public Microsoft::Console::TSF::IDataProvider + { + TsfDataProvider(HwndTerminal* t) : + _terminal(t) {} + virtual ~TsfDataProvider() = default; + STDMETHODIMP TsfDataProvider::QueryInterface(REFIID, void**) noexcept override; + ULONG STDMETHODCALLTYPE TsfDataProvider::AddRef() noexcept override; + ULONG STDMETHODCALLTYPE TsfDataProvider::Release() noexcept override; + HWND GetHwnd() override; + RECT GetViewport() override; + RECT GetCursorPosition() override; + void HandleOutput(std::wstring_view text) override; + Microsoft::Console::Render::Renderer* GetRenderer() override; + HwndTerminal* _terminal; + }; wil::unique_hwnd _hwnd; FontInfoDesired _desiredFont; FontInfo _actualFont; @@ -106,6 +122,10 @@ private: std::optional _lastMouseClickPos; std::optional _singleClickTouchdownPos; + // _tsfHandle uses _tsfDataProvider. Destructors run from bottom to top; this maintains correct destruction order. + TsfDataProvider _tsfDataProvider{ this }; + Microsoft::Console::TSF::Handle _tsfHandle; + friend HRESULT _stdcall CreateTerminal(HWND parentHwnd, _Out_ void** hwnd, _Out_ void** terminal); friend HRESULT _stdcall TerminalTriggerResize(_In_ void* terminal, _In_ til::CoordType width, _In_ til::CoordType height, _Out_ til::size* dimensions); friend HRESULT _stdcall TerminalTriggerResizeWithDimension(_In_ void* terminal, _In_ til::size dimensions, _Out_ til::size* dimensionsInPixels); @@ -129,6 +149,8 @@ private: HRESULT _CopyToSystemClipboard(const std::string& stringToCopy, LPCWSTR lpszFormat) const; void _PasteTextFromClipboard() noexcept; + void _FocusTSF() noexcept; + const unsigned int _NumberOfClicks(til::point clickPos, std::chrono::steady_clock::time_point clickTime) noexcept; HRESULT _StartSelection(LPARAM lParam) noexcept; HRESULT _MoveSelection(LPARAM lParam) noexcept;