Commit Graph

3520 Commits

Author SHA1 Message Date
Dustin L. Howett 11cf895e17 build: pass branding into the nuget variable template (#16122)
This fixes a cosmetic issue with the version number in the unpackaged
builds and NuGet packages.

They were showing up as `-preview`, even when they were stable, because
the variable template didn't know about the branding.

(cherry picked from commit 544cdd78af)
Service-Card-Id: 91211923
Service-Version: 1.17
2023-11-28 13:11:35 -06:00
Dustin L. Howett 086c388147 build: add a OneBranch Official release pipeline (#16081)
This pipeline does everything the existing release pipeline does, except
it does it using the OneBranch official templates.

Most of our existing build infrastructure has been reused, with the
following changes:

- We are no longer using `job-submit-windows-vpack`, as OneBranch does
this for us.
- `job-merge-msix-into-bundle` now supports afterBuildSteps, which we
use to stage the msixbundle into the right place for the vpack
- `job-build-project` supports deleting all non-signed files (which the
OneBranch post-build validation requires)
- `job-build-project` now deletes `console.dll`, which is unused in any
of our builds, because XFGCheck blows up on it for some reason on x86
- `job-publish-symbols` now supports two different types of PAT
ingestion
- I have pulled out the NuGet filename variables into a shared variables
template

I have also introduced a TSA config (which files bugs on us for binary
analysis failures as well as using the word 'sucks' and stuff.)

I have also baselined a number of control flow guard/binary analysis
failures.

(cherry picked from commit 6489f6b39d)
Service-Card-Id: 91211920
Service-Version: 1.17
2023-11-28 13:11:34 -06:00
Dustin L. Howett 1cd877932b Allow skipping artifact publication in all release build jobs (#15846)
The OneBranch build system relies on the *build container host* being
able to publish all artifacts all at once. Therefore, our build steps
must not publish any artifacts.

I made it configurable so that the impact on existing pipelines was
minimal.

For every job that produces artifacts and is part of the release
pipeline, I am now exposing two variables that we can pass to OneBranch
so that it can locate and name artifacts:
- `JobOutputDirectory`, the output folder for the entire job
- `JobOutputArtifactName`, the name of the artifact produced by the job

I have also added a `variables` parameter to every job, so consuming
pipelines can override or insert their own variables.

(cherry picked from commit 6cb14d226d)
Service-Card-Id: 91211957
Service-Version: 1.17
2023-11-28 13:11:33 -06:00
Dustin L. Howett 48db06ea81 build: switch the EsrpCodeSigning task to version 3 (#16057)
The version we were using requires .NET 2.1 (wow) which is way out of
support.

Task version 3 supports much newer versions.

(cherry picked from commit ac2b0e744c)
Service-Card-Id: 91211918
Service-Version: 1.17
2023-11-28 13:09:30 -06:00
inisarg ec0b257c1e Allows negative values in launch parameters (#15941)
Added a style that allows negative values in the launch position
parameters.

## PR Checklist
- [x] Closes #15832

(cherry picked from commit 5d300b20ed)
Service-Card-Id: 90451444
Service-Version: 1.17
2023-11-28 13:09:29 -06:00
Mike Griese ce2a9aca38 Don't explode if HKCU\Console is write-protected (#15916)
I manually changed the permissions on `HKCU\Console` to deny "Create
subkey" to myself. Then confirmed that it explodes before this change,
and not after this change.

Closes #15458

(cherry picked from commit 6cff135f37)
Service-Card-Id: 90380919
Service-Version: 1.17
2023-11-28 13:09:28 -06:00
Mike Griese 63addccfb0 Make conhost act in VtIo mode earlier in startup (#15298)
We need to act like a ConPTY just a little earlier in startup. My relevant notes start here: https://github.com/microsoft/terminal/issues/15245#issuecomment-1536150388.

Basically, we'd create the first screen buffer with 9001 rows, because it would be created _before_ VtIo would be in a state to say "yes, we're a conpty". Then, if a CLI app emits an entire screenful of text _before_ the terminal has a chance to resize the conpty, then the conpty will explode during `_DoLineFeed`. That method is absolutely not expecting the buffer to get resized (and the old text buffer deallocated).

Instead, this will treat the console as in ConPty mode as soon as `VtIo::Initialize` is called (this is during `ConsoleCreateIoThread`, which is right at the end of `ConsoleEstablishHandoff`, which is before the API server starts to process the client connect message).  THEORETICALLY, `VtIo` could `Initialize` then fail to create objects in `CreateIoHandlers` (which is what we used to treat as the moment that we were in conpty mode). However, if we do fail out of `CreateIoHandlers`, then the console itself will fail to start up, and just die. So I don't think that's needed.

This fixes #15245. I think this is PROBABLY also the solution to #14512, but I'm not gonna explicitly mark closed. We'll loop back on it.

(cherry picked from commit 6ad8cd0a63)
Service-Card-Id: 89112504
Service-Version: 1.17
2023-11-28 13:09:26 -06:00
Dustin L. Howett a6ce08a4cf Add a Nightly build pipeline for the Canary branding (#15869)
To make this happen, I moved most of `release.yml` into a shared
_pipeline_ template (which is larger than a steps or jobs template).
Most of the diffs are due to that move.

If you compare main:build/pipelines/release.yml against
dev/duhowett/nightly-build:build/pipelines/templates-v2/pipeline-full-release-build.yml,
you will see that the changes are much more minimal than they look.

I also added a parameter to configure how long symbols will be kept. It
defaults to 36530 days (which is the default for the PublishSymbols
task! Yes, 100 years!) but nightly builds will get 15 days.

(cherry picked from commit 5651f08770)
Service-Card-Id: 90368683
Service-Version: 1.17
2023-08-30 11:43:27 -05:00
Dustin L. Howett aced0fdabe Disambiguate the test job artifact based on attempt number (#15877)
Closes #15876

(cherry picked from commit b024efb3b7)
Service-Card-Id: 90368681
Service-Version: 1.17
2023-08-30 11:43:26 -05:00
Dustin L. Howett ffaff175b4 Include our Azure client ID in AzureConnection (#15866)
Some folks over in MSAL land told us that client IDs don't need to be
kept secret.

This reduces the delta between "public" terminal and "release build"
terminal by one more file, leaving only the telemetry header left (which
won't be going public for obvious reasons).

This will also make it easier for contributors to test out Azure Cloud
Shell changes... and testing out VT without ConPTY interfering[^1].

[^1]: When Dev branding is selected, Azure Cloud Shell has the added
perk of being wired directly to TerminalCore rather than going through
ConPTY.

(cherry picked from commit 8f20ea6b2d)
Service-Card-Id: 90293631
Service-Version: 1.17
2023-08-30 11:42:52 -05:00
Dustin L. Howett 50adbcab54 Move the Azure Cloud Shell icons from terminal-internals (#15841)
I put them in that package like 40 years ago to get them into the build
system faster. They actually belong here.

I made them based on SVGs the Azure Cloud Shell team shared with us.

(cherry picked from commit d28b6bf1f2)
Service-Card-Id: 90245816
Service-Version: 1.17
2023-08-30 11:42:50 -05:00
Dustin L. Howett bf72b707bc Rewrite the entire Azure DevOps build system (#15808)
This pull request rewrites the entire Azure DevOps build system.

The guiding principles behind this rewrite are:

- No pipeline definitions should contain steps (or tasks) directly.
- All jobs should be in template files.
- Any set of steps that is reused across multiple jobs must be in
  template files.
- All artifact names can be customized (via a property called
  `artifactStem` on all templates that produce or consume artifacts).
- No compilation happens outside of the "Build" phase, to consolidate
  the production and indexing of PDBs.
- **Building the project produces a `bin` directory.** That `bin`
  directory is therefore the primary currency of the build. Jobs will
  either produce or consume `bin` if they want to do anything with the
  build outputs.
- All step and job templates are named with `step` or `job` _first_,
  which disambiguates them in the templates directory.
- Most jobs can be run on different `pool`s, so that we can put
  expensive jobs on expensive build agents and cheap jobs on cheap
  build agents. Some jobs handle pool selection on their own, however.

Our original build pipelines used the `VSBuild` task _all over the
place._ This resulted in Terminal being built in myriad ways, different
for every pipeline. There was an attempt at standardization early on,
where `ci.yml` consumed jobs and steps templates... but when
`release.yml` was added, all of that went out the window.

The new pipelines are consistent and focus on a small, well-defined set
of jobs:

- `job-build-project`
    - This is the big one!
    - Takes a list of build configurations and platforms.
    - Produces an artifact named `build-PLATFORM-CONFIG` for the entire
      matrix of possibilities.
    - Optionally signs the output and produces a bill of materials.
    - Admittedly has a lot going on.
- `job-build-package-wpf`
    - Takes a list of build configurations and platforms.
    - Consumes the `build-` artifact for every config/platform
      possibility, plus one for "Any CPU" (hardcoded; this is where the
      .NET code builds)
    - Produces one `wpf-nupkg-CONFIG` for each configuration, merging
      all platforms.
    - Optionally signs the output and produces a bill of materials.
- `job-merge-msix-into-bundle`
    - Takes a list of build configurations and platforms.
    - Consumes the `build-` artifact for every config/platform
    - Produces one `appxbundle-CONFIG` for each configuration, merging
      all platforms for that config into one `msixbundle`.
    - Optionally signs the output and produces a bill of materials.
- `job-package-conpty`
    - Takes a list of build configurations and platforms.
    - Consumes the `build-` artifact for every config/platform
    - Produces one `conpty-nupkg-CONFIG` for each configuration, merging
      all platforms.
    - Optionally signs the output and produces a bill of materials.
- `job-test-project`
    - Takes **one** build config and **one** platform.
    - Consumes `build-PLATFORM-CONFIG`
    - Selects its own pools (hardcoded) because it knows about
      architectures and must choose the right agent arch.
    - Runs tests (directly on the build agent).
- `job-run-pgo-tests`
    - Just like the above, but runs tests where `IsPgo` is `true`
    - Collects all of the PGO counts and publishes a `pgc-intermediates`
      artifact for that platform and configuration.
- `job-pgo-merge-pgd`
    - Takes **one** build config and multiple platforms.
    - Consumes `build-$platform-CONFIG` for each platform.
    - Consumes `pgc-intermediates-$platform-CONFIG` for each platform.
    - Merges the `pgc` files into `pgd` files
    - Produces a new `pgd-` artifact.
- `job-pgo-build-nuget-and-publish`
    - Consumes the `pgd-` artifact from above.
    - Packs it into a `nupkg` and publishes it.
- `job-submit-windows-vpack`
    - Only expected to run against `Release`.
    - Consumes the `appxbundle-CONFIG` artifact.
    - Publishes it to a vpack for Windows to consume.
- `job-check-code-format`
    - Does not use artifacts. Runs `clang-format`.
- `job-index-github-codenav`
    - Does not use artifacts.

Fuzz submission is broken due to changes in the `onefuzz` client.

I have removed the compliance and security build because it is no longer
supported.

Finally, this pull request has some additional benefits:

- I've expanded the PGO build phase to cover ARM64!
- We can remove everything Helix-related except the WTT parser
    - We no longer depend on Helix submission or Helix pools
- The WPF control's inner DLLs are now codesigned (#15404)
- Symbols for the WPF control, both .NET and C++, are published
  alongside all other symbols.
- The files we submit to ESRP for signing are batched up into a single
  step[^1]

Closes #11874
Closes #11974
Closes #15404

[^1]: This will have to change if we want to sign the individual
per-architecture `.appx` files before bundling so that they can be
directly installed.

(cherry picked from commit 69eff7e9fd)
Service-Card-Id: 90183387
Service-Version: 1.17
2023-08-11 14:19:11 -05:00
Dustin Howett afd3d9802e **BODGY** Migrate resw files from main
This works around an issue we encountered in Touchdown where we added
keys in main *and* changed keys in main and release-1.17. Because the
file hashes don't match, this file is not considered a localization
target. I think it is because we changed keys on both branches, but
there was no intermediate time point where the entire file was
consistent on both branches. Therefore, the files got localized on main
and the translations logged against the specific resw version that
existed on main. They were never logged against this weird backported
verison.
2023-08-03 19:08:27 -05:00
Dustin Howett 5a1b737efe Build fix for 005af4705 2023-08-02 15:08:59 -05:00
Leonard Hecker 005af47054 Fix a crash when duplicating tabs with elevate:true (#15548)
When `elevate` is set to `true`, `_maybeElevate` would try to
modify `newTerminalArgs` and crash, because during tab duplication
there aren't any `newTerminalArgs`. This issue may happen for instance
when receiving hand-off from a non-elevated client and then trying
to duplicate that tab.

Closes #15534

* Launch with `"elevate": false`
* Set `"elevate": true`
* Duplicate a tab
* Doesn't crash 

(cherry picked from commit 427b37c07d)
Service-Card-Id: 89534064
Service-Version: 1.17
2023-08-02 12:59:13 -05:00
Mike Griese c3bdf74538 Don't dismiss the command palette when the new tab menu closes (#15340)
Transient UIs are hard.

Regressed in #15077.

Closes #15305

(cherry picked from commit 1bf2fcb6e0)
Service-Card-Id: 89899296
Service-Version: 1.17
2023-08-02 12:51:43 -05:00
nxya 293105d885 Added background to CommandKeyChord (#15677)
## Summary of the Pull Request

Adds a background to key chord border in the CommandPalette Screen. This
prevents certain accent colors from rendering the KeyChords unreadable.

Before (where the text is unreadble);

![image](https://github.com/microsoft/terminal/assets/33658638/370fa7c7-f42e-48b3-af54-6fe7d5f89c73)

After (from this PR):

![image](https://github.com/microsoft/terminal/assets/33658638/5ce8601a-80f2-4efe-9270-9dd7209cdfff)

See #15228 for more details

(cherry picked from commit 91012a4e3f)
Service-Card-Id: 90068187
Service-Version: 1.17
2023-08-02 12:47:57 -05:00
Dustin L. Howett a2a86239ed Remove TerminalTrySetDarkTheme, use the DWMWA directly (#15667)
The DWMWA for this has been documented for quite a while now!

I've also updated to a version of TerminalThemeHelpers that removes all the Dark Theme exports.

(cherry picked from commit 2f0d3dc17a)
Service-Card-Id: 90068185
Service-Version: 1.17
2023-08-02 12:47:56 -05:00
Dustin L. Howett a0619c4e49 Consolidate and clean up all API logging (#15737)
`s_TraceApi` was a magic function in Tracing that logged a different
event based on what type it was called with. It was bad for two reasons:

1. I wanted to add a field to each trace indicating the originating
process and thread. This would have required adding a `CONSOLE_API_MSG`
parameter to _every instance_ of `s_TraceApi`, and even then it would
have not been particularly consistent.
2. The design of Tracing, where the TraceLogging macros are hidden
inside opaque functions, subverts the lightweight trace probe detection
present in `TraceLoggingWrite`. Every tracing probe turned into a call
to a cold function which, in 99% of cases, returned immediately.

To that end, I've introduced a new macro _only_ to ApiDispatchers that
emits a named probe with a set of preloaded information. It is a macro
to avoid any unnecessary branching or the emission of any explicit
tracing functions into the final binary.

I have also removed the generic handler for timing any/all API calls, as
we never used them and they were largely redundant with the information
we were capturing from API-specific reports.

I've also removed tracing from all APIs that do not mutate console
state. With the notable exception of ReadConsoleInput, we will see logs
only for things that change mutable console state.

All these things together allows us to construct a process+API-focused
timeline of console events, ala:

```
cmd.exe (20304)   CookedRead          pwsh                4                07/13/2023 22:02:53.751
cmd.exe (20304)   API_GetConsoleMode  True
cmd.exe (20304)   API_SetConsoleMode  False               0x00000003
cmd.exe (20304)   API_SetConsoleMode  True                0x000001F7
pwsh.exe (4032)   ConsoleAttachDetach 07/13/2023 22:03:17.393              True                True
pwsh.exe (4032)   API_GetConsoleMode  False
pwsh.exe (4032)   API_GetConsoleMode  False
pwsh.exe (4032)   API_SetConsoleMode  False               0x00000007
```

This pull request also switches the ConsoleAttachDetach and CookedRead
reports to use the PID and FILETIME markings for their pids and
filetimes. This is compatible with the uint32 and uint64 fields that
used to use those names, so anybody who was depending on them will
experience no change in functionality.

I also switched up their order to make them more ergonomic in WPA when
combined with the other API_ tracing (as viewed above.)

(cherry picked from commit 5daf4983d2)
Service-Card-Id: 90012630
Service-Version: 1.17
2023-07-27 12:45:04 -05:00
Dustin L. Howett 4997c518af Lazily load the settings UI DLL (#15628)
Due to an implementation detail in the Xaml compiler--which wants to
ensure that all metadata providers on an App are available
immediately--we were eagerly loading the settings UI DLL and all of its
dependencies, even in sessions where the user was not going to open
Settings.

By turning off eager provider generation and handling it ourselves, we
get to control exactly when the settings UI is loaded.

This required some gentle poking-through of the barrier between App and
Page, but it is almost certainly worth it.

Turning on the Xaml code generation flag to not generate providers
automatically adds an `AddProvider` member to the internal interface for
the autogenerated XamlMetadataProvider. We needed to switch to using the
internal interface rather than the projected type in our custom App base
class to get at it.

Providers that App/Page use must be initialized by the time we start the
WindowsXamlManager, so we load Control and Controls (ha) eagerly and
early.

It looks like it may save 400ms of CPU time (?) on startup.

(cherry picked from commit 0f41851e67)
Service-Card-Id: 90012538
Service-Version: 1.17
2023-07-27 12:45:03 -05:00
Leonard Hecker 54950185f2 Display Unicode URIs side-by-side with their Punycode encoding (#15488)
06174a9 didn't properly fix the issue of us showing homoglyphs in our
URI tooltip. This commit introduces a different approach where we
display both, the Punycode and Unicode encoding, whenever we encounter
an IDN. This isn't perfect but simple to implement.

Closes #15432

## Validation Steps Performed
* `https://www.xn--fcbook-3nf5b.com/` (which contains confusing glyphs)
  is shown both in its Punycode and Unicode form simultaneously. 

---------

Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com>
(cherry picked from commit f1aa6993f1)
Service-Card-Id: 90012448
Service-Version: 1.17
2023-07-27 12:44:59 -05:00
Carlos Zamora 4247381bd2 Expose 'Default' tag to Screen Readers in Color Schemes page (#15486)
## Summary of the Pull Request
This removes the "default" text box from the UI Automation tree, thus
preventing screen readers from navigating to it. This was a confusing
scenario for users because the "default" tag was unclear if it was a
part of the previous or next color scheme (i.e. consider hearing
"Campbell, default, Campbell PowerShell"; it's unclear which one is
default).

This also appends the "default" string to the `ToString` function of the
color scheme view model. This makes it so that the combo box and list
view visually appear the same, but can be quick searched or read out by
the screen reader with the 'default' tag.

## Validation Steps Performed
- [x] Verified this works on Windows 11
- [x] Verified this works on Windows 10
- Scenarios tested:
   - [x] saving settings after changing the default scheme
   - [x] saving settings.json to force a refresh in SUI

Closes #14401

(cherry picked from commit 0425ab0c1d)
Service-Card-Id: 90012453
Service-Version: 1.17
2023-07-27 12:44:58 -05:00
Brandon Dong 78294b30d6 Fix matches of multiple schemas on "colorScheme" (#15748)
Adds proper `type` for `SchemePair` definition to avoid warnings about matches of multiple schemas.

Same fix as https://github.com/microsoft/terminal/pull/4045

## Validation Steps Performed
- Pointed $schema to local file instead of https://aka.ms/terminal-profiles-schema
- Confirmed warning goes away when using a string
- Confirmed using the light/dark object format still passes validation
- Confirmed values like `"colorScheme": 3` no longer incorrectly pass validation whereas they would before

(cherry picked from commit 57b9549ff8)
Service-Card-Id: 90012052
Service-Version: 1.17
2023-07-27 12:37:02 -05:00
Carlos Zamora 18c6d2722a Fix Default Terminal and Color Scheme ComboBoxes cropping at 200% Text Size (#15762)
When the OS' "text size" setting gets set to 200% and the display
resolution is reduced quite a bit, we get some cropped text in the SUI's
Default Terminal ComboBox. Turns out, we have a height set on the items.
I went ahead and removed that so we don't crop the text. Everything
looks good still!

A similar issue occurs in the Profile > Appearance > Color Scheme
ComboBox. I went ahead and fixed that too by removing the height
restriction.

Other minor changes:
- fixed the comments
- changed "author and version" row to "auto" instead of "*" (star sizing
is great for proportional sizing, so we're not really taking advantage
of it)

Closes #15149

(cherry picked from commit 1f9426b051)
Service-Card-Id: 89991190
Service-Version: 1.17
2023-07-27 12:37:01 -05:00
Carlos Zamora 3edbcf9331 Add UIA element grouping to SettingsContainer (#15756)
Adds an `AutomationProperty.Name` to the main grid in the `SettingContainer`. Doing so makes it so that the group of elements is considered a "group \<header\>".

Now, when navigating with a screen reader, when you enter the group of elements, the "group \<header\>" will be presented. Thus, if the user navigates to the "reset" button, it'll be prefaced with a "group \<header\>" announcement first. If the user navigates to it from the other direction (the setting control), this announcement isn't made, but the user already has an understanding of what group of settings they're in, which is standard practice.

Closes #15158

(cherry picked from commit d70794a246)
Service-Card-Id: 89990838
Service-Version: 1.17
2023-07-27 12:37:00 -05:00
Dustin L. Howett ef81022c17 Switch away from the WinDev agent pools (#15755)
Using our own pools like this gives us a lot of freedom in the tooling
that's installed, the OS versions it targets, and when we take on Visual
Studio updates.

As part of this effort, I've also stood up a "small" agent pool. At the
time of this PR, that pool is using D2ads-v5 SKU VMs (2 vcore 8 GiB)
versus the "large" agent pool's D8as-v5 (8 vcore 32 GiB). Smaller build
tasks have been moved over to the small pool. Compilation's the hard
part, so it gets to stay on the large pool.

(cherry picked from commit 1a40ff3746)
Service-Card-Id: 89988509
Service-Version: 1.17
2023-07-27 12:36:59 -05:00
Leonard Hecker 2778cdd1e9 Fix VtEngine hang when resizing while scrolling (#15618)
This fixes a bug reported internally that occurs when resizing the
terminal while also scolling the contents. The easiest way to reproduce
it is to resize the terminal to 0 rows, but it's much more prominent
in a debug build where everything goes out of sync almost immediately.

The underlying issue is that `VtEngine::_wrappedRow` may contain an
offset that is outside of the viewport bounds, because reflowing and
scrolling aren't properly synchronized. The previous `bitmap` code
would then throw an exception for such invalid coordinates and cause
the internal `VtEngine` state to be broken. Once `_wrappedRow` got
to a negative value at least once, it would stay that way unless you're
scrolling up. If the contents are actively scrolling it would quickly
reach a negative value from which it can never recover. At that point
OpenConsole would enter a tight exception-throw-catch-retry loop
and Windows Terminal seemingly cease to show any content.

## Validation Steps Performed
* Resize WT to the minimal window size repeatedly
* Doesn't hang 

(cherry picked from commit 358e10b17f)
Service-Card-Id: 89739741
Service-Version: 1.17
2023-07-17 14:52:50 -05:00
Dustin L. Howett 369b7fa36b wpf: delay-load UIAutomationCore because it's incomplete in RS1 (#15614)
UiaRaiseNotificationEvent is not present on Windows Server 2016, even
though it is documented as being present.
This also removes the cost of loading up UIAutomationCore from the
critical path.

(cherry picked from commit 99c18ce57e)
Service-Card-Id: 89704753
Service-Version: 1.17
2023-07-17 14:52:48 -05:00
Dustin L. Howett 6ea4ce6b07 Add the drop validator task, rework some build artifacts (#15568)
I originally intended to add the Drop Validator (which is a compliance
requirement) task to the build, but I quickly realized that we weren't
generating a complete SBOM manifest covering every artifact that we
produced.

We were generating the SBOM manifest, and then re-packing the Terminal
app which very likely invalidated all of the hashes and signatures in
the SBOM manifest!

We were also missing the unpackaged build.

I've removed the `appx-PLATFORM-CONFIG` and `unpackaged-PLAT-CONF`
artifacts and combined them into a single one, `terminal-PLAT-CONF`.

(cherry picked from commit 191eb00f43)
Service-Card-Id: 89624682
Service-Version: 1.17
2023-07-17 14:52:47 -05:00
James Holderness bb06648d32 Make sure RIS re-enables win32 input and focus events (#15476)
When an `RIS` (hard reset) sequence is executed, ConHost will pass that
through to the connected conpty terminal, which results in all modes
being reset to their initial state. To work best, though, conpty needs
to have the win32 input mode enabled, as well as the focus event mode.
This PR addresses that by explicitly requesting the required modes after
an `RIS` is passed through.

Originally these modes were only set if the `--win32input` option was
given, but there is really no need for that, since terminals that don't
support them should simply ignore the request. To avoid that additional
complication, I've now removed the option (i.e. ConHost will now always
attempt to set the modes it needs).

I've manually confirmed that keypresses are still passed through with
win32 input sequences after a hard reset, and that focus events are
still being generated. I've also updated the existing conpty round-trip
test for `RIS` to confirm that it's now also passing through the mode
requests that it needs.

Closes #15461

(cherry picked from commit 8aefc7a697)
Service-Card-Id: 89409030
Service-Version: 1.17
2023-07-17 14:52:43 -05:00
sitiom 280be8286e Add a manual winget release workflow (#14965)
[The winget-releaser action] automatically generates manifests for the
[Winget Community Repository] and submits them.

I suggest adding Dependabot to keep the action up to date. There were
many cases where the action was failing due to an outdated version.

Closes #14795

[The winget-releaser action]:
https://github.com/vedantmgoyal2009/winget-releaser
[Winget Community Repository]: https://github.com/microsoft/winget-pkgs

(cherry picked from commit bee22f3ec8)

winget: use the correct fork-user

(cherry picked from commit e1079d8f55)

winget.yml: switch to manually using wingetcreate (#15023)

It was brought to my attention that we should be more restrictive in
which tasks we ovver a GitHub token to. Sorry!

With thanks to sitiom for the version parsing and the magic GitHub
action syntax incantation for determining what is a prerelease.

(cherry picked from commit 5a34d92cb5)
2023-05-29 10:41:29 -05:00
Mike Griese 20c1d563fc Fix `focusFollowMouse` (#15420)
Because this looks like it's entirely broken in `main`, and possibly in
1.17(?)

We didn't take a strong ref to the coroutine parameter. As to be
expected, that explodes.

Closes #15412

(cherry picked from commit 6775300f42)
Service-Card-Id: 89311372
Service-Version: 1.17
2023-05-26 10:56:54 -07:00
Leonard Hecker 770af0ae1b Fix VS profile command generation (#15439)
This regressed in f06cd17. It seems like the change went untested,
because it appends an extra " after -startdir=none.
This changeset also avoids calling `append()` twice.

Closes #15436

## Validation Steps Performed
* VS Developer Command Prompt works 

(cherry picked from commit 0073e36d81)
Service-Card-Id: 89324784
Service-Version: 1.17
2023-05-25 12:49:47 -07:00
Dustin L. Howett 5ce63b923b Switch the Preview text emoji to one that exists on Win10 (#15381)
(cherry picked from commit 0ee2c74cd4)
Service-Card-Id: 89252871
Service-Version: 1.17
2023-05-18 16:37:17 -05:00
Dustin L. Howett 4b71d7b470 Build fixes on top of d056f2221 (no til::property) 2023-05-16 18:30:06 -05:00
Dustin L. Howett 73244461cc Make the preview text 100% more accurate (#15366)
(cherry picked from commit ce60bf290a)
Service-Card-Id: 89232220
Service-Version: 1.17
2023-05-16 18:04:53 -05:00
Dustin L. Howett d056f22219 Add a fun new preview text in the SUI, enable the cursor (#15363)
Our existing preview text was not very helpful in learning how different
settings impacted the display of text in Terminal.

This new preview text contains:
* Bold text, which is controlled by intenseTextStyle
* Colors
* Emoji
* A cursor, which overlaps a single character to show inversion behavior

(cherry picked from commit fbe45fafb5)
Service-Card-Id: 89230301
Service-Version: 1.17
2023-05-16 15:05:20 -05:00
Leonard Hecker e9074fe138 Fix AtlasEngine not being used in the appearance settings (#15355)
`TermControl` cannot change the text rendering engine after its
construction. Fix the issue by deferring the construction until
after we got the initial profile settings.

## Validation Steps Performed
* A line height of 0.5 shows up with overlapping rows 

(cherry picked from commit f6e9f91504)
Service-Card-Id: 89230342
Service-Version: 1.17
2023-05-16 15:05:18 -05:00
Dustin L. Howett 8b9f807391 Reword the AdjustIndistinguishableColors subhead and perf. note (#15361)
I've changed the wording so that it flows better.

(cherry picked from commit e269945a74)
Service-Card-Id: 89230298
Service-Version: 1.17
2023-05-16 15:04:03 -05:00
Dustin L. Howett e967ad772d Reword or remove a bunch of subheadings in the SUI (#15362)
Some of these were reundant, and some didn't feel right when I read
them.

Oh, and I got rid of all of these particularly unhelpful or non-additive
resources:

```
Color Scheme        [                     v ]
Is a color scheme
```

(cherry picked from commit 62766db94d)
Service-Card-Id: 89230303
Service-Version: 1.17
2023-05-16 15:03:47 -05:00
Leonard Hecker 4977fc9883 Use Oklab for text and cursor contrast adjustments (#15283)
Oklab by Björn Ottosson is a color space that has less irregularities
than the CIELAB color space used for ΔE2000. The distance metric for
Oklab (ΔEOK) is defined by CSS4 as the simple euclidian distance.
This allows us to drastically simplify the code needed to determine
a color that has enough contrast. The new implementation still lacks
proper gamut mapping, but that's another and less important issue.
I also made it so that text with the dim attribute gets adjusted just
like regular text, since this is an accessibility feature after all.

The new code is so much faster than the old code (12-125x) that I
dropped any caching code we had. While this increases the CPU overhead
when printing lots of indexed colors, the code is way less complex now.
"Increases" in this case however means something in the order of 15-60ns
per color change (as measured on my CPU). It's possible to further
improve the performance using explicit SIMD instructions, but I've
left that as a future improvement, since that will make the code quite
a bit more verbose and I didn't want to hinder the initial review.

Finally, these new routines are also used for ensuring that the
AtlasEngine cursors remains visible at all times.

Closes #9610

* When `adjustIndistinguishableColors` is enabled
  colors are distinguishable 
* An inverted cursor on top of a `#7f7f7f` foreground & background
  is still visible 
* A colored cursor on top of a background with identical color
  is still visible 
* Cursors on a transparent background are visible 

(cherry picked from commit 4dd9493135)
Service-Card-Id: 89215984
Service-Version: 1.17
2023-05-16 15:03:23 -05:00
Dustin Howett 3ec5fe4eee Fix a build break from 752df35cf 2023-05-15 18:05:45 -05:00
Dustin L. Howett 752df35cf5 Remove IsUwp, RunAsUwp, defaults-universal and all fallout (#15222)
The ability to build and run Terminal as a UWP application was removed
in #12119. We left some of its vestiges around, but now there is no need
for them.

(cherry picked from commit 5ed3c76dcb)
Service-Card-Id: 89001993
Service-Version: 1.17
2023-05-15 17:01:56 -05:00
Mike Griese 526704b725 Clearly differentiate running elevated vs. drag/drop breaking (#14946)
Credit where credit is due - @jboelter did literally all the hard work.

I just separated this out to two elements:
* Are we running elevated?
* Can we drag drop?

As we learned in #7754, the builtin administrator _can_ drag drop. But
critically, they are also running as admin! The way we had this logic
before, we're treat them as unelevated, because we had been overloading
the meaning here.

This splits these into two separate functions. Comes with the added
benefit of re-adding the elevation shield to the Terminal window for
users with UAC disabled (which was missing before) (and can _still_ be
disabled).

Closes #13928

Tested on a Win10 VM with `EnableLua=0`

(cherry picked from commit c5c15e86f3)
Service-Card-Id: 88484047
Service-Version: 1.17
2023-05-15 16:56:28 -05:00
Mike Griese 8108f22262 Fix an infinite loop when pressing `alt` (#15253)
As discussed in
https://github.com/microsoft/terminal/issues/14051#issuecomment-1517973776

regressed in #15189

(cherry picked from commit 0553f3ebf1)
Service-Card-Id: 89031966
Service-Version: 1.17
2023-05-15 16:49:07 -05:00
Ben Constable 9e3cc9d379 Make reset button accessible (#15257)
Make the reset button accessible by adding description in reset.

Closes #12044

---------

Co-authored-by: Dustin L. Howett <dustin@howett.net>
(cherry picked from commit 6abd72177b)
Service-Card-Id: 89047231
Service-Version: 1.17
2023-05-15 16:45:47 -05:00
Dustin L. Howett 0db21e8904 Fix compilation errors from backports 2023-05-12 17:12:47 -05:00
Dustin L. Howett b4fcf28b92 1.17: build PGO using Release branding 2023-05-12 15:00:05 -05:00
Dustin L. Howett 8a4def793f PGO train 1.17 separately 2023-05-12 14:27:47 -05:00
James Holderness 95636b976d Prevent crash when VTParameters::subspan is out of range (#15235)
## Summary of the Pull Request

There are certain escape sequences that use the `VTParameters::subspan`
method to access a subsection of the provided parameter list. When the
parameter list is empty, that `subspan` call can end up using an offset
that is out of range, which causes the terminal to crash. This PR stops
that from happening by clamping the offset so it's in range.

## References and Relevant Issues

This bug effected the `DECCARA` and `DECRARA` operations introduced in
PR #14285, and the `DECPS` operation introduced in PR #13208.

## Validation Steps Performed

I've manually confirmed that the sequences mentioned above are no longer
crashing when executed with an empty parameter list, and I've added a
little unit test that checks `VTParameters::subspan` method is returning
the expected results when passed an offset that is out of range.

## PR Checklist
- [x] Closes #15234
- [x] Tests added/passed
- [ ] Documentation updated
- [ ] Schema updated (if necessary)

(cherry picked from commit e413a4148e)
Service-Card-Id: 89001985
Service-Version: 1.17
2023-04-25 17:31:30 -05:00