4628 Commits

Author SHA1 Message Date
SEt
b4cf05a02c Gracefully handle unavailable TSF from SYSTEM account (#19635)
When run from SYSTEM account TSF seems to be unavailable. The only
missing step to handle that is check during initialization.

Not sure if fail after partial success in `Implementation::Initialize`
should also be gracefully handled.

Closes #19634

(cherry picked from commit 8bb831f628d3b8ddaf614c0a4d6f9b0b0533b5f0)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgiXm18
Service-Version: 1.23
2025-12-09 17:04:26 -06:00
Windows Console Service Bot
b8f270a4f7 Localization Updates - fix ja-jp and fr-fr loc bugs - 12/04/2025 00:46:52 (#19616)
Closes #17191
Closes #18795
Closes #17827

(cherry picked from commit c4668d99b73f33430a604c6054ad6cafd4d9e67e)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgiGa_s
Service-Version: 1.23
2025-12-09 11:28:50 -06:00
Dustin L. Howett
7381196865 Enable DECRQCRA at compile time for all Terminal builds (#19606)
Support for DECRQCRA Request Checksum of Rectangular Area was added in
#14989, but left disabled at build time because it could be considered a
security risk.

In #17895, we unconditionally added a toggle for it to Terminal's
settings UI and settings schema (`compatibility.allowDECRQCRA`). For
users on Stable and Preview, it didn't actually enable anything. Whoops.

Since we have a way to turn it off (and in so doing, mitigate the risk)
in Terminal, it's high time for us to remove the feature gating.

Conhost doesn't support turning it off for now and so conhost can still
have it compiled out, as a treat.

(cherry picked from commit 3e29d2a316c5f2380ffc2b97939e58c9859fadc8)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgiA9Jg
Service-Version: 1.23
2025-12-09 11:26:24 -06:00
Leonard Hecker
f8efd14e81 Fix a WPF<>TSF crash by avoiding TF_TMAE_CONSOLE (#19584)
As explained in detail in the diff.

Closes #19562

(cherry picked from commit 1ca0c76bc74012fdd1ff6211b5c8f389a4efd9b4)
Service-Card-Id: PVTI_lADOAF3p4s4Axadtzghp8jw
Service-Version: 1.23
2025-11-24 12:50:21 -06:00
Windows Console Service Bot
51f412f7c2 Localization Updates - main - 11/07/2025 03:05:02 (#19532)
It said the equivalent of "Nickname" rather than "aliased".

Co-authored-by: Console Service Bot <consvc@microsoft.com>
(cherry picked from commit 965a121a3814fe8addc8843bd20c834de4da6110)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzghDyBE
Service-Version: 1.23
2025-11-24 12:50:02 -06:00
Leonard Hecker
221c04f0ac Allow creating new windows on another virtual desktop (#19458)
Whoops. Closes #18652

<DHowett> I chatted with Leonard to figure out why I kept
misunderstanding this PR. The key is that **this function should not
always return an existing window.** It's supposed to find an existing
window on the current virtual desktop, not literally any window
anywhere.

(cherry picked from commit 5ae95d7df0ee3050ad36b98cd8f3f8d55005f0d2)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgYvdmA
Service-Version: 1.23
2025-11-24 12:50:01 -06:00
Dustin L. Howett
93335d045c Make sure UIHelpers' resources are included in the final PRI file (#19461)
OCWildcardResource requires the inclusion of a magic MSBuild target that
we wrote. We forgot to include it here. Oops.

Closes #19444

(cherry picked from commit 0e3d136dad1263e36b136b66adbc7e7d4789d56e)
Service-Card-Id: PVTI_lADOAF3p4s4Axadtzgf7udI
Service-Version: 1.23
2025-11-24 12:50:00 -06:00
Windows Console Service Bot
821eb1b645 Localization Updates - main - 10/15/2025 02:48:19 (#19451)
Closes #18849
Closes #19412

Co-authored-by: Console Service Bot <consvc@microsoft.com>
(cherry picked from commit 7f6ab5520ee75e5bcda870998061fd120dbf4966)
Service-Card-Id: PVTI_lADOAF3p4s4Axadtzgf5KOw
Service-Version: 1.23
2025-11-24 12:49:58 -06:00
Carlos Zamora
2aeeef72f9 Fix unfocusedBackground being used as active tab color (#19424)
Turns out that the `"TabViewItemHeaderBackground"` resource should be
set to the _selected_ color instead of the _deselected_ color.

In 1.22, (pre-#18109) we actually didn't set this resource. But we do
actually need it for high contrast mode! (verified)

 High contrast mode looks right
 "Snazzy" theme from bug report looks right

 Closes #19343

(cherry picked from commit b62cad640b6871be1daf8b3e80f8db848ae0800e)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgfrGvM
Service-Version: 1.23
2025-11-24 12:48:15 -06:00
Dustin L. Howett
96f13a15de Use the actual process image instead of module filename to dedup session (#19415)
Apparently, `GetModuleFileNameW` returns exactly the path (or prefix, in
case of a DLL) passed to `CreateProcess` casing and all. Since we were
using it to generate the uniquing hash for Portable and Unpackaged
instances, this meant that `C:\Terminal\wt` and `C:\TeRmInAl\wt` were
considered different instances. Whoops.

Using `QueryFullProcessImageNameW` instead results in canonicalization.
Maybe the kernel does it. I don't know. What I do know is that it works
more correctly.

(`Query...` goes through the kernel, while `GetModule...` goes through
the loader. Interesting!)

Closes #19253

(cherry picked from commit 9d7ea77cc8ecbfcf213f6a38fbeb611c71040a34)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgfkTus
Service-Version: 1.23
v1.23.12811.0
2025-10-08 17:53:51 -05:00
PankajBhojwani
5fa2718b2f Only do "keys" fixups for non-nested, non-iterable commands (#19408)
## Summary of the Pull Request
When we introduced action IDs, we separated "commands" from
"keybindings", and introduced fixup logic to rewrite the legacy-style
command blocks into the new version. However we don't do any ID logic
for nested and iterable commands, so make sure we don't inform the
loader for fixups in those cases.

## Validation Steps Performed
We no longer repeatedly attempt to fixup the settings file when we see a
`"keys"` entry in a nested/iterable command block

## PR Checklist
- [x] Closes #18736

(cherry picked from commit 04676bd31a598ccede4517367cbb070c38964f8e)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgfjxUM
Service-Version: 1.23
2025-10-08 17:53:50 -05:00
Dustin L. Howett
e1f785cedd Remove the leading fire from the taskbar progress handler (#19403)
If the progress state hasn't been set for more than 200ms, we shouldn't
even bother flickering the old state.

This prevents applications from making the tab (and the taskbar icon)
flicker.

We were reviewing #19394 and decided that the _original_ behavior before
Leonard's throttling fix was somewhat unfortunate as well. An
application that sets an indeterminate state for 10ms and then clears it
shouldn't be able to make any part of the application flicker, fast _or_
slow.

Removing the leading fire time from the throttled function ensures that
it will only fire once every 200ms, and only with the state most
recently set. It will not debounce (so setting the progress every 150ms
will not prevent it from updating.)

Closes #19394

(cherry picked from commit 998ab586e1cccf11a965cab9dc2dcdb7da8eaa6c)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgfZOsM PVTI_lADOAF3p4s4Axadtzgfb1Nw
Service-Version: 1.23
2025-10-08 17:53:48 -05:00
Dustin L. Howett
b4270e545d Avoid reentrancy issues when dropping AppHost, even harder (#19395)
The previous fix in #19296 moved the _destruction_ of AppHost into the
tail end after we manipulate the `_windows` vector; however, it kept the
part which calls into XAML (`Close`) before the `erase`. I suspect that
we still had some reentrancy issues, where we cached an iterator before
the list was modified by another window close event.

That is:

```mermaid
sequenceDiagram
		Emperor->>Emperor: Close Window
		Emperor->>+AppHost: Close (a)
		AppHost->>XAML: Close
		XAML-->>Emperor: pump loop
		Emperor->>Emperor: Close Window
		Emperor->>+AppHost: Close (b)
		AppHost->>XAML: Close
		XAML-->>Emperor: pump loop
		AppHost->>-Emperor: Closed
		Emperor->>Emperor: erase(b)
		AppHost->>-Emperor: Closed
		Emperor->>Emperor: erase(a)
```

Moving the `Close()` to after the `erase` ensures that there are no
cached iterators that survive beyond XAML pumping the message loop.

Fixes 8d41ace3

(cherry picked from commit 5976de16000b3e49f3f010c42b23f6a42f6a6405)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgfScoo
Service-Version: 1.23
2025-10-08 17:53:47 -05:00
Dustin L. Howett
a4c512f016 build: separate vpack creation from vpack publication (#19380)
This will allow us to publish vpacks without making the build fail
waiting for us to *merge* those vpacks into Windows. It also gives us
better control over when and where the vpack update gets merged.

(cherry picked from commit 6b428577b95835b95479306d88db8bc74232bea7)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgfLAk0
Service-Version: 1.23
v1.23.12681.0
2025-09-25 13:36:59 -05:00
Dustin L. Howett
77a1f5a9e7 VsDev: reject VS instances which do not actually contain devshell/devcmd (#19352)
Closes #19169

(cherry picked from commit 1926c4601c489ca724a8586242a667d52da8e45a)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgdI3eE
Service-Version: 1.23
2025-09-16 18:22:57 -05:00
Leonard Hecker
f486a5f7d4 Fix behavior of split-pane for existing windows (#19347)
Closes #18815

## Validation Steps Performed
* `wt -w 0 sp` splits the current tab 

(cherry picked from commit 0aee174e680d889fd6d9ddba6f037002d6f79fdd)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgZrR-E
Service-Version: 1.23
2025-09-16 14:38:01 -05:00
John Cavanaugh
6dde7d3b78 Fix terminal profile schema to allow null in keybinding id (#19332)
Fixes the terminal profile jsonschema to allow for null in the id. This
is to match the current implementation when disabling a built in default
keybind.

(cherry picked from commit eb16eb26ab5d0c3f36a1a2084edcceacdf2a99f9)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgemwL4
Service-Version: 1.23
2025-09-16 14:38:00 -05:00
Leonard Hecker
f18abeb62e Extend lead/trail edge support for throttled_func (#19210)
You can now create throttled functions which trigger both on the leading
and trailing edge. This was then also ported to `ThrottledFunc` for
`DispatcherQueue`s and used for title/taskbar updates.

Closes #19188

* In CMD run:
  ```batch
  FOR /L %N IN () DO @echo %time%
  ```
* Doesn't hang the UI 

SERVICE NOTES
This replays part of #19192 to make it compatible with throttled_func.

(cherry picked from commit dbf740cf2c113b9613b22c0895529e68d66e14db)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgdI2TQ PVTI_lADOAF3p4s4AxadtzgdSMv0
Service-Version: 1.23
2025-09-16 14:36:44 -05:00
Myungchul Keum
f1dad37670 Adjust "Dimidium" color scheme (#19303)
- Add Selection BG color
- Make Bright white brighter

## Summary of the Pull Request
Final tune for Dimidium color scheme before its release.

## References and Relevant Issues
#18563

## Detailed Description of the Pull Request / Additional comments
I made little change to Dimidium color scheme.

<img width="640" height="174" alt="cmp-lightness1c"
src="https://github.com/user-attachments/assets/2e4aa6ca-5864-4901-b323-2e2bb2bf00e8"
/>

![preview-terminal](https://github.com/user-attachments/assets/8a53c54d-942a-44a2-9ee7-9ff8a6d2dfab)

<img width="584" height="207" alt="image"
src="https://github.com/user-attachments/assets/b70b0759-7961-4f8f-aaa7-762fc48e425b"
/>

- Adjusted "Bright white" slightly brighter, hoping it can be
distinguished better from "White".
- Defined "Selection Background" color.

This will be the final tune for Dimidum color scheme.

(cherry picked from commit 8011f3e28cd1c58f415be33a88cef7b9ce38ea09)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgeMuoU
Service-Version: 1.23
2025-09-05 14:10:24 -05:00
Leonard Hecker
5d97c3ae36 Avoid reentrancy issues when dropping AppHost (#19296)
tl;dr: ~Apphost() may pump the message loop.
That's no bueno. See comments in the diff.

Additionally, this PR enables `_assertIsMainThread` in
release to trace down mysterious crashes in those builds.

**BACKPORT NOTES**
I returned the `_assertIsMainThread` check to debug-only to remove the
assertion risk from production builds.

(cherry picked from commit 8d41ace320216f4c22b0aa7fb4cd42f362096e9c)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgebmmE
Service-Version: 1.23
2025-09-05 14:09:57 -05:00
Myungchul Keum
be596f16a3 Add CAM16 based color scheme "Dimidium" (#18563)
Okay, here is a challenge for the default color scheme.

This PR adds the [Dimidium] color scheme.

Refs #17818
Refs #18502

I adjusted colors using CAM16. I prioritized lightness so that all
colors (especially blue) has appropriate contrast with the background.

[Brief information about the Dimidium color scheme](https://github.com/dofuuz/dimidium/blob/main/README.md)

[Detailed explanation on crafting the color scheme with CAM16](https://dofuuz.github.io/color/2024/03/17/dimidium-terminal-color-scheme.html)

[Dimidium]: https://github.com/dofuuz/dimidium

(cherry picked from commit b6b8caba1eb73846972470fedede21c88aec57a9)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgebmKA
Service-Version: 1.23
2025-09-05 14:09:05 -05:00
Leonard Hecker
829176363c Fix CoreWindow being destroyed after handoff (#19298)
As per: https://github.com/microsoft/terminal/discussions/19280#discussioncomment-14237148

## Validation Steps Performed
* Launch wtd via handoff (spawn cmd, etc.)
* Shift+Click the tab bar + button to create a new window
* Close the initial window
* UI doesn't lock up 

(cherry picked from commit 7849b00cbddfb4d7f532472bc41fd8d8579bd72e)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgeLN9w
Service-Version: 1.23
2025-09-05 13:58:36 -05:00
Dustin L. Howett
5438177a49 sb: add appId to the StoreBroker blobs (new AERO requirement) (#19290)
> _I am altering the deal. Pray I do not alter it further._
> -the AERO team, maybe

(cherry picked from commit bd14f6908026a1d868b6719774ee685433df4fbf)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgeF9fU
Service-Version: 1.23
2025-09-05 13:57:56 -05:00
Adaline Valentina Simonian
55cb7049ed fix: don't render bidi isolates LRI, RLI, FSI, PDI (#18942)
Skips rendering LRI, RLI, FSI, and PDI "glyphs" in the terminal.

Does not implement BIDI/RTL; that is out of scope, see #538. This is
just a hotfix to stop spamming the console with undesired character
printouts. Once BIDI support is implemented, this change will (maybe?)
no longer be necessary.

Fixes #16574.

(cherry picked from commit 59590fc6657ece06ef7d2006f5fd5907b1ba1828)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgeAsaA
Service-Version: 1.23
2025-09-05 13:57:55 -05:00
abutcher-gh
8701c4ffa0 TerminalControl: Support MinGW path translation style (C:\ -> C:/) (#18759)
## Summary of the Pull Request

Support drag-n-drop path translation in the style used by MinGW
programs. In particular for usage with shells like `ash` from busybox
(https://frippery.org/busybox/).

## Detailed Description of the Pull Request / Additional comments

Provides a new option "mingw" for "pathTranslationStyle".
Shown as "MinGW" with translation documented as `(C:\ -> C:/)` in the
UI.
As per the other modes, this translates `\` to `/` but stops there.
There is no prefix/drive translation.

## Validation Steps Performed

Run using `busybox ash` shell. Dragged directories and files from both
local disks and network shares onto terminal. All were appropriately
single quoted and had their backslashes replaced with forward slashes.
They were directly usable by the `ash` shell.

Language files containing the other options have been updated to include
the new one.

## PR Checklist
- [ ] Closes #xxx
- [ ] Tests added/passed
- [x] Documentation updated
   - [Docs PR #849](https://github.com/MicrosoftDocs/terminal/pull/849)
- [ ] Schema updated (if necessary)

Co-authored-by: Adam Butcher <adam@jessamine.uk>
(cherry picked from commit 6682bed311a75be4d1d8e117bf2f514eb763a547)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgeAsM0
Service-Version: 1.23
2025-09-05 13:57:53 -05:00
Dustin L. Howett
29dc1fdd9c build: remove the forced vpack submission; let us do it on our own time (#19271)
(cherry picked from commit 4f391c5e42db09738cbefef9b17bb6274094dc91)
Service-Card-Id: PVTI_lADOAF3p4s4Axadtzgd_3-M
Service-Version: 1.23
v1.23.12371.0
2025-08-25 16:42:58 -05:00
Carlos Zamora
ca70e49cdf Add telemetry for settings UI traffic (#19156)
Adds a telemetry provider to the Terminal.Settings.Editor project as
well as new telemetry events to track traffic through the settings UI.
Specifically, the following events were added:
- `NavigatedToPage`: Event emitted when the user navigates to a page in
the settings UI
- Has a `PageId` parameter that includes the identifier of the page that
was navigated to
- (conditionally added when PageId = `page.editColorScheme`)
`SchemeName` parameter tracks the name of the color scheme that's being
edited
   - conditionally added when PageId = `page.extensions`:
- `ExtensionPackageCount`: The number of extension packages displayed
- `ProfilesModifiedCount`: The number of profiles modified by enabled
extensions
- `ProfilesAddedCount`: The number of profiles added by enabled
extensions
- `ColorSchemesAddedCount`: The number of color schemes added by enabled
extensions
   - conditionally added when PageId = `page.extensions.extensionView`:
- `FragmentSource`: The source of the fragment included in this
extension package
- `FragmentCount`: The number of fragments included in this extension
package
      - `Enabled`: The enabled status of the extension
- (conditionally added when PageID = `page.newTabMenu`) if the page is
representing a folder view
   - conditionally added when PageID = `page.profile.*`:
- `IsProfileDefaults`: if the modified profile is the profile.defaults
object
      - `ProfileGuid`: the guid of the profile that was navigated to
      - `ProfileSource`: the source of the profile that was navigated to
- conditionally added when PageID = `page.profile` (aka the base profile
page):
         - `Orphaned`: tracks if the profile was orphaned
         - `Hidden`: tracks if the profile is hidden
- (conditionally added when PageID = `page.profile.appearance`)
`HasBackgroundImage`: `if the profile has a background image defined`
- (conditionally added when PageID = `page.profile.appearance`)
`HasUnfocusedAppearance`: `if the profile has an unfocused appearance
defined`
- `AddNewProfile`: Event emitted when the user adds a new profile
`IsExtensionView` parameter tracks if the page is representing a view of
an extension
- Has a `Type` parameter that represents the type of the creation method
(i.e. empty profile, duplicate)
- `ResetApplicationState`: Event emitted when the user resets their
application state (via the UI)
- `ResetToDefaultSettings`: Event emitted when the user resets their
settings to their default value (via the UI)
- `OpenJson`: Event emitted when the user clicks the Open JSON button in
the settings UI
- Has a `SettingsTarget` parameter that represents the target settings
file (i.e. settings.json vs defaults.json)
- `CreateUnfocusedAppearance`: Event emitted when the user creates an
unfocused appearance for a profile
- `IsProfileDefaults`: if the modified profile is the profile.defaults
object
   - `ProfileGuid`: the guid of the profile that was navigated to
   - `ProfileSource`: the source of the profile that was navigated to
- `DeleteProfile`: Event emitted when the user deletes a profile
- also includes `ProfileGuid`, `ProfileSource`, `Orphaned` from the
`NavigatedToPage` section above

The page ids can be reused later as a serialized reference to the page.
We already use the one for the extensions page for the "new" badge.

(cherry picked from commit 7578209be5a0bb6aa567234e480de1a2312b2205)
Service-Card-Id: PVTI_lADOAF3p4s4Axadtzgc2p-8
Service-Version: 1.23
2025-08-25 11:23:24 -05:00
James Pack
ee9198c9a3 Ensure items is not null before checking its size so we dont crash (#19026)
Prevents a crash when no storage items are returned from a dropped path.

Terminal no longer crashes when a relative path is dragged and dropped
into the tool.

Closes #19015

(cherry picked from commit 7a9fb769558693d982660a88640bea7ba1bf7eb2)
Service-Card-Id: PVTI_lADOAF3p4s4Axadtzgd5l6I
Service-Version: 1.23
2025-08-21 17:45:35 -05:00
Leonard Hecker
eae5fbd83d Implement custom text context menus to fix crashes (#18854)
This works around a bug in WinUI where it creates a single context
menu/flyout for text elements per thread, not per `XamlRoot`, similar to
many other areas. Since the `XamlRoot` cannot change after creation,
this means that once you've opened the flyout, you're locked into that
window (= XAML root) forever. You can't open the flyout in another
window and once you've closed that window, you can't open it anywhere at
all.

Closes #18599

* Flies out right click in the
  * About dialog 
  * Search dialog 
  * Word delimiters setting 
  * Launch size setting 
* Across two windows 

(cherry picked from commit 076746a7a62197111981ca706eac9ff948286133)
Service-Card-Id: PVTI_lADOAF3p4s4Axadtzgd5l-U
Service-Version: 1.23
2025-08-21 17:45:34 -05:00
Carlos Zamora
59ff525128 Fix names and types of a few telemetry events (#19257)
Fixes a few issues with some telemetry events:
- The macro is organized as such: `TraceLoggingX(value, argName,
[argDescription])`. A few args had a description set on the spot where
the name should be. I added a name for a few of these.
- `TraceLoggingBool` --> `TraceLoggingInt32` for `themeChoice` (we
shouldn't be casting the evaluated int as a bool; it loses some of the
data we care about)
- improves the description for `themeChoice` to include information
about the legacy values

Checked through all our telemetry events and all of the args have a
proper name set. We tend to use `TraceLoggingValue` too which
automatically figures out the type that's being used, so that's also
handled.

(cherry picked from commit 7055b99acc4b6a54103ae4a14ad30b8c503d3708)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgdzQck
Service-Version: 1.23
2025-08-21 17:44:00 -05:00
Dustin L. Howett
ea8753f4ee Switch to the @Local view on TerminalDependencies (#19243)
Due to an unexpected decision on behalf of the Azure Artifacts folks,
the default view for a feed with upstream sources reports all packages,
even if they are not actually populated into the feed.

This results in (uncontrolled) 401 errors whenever a new package appears
upstream, because the feed tells our users and our build system that it
is available, but fails when the download actually begins because it is
not allowed to "write" the upstream version to the feed.

(cherry picked from commit abaa9488d926145fe9ca377ed5f4eb5d6396ecc7)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgdnCVw
Service-Version: 1.23
2025-08-21 17:43:59 -05:00
Leonard Hecker
829688d06a Fix a output marks performance regression (#19242)
An alternative approach for #18291. Improves perf by ~7%.

(cherry picked from commit 6b19d218457697794faaf4794451ba5f8ebff252)
Service-Card-Id: PVTI_lADOAF3p4s4Axadtzgdm49M
Service-Version: 1.23
2025-08-21 17:43:23 -05:00
Dustin L. Howett
a916704a6f Use a new API to propagate foreground state to child processes (#19192)
Windows 11 uses some additional signals to determine what the user cares
about and give it a bit of a QoS boost. One of those signals is whether
it is associated with a window that is in the foreground or which has
input focus.

Association today takes two forms:
- Process has a window which is in the foreground or which has input
  focus
- Process has a *parent* that meets the above criterion.

Console applications that are spawned "inside" terminal by handoff do
not fall into either bucket. They don't have a window. Their parent is
`dllhost` or `explorer`, who is definitely not in focus.

We are piloting a new API that allows us to associate those processes
with Terminal's window.

When Terminal is in focus, it will attach every process from the active
tab to its QoS group. This means that whatever is running in that tab
is put into the "foreground" bucket, and everything running in other
background tabs is not.

When Terminal is out of focus, it attaches every process to its QoS
group. This ensures that they all go into the "background" bucket
together, following the window.

(cherry picked from commit 0d23624fa9d620b13155f491c8b1c5d91dbf0ba4)
Service-Card-Id: PVTI_lADOAF3p4s4Axadtzgdh6-Q
Service-Version: 1.23
2025-08-21 17:43:21 -05:00
Dustin L. Howett
9449d0b29e Fix hot reload for icon, bell, close on exit; regressed in #16172 (#19217)
In #16172, we removed the propagation of the profile down into the
Terminal Pane Content.

It was holding on to the profile from the _old_ settings model (😱).

This also broke background image hot reload.

(cherry picked from commit 666a75bc7027e5dec4f33e395340741cfc30c4bb)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgdVVHA
Service-Version: 1.23
2025-08-06 13:40:12 -05:00
Leonard Hecker
34cd29a0ce Fix WSL PATH corruption & potential use-after-free (#19211)
Closes #19152

## Validation Steps Performed
* Set `PATH` on a linux profile
* `PATH` isn't messed up inside WSL 

(cherry picked from commit 0a6394270e2026bbd2bf5f937870eb9242f326ed)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgdR6bA
Service-Version: 1.23
2025-08-06 13:40:05 -05:00
MQY
4995af3dc1 Prevent cursor repositioning during mouse selection (#19182)
- Modify the cursor repositioning logic to check if a selection is in
progress
- Only reposition the cursor when the mouse is used for positioning, not
during selection operations

Closes #19181

(cherry picked from commit 88ab154f2227a3d8f213c1604ac19c8fb8dc5148)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgdSbu4
Service-Version: 1.23
2025-08-06 13:40:04 -05:00
Leonard Hecker
ed022e89db Fix another VT input double-encoding issue (#19083)
Closes #17264
Closes https://github.com/microsoft/edit/issues/182

Long shot, but probably also...
Closes #18579
Closes #19082

(cherry picked from commit 97f0a06fbe0d01521c14e7b1461faea2e5a83d5a)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgdOWF0
Service-Version: 1.23
2025-08-01 17:43:43 -05:00
Dustin L. Howett
df34f34691 Fix overeager pre-delayed-EOL wrapping in AdaptDispatch (#18899)
AdaptDispatch has a TODO item indicating that we should *not* consider a
row wrapped until we write into the cell beyond it. We actually do have
that logic (it even refers to it!), but we still set the wrap flag when
we fill the final column.

We never removed it because it broke the old VT rendering-based ConPTY
implementation.

Now that VtEngine is gone, so can be this code and this strange
workaround for a problem nobody was quite sure what was.

This will fix, hopefully, the last of our exact line length write wrap
issues. tmux users can finally rejoice.

Closes #8976
Closes #15602

(cherry picked from commit 14993db1cbd3f1bbe95f9a3fa0ab1dd1e565b2b7)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgaWx6A
Service-Version: 1.23
2025-08-01 17:43:42 -05:00
Leonard Hecker
9357281507 Fix use-after-free when disabling the ASB (#19186)
Closes #17515

## Validation Steps Performed
* Disable the ASB while there's a pending cooked read
* Type some text
* No crash 

(cherry picked from commit dfcc8f3c6218b8d747bdd4bed6f7b6d1996bb376)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgdFoBM
Service-Version: 1.23
v1.23.12102.0
2025-07-29 14:05:50 -05:00
Quaylyn Rimer
edcd042913 Fix scrollbar marks not appearing until scroll or resize (#19185)
This PR resolves an issue where scrollbar marks created by shell
integration sequences (OSC 133 FTCS, OSC 1337 iTerm2, and OSC 9;12
ConEmu sequences) were not visible on the scrollbar until the user
manually scrolled.

The problem was that while marks were being created in the buffer
correctly, the UI wasn't being notified to refresh the scrollbar
display. The fix adds a new NotifyShellIntegrationMark() method to the
ITerminalApi interface that calls _NotifyScrollEvent() to trigger
scrollbar refresh, and updates all shell integration sequence handlers
in AdaptDispatch to call this notification method after creating marks.
This ensures scrollbar marks appear immediately when shell integration
sequences are processed, bringing feature parity between auto-detected
and shell-integration-based marks.

Closes #19104

(cherry picked from commit e818dafa6db29cb67cc2418ba67e5e0846a6e9b4)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgdFukU
Service-Version: 1.23
2025-07-29 12:55:20 -05:00
Weichen Li
99c6de5bbe Fix WSLENV environment variable duplication in ConptyConnection (#19167)
This PR fixes issue #7130 where WT_SESSION and WT_PROFILE_ID environment
variables were being duplicated in the WSLENV environment variable when
multiple terminal sessions were created.

The previous implementation always appended WT_SESSION:WT_PROFILE_ID: to
WSLENV without checking if these variables already existed, causing
duplication.

Closes #7130

Co-authored-by: Leonard Hecker <lhecker@microsoft.com>
(cherry picked from commit 7d6e0c8b8e499b24eb59e197f06bc9b82c6b9427)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgdDF2w
Service-Version: 1.23
2025-07-29 12:55:18 -05:00
Carlos Zamora
7c593c5aac Add telemetry for new tab menu traffic (#19142)
## Summary of the Pull Request
Adds new telemetry events to track traffic through the new tab menu.
Specifically, the following events are added:
- `NewTabMenuDefaultButtonClicked`: Event emitted when the default
button from the new tab split button is invoked
- `NewTabMenuOpened`: Event emitted when the new tab menu is opened
- `NewTabMenuClosed`: Event emitted when the new tab menu is closed
- `NewTabMenuItemClicked`: Event emitted when an item from the new tab
menu is invoked
- Has an `ItemType` parameter that can be set to `Settings`,
`CommandPalette`, `About, `Profile`, `Action`
- Has a `TabCount` parameter that keeps tracked of the number of tabs in
the window before changing the state
- `NewTabMenuCreatedNewTerminalSession`: Event emitted when a new
terminal was created via the new tab menu
- Has a `SessionType` parameter that can be set to `ElevatedWindow`,
`Window`, `Pane`, `Tab`
- Instead of `TabCount`, has a `NewTabCount` that keeps track of the
_new_ number of tabs after the session has been created
- `NewTabMenuItemElevateSubmenuItemClicked`: Event emitted when the
elevate submenu item from the new tab menu is invoked

## Validation Steps Performed
Used TVPP to see events generated from interacting with the new tab
menu.

(cherry picked from commit 8c20d2052df20a6cb40b2f6d0e0b3d1dbbfb529b)
Service-Card-Id: PVTI_lADOAF3p4s4Axadtzgc0Dws
Service-Version: 1.23
2025-07-29 12:55:16 -05:00
Dustin L. Howett
8673cd2abb Re-enable web-source icons in Stable and Preview builds (#19137)
Disables a controversial part of #19044.

Refs #19075

(cherry picked from commit 7b841628dfd332dbd6e69a44dc1b85ec17ca5837)
Service-Card-Id: PVTI_lADOAF3p4s4Axadtzgcqq7A
Service-Version: 1.23
2025-07-29 12:55:14 -05:00
Leonard Hecker
72cad7f3e2 Improve TSF color filtering logic (re: QQPinyin) (#19117)
If an IME provider sets both `crText` and `crBk` we should respect this,
but the previous logic would incorrectly assert for `crLine !=
TF_CT_NONE`.

## Validation Steps Performed
 I'm not aware which TSF even sets these colors in a
way that's compatible with us in the first place...

(cherry picked from commit f2b30b4e1e6b6555bddb5d3c9ff8f400d5ebe4b2)
Service-Card-Id: PVTI_lADOAF3p4s4Axadtzgck4T0
Service-Version: 1.23
2025-07-29 12:55:12 -05:00
Dustin L. Howett
110e100384 version: fix the LCID in our VERSIONINFO, add descriptions to each file (#19114)
Closes #19106

(cherry picked from commit f14718f738bea5744ab6b61c3d63aaf998d97ad7)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgcbOIk
Service-Version: 1.23
2025-07-29 12:55:10 -05:00
Dustin L. Howett
b6c7410a33 During session save, use the profile's GUID rather than its Name (#19113)
This will prevent Terminal from erroneously selecting a hidden (deleted,
disabled or otherwise) profile of the same name during restoration and
subsequently using the wrong settings.

I am not certain why we used the name at all!

Closes #19105

(cherry picked from commit c4fbb58f69b0a5cc86c245505311d0a0b3cc1399)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgcbMe0
Service-Version: 1.23
2025-07-29 12:54:50 -05:00
Dustin L. Howett
7d751a54bd Include the hash of the SID in the Window Class and Mutant (#19109)
Right now, we do not use a sufficiently unique name to disambiguate
Terminal instances running on the same desktop.

Mutexes (mutants) are named objects that live in the user's session,
under `Sessions\1\BaseNamedObjects` (for the local desktop session).
When multiple users are logged into the same session--such as with "Run
as different user"--they share a local BaseNamedObjects namespace. Ugh.

We cannot use [`CreatePrivateNamespace`] as it requires a boundary
descriptor, and the only boundary descriptors supported by the current
API are based on package identity. I also fear that
`CreatePrivateNamespace` is subject to a race condition with
`OpenPrivateNamespace`; Create will not Open an existing one, so we
would need to back off and retry either opening or creating. Yuck.

After this commit, we will hash the user's SID into the name of both the
window class and the mutant, right after the path hash (if running
unpackaged).

Closes #18704

[`CreatePrivateNamespace`]:
https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createprivatenamespacea

(cherry picked from commit 02f173d504d82a05da048981c56b7402c11b6c0c)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgYvcQw
Service-Version: 1.23
2025-07-29 12:54:48 -05:00
Leonard Hecker
5aafc0172e Fix a crash during commandline handoff (#19096)
The crash occurs because WinRT `abort()`s when it encounters
a `std::wstring_view` without null-terminator.

Closes #19093

## Validation Steps Performed
* Set `wtd` as the default terminal
* Launch `cmd`
* Launch `wtd`
* 2 windows 

(cherry picked from commit ac07afebcb949687db8cadf60605f11ee804ec15)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgcO9T4
Service-Version: 1.23
2025-07-29 12:54:46 -05:00
Leonard Hecker
6157302fbd Move ConPTY handoff logic into WindowEmperor (#19088)
This changes the ConPTY handoff COM server from `REGCLS_SINGLEUSE`
to `REGCLS_MULTIPLEUSE`. The former causes a race condition, because
handoff runs concurrently with the creation of WinUI windows.
This can then result in the a window getting the wrong handoff.

It then moves the "root" of ConPTY handoff from `TerminalPage`
(WindowEmperor -> AppHost -> TerminalWindow -> TerminalPage)
into `WindowEmperor` (WindowEmperor).

Closes #19049

## Validation Steps Performed
* Launching cmd from the Start Menu shows a "Command Prompt" tab 
* Win+R -> `cmd` creates windows in the foreground 
* Win+R -> `cmd /c start /max cmd` creates a fullscreen tab 
  * This even works for multiple windows, unlike with Canary 
* Win+R -> `cmd /c start /min cmd` does not work 
  * It also doesn't work in Canary, so it's not a bug in this PR 

(cherry picked from commit a25d968fe0026ac5abea62a67d798c89e1280d32)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgbpecU
Service-Version: 1.23
2025-07-29 12:54:45 -05:00
Leonard Hecker
8fc82582bf Preserve the cursor row during Clear Buffer (#18976)
Introduces an ABI change to the ConptyClearPseudoConsole signal.
Otherwise, we have to make it so that the API call always retains
the row the cursor is on, but I feel like that makes it worse.

Closes #18732
Closes #18878

## Validation Steps Performed
* Launch `ConsoleMonitor.exe`
* Create some text above & below the cursor in PowerShell
* Clear Buffer
* Buffer is cleared except for the cursor row 
* ...same in ConPTY 

(cherry picked from commit fc0a06c3b6cae2ede1326eef202a800244365ebd)
Service-Card-Id: PVTI_lADOAF3p4s4Axadtzga5M7E
Service-Version: 1.23
2025-07-29 12:54:42 -05:00