4755 Commits

Author SHA1 Message Date
Leonard Hecker
81cdb07646
Separate pruning of elevated/unelevated session buffers (#19546)
Previously, launching an unelevated session after an elevated one would
delete the latter's persisted buffers, and vice versa of course. Also,
elevated buffers didn't have an ACL forbidding access to unelevated
users. That's also fixed now.

Closes #19526

## Validation Steps Performed
* Unelevated/elevated WT doesn't erase each other's buffers 
* Old buffers named `buffer_` are renamed to `elevated_` if needed 
2025-11-20 11:49:14 -08:00
Carlos Zamora
2537ea7df8
Replace BuiltInIcon ComboBox with AutoSuggestBox (#19569)
## Summary of the Pull Request
Replaces the `ComboBox` used for built-in profile icons with an
`AutoSuggestBox` to allow for searching.

## References and Relevant Issues
Practically plagiarizes #16821

## Validation Steps Performed
 It completes
 It filters

## PR Checklist
Closes #19457
2025-11-20 11:02:30 -08:00
Yash kumar kasaudhan
c28610d016
Fix #19390: Make snap-on-input conditional to prevent blocking programmatic scroll (#19414)
## Summary of the Pull Request
This PR fixes a bug where programmatic scrolling would get stuck. The
fix makes the "snap-on-input" feature conditional, activating it only
for modern applications that use Virtual Terminal (VT) processing. This
restores correct scrolling behavior for legacy applications without
removing the feature for new ones.

## References and Relevant Issues
Fixes #19390: OpenConsole: Cursor visibility prevents programmatic
scrolling

## Detailed Description of the Pull Request / Additional comments
The "snap-on-input" feature introduced in a previous PR caused an
unintended side effect for older console programs that use the
SetConsoleWindowInfo API to manage their own viewport. When such a
program tried to scroll using a key press, the snap feature would
immediately pull the view back to the cursor's position, causing the
screen to flicker and get stuck.

This fix makes the snap-on-input feature smarter by checking the
application's mode first.

## Validation Steps Performed

Compiled the minimal C++ reproduction case from issue #19390.

Ran the test executable inside the newly built OpenConsole.exe.

Confirmed that scrolling with the Up/Down arrow keys now works
correctly, even with a visible cursor. The view no longer flickers or
gets stuck when the cursor moves outside the viewport.

Closes #19390
2025-11-19 18:59:46 +00:00
Carlos Zamora
19a85010fe
mark mode: begin selection at focused search result (#19550)
## Summary of the Pull Request
Searching in terminal highlights all search results. However, those
results are considered separate from a selection. In the past, the
highlighted result would be selected, resulting in it being the initial
position for mark mode. Now that it's separate, mark mode doesn't start
there.

To fix this, there's 2 changes here:
1. When we exit the search, we now select the focused search result.
This becomes the initial position for mark mode.
2. When we're in the middle of a search and mark mode becomes enabled,
the focused search result becomes the initial position for mark mode.

With this change, mark mode's initial position is determined in this
order:
1. the position of an active selection
2. the position of the focused search result (if one is available)
3. the top-left position of the viewport (if there is a scrollback) (see
#19549)
4. the current cursor position

## Validation Steps Performed
Entering mark mode in scenario X results in a starting position of Y:
 selected text during a search --> selected text
- NOTE: this seems to only occur if you start a search, then manually
click on the terminal to bring focus there, but keep the search results
active

 performed a search and results are available -->focused search result
 performed a search and no results are available
   - scrolled up --> top-left of viewport
   - no scrollback --> cursor position

 performed a search, got results, then closed search --> focused search
result

Closes #19358
2025-11-18 11:43:42 -08:00
Leonard Hecker
898b9e3cab
Fetch the terminal cursor position after a resize (#19535)
Closes #18725

## Validation Steps Performed
Functionality was observed under a
debugger while using PowerShell 5.
2025-11-18 11:42:09 -08:00
Dustin L. Howett
fb668f3a4a
chore: Update to WIL 1.0.250325.1 (#19553)
It adds a C++/WinRT-compatible COM server class factory and
`ArgvToCommandlineW` (which is just plain fun.)

It also makes more things noexcept.
2025-11-13 12:23:59 -06:00
Carlos Zamora
d2f977aa3d
mark mode: begin selection at viewport when scrolled up (#19549)
## Summary of the Pull Request
Updates mark mode so that it starts at the viewport's origin (top-left)
if we're not scrolled to the bottom. This is based on the discussion in
#19488.

## Validation Steps Performed
 scrolled at bottom --> mark mode starts at cursor
 scrolled up --> mark mode starts at cursor

Closes #19488
2025-11-11 12:07:52 -08:00
Windows Console Service Bot
965a121a38
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>
2025-11-11 11:40:26 -06:00
Leonard Hecker
2e78665ee0
Move all blink handling into Renderer (#19330)
This PR moves the cursor blinker and VT blink rendition timer into
`Renderer`. To do so, this PR introduces a generic timer system with
which you can schedule arbitrary timer jobs. Thanks to this, this PR
removes a crapton of code, particularly throughout conhost.

## Validation Steps Performed
* Focus/unfocus starts/stops blinking 
* OS-wide blink settings apply on focus 
2025-11-11 15:29:48 +01:00
Dustin L. Howett
47018442cd
chore: Update to TAEF 10.100.251104001 (#19537) 2025-11-10 13:38:35 -06:00
Dustin L. Howett
4b946c0d5c
Remove TerminalAzBridge and use AzureConnection directly (#19528)
We used to run the cloud shell connector in an intermediate process
because our VT implementation lived mostly in conhost. James fixed that
up over the intervening years, and since #17510 landed Terminal is
exposed to 100% of application-originated VT. That means we no longer
need this workaround, its build steps, or anything else about it.

Closes #4661
2025-11-06 12:10:01 -08:00
Dustin L. Howett
63d7a19ce5
build: update all Azure DevOps pools to windows-latest (#19522)
I will follow this up by switching our default pool build image to
Windows Server 2022.
2025-11-04 23:57:15 +00:00
stynix
05baa41b56
doc: replace the broken link in the ColorTool notices file (#19523)
tango-project seems to have rotted. Replace it with a Web Archive link.
2025-11-04 20:22:32 +00:00
Windows Console Service Bot
a8beb4cdc4
Localization Updates - main - 10/28/2025 03:04:54 (#19510)
Co-authored-by: Console Service Bot <consvc@microsoft.com>
2025-10-31 15:34:51 -05:00
Dustin L. Howett
a9ea60799f
When translating clipboard to numpad events, use the *input* CP (#19511)
I looked as far back as I was able to find, and we've used the OutputCP
since at least Windows NT 3.51.

I think it has _never_ been correct.

At issue today is the GB18030-2022 test string, which contains the
following problematic characters:

* `ˊ` `U+02CA` Modifier Letter Acute Accent
* `ˋ` `U+02CB` Modifier Letter Grave Accent
* `˙` `U+02D9` Dot Above
* `–` `U+2013` En Dash

They cannot be pasted into PowerShell 5.1 (PSReadline).

It turns out that when we try to synthesize an input event (Alt down,
numpad press, Alt up **with wchar**) we are using their output codepage
65001. These characters, of course, do not have a single byte encoding
in that codepage... and so we do not generate the numpad portion of the
synthesized event, only the alt down and up parts!

This is totally fine. **However**, there is also a .NET Framework bug
(which was only fixed after they released .NET Core, and rebranded, and
the community stepped in, ...) finally fixed in .NET 9 which used to
result in some Alt KeyUp events being dropped from the queue entirely.

https://github.com/dotnet/runtime/issues/102425

Using the input codepage ensures the right events get synthesized. It
works around the .NET bug.

Technically, padding in those numpad input events is _also more
correct_.

It also scares me, because it has been this way since NT 3.51 or
earlier.
2025-10-30 17:07:02 -05:00
Carlos Zamora
b56f61eca1
Update firstWindowPreference localizations for SUI (#19508) 2025-10-28 01:13:59 +00:00
Carlos Zamora
16f7ab4185
Add firstWindowPreference value for layout only (#19341)
## Summary of the Pull Request
Updates the "firstWindowPreference" global setting to take 3 values:
"defaultProfile", "persistedLayout", and "persistedLayoutAndContent".

The legacy "persistedWindowLayout" is being interpreted as
"persistedLayoutAndContent".

The tricky part here is that we need to maintain support for the legacy
value as persisting the layout and content, even though the value's name
suggests that it should just support the layout and no content. To get
around this, I added "persistedLayout" and "persistedLayoutAndContent".

The enum map is manually constructed for `FirstWindowPreference` to
exclude the deprecated value. This prevents the legacy value from
leaking into the settings UI.

Functionally, the change to serialize the contents is simple.
`WindowEmperor::_persistState()`'s second parameter is used to serialize
the buffer. Rather than having it set to `true`, we set it to
`GlobalSettings().FirstWindowPreference() ==
FirstWindowPreference::PersistedLayoutAndContent`.

## Validation Steps Performed
 "persistedWindowLayout" is changed to "persistedLayoutAndContent"

 Closes #18757
2025-10-27 20:55:54 +00:00
Leonard Hecker
5ae95d7df0
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.
2025-10-21 14:08:57 -05:00
Anastasia Smigaliova
b357de9897
Fix cursor being hidden when pressing modifier keys (#19473)
Closes #19445
2025-10-21 15:03:59 +02:00
Ivan Pešić
b8f35a31c2
Update of the sr-Cyrl-RS translation (#19472) 2025-10-18 10:43:22 -05:00
Ivan Pešić
b7bd4f7dcf
Community Localization to Serbian (sr-Cyrl-RS) (#17995) 2025-10-16 01:27:53 +00:00
Piotr Szlazak
f5ddecd1d4
Fix the casing on an image URL in the FTCS marks spec (#19440) 2025-10-15 19:45:08 -05:00
Musaddiq Ahmed Khan
fcf32351ff
README: Capitalize 'Download' links in distribution table (#19437)
It's more consistent.
2025-10-15 19:44:37 -05:00
Dustin L. Howett
0e3d136dad
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
2025-10-15 19:23:22 -05:00
Windows Console Service Bot
7f6ab5520e
Localization Updates - main - 10/15/2025 02:48:19 (#19451)
Closes #18849
Closes #19412

Co-authored-by: Console Service Bot <consvc@microsoft.com>
2025-10-15 03:44:46 +00:00
Alex Alabuzhev
84cc3e3e52
Add initial bold font support to the GDI renderer (#19441)
Render SGR1 as bold in 256 and true colors, where "bold is intense" is
not applicable.
Implemented by creating 2 extra fonts: bold for 1 and bold italic for 1
+ 3.

No non-trivial changes, just extensions.
LOGFONT also supports Underline and StrikeOut, but they seem to be
already covered by other means, so no combinatorial explosion of fonts
expected.

Refs #18919

Co-authored-by: Leonard Hecker <lhecker@microsoft.com>
2025-10-14 17:00:13 -05:00
Carlos Zamora
819987c90e
Update WinGet CNF for exact command matching (#19432)
## Summary of the Pull Request
Update the WinGet CNF package search to match that of the updated
PowerShell WinGet CNF module. Now, we'll only search for matching
commands instead of by name and moniker.

## References and Relevant Issues
https://github.com/microsoft/winget-command-not-found/pull/29

## Validation Steps Performed
 In CMD, type "vim" and vim packages are suggested
2025-10-09 16:27:41 -05:00
Carlos Zamora
b62cad640b
Fix unfocusedBackground being used as active tab color (#19424)
## Summary of the Pull Request
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)

## Validation Steps Performed
 High contrast mode looks right
 "Snazzy" theme from bug report looks right

## PR Checklist
 Closes #19343
2025-10-09 17:29:09 +00:00
Dustin L. Howett
9d7ea77cc8
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
2025-10-07 17:13:36 -05:00
Faisal Ahmad
6a8b2d10f0
chore: remove extra semicolons from ActionArgs (#19411)
Removes unnecessary extra semicolons at the end of `Equals` method
implementations in various ActionArgs classes.

Closes #19404
2025-10-07 17:35:38 +00:00
PankajBhojwani
04676bd31a
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
2025-10-06 11:31:15 -07:00
Samuel D. Leslie
fc2d107897
Minor fixes to the settings schema (#19387)
## Summary of the Pull Request
Fixes a couple of minor issues in the settings schema which can result
in erroneous settings validation failures.

## References and Relevant Issues
None

## Detailed Description of the Pull Request / Additional comments
- `answerbackMessage`  
  Permit `null` type (corresponds to the default value).
- `compatibility.input.forceVT`  
  Add missing setting (previously was `experimental.input.forceVT`).
- `rendering.graphicsAPI`  
  Add missing `automatic` enumeration value.
- Mark several settings as deprecated using the same format and direct
the user to the updated settings to use.

## Validation Steps Performed
Tested updated schema against configuration with above settings present.

## PR Checklist
- [X] Schema updated (if necessary)

---------

Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com>
2025-10-02 23:13:36 -05:00
Dustin L. Howett
998ab586e1
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
2025-10-02 11:24:31 -05:00
Windows Console Service Bot
10ef1284d4
Localization Updates - main - 09/30/2025 21:11:05 (#19400) 2025-09-30 21:50:33 +00:00
Dustin L. Howett
5976de1600
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
2025-09-30 16:05:58 -05:00
Dustin L. Howett
52f9bd6d2c
build: switch Touchdown to Federated Identity (#19399)
This is required as part of offboarding our non-user service account.
2025-09-30 15:57:45 -05:00
Avishek Das
05a4afcf35
Fix broken MSDN link in gdi/state.cpp (#19375)
Closes #16439

Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com>
2025-09-25 19:17:08 +00:00
Carlos Zamora
ad6473d6ae
Add tab color setting to settings UI (#19351)
## Summary of the Pull Request
Adds the tab color profile setting to the settings UI. It's positioned
next to the tab title at the root of the profile page.

The new component uses a nullable color picker control to allow the user
to pick a color. The null color is represented as "Use theme color".

The tricky part is evaluating the `ThemeColor` for `null` (aka "use
theme color"). Since the value is dependent on the active theme, it can
be any of the following values:
- theme.tab.background...
   - explicit color
   - accent color
   - terminal background color
- (if no theme.tab.background is defined) theme.window.applicationTheme
   - light --> #F9F9F9
   - dark --> #282828
- default --> one of the above two values depending on the application
theme

The above light/dark values were acquired by using the color picker on
the tab when in light/dark theme.

## Validation Steps Performed
 accessible value is read out
 explicit tab color set
- tab color is null, so we fall back to...
-  theme.tab.background: explicit color, accent color, terminal
background color
-  theme.window.applicationTheme (and no theme.tab.background defined):
light, dark, default (aka not defined)
      -  updates when theme is changed locally and via JSON

## PR Checklist
Closes part of #18318
2025-09-25 11:37:43 -07:00
Dustin L. Howett
6b428577b9
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.
2025-09-25 13:36:31 -05:00
Leonard Hecker
4600c4791b
Rewrite the MSAA/UIA integration into conhost (#19344)
Goal: Remove `CursorBlinker`.
Problem: Spooky action at a distance via `Cursor::HasMoved`.
Solution: Moved all the a11y event raising into `_stream.cpp` and pray
for the best.

Goal: Prevent node.js from tanking conhost performance via MSAA (WHY).
Problem: `ServiceLocator`.
Solution: Unserviced the locator. Debounced event raising. Performance
increased by >10x.
Problem 2: Lots of files changed.

This PR is a prerequisite for #19330

## Validation Steps Performed
Ran NVDA with and without UIA enabled and with different delays. 
2025-09-22 22:53:52 +00:00
Dustin L. Howett
e80aadd98b
Move newTabMenu creation to Settings fixups (#19353)
Some of the other settings fixups require there to be a valid
NewTabMenu, rather than just a temporary object. Since the resolving all
the menu entries after loading already forces the user to have a
`newTabMenu`, let's just codify it as a real fixup.

I've moved the SSH folder fixup after the settings fixup because it
relies on there being a NTM.

I decided not to make this fixup write back to the user's settings.
There are a couple reasons for this, all of which are flimsy.

- There are a number of tests that test fixup behavior, especially those
around actions, which would need to be updated for this new mandatory
key. I did not think it proper to add `newTabMenu` to ten unrelated
tests that only contain actions (for example.)
- We actually don't currently have mandatory keys. But this one was
always being added anyway, in a later phase...
- It's consistent with the existing behavior.

Closes #19356
2025-09-16 21:08:45 +00:00
Dustin L. Howett
1926c4601c
VsDev: reject VS instances which do not actually contain devshell/devcmd (#19352)
Closes #19169
2025-09-16 15:24:10 -05:00
Dustin L. Howett
46b9572e60
Avoid generating SSH profiles using stale memory (#19354)
You can't return a `string_view` to a temporary. It's a miracle this
ever worked.

Broken since inception in a5f9c85c39

Closes #19355
2025-09-16 15:23:58 -05:00
Leonard Hecker
0aee174e68
Fix behavior of split-pane for existing windows (#19347)
Closes #18815

## Validation Steps Performed
* `wt -w 0 sp` splits the current tab 
2025-09-16 13:09:56 -05:00
Ayman Bagabas
814f78ed2c
Add support for VT horizontal mouse wheel events (#19248)
This adds support for horizontal mouse wheel events (`WM_MOUSEHWHEEL`).
With this change, applications running in the terminal can now receive
and respond to horizontal scroll inputs from the mouse/trackpad.

Closes #19245
Closes #10329
2025-09-11 18:48:49 -05:00
John Cavanaugh
eb16eb26ab
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.
2025-09-11 13:06:33 -05:00
Leonard Hecker
384932183f
Fix a crash in _makeCursorVisible (#19329)
Fixes the crash and also makes `SnapOnOutput` a bit nicer.

Closes #19325

## Validation Steps Performed
* Launch vim in WSL
* Exit
* No crash 
2025-09-10 21:21:46 +02:00
Dustin L. Howett
5a05f82f7c
Apparently finish the SLNX migration (#19335) 2025-09-09 20:39:39 -05:00
Dustin L. Howett
d6714f3ca9
Convert the solution file to the new SLNX format (#19328) 2025-09-09 15:01:03 -05:00
Leonard Hecker
4a34a76504
Fix right click on tabs closing them (#19273)
I do not like this.

## Validation Steps Performed
* Enable close buttons on tabs
* Open a tab
* Close the tab with middle click
* Open a tab
* Right click the tab
* Tab doesn't close, Menu opens 
2025-09-08 23:16:20 +00:00