4769 Commits

Author SHA1 Message Date
Leonard Hecker
224ac9de47
Stop leaking CPR sequences (#19620)
Due to the `IsVtInputEnabled` early return, we'd skip
the `_captureNextCursorPositionReport` by accident.

Closes #19575
Closes #19609
2025-12-05 21:24:06 +00:00
Dustin L. Howett
7a7cdec91f
Disallow fragments from containing UNC media paths (#19615)
Fragments are not allowed to declare web-source icons; this is equally
true for UNC paths in the local network (or WebDAV paths!)
2025-12-05 12:41:03 -08:00
Dustin L. Howett
c7c742c326
Typo fix: StarTimer->StartTimer (though it was funny) (#19617) 2025-12-04 15:28:17 -08:00
Windows Console Service Bot
c4668d99b7
Localization Updates - fix ja-jp and fr-fr loc bugs - 12/04/2025 00:46:52 (#19616)
Closes #17191
Closes #18795
Closes #17827
2025-12-04 01:18:59 +00:00
Dustin L. Howett
a719970913
Run the LocalTests in CI (#15770)
It was very bad. We had to disable 14 failing tests.
2025-12-03 16:22:50 -06:00
Dustin L. Howett
20998f7628
Move LibraryResourceLoader to PCH (#19184)
It is foundational enough that everyone should have access by now.
2025-12-02 12:33:02 -08:00
Dustin L. Howett
3e29d2a316
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.
2025-12-02 12:25:07 -08:00
Dustin L. Howett
afb4752102
Tidy up some of our Velocity features (#19605)
A few features were marked "always disabled" and then enabled in dev,
canary and preview. I simplified those to "always enabled" and disabled
in release instead. This required changes to Generate-FeatureStaging to
make it consider `WindowsInbox` a Release branding (which, honestly, it
always should have been.)

- Feature_DynamicSSHProfiles
- Feature_ShellCompletions
- Feature_SaveSnippet
- Feature_QuickFix

Feature_DisableWebSourceIcons was deprecated in #19143, but the XML file
never got the memo.
2025-12-02 12:22:51 -08:00
Carlos Zamora
7f37fdd369
Fix dangling search selection using viewport pos (#19603)
## Summary of the Pull Request
Fixes a bug where the dangling selection from a search would be applied
to the wrong position. Specifically, the issue is that
`SetSelectionAnchor()` and `SetSelectionEnd()` expect viewport positions
whereas the searcher outputs buffer positions.

This PR simply applies the scroll offset to the search result before
calling the functions.

In a separate iteration, I changed the functions to allow for
viewport-relative vs buffer-relative positions. However, that ended up
feeling a bit odd because this is the only scenario where the functions
were receiving buffer-relative positions. I chose this approach instead
because it's smaller/cleaner, even though we convert to
viewport-relative before the call just to change it to buffer-relative
in the function.

Bug introduced in #19550

## Validation Steps Performed
The correct region is selected in the following scenarios:
 no scrollback
 with scrollback, at bottom
 with scrollback, not at bottom (selection isn't scrolled to, but I
think that's ok. Can be fixed easily if requested)
 alt buffer
2025-12-02 11:34:43 -06:00
Dustin L. Howett
f8506f4779
Fix the Windows/razzle build after #19344 (#19590) 2025-11-25 22:36:38 +00:00
penguin-sophist
fb75fb56c0
Fix negative delta scroll (#19573)
This fixes the sign extension from 16 to 32 bit by casting
from the unsigned to the signed type first.

Closes #19391
Closes #19484
2025-11-25 15:46:14 +00:00
Carlos Zamora
38d2fdad5f
Replace NullableColorPicker ContentDialog with Flyout (#19572)
## Summary of the Pull Request
Updates the NullableColorPicker to use a flyout instead of a content
dialog. Frankly, it should've been this way from the start.

#19561 is an issue regarding the rectangle on the right side of the
picker. The complaint being that it should be something more useful than
a preview, an idea being that it could be a lightness gradient.
Unfortunately, the WinUI color picker doesn't let you do that. It's just
a plain preview.

That said, there's a lot of customizations that can be added still to
increase value here. To name a few:
- IsColorSliderVisible --> a color slider to adjust the lightness of the
color (as desired in #19561)
- IsHexInputVisible --> an input field to see and adjust the hex value
directly
- IsColorChannelTextInputVisible --> several input fields to adjust
individual RGB channels or switch over to HSV

However, the content dialog doesn't allow for text input due to a WinUI
bug and it's too small to display all of those controls.

Instead, I just discarded the content dialog altogether and opted into a
flyout. This makes it a more consistent experience with the other color
pickers (i.e. tab color, edit color scheme page). This also adds space
for all of the functionality mentioned above (those properties are
enabled by default).

## Validation Steps Performed
 selecting a color still works

Closes #19561
2025-11-24 16:21:49 -08:00
Leonard Hecker
1ca0c76bc7
Fix a WPF<>TSF crash by avoiding TF_TMAE_CONSOLE (#19584)
As explained in detail in the diff.

Closes #19562
2025-11-24 12:01:21 -06:00
Carlos Zamora
ee6060b3a4
Fix search not scrolling to result past view (#19571)
## Summary of the Pull Request
Fixes a bug where search would not scroll to results just below the
viewport.

This was caused by code intended to scroll the search result in such a
way that it isn't covered by the search box. The scroll offset is
calculated in `TermControl::_calculateSearchScrollOffset()` then handed
down in the `SearchRequest` when conducting a search. This would get to
`Terminal::ScrollToSearchHighlight()` where the offset is applied to the
search result's position so that we would scroll to the adjusted
position.

The adjustment was overly aggressive in that it would apply it to both
"start" and "end". In reality, we don't need to apply it to "end"
because it wouldn't be covered by the search box (we only scroll to end
if it's past the end of the current view anyways).

The fix applies the adjustment only to "start" and only does so if it's
actually in the first few rows that would be covered by the search box.

That unveiled another bug where `Terminal::_ScrollToPoints()` would also
be too aggressive about scrolling the "end" into view. In some testing,
it would generally end up scrolling to the end of the buffer. To fix
this cascading bug, I just had `_ScrollToPoints()` just call
`Terminal::_ScrollToPoint()` (singular, not plural) which is
consistently used throughout the Terminal code for selection (so it's
battle tested).

`_ScrollToPoints()` was kept since it's still used for accessibility
when selecting a new region to keep the new selection in view. It's also
just a nice wrapper that ensures a range is visible (or at least as much
as it could be).

## References and Relevant Issues
Scroll offset was added in #17516

## Validation Steps Performed
 search results that would be covered by the search box are still
adjusted
 search results that are past the end of the view become visible
 UIA still selects properly and brings the selection into view

## PR Checklist
Duncan reported this bug internally, but there doesn't seem to be one on
the repo.
2025-11-24 09:35:52 -08:00
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