Compare commits

...

93 Commits

Author SHA1 Message Date
Dustin L. Howett
6ffde34897 ServicingPipeline: make a bunch of quality of life improvements (#18830)
We used to cherry-pick every commit that had even one card in "To Cherry
Pick", even if it was also referenced by a card in "Rejected" or even
"To Consider".

Now we will warn and skip those commits.

I took this opportunity to add a bit of an object model for servicing
cards as well as prettify the output.

That allowed us to add a list of cards that were ignored due to having
no commits, and display little icons for each type of card.

(cherry picked from commit 8e94983170)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgZtprA
Service-Version: 1.22
2025-04-24 13:26:12 -05:00
Leonard Hecker
d43bc22997 Fix til string to integer routines (#18276)
(cherry picked from commit 89bc36c021)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgZtkWk
Service-Version: 1.22
2025-04-24 12:39:06 -05:00
Leonard Hecker
fa65a29bcc New tokenization & integer parsing helpers (#17962)
Reading through our existing patterns for integer parsing, I noticed
that we'd be better off returning them as optionals.
This also allowed me to improve the implementation to support integers
all the way up to their absolute maximum/minimum.

Furthermore, I noticed that `prefix_split` was unsound:
If the last needle character was the last character in the remaining
text, the remaining text would be updated to an empty string view.
The caller would then have no idea if there's 1 more token left
or if the string is truly empty.
To solve this, this PR introduces an iterator class. This will allow
it to be used in our VT parser code.

(cherry picked from commit fa8273065f)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgZtkTk
Service-Version: 1.22
2025-04-24 12:39:04 -05:00
Carlos Zamora
0892689fbb [SUI] Improve accessibility to open json (#18828)
The "open JSON" button in the settings UI wasn't working when invoked
via accessibility tools (specifically Narrator in scan mode and Voice
Access). For some reason, in those scenarios, neither the `Tapped` or
`KeyDown` event were hit!

This PR adds the logic to open the json file via the `ItemInvoked` event
instead. The `Tapped` and `KeyDown` handlers were removed to prevent a
redundant `OpenJson` event being raised.

Additionally, `SelectsOnInvoked` was set to `False` on the "open JSON"
nav item. This prevents the selection pill from moving to the nav item,
which feels more correct.

The following scenarios are confirmed to open the JSON
 Mouse click
 Keyboard (Spacebar and Enter)
 Voice Access
 Narrator in scan mode

For all of these (except Voice Access), I've confirmed that holding the
Alt button while invoking the JSON button opens defaults.json.

Closes #18770
Closes #12003

(cherry picked from commit a8a47b9367)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgZrDt4
Service-Version: 1.22
2025-04-23 15:51:27 -05:00
Dustin L. Howett
246e1d5770 Add support for OSC 104, 110, 111, 112 and 117 (resets) (#18767)
This pull request adds support for resetting the various color table
entries and xterm resource values back to their defaults.

Building on the default color table James introduced in #17879, it was
relatively straightforward to add support for resetting specific
entries.

This implementation cleaves tightly to observed behavior in xterm(379)
rather than observed behavior in libvte(0.70.6). They differ in the
following ways:

- xterm rejects any OSC [110..119] with any number of parameters; libvte
accepts it but only resets the first color.
- When passed a list of color indices to reset in 104, xterm resets any
colors up until the first one which fails to parse as an integer and
does _not_ reset the rest; libvte resets all parseable color indices.

I was unable to verify how these reset commands interact with colors set
via `DECAC Assign Color` so I went with the implementation that made the
most sense:

- Resetting the background color with `110` also restores the background
color alias entry to its pre-`DECAC` value; this results in the
perceived background color returning to e.g. index 0 in conhost and the
`background` color in Terminal.
- _ibid._ for the foreground color

Refs #18695
Refs #17879
Closes #3719

(cherry picked from commit 5f311506dc)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgZOWsU
Service-Version: 1.22
2025-04-21 17:40:21 -05:00
Heiko
180a52e925 [Enterprise, GPO] Add "Default Terminal app" policy to definition template (#18363)
This PR adds a new policy definition to the ADMX templates for settings
the default Terminal application in Windows.

> [!Note]
> This PR does not change any code of Windows, Console Host or Windows
Terminal. It only adds the definition for a new policy to the templates.

I got the registry values form the documentation and by testing the
values.

The policy is only available as user policy because the registry values
have to be in HKCU.

The Policy is implemented as preference (not inside the Policy key) and
therefore keeps it's value on removing (not configured) it. You can see
this in `gpedit.msc` on the policy symbol and the hint in the
description.

Closes #18302
Refs #18303

(cherry picked from commit 68d9e0d038)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgZlw44
Service-Version: 1.22
2025-04-21 17:37:15 -05:00
Windows Console Service Bot
2b6f437671 Localization Updates - main - 04/16/2025 21:02:38 (#18807)
(cherry picked from commit 712ce5fa2f)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgZlxKI
Service-Version: 1.22
2025-04-21 17:37:13 -05:00
Leonard Hecker
7d15e2d600 Backup and restore attributes during cooked reads (#18797)
Use DECSC/DECRC and XTPUSHSGR/XTPOPSGR while redrawing
popups, since they're drawn using the current popup colors.

I wish we could just use the reverse video rendition...

Closes #18742

## Validation Steps Performed
* Run `color 3f` and then press F7
* Works fine in conhost (VtPipeTerm) 
* Works as expected (black background) in VS Code 

(cherry picked from commit 8b01f546cb)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgZd3bw
Service-Version: 1.22
2025-04-21 17:36:20 -05:00
Dustin Hall
2977892e98 Add 2 additional error messages (#18462)
Add additional information to 2 error scenarios when launching a
different profile in the `ConptyConnection.cpp` file.
  - Requires Elevation
  - File Not Found

Created a profile that required elevation and verified the error
message. Created profile that passed a made up command and verified the
error message.

Closes #7186

(cherry picked from commit f7e853cd9f)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgZlxJc
Service-Version: 1.22
2025-04-21 17:36:19 -05:00
Leonard Hecker
2375c1b005 Fix CRLF translation when DISABLE_NEWLINE_AUTO_RETURN is reset (#18781)
We can't do the `pos.x != 0` check. Instead, I replaced it with
a CR check to avoid redundant CRs during CRLF translation.

Closes #18735

## Validation Steps Performed
* Run the repro in the linked issue

(cherry picked from commit 354e05d713)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgZRM3c
Service-Version: 1.22
2025-04-16 15:53:33 -05:00
Leonard Hecker
ed1ddd2aeb Fix wide char support for WriteConsoleOutputAttribute (#18796)
When we overwrite the attributes during the fill,
we must retain the lead/trail byte attributes.

Closes #18746

## Validation Steps Performed
* Added a unit test 

(cherry picked from commit 90c312f7da)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgZX2Dk
Service-Version: 1.22
2025-04-16 15:53:31 -05:00
Vamsi Krishna Kanjeevaram
747b3a4ffc Add a right margin to the suggestion description textblock (#18780)
This ensures that the vertical scrollbar will not cover the description text.
Closes #18545

(cherry picked from commit f83b98e100)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgZX-v8
Service-Version: 1.22
2025-04-16 15:53:30 -05:00
Vamsi Krishna Kanjeevaram
7b79b73ea4 Display local time instead of UTC while restoring previous session (#18775)
Closes #18727

(cherry picked from commit ad19d2c967)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgYvbLY
Service-Version: 1.22
2025-04-16 15:53:28 -05:00
Dustin L. Howett
26eb5f84de vcpkg: add an overlay port for fmt 11.1.4; enable /W3 (#18729)
This pull request brings us up to fmt 11.1.4 and enables `FMT_PEDANTIC`.

`FMT_PEDANTIC` turns on `/W3`, which is required by our local feudal
lords who will automatically file bugs on us if we don't build with
enough warnings enabled.

(cherry picked from commit f34dbbf3ac)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgYvOpA
Service-Version: 1.22
2025-03-26 17:37:53 -05:00
Windows Console Service Bot
39ffa65d7f Localization Updates - main - startOnUserLogin (#18609)
(cherry picked from commit 4bcdd7a844)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgYvO2I
Service-Version: 1.22
2025-03-26 15:18:55 -05:00
Dustin L. Howett
572f804007 Remove startOnUserLogin from the settings; use OS APIs only (#18530)
Before we had a Settings UI, we added support for a setting called
`startOnUserLogin`. It was a boolean, and on startup we would try to
yeet the value of that setting into the Windows API responsible for
registering us as a startup task.

Unfortunately, we failed to take into account a few things.

- Startup tasks can be independently controlled by the user in Windows
Settings or by an enterprise using enterprise policy
- This control is not limited to *disabling* the task; it also supports
enabling it!

Users could enable our startup task outside the settings file and we
would never know it. We would load up, see that `startOnUserLogin` was
`false`, and go disable the task again. 🤦

Conversely, if the user disables our task outside the app _we can never
enable it from inside the app._ If an enterprise has configured it
either direction, we can't change it either.

The best way forward is to remove it from our settings model and only
ever interact with the Windows API.

This pull request replaces `startOnUserLogin` with a rich settings
experience that will reflect the current and final state of the task as
configured through Windows. Terminal will enable it if it can and
display a message if it can't.

My first attempt at this PR (which you can read in the commit history)
made us try harder to sync the state between the settings model and the
OS; we would propagate the disabled state back to the user setting when
the task was disabled in the OS or if we failed to enable it when the
user asked for it. That was fragile and didn't support reporting the
state in the settings UI, and it seems like it would be confusing for a
setting to silently turn itself back off anyway...

Closes #12564

(cherry picked from commit a46fac25d3)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgYvOug
Service-Version: 1.22
2025-03-26 15:17:07 -05:00
Dustin L. Howett
72849610ad Add support for language override to unpackaged/portable builds (#18684)
It turns out that we *can* support language overrides--fairly easily, in
fact!--by simply changing the default Language qualifier.

I elected not to change how packaged language override works until we
are certain this works properly everywhere. Consider it a healthy
distrust of the Windows App Platform.

Closes #18419
Closes #18336
Closes #17619

(cherry picked from commit 7d8f7eb429)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgYVTtg
Service-Version: 1.22
2025-03-25 13:13:59 -05:00
Dustin L. Howett
cb3fb42a63 Delay-load icu so that we don't fail to start up on Windows <1903 (#18707)
(cherry picked from commit 75d8fc29f5)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgYi9uU
Service-Version: 1.22
2025-03-25 13:12:53 -05:00
aphistra
bd49b19c1a Remove unused MUXCustomBuildTasks package (#18683)
It has a Component Governance alert (and no license), plus we aren't using it.

(cherry picked from commit f023b3bfd2)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgYf3c0
Service-Version: 1.22
2025-03-19 12:48:36 -05:00
Javier
dec00afc3b Multiple fixes to address DD CodeQL requirements (#18451)
After taking in 1.22, our CodeQL process caught a few locations where we
weren't following the right guidance:
- Performing integer comparisons of different sizes which could lead to
an infinite loop if the larger integer goes out of range of the smaller
integer
- Not checking HResult of a called method

Co-authored-by: aphistra <102989060+aphistra@users.noreply.github.com>
(cherry picked from commit 6e89242373)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgWmd4s
Service-Version: 1.22
2025-03-18 13:27:13 -05:00
Leonard Hecker
f465275bc5 Fix a shutdown race condition in ControlCore (#18632)
I found multiple issues while investigating this:
* Render thread shutdown is racy, because it doesn't actually stop the
render thread.
* Lifetime management in `ControlCore` failed to account for the
circular dependency of render thread --> renderer --> render data -->
terminal --> renderer --> render thread. Fixed by reordering the
`ControlCore` members to ensure their correct destruction.
* Ensured that the connection setter calls close on the previous
connection.

(Hopefully) Closes #18598

## Validation Steps Performed
* Can't repro the original failure 
* Opening and closing tabs as fast as possible doesn't crash anymore 
* Detaching and reattaching a tab producing continuous output 

(cherry picked from commit 70f85a4a35)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgXhFbo
Service-Version: 1.22
2025-03-18 13:27:10 -05:00
Leonard Hecker
ccdfd4d0e5 Fix a ConPTY startup hang with 0-param DA1 responses (#18681)
Since `WaitForDA1` would wait until `_deviceAttributes` is non-zero,
we must ensure it's actually non-zero at the end of this handler,
even if there are no parameters.

## Validation Steps Performed
* Mod the Terminal DA1 to be `\x1b[?6c`. No hang 
* Mod the Terminal DA1 to be `\x1b[?61c`. No hang 

(cherry picked from commit 32ae00f71a)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgYO0bA
Service-Version: 1.22
2025-03-12 18:29:58 -05:00
Leonard Hecker
a3d285000d Fix a handoff deadlock if layout completes synchronously (#18676)
I've received a dump from an affected user, and it showed that the
layout event in TerminalPage was raised synchronously. This meant that
during page initialization, the handoff listener was started while still
being stuck inside the handoff listener. This resulted in a deadlock.

This PR fixes the issue by not holding the lock across handoff callback
calls.

Closes #18634

## Validation Steps Performed
* Can't repro 

(cherry picked from commit 2693210ead)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgYLZvQ
Service-Version: 1.22
2025-03-12 18:29:33 -05:00
Leonard Hecker
cb29bed3d6 ConPTY: Fix shutdown if killed during startup (#18588)
During startup we relinquish ownership of the console lock to wait for
the DA1 response of the hosting terminal. The problem occurs if the
hosting terminal disconnects during that time. The broken pipe will
cause `VtIo` to send out `CTRL_CLOSE_EVENT` messages, but those won't
achieve anything, because the first and only client hasn't even finished
connecting yet. What we need to do instead is to return an error code.

In order to not use a bunch of booleans to control this behavior, I gave
`VtIo` a state enum. This however required restructuring the calling
code in order to not have a dozen states.

## Validation Steps Performed
* Launch cmd.exe with ConPTY
* ...but leave the stdin pipe unbound (which will hang the DA1 request)
* Immediately kill the ConPTY session
* cmd.exe exits after clicking away the error message 

(cherry picked from commit 733a5e7bec)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgXjzIk
Service-Version: 1.22
2025-02-26 13:07:40 -06:00
Windows Console Service Bot
990da6cad0 Localization Updates - main - 02/13/2025 03:05:04 (#18569)
(cherry picked from commit 13e7c9314d)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgXeZ1M
Service-Version: 1.22
2025-02-26 13:07:39 -06:00
Leonard Hecker
18d7231ef2 Add Oklab based color scheme "Ottosson" (#18502)
Campbell has been the default color scheme for a long time now,
but it has quite some issues with hue and chroma.

This PR introduces a new scheme which was created using the Oklab
color space to find colors with maximal distance to each other
and well distributed and consistent hue and chroma.
Because of this, I've named the scheme after the creator of Oklab.
 
Closes #17818

(cherry picked from commit e60acbc12a)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgW-IDA
Service-Version: 1.22
2025-02-03 17:12:52 -06:00
Éléa Dufresne
1951f93ad4 Fix Ctrl+Insert does not copy the selected text from Command Palette (#18483)
Fixes an issue where pressing `CTRL` + `Insert` does not copy text
selected in the Command Palette. Instead, it closes it, and any text
selected in the pane is copied to the clipboard.

Since `Insert` is a virtual key, I address the issue by adding a
conditional check for `CTRL` with either `Insert` or `C` (previously, it
only checked for `CTRL` with `C`) for the copy action in the Command
Palette.

## Validation Steps Performed

I followed the reproduction steps and verified that the actual behaviour
matched the expected behaviour. All existing tests passed, but no new
test was added.

Closes #9520

(cherry picked from commit 2e92a15464)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgW9xcY
Service-Version: 1.22
2025-02-03 15:21:13 -06:00
Dustin L. Howett
14a7cf3ad3 Update Cascadia Code to 2407.24 (#18499)
This update fixes a hinting issue in Arabic glyphs.

See microsoft/cascadia-code#746 for more details.

(cherry picked from commit bf074f3e40)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgW99S0
Service-Version: 1.22
2025-02-03 15:21:12 -06:00
Tsukasa OI
f9e962c298 Escape single quotes while translating dropped Win32 paths (#18007)
When file/folder is dropped to the terminal, its path is translated and
quoted with a pair of single quotes if necessary.

However, the terminal control does not escape single quotes (allowed in
the Win32 subsystem) that need escapes when translated.

On the translation styles other than `"none"` (note: all other
translation styles are currently intended for the POSIX shell), it
causes incorrect path to be pasted when the path contains one or more
single quotes (see #18006 for an example).

With this commit, the terminal control escapes a single quote with a
valid escape sequence `'\''` (finish quote, print a single quote then
begin quote again) when the path translation is required.

* Changed escape sequence from `'"'"'` to much shorter `'\''`.
* Reflected comments by the reviewer.

* Overhaul after addition of multiple path translation styles (not just
WSL but Cygwin and MSYS).
* More clarification both in the code and in the commit message.

* Minor clarification both in the code and in the commit message.

* #18006
* #16214
* #18195

This is a follow-up of #16214 and #18195, fixing #18006.

Closes #18006

Supersedes 7878728752

(cherry picked from commit ae90d52bb1)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgVEvdU
Service-Version: 1.22
2025-02-03 13:08:47 -06:00
Windows Console Service Bot
3af8a05697 Localization Updates - main - Orphaned and Path Translation (#18208)
(cherry picked from commit 84d6b0fba0)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgW9l4E
Service-Version: 1.22
2025-02-03 13:08:47 -06:00
Dustin L. Howett
9a262e947c Add a new (advanced) profile setting, pathTranslationStyle (#18195)
`pathTranslationStyle` has four options:

- `none`: Do no translation
- `wsl`: Translate `C:\` to `/mnt/c` and `\\wsl$\Foo\bar` to `/bar`
- `cygwin`: Translate `C:\` to `/cygdrive/c`
- `msys2`: Translate `C:\` to `/c`

It is intended as a broadly-supported replacement for us checking the
source every time the user drops a path.

We no longer need to push the source name all the way down to the
control.

I am hesitant to commit to using other folks' product names in our
settings model,
however, these are almost certainly more recognizable than whatever
other weird
names we could come up with.

The Git Bash fragment extension profile could conceivably use
`pathTranslationStyle`
`msys2` to make sure drag/dropped paths look right.

(cherry picked from commit 068906714f)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgW9l6A
Service-Version: 1.22
2025-02-03 13:08:47 -06:00
Windows Console Service Bot
1b5381b37f OSC 52 Localization Updates - main - 01/24/2025 03:05:35 (#18456)
(cherry picked from commit d6b56ae818)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgW9i6c
Service-Version: 1.22
2025-02-03 13:08:47 -06:00
Dustin L. Howett
db7a50a80b Let folks disable OSC 52 (#18449)
This pull request introduces a new profile setting,
`compatibility.allowOSC52`, which defaults to `true`. When disabled, it
will not allow applications to write to the clipboard.

Security-minded folks may choose to disable it.

(cherry picked from commit 33556fb631)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgWpodA
Service-Version: 1.22
2025-02-03 13:08:46 -06:00
Carlos Zamora
6debbc3d13 Add a Compatibility and Terminal page to the Settings UI (#17895)
Adds a global Compatibility page to the settings UI. This page exposes
several existing settings and introduces a few new settings:
- compatibility.allowHeadless
- compatibility.isolatedMode
- compatibility.textMeasurement
- debugFeatures

This also adds a Terminal subpage for profiles in the settings UI. This
page includes:
- suppressApplicationTitle
- compatibility.input.forceVT
- compatibility.allowDECRQCRA
- answerbackMessage

Several smaller changes were accomplished as a part of this PR:
- `experimental.input.forceVT` was renamed to
`compatibility.input.forceVT`
- introduced the `compatibility.allowDECRQCRA` setting
- updated the schema for these new settings and
`compatibility.allowHeadless` (which was missing)
- add `Feature_DebugModeUI` feature flag to control if debug features
should be shown in the SUI

Verified accessible via Accessibility Insights

A part of #10000
Closes #16672

(cherry picked from commit 18d86bca09)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgW9kBM
Service-Version: 1.22
2025-02-03 12:15:36 -06:00
Leonard Hecker
5148c0cf0d Add 10.0.26100.0 to MaxVersionTested (#18252)
As it turns out, you cannot use `<uap17:UpdateWhileInUse>`
(or any other newer namespace) unless you declare a corresponding
`MaxVersionTested` in your package manifest.
It does not appear that there's a reason for this, it just is.
`MaxVersionTested` is not to be confused with the `maxversiontested`,
which is something else entirely, but I updated it for safe measure.
Since `maxversiontested` is not a "max", but rather a list
of tested versions, it gets appended to the end of the list.

Closes #18119

(cherry picked from commit 32eeefd89e)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgVXHVQ
Service-Version: 1.22
2025-02-03 11:55:32 -06:00
Leonard Hecker
a5dc395c03 Fix order and robustness of CTRL_*_EVENTs (#18233)
* This fixes a regression in 391abafc, which caused attached clients
  to receive CTRL_CLOSE_EVENTs, etc., in oldest-to-newest order,
  while historically the opposite is expected.
* It also changes the behavior of `ProcessCtrlEvents` to dispatch
  these events no matter whether a client is already dead.
  This restores the Windows XP to Windows 8.1 behavior.

Both of these fixes would address the issue on their own.

Closes #15373

## Validation Steps Performed
* CloseTest from our repository shows newest-to-oldest order again.
* node gets killed when run under npm and closing the tab.

(cherry picked from commit 09d8ac44ad)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgVBZ1o
Service-Version: 1.22
2025-02-03 11:55:30 -06:00
Leonard Hecker
938b2190e5 Revert "Dedup command history by default (#17852)" (#18229)
This reverts commit 5fdfd51209,
because 3 people complained about this change VS 1 person
requesting the change to be made in the first place.

Closes #18138
Reopens #17797 for discussion

(cherry picked from commit 220c7cd92e)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgUeWb8
Service-Version: 1.22
2025-02-03 11:55:29 -06:00
Dustin L. Howett
e571e4fa22 build: change how we find the latest VC tools version (#18468)
Apparently, we were using the package containing the CRT _source code_
to determine the version of the tools.

Also apparently, VS does not guarantee that that package has the same
version as the tools package.

We should use the version of the tools package instead.

(cherry picked from commit 8e4da6e938)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgWyLAQ
Service-Version: 1.22
2025-01-28 17:03:18 -06:00
Leonard Hecker
26f82608b3 Reduce likelihood of races between stdout and cooked stdin reads (#18326)
As explained in the comment on `_getViewportCursorPosition`, printing
to stdout after initiating a cooked stdin reads is a race condition
between the application and the terminal. But we can significantly
reduce the likelihood of this being obvious with this change.

Related to #18265
Possibly related to #18081

## Validation Steps Performed

Execute the following Go code and start typing:
```go
package main

import (
	"fmt"
	"time"
)

func main() {
	go func() {
		time.Sleep(50 * time.Millisecond)
		fmt.Printf("Here is a prompt! >")
	}()

	var text string
	fmt.Scanln(&text)
}
```

Without this change the prompt will disappear,
and with this change in place, it'll work as expected. 

(cherry picked from commit 1040035b55)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgWppag
Service-Version: 1.22
2025-01-28 17:03:17 -06:00
Carlos Zamora
e435c1670f Fix 'closeWindow' ignoring confirmation (#18434)
Reroutes the `closeWindow` action to use the `CloseWindow()` method like
the window's X button does. This includes logic to display the
confirmation dialog.

Also removes `CloseRequested` as it was only used by this action
handler. We already have `CloseWindowRequested` so we're just using that
instead.

## Validation Steps Performed
 `closeWindow` action while multiple tabs opened brings up the
confirmation dialog

Closes #17613

(cherry picked from commit fb7b0e1218)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgWkUeU
Service-Version: 1.22
2025-01-28 17:03:16 -06:00
Javier
91086f6706 propsheet: add a CodeQL supression comment (#18431)
CodeQL is raising errors when building Visual Studio since they have a
dependency on Windows Terminal for our integrated terminal. The issue
raised by CodeQL refers to a non-constant string format, but in this
case the string comes from a resource file and should be considered
constant.

(cherry picked from commit 25392ea604)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgWYgYU
Service-Version: 1.22
2025-01-15 15:00:06 -06:00
Carlos Zamora
795077cb25 Fix tag for SessionBecameInteractive event (#18426)
Adds a description and keyword for the `SessionBecameInteractive` event

Follow-up from #17682

(cherry picked from commit 3772fc3fc5)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmszgWWlDk
Service-Version: 1.21
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgWWlDg
Service-Version: 1.22
2025-01-14 20:06:27 -06:00
Dustin L. Howett
0e5fbad0f6 Teach ServicingPipeline to paginate project board items (#18328)
Oops, it didn't support more than 100 items!

(cherry picked from commit 3e6690290f)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgWLtrU
Service-Version: 1.22
2025-01-08 15:41:19 -06:00
Dustin L. Howett
8ed73b1473 build: add a couple more signing variables to ESRP (#18411)
This is in support of some identity changes we need to make.

(cherry picked from commit a3a4464667)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgWLo5Y
Service-Version: 1.22
2025-01-08 15:41:17 -06:00
Leonard Hecker
b4207403ea Reduce malloc churn for console calls <=128KiB (#18287)
This increases the console IO buffer size to retain at least 128KiB as
this matches the default buffer size of `cat`. This avoids allocator
churn due to constantly freeing and reallocating buffers. In the future
this should ideally use a better suited, cheap allocator.

Closes #18286

(cherry picked from commit aa5459df4a)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgWLtjY
Service-Version: 1.22
2025-01-08 15:41:16 -06:00
Carlos Zamora
dc807db593 Add "Windows.Terminal.VisualStudio" to schema (#18322)
Closes #18037

(cherry picked from commit 8598ed78d5)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgVq2uw
Service-Version: 1.22
2024-12-13 14:41:25 -06:00
Javier
f78bf09336 Add CodeQL suppression comment to propsheet (#18315)
CodeQL is raising errors when building Visual Studio since we have a
dependency on Windows Terminal for our integrated terminal. The issue
raised is not applicable to this case and therefore requires a
suppression comment to ignore the raised error.

(cherry picked from commit 19460f98e0)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgVqzyA
Service-Version: 1.22
2024-12-13 14:38:15 -06:00
Leonard Hecker
a24d3a9ce4 Update settings schema for compatibility.textMeasurement (#18277)
It seems I forgot to add this in #16916.

(cherry picked from commit c0d40c9768)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgVUrMM
Service-Version: 1.22
2024-12-13 14:38:14 -06:00
Leonard Hecker
6b8c04ad71 Fix infinite recursion in TSF (#18248)
The current `FindWindowOfActiveTSF` implementation can
result in infinite recursion which we must guard again.
This change is not tested as I don't know how to trigger
the issue to begin with (a missing CoreInput thread).

(cherry picked from commit 924310481a)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgVIDNA
Service-Version: 1.22
2024-11-26 13:21:48 -06:00
Tsukasa OI
7878728752 Escape single quotes while translating dropped Win32 paths (#18007)
When file/folder is dropped to the terminal, its path is translated and
quoted with a pair of single quotes if necessary.

However, the terminal control does not escape single quotes (allowed in
the Win32 subsystem) that need escapes when translated.

On the translation styles other than `"none"` (note: all other
translation styles are currently intended for the POSIX shell), it
causes incorrect path to be pasted when the path contains one or more
single quotes (see #18006 for an example).

With this commit, the terminal control escapes a single quote with a
valid escape sequence `'\''` (finish quote, print a single quote then
begin quote again) when the path translation is required.

* Changed escape sequence from `'"'"'` to much shorter `'\''`.
* Reflected comments by the reviewer.

* Overhaul after addition of multiple path translation styles (not just
WSL but Cygwin and MSYS).
* More clarification both in the code and in the commit message.

* Minor clarification both in the code and in the commit message.

* #18006
* #16214
* #18195

This is a follow-up of #16214 and #18195, fixing #18006.

Closes #18006

(cherry picked from commit ae90d52bb1)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgVEvdU
Service-Version: 1.22
2024-11-25 14:57:44 -06:00
Dustin L. Howett
ede23a5a18 build: fix arm64 vcpkg triplet selection error (#18239)
microsoft/vcpkg-tool#1474 now validates that the target triplet is
valid. Unfortunately, `ARM64` is not valid... despite VS defaulting to
it.

VS 17.12 moved to the newer version of the vcpkg tool.

Given that we still want to build on VS 17.12, this commit adds a local
workaround.

See DD-2302065 for the internal tracking bug.
 
See microsoft/vcpkg#42182 for the upstream fix.

(cherry picked from commit 6047f37e84)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgVEH-w
Service-Version: 1.22
2024-11-25 14:54:02 -06:00
Windows Console Service Bot
03f050559c Localization Updates - main - 11/01/2024 03:05:38 (#18135)
(cherry picked from commit 52262b05fa)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgU6Zlw
Service-Version: 1.22
2024-11-18 16:02:35 -06:00
Leonard Hecker
819628a185 AtlasEngine: Better builtin glyphs (#18179)
This slightly modifies the builtin glyph width and corner radius to
more closely match Cascadia Mono. Previously, at low DPI (100% scale),
the corner radius was barely noticeable which looked kind of bad.

(cherry picked from commit a8e83c1c0f)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgU6YuY
Service-Version: 1.22
2024-11-18 16:00:45 -06:00
Carlos Zamora
ef0a6b76bd Add 'Move Tab' submenu to tab context menu (#18107)
## Summary of the Pull Request
Adds a "Move tab" submenu to the tab's context menu. This submenu includes "move tab to new window", "move left", and "move right".

The new "move left/right" items are disabled if the tab can't be moved in a certain direction.'

Closes #17900

(cherry picked from commit d8089e903e)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgU6Yu8
Service-Version: 1.22
2024-11-18 16:00:43 -06:00
Dustin L. Howett
2143ca1c92 [<= 1.22] Retain (BUT DON'T INDICATE) orphaned dynamic profiles (#18206)
The original intent with dynamic profiles was that they could be
uninstalled but that Terminal would remember your settings in case they
ever came back.

After we implemented dynamic profile _deletion_, however, we
accidentally made it so that saving your settings after a dynamic
profile disappeared scoured it from the planet _forever_ (since we
remembered that we generated it, but now it was no longer in the
settings file).

This pull request implements:

- Tracking for orphaned dynamic profiles

Closes #14061
Closes #11510
Refs #13916
Refs #9997

Modified for 1.22. I am not including any of the UI affordances.

(cherry picked from commit 90866c7c93)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgU1-p4
Service-Version: 1.22
2024-11-18 15:52:44 -06:00
Dustin L. Howett
e476dd2b9c [<= 1.22] Do path translation for multiple types of WSL (#18205)
In #18195, we introduced a real `pathTranslationStyle` setting.

I'm not backporting that whole thing.
2024-11-18 08:36:45 -08:00
Dustin L. Howett
b97f3c1cd7 wsl: skip distributions that indicate they are "Modern" (#18183)
(cherry picked from commit 00ff803ace)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgUu4sg
Service-Version: 1.22
2024-11-15 10:50:08 -06:00
Carlos Zamora
c1890c4a99 Fix High Contrast mode in Settings UI (#18130)
"HighContrast" is not a possible requested theme. So `_UpdateBackgroundForMica()` would force the settings UI to be light or dark. To fix this, we just check if we're in high contrast mode and, if so, we don't bother setting the requested theme.

(cherry picked from commit d04381ec05)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgUZ6Mc
Service-Version: 1.22
2024-11-15 10:50:05 -06:00
Carlos Zamora
5f614bc1a0 Fix High Contrast mode in Command Palette (#18132)
Turns out that having the styles for the KeyChordText and ParsedCommandLineText be empty for high contrast mode caused the issue. Since we're already using theme resources for the colors, we automatically adjust properly to whatever the high contrast theme is (Thanks XAML!).

Bonus points:
- we didn't need the theme dictionaries anymore, so I just moved them to the ResourceDictionary directly
- ParsedCommandLineTextBlockStyle isn't used. So I removed it altogether.

Validated command palette with multiple high contrast themes. See PR thread for demo.

Closes #17914

(cherry picked from commit e83434ff7e)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgUZ6Mo
Service-Version: 1.22
2024-11-15 10:50:02 -06:00
Windows Console Service Bot
0a9ed2bfda Localization Updates - 10/22/2024 03:06:53 (#18031)
Closes #17752

(cherry picked from commit b58aa26e7a)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgUIJdU
Service-Version: 1.22
2024-11-15 10:49:56 -06:00
Leonard Hecker
3ace5785cd Add a policy for profile sources (#18009)
This adds a basic policy check for DisabledProfileSources, so that
organizations can easily disable certain profiles like the Azure one.

Closes #17964

## Validation Steps Performed
* Add a policy to disable Azure under HKCU. Disabled 
* Add a policy to disable nothing under HKLM. Enabled 
  (...because it overrides the HKCU setting.)

(cherry picked from commit 3a06826915)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgT6i0c
Service-Version: 1.22
2024-10-17 16:47:51 -05:00
Carlos Zamora
8fa98f62bc Fix hiding the icon when it's set to "none" (#18030)
The settings UI and settings model allow you to set the icon to "none"
to hide the icon (you can actually see this effect in the settings UI
when changing the value of the profile icon). However, during settings
validation, "none" is considered a file path, which is then failed to be
parsed, resulting in the icon being marked as invalid and immediately
clearing the value.

This PR fixes this issue by considering "none" to be an accepted value
during validation.

Related to #15843
Closes #17943

## Validation Steps Performed
When an icon is set to "none", ...
 no more warning
 the icon is hidden

(cherry picked from commit 36f064cfc8)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTyV8E
Service-Version: 1.22
2024-10-17 16:47:49 -05:00
Leonard Hecker
b947d1a8be Avoid focus loops in ConPTY (#17829)
This fixes a lot of subtle issues:
* Avoid emitting another de-/iconify VT sequence when
  we encounter a (de)iconify VT sequence during parsing.
* Avoid emitting a de-/iconify VT sequence when
  a focus event is received on the signal pipe.
* Avoid emitting such sequences on startup.
* Avoid emitting multiple such sequences
  when rapidly un-/focusing the window.

It's also a minor cleanup, because the `GA_ROOTOWNER` is not security
relevant. It was added because there was concern that someone can just
spawn a ConPTY session, tell it that it's focused, and spawn a child
which is now focused. But why would someone do that, when the console
IOCTLs to do so are not just publicly available but also documented?

I also disabled the IME window.

## Validation Steps Performed
* First:
  ```cpp
  int main() {
      for (bool show = false;; show = !show) {
          printf(show ? "Show in 3s...\n" : "Hide in 3s...\n");
          Sleep(3000);
          ShowWindow(GetConsoleWindow(), show ? SW_SHOW : SW_HIDE);
      }
  }
  ```
* PowerShell 5's `Get-Credential` gains focus 
* `sleep 5; Get-Credential` and focus another app. WT should start
  blinking in the taskbar. Restore it. The popup has focus 
* Run `:hardcopy` in vim: Window is shown centered at (0,0) ✖️
  But that's okay because it does that already anyway 
* `Connect-AzAccount` doesn't crash PowerShell 

(cherry picked from commit 4386bf07fd)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTs61k
Service-Version: 1.22
2024-10-08 17:43:51 -05:00
Dustin L. Howett
a0987c22c8 Revert "Stop updating AutoSuggestBox on selection" (#17989)
Reverts microsoft/terminal#17961
Closes #17987
Reopens #17916

(cherry picked from commit b715008de3)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTiWbQ
Service-Version: 1.22
2024-10-08 17:43:50 -05:00
Leonard Hecker
24475acba8 Add input scope startup setting (#17953)
This adds a "defaultInputScope" setting, hooks it up to our TSF,
and exposes it as a setting in the UI under the startup page.
In order to stay close with the other language setting, I moved that
one from the appearance to the startup page as well.
20 out of the 26 files in this PR are boilerplate unfortunately.

Closes #17816

## Validation Steps Performed
* Install and use the Chinese IME
* Launch WT
* Chinese input 
* Change setting to `alphanumericHalfWidth`
* Restart WT
* English input 

(cherry picked from commit fc606d2bae)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTTKAI
Service-Version: 1.22
2024-09-26 14:58:14 -05:00
James Holderness
2a8dee286e Add support for resetting the color scheme with RIS (#17879)
## Summary of the Pull Request

This improves our `RIS` (hard reset) implementation, so it now also
resets any changes that are made to the color table and color aliases,
which is one of the things it's supposed to be doing.

## References and Relevant Issues

This is also a small step towards implementing the `OSC` sequences that
reset individual color table entries (issue #3719).

## Detailed Description of the Pull Request / Additional comments

The way this works is by having a second copy of the color table and
alias indices to hold the default values in the `RenderSettings` class.
This default set is initially populated at startup with the user's
chosen color scheme, but can also potentially be updated if the user
changes their settings while a session is already in progress.

When we receive an `RIS` request, we just copy the default values back
over the active settings, and refresh the renderer.

## Validation Steps Performed

I've manually tested both OpenConsole and Windows Terminal by changing
my color scheme programmatically, and then confirming that the original
colors are restored when an `RIS` sequence is received.

I've also added some basic unit tests that check both the color aliases
and color table are restored by `RIS`.

## PR Checklist
- [x] Tests added/passed

(cherry picked from commit 5e8e10fdc0)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTTOyY
Service-Version: 1.22
2024-09-26 14:58:13 -05:00
Windows Console Service Bot
181448908e Localization Updates - main - 09/26/2024 19:14:21 (#17958)
Closes #17752
Closes #17764
Closes #17830

(cherry picked from commit 59dc5eff42)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTX8OU
Service-Version: 1.22
2024-09-26 14:23:01 -05:00
Leonard Hecker
e5f0af22d7 Stop updating AutoSuggestBox on selection (#17961)
`AutoSuggestBox` has a `SuggestionChosen` event and any reasonable
person would assume that this means one of the items was chosen.
But with WinUI it's raised whenever a suggestion is merely highlighted.
`QuerySubmitted` is the right event instead. Clearly that naming is
a lot better than `SuggestionChosen`, since the property to get the
chosen item is called `ChosenSuggestion`.
WinUI, like the unrelenting wilderness of a world indifferent to human
suffering, stands as a testament to the futility of human aspiration.

Closes #17916

## Validation Steps Performed
* Type "Casc"
* Move up/down with the arrow keys
* Neither the filtered list nor the text updates 
* Press Enter on an item
* Text updates 

(cherry picked from commit bcac9993cb)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTW9-o
Service-Version: 1.22
2024-09-26 14:23:00 -05:00
Carlos Zamora
c49d79a1ec Improve color contrast of reset button in SUI (#17912)
Adds a theme resource for the color of the reset button in the settings UI.

Closes #17902

(cherry picked from commit 0bd19e9cfc)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTTb0w
Service-Version: 1.22
2024-09-26 14:22:59 -05:00
Leonard Hecker
ff7f1a7c83 Fix clear buffer command (#17884)
Without a VT "renderer" there's no implicit output anymore when
calling `ClearPseudoConsole`. The fix is trivial, but it works
slightly different from before: Previously, we would preserve
the line the cursor is on, while this PR doesn't do that.
I felt like there's not much merit in preserving the line,
because it may be a multi-line prompt which won't work with that.

Closes #17867

## Validation Steps Performed
Bind 3 different actions to the 3 variants of "Clear buffer"
and test them. They work. 

(cherry picked from commit 4259ce535f)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgS3NbU
Service-Version: 1.22
2024-09-24 14:12:18 -05:00
Leonard Hecker
9b8c0602a2 Stop scrolling on output when search is open (#17885)
* Don't reset the position entirely when changing the needle
* Don't change the scroll position when output arrives
* Don't interfere with the search when output arrives constantly

Closes #17301

## Validation Steps Performed
* In pwsh, run `10000..20000 | % { sleep 0.25; $_ }`
  * You can search for e.g. `1004` and it'll find 10 results. 
  * You can scroll up and down past it and it won't snap back
    when new output arrives. 
* `while ($true) { Write-Host -NoNewline "`e[Ha"; sleep 0.0001; }`
  * You can cycle between the hits effortlessly.  (This tests that
    the constantly reset `OutputIdle` event won't interfere.)
* On input change, the focused result is near the previous one. 

(cherry picked from commit d9131c6889)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgS3elo PVTI_lADOAF3p4s4AmhmQzgTEciM
Service-Version: 1.22
2024-09-24 14:08:04 -05:00
Leonard Hecker
ea60f14627 Fix a cooked read deadlock (#17905)
Because `_layoutLine` would never return `column == columnLimit` for
control character visualizers, we'd get a deadlock in `_redisplay`,
as it tries to fill the line until it's full, but never achieve it.

Closes #17893

## Validation Steps Performed
* Press Ctrl-A to insert "^A"
* Press Home to get to the start of the prompt
* Press and hold "A" until the line wraps
* The line wraps and there's no deadlock 

(cherry picked from commit 0ce654eaf6)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTEJwI
Service-Version: 1.22
2024-09-24 14:08:03 -05:00
James Holderness
145babeae0 Fix a sixel crash when the buffer is reflowed (#17951)
## Summary of the Pull Request

The sixel parser has an internal buffer that holds the indexed-color
representation of the image, prior to it being translated to RGB. This
buffer only retains the section of the image that is within the visible
viewport, so we're continually erasing segments from the top of it when
the image is large enough to trigger a scroll.

But there is a problem that arises if the window or font is resized so
that the buffer needs to reflow, because that can result in the image
being pushed entirely offscreen. At that point the segment we're trying
to erase is actually larger than the buffer itself, which can end up
causing the terminal to crash

To fix this, we just need to check for an oversized erase attempt and
simply clear the buffer instead.

## Validation Steps Performed

I could easily reproduce this crash in Windows Terminal by resizing the
font while viewing an animated gif with img2sixel. With this PR applied
the crash no longer occurs.

## PR Checklist
- [x] Closes #17947

(cherry picked from commit fc586e2662)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTTKv4
Service-Version: 1.22
2024-09-24 14:08:01 -05:00
Leonard Hecker
a2d7742567 Check EnableHexNumpad before enabling it (#17954)
This just adds a quick registry check for `EnableHexNumpad`.

Depends on #17774
Closes #17762 (again)

## Validation Steps Performed
* Alt + NumpadAdd + 221E doesn't do anything 
* Set the `EnableHexNumpad` registry key
* Restart
* Alt + NumpadAdd + 221E inserts ∞ 

(cherry picked from commit b520da26d4)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTQseA
Service-Version: 1.22
2024-09-24 14:08:00 -05:00
Carlos Zamora
44315b4909 Fix text scaling issues in settings UI (#17910)
## Summary of the Pull Request
Fixes some issues with truncated text in the settings UI when 200% text
scaling is applied.

For #17897, a minimum height was applied instead of a plain "height".
This ensures that the desired height is applied in general, but under
200% text scaling, we are allowed to grow past that, thus preventing the
truncation of the text.

For #17898, flyouts have a scroll viewer inside them by default. We
actually don't want the scroll viewer because that means the text will
appear "truncated" when in reality, the user is expected to notice the
small scrollbar and scroll horizontally (why that's the default, I will
never know). This PR introduces a new style that can be applied to these
flyouts to cause text wrapping instead of horizontal scrolling. Looked
through the app for any instances where this happens.

For #12006, simply changing the column width from a static value to
"auto" fixes the issue. Frankly, we care more about the text appearing
as a whole (and as whole words). The name of the actions wrap properly
anyways.

Closes #17897
Closes #17898
Closes #12006

(cherry picked from commit a7e47b711a)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTEfj8
Service-Version: 1.22
2024-09-17 16:05:27 -05:00
Dustin L. Howett
5e8efdf008 build: fix the TSA configuration (#17929)
We are, quite literally, shipping the org chart.

(cherry picked from commit 2c97c0555d)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTGRAo
Service-Version: 1.22
2024-09-17 16:05:26 -05:00
Leonard Hecker
d95a77b369 Fix a crash on pane close (#17886)
The underlying issue is that the "Pane" is used both as a model and as
a UI element and so a pane loses its content as soon as it is closed,
but the tree only gets reordered after the animation has finished.
This PR is truly just a hotfix, because it doesn't solve this issue,
it only adds checks to the function that crashes.

Closes #17869
Closes #17871

## Validation Steps Performed
* `Split pane` a few times
* Run the "Close all other panes" action
* Doesn't crash 

(cherry picked from commit bc6f3e2275)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgS3Ndk PVTI_lADOAF3p4s4AmhmQzgTEJYM
Service-Version: 1.22
2024-09-16 16:00:36 -05:00
Carlos Zamora
cc132d5e50 Add Feature_QuickFix to preview builds (#17888)
(cherry picked from commit 6196a3d0f7)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgS4Ha8
Service-Version: 1.22
2024-09-16 16:00:35 -05:00
Dustin L. Howett
22731e8673 Remove PackageES in favor of our own versioning package (#17872)
PackageES is deprecated by known scourge-on-earth OneBranch, and is now
the cause of some non-compliance.

I got permission from them to open-source it, so that's coming next.

For now, we can just depend on a package based on our code based on
theirs.

Tested and working for C++ (DLL, EXE), C#, NuGet and MSIX.

(cherry picked from commit 4aa1624cd2)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgTD8is
Service-Version: 1.22
2024-09-16 16:00:34 -05:00
Mike Griese
c129e794f8 Add Feature_SaveSnippet to preview builds (#17881)
whoops. This should have been in preview after I sorted out #17366

----

I did this one on GH so let's hope CI works

(cherry picked from commit c699a468c9)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgS66Co
Service-Version: 1.22
2024-09-16 16:00:32 -05:00
Nihat Uygar Köseer
bd33c7f20b Add tab color indicator for tab switch menu (CTRL+Tab) (#17820)
Added tab color indicator for the tab switch menu. Tab color indicators
have the same color as the background color of the tabs. If a tab has
the default background color, the indicator is not shown in the tab
switch menu.

Closes #17465

(cherry picked from commit 544452dad4)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgS0CZA
Service-Version: 1.22
2024-09-06 18:37:04 -05:00
Leonard Hecker
893f32c642 Fix crash in AppHost::_QuitRequested (#17848)
(cherry picked from commit 00f46e400a)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgSwXpY
Service-Version: 1.22
2024-09-06 18:37:03 -05:00
Leonard Hecker
58a50caf6a Restore contents when a screen info is closed (#17853)
(cherry picked from commit 4eb06fee07)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgSaylY
Service-Version: 1.22
2024-09-06 18:37:03 -05:00
Leonard Hecker
33b0e9dd10 Fix ScrollRect to DECCRA translation (#17849)
By translating the clip rectangle into a source-relative coordinate
space we can calculate the intersection that must be copied
much much more easily. I should've done that from the start.

Closes #17801

## Validation Steps Performed
* Test code provided in #17801

(cherry picked from commit d2c3cfd164)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgSa7nQ
Service-Version: 1.22
2024-09-06 18:37:02 -05:00
James Holderness
385a9a6111 Pass through DCS responses when VT input mode is disabled (#17845)
## Summary of the Pull Request

When an app makes a VT request that returns a `DCS` response, and it
hasn't also enabled VT input mode, the new passthrough implementation
loses that response. All the app receives is an `Alt`+`\` key press
triggered by the `ST` terminator. This PR fixes that issue.

## References and Relevant Issues

This is one of the unresolved issues tracked in #17643.

## Detailed Description of the Pull Request / Additional comments

The way `DCS` sequences are handled in the input state machine engine is
by returning a nullptr from `ActionDcsDispatch`, which tells the state
machine to ignore that content. But the sequence is still buffered, and
when the `ST` terminator is eventually received, that buffer is flushed,
which passes the whole thing through to the app.

Originally this only worked when VT input mode was enabled, otherwise
the `ST` sequence is converted into a key press, and the buffered `DCS`
content is lost. The way it works now is we set a flag when the `DCS`
introducer is received, and if that flag is set when the `ST` arrives,
we know to trigger a flush rather a key press.

## Validation Steps Performed

I've tested a `DA3` request from the cmd shell (i.e. `echo ^[[=c`), and
confirmed that now works as expected. I've also hacked Windows Terminal
to disable win32-input mode, so I could check how it works with conpty
clients generating standard VT input, and confirmed that an `Alt`+`\`
keypress is still translated correctly.

(cherry picked from commit 6e5827add5)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgSwKBc
Service-Version: 1.22
2024-09-06 18:37:01 -05:00
Leonard Hecker
03fc325ad1 Dedup command history by default (#17852)
Under ConPTY we don't load any user settings. `SetUpConsole` notes:
> If we are [ConPTY], we don't want to load any user settings,
> because that could result in some strange rendering results [...]

This enables deduplication by default, which I figured wouldn't cause
any regressions since it's a user-controllable setting anyway, while
it's clearly something the average user wants enabled, for the same
reason that PSReadLine has HistoryNoDuplicates enabled by default.

Closes #17797

## Validation Steps Performed
* Launch conhost, enter 2 commands, press F7, select the older one,
  press Enter, press F7. 2 entries 
* Launch WT, enter 2 commands, press F7, select the older one,
  press Enter, press F7. 2 entries 

(cherry picked from commit 5fdfd51209)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgSN1FQ
Service-Version: 1.22
2024-09-04 15:04:32 -05:00
Leonard Hecker
be99f93094 Avoid dropping Esc characters from VT responses (#17833)
`GetChar` checks if the vkey is VK_ESCAPE. `CharToKeyEvents` however
tries really hard to figure out the vkeys of all characters.
To avoid these issues all we need to do is to simply use the existing
`WriteString` function we already use for all other VT responses.
If it's good for conhost responses, it's good for ConPTY responses.

Additionally, this removes another `IsVtInputEnabled` which was
redundant with `WriteString` which worked exactly the same internally.

Closes #17813
Closes #17851
Probably also related to #17823

* Wrote a small app to send and receive a DA1 request. It works 
* WSL already worked to begin with (and still works now) 
* No double-encoding of mouse input events 

(cherry picked from commit 7b50f12a78)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgSa4RU PVTI_lADOAF3p4s4AmhmQzgStRA0
Service-Version: 1.22
2024-09-04 14:56:05 -05:00
Mike Griese
696fd1196b Fix two ConPTY HWND focus issues (#17828)
Worked with @ekoschik on this one.

## Bug the first: the MSAL window `ixptools` spawns

> The auth prompt in pwsh.exe is disabling the terminal window while its
opened and re-enabling it when the window closes. BUT it is enabling
Terminal after dismissing itself, instead of before, which means
terminal is disabled when activated.
>
> Terminal wants focus on the ISLAND window (a grandchild; island is
parented to bridge, which is parented to terminal’s TLW). When it is
activated, it gets a `WM_SETFOCUS` (in response to DefWindowProc
`WM_ACTIVATE`). From `WM_SETFOCUS` it calls `SetFocus` on the bridge
window, and similarly the bridge calls `SetFocus` on the island.
>
> If the TLW is disabled, these `SetFocus` calls fail (see [this
check](#internal-link-redacted) in `SetFocus`). In the case above, this
leaves Terminal’s TLW as focus, and it doesn’t handle keyboard input.
Note that the window IS foreground/active, but because focus is not on
the island it doesn’t see the keyboard input. Another thing to note is
that clicking on the space to the right of the tabs does NOT revive
keyboard input, but clicking on the tabs or main area does.

> **I recommend having the TLW handle WM_ENABLE and call SetFocus on the
island window.**

And guess what, that works!

## Bug the second: When sublime text is the git `EDITOR`, it doesn't
toss focus back to the Terminal

> In this case, Sublime is calling SFW on the pseudo console window. I
don’t have its code, but it is presumably doing something like
SetForegroundWindow(GetConsoleWindow()). This queues an event to the
pseudo window, and when that event is processed the pseudo window
becomes the active and focus window on the queue (which is shared with
Terminal).
>
> The sublime window dismisses itself and does the above SFW call.
Dismissing immediately activates the Terminal TLW, which does the
triple-focus dance (TLW sets focus on itself, then bridge, then island).
This completes but is overwritten immediately when the pseudo window
activates itself. Note that the pseudo window is active at this point
(not the terminal window).

> **I recommend having the Pseudo console window handle WM_ACTIVATE by
calling SetFocus on the island window (and not passing the message to
DefWindowProc).**

And guess what, that works!

----

Closes #15956 (I did test this)
This might be related to #13388, we'll have folks try canary and check

(cherry picked from commit 17a55da0f9)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgSwIkE
Service-Version: 1.22
2024-09-04 14:55:17 -05:00
Leonard Hecker
649d8b2979 Give spacing marks space (#17826)
Spacing marks are called so, because they have a positive advance
width, unlike their non-spacing neighbors (as the name indicates).
After this we stop assigning such gc=Mc codepoints a zero width.

Closes #17810

(cherry picked from commit 0cb3426281)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgSg1L4
Service-Version: 1.22
2024-09-04 14:55:17 -05:00
PankajBhojwani
3d01439c9f Add action IDs to the color selection commands (#17821)
## Summary of the Pull Request
Add action IDs to the default commands for color selection

## Validation Steps Performed
Color selection commands now show up in the command palette

## PR Checklist
- [x] Closes #17819
- [ ] Tests added/passed
- [ ] Documentation updated
- If checked, please file a pull request on [our docs
repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
- [ ] Schema updated (if necessary)

(cherry picked from commit 1482fd4ecd)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgSawsY PVTI_lADOAF3p4s4AmhmQzgSwIVc
Service-Version: 1.22
2024-09-04 14:55:15 -05:00
Carlos Zamora
85afa41c32 Remove unnecessary FMT (#17795)
There's an unnecessary `fmt::format` here caught in the code review: https://github.com/microsoft/terminal/pull/17678#discussion_r1729426705

This simply removes it.

(cherry picked from commit 93d592bb41)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgSwIS4
Service-Version: 1.22
2024-09-04 14:55:14 -05:00
James Holderness
b3f0afbc8f Make sure a blank title string resets the title (#17802)
## Summary of the Pull Request

When a VT title sequence sets the title to a blank string, that is meant
to trigger a reset to the default starting value. This used to work in
the past because the blank value was dealt with by conhost, so Windows
Terminal never received a blank title, but that's no longer the case
with the new VT passthrough. This PR fixes the issue by getting Windows
Terminal to handle the blank title strings itself.

## References and Relevant Issues

VT passthrough was introduced in PR #17510.

## Validation Steps Performed

I've manually verified that the `OSC 0`, `OSC 2`, and `DECSWT` sequences
now correctly reset the title when passed a blank title string.

## PR Checklist
- [x] Closes #17800

(cherry picked from commit 1f71568c2a)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgSNvr0 PVTI_lADOAF3p4s4AmhmQzgSOFrc
Service-Version: 1.22
2024-09-04 14:55:13 -05:00
Dustin L. Howett
90cfb33c13 PGO: train 1.22 separately 2024-08-23 15:10:47 -05:00
283 changed files with 6730 additions and 2639 deletions

View File

@@ -9,6 +9,7 @@ CMMI
colorbrewer
consvc
copyable
CText
dalet
dcs
deselection

View File

@@ -96,6 +96,7 @@ IGraphics
IImage
IInheritable
IMap
imm
IMonarch
IObject
iosfwd

View File

@@ -1,5 +0,0 @@
EOB
swrapped
wordi
wordiswrapped
wrappe

View File

@@ -16,6 +16,8 @@ ADDALIAS
ADDREF
ADDSTRING
ADDTOOL
adml
admx
AFill
AFX
AHelper
@@ -339,6 +341,7 @@ CXVIRTUALSCREEN
CXVSCROLL
CYFRAME
CYFULLSCREEN
cygdrive
CYHSCROLL
CYMIN
CYPADDEDBORDER
@@ -564,6 +567,7 @@ entrypoints
ENU
ENUMLOGFONT
ENUMLOGFONTEX
EOB
EOK
EPres
EQU
@@ -782,6 +786,7 @@ HIWORD
HKCU
hkey
hkl
HKLM
hlocal
hlsl
HMB
@@ -864,6 +869,7 @@ INLINEPREFIX
inproc
Inputkeyinfo
Inputreadhandledata
INPUTSCOPE
INSERTMODE
INTERACTIVITYBASE
INTERCEPTCOPYPASTE
@@ -1289,6 +1295,7 @@ parms
PATCOPY
pathcch
PATTERNID
pbstr
pcb
pcch
PCCHAR
@@ -1374,9 +1381,11 @@ POSTCHARBREAKS
POSX
POSXSCROLL
POSYSCROLL
ppbstr
PPEB
ppf
ppidl
pprg
PPROC
ppropvar
ppsi
@@ -1692,6 +1701,7 @@ srcsrv
SRCSRVTRG
srctool
srect
SRGS
srvinit
srvpipe
ssa
@@ -1729,6 +1739,7 @@ swapchain
swapchainpanel
SWMR
SWP
swrapped
SYMED
SYNCPAINT
syscalls
@@ -1838,7 +1849,6 @@ triaging
TRIMZEROHEADINGS
trx
tsa
tsattrs
tsgr
tsm
TStr
@@ -1966,10 +1976,8 @@ vswhere
vtapp
VTE
VTID
vtio
vtmode
vtpipeterm
vtpt
VTRGB
VTRGBTo
vtseq
@@ -2074,6 +2082,8 @@ WNDCLASSW
Wndproc
WNegative
WNull
wordi
wordiswrapped
workarea
WOutside
WOWARM
@@ -2087,6 +2097,7 @@ WPrep
WPresent
wprp
wprpi
wrappe
wregex
writeback
WRITECONSOLE

View File

@@ -1,6 +1,6 @@
{
"instanceUrl": "https://microsoft.visualstudio.com",
"projectName": "OS",
"areaPath": "OS\\Windows Client and Services\\ADEPT\\E4D-Engineered for Developers\\SHINE\\Terminal",
"areaPath": "OS\\Windows Client and Services\\WinPD\\DEEP-Developer Experience, Ecosystem and Partnerships\\SHINE\\Terminal",
"notificationAliases": ["condev@microsoft.com", "duhowett@microsoft.com"]
}

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MUXCustomBuildTasks" version="1.0.48" targetFramework="native" />
<package id="Microsoft.Taef" version="10.93.240607003" targetFramework="native" />
<package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
<package id="Microsoft.Debugging.Tools.PdbStr" version="20220617.1556.0" targetFramework="native" />

View File

@@ -9,7 +9,7 @@
<PropertyGroup>
<!-- Optional, defaults to main. Name of the branch which will be used for calculating branch point. -->
<PGOBranch>main</PGOBranch>
<PGOBranch>release-1.22</PGOBranch>
<!-- Mandatory. Name of the NuGet package which will contain PGO databases for consumption by build system. -->
<PGOPackageName>Microsoft.Internal.Windows.Terminal.PGODatabase</PGOPackageName>

View File

@@ -37,6 +37,8 @@ extends:
akvName: $(SigningAKVName)
authCertName: $(SigningAuthCertName)
signCertName: $(SigningSignCertName)
useManagedIdentity: $(SigningUseManagedIdentity)
clientId: $(SigningOriginalClientId)
publishSymbolsToPublic: true
publishVpackToWindows: false
symbolExpiryTime: 15

View File

@@ -85,6 +85,8 @@ extends:
akvName: $(SigningAKVName)
authCertName: $(SigningAuthCertName)
signCertName: $(SigningSignCertName)
useManagedIdentity: $(SigningUseManagedIdentity)
clientId: $(SigningOriginalClientId)
terminalInternalPackageVersion: ${{ parameters.terminalInternalPackageVersion }}
publishSymbolsToPublic: ${{ parameters.publishSymbolsToPublic }}
publishVpackToWindows: ${{ parameters.publishVpackToWindows }}

View File

@@ -59,10 +59,7 @@ jobs:
submodules: true
persistCredentials: True
- task: PkgESSetupBuild@12
displayName: Package ES - Setup Build
inputs:
disableOutputRedirect: true
- template: steps-setup-versioning.yml
- template: steps-download-bin-dir-artifact.yml
parameters:

View File

@@ -69,10 +69,9 @@ jobs:
fetchTags: false # Tags still result in depth > 1 fetch; we don't need them here
submodules: true
persistCredentials: True
- task: PkgESSetupBuild@12
displayName: Package ES - Setup Build
inputs:
disableOutputRedirect: true
- template: steps-setup-versioning.yml
- template: steps-download-bin-dir-artifact.yml
parameters:
buildPlatforms: ${{ parameters.buildPlatforms }}

View File

@@ -57,10 +57,7 @@ jobs:
submodules: true
persistCredentials: True
- task: PkgESSetupBuild@12
displayName: Package ES - Setup Build
inputs:
disableOutputRedirect: true
- template: steps-setup-versioning.yml
- template: steps-download-bin-dir-artifact.yml
parameters:

View File

@@ -44,10 +44,7 @@ jobs:
submodules: true
persistCredentials: True
- task: PkgESSetupBuild@12
displayName: Package ES - Setup Build
inputs:
disableOutputRedirect: true
- template: steps-setup-versioning.yml
- task: DownloadPipelineArtifact@2
displayName: Download all PDBs from all prior build phases

View File

@@ -43,10 +43,7 @@ jobs:
submodules: true
persistCredentials: True
- task: PkgESSetupBuild@12
displayName: Package ES - Setup Build
inputs:
disableOutputRedirect: true
- template: steps-setup-versioning.yml
- task: DownloadPipelineArtifact@2
displayName: Download all PDBs from all prior build phases

View File

@@ -38,10 +38,7 @@ jobs:
submodules: true
persistCredentials: True
- task: PkgESSetupBuild@12
displayName: Package ES - Setup Build
inputs:
disableOutputRedirect: true
- template: steps-setup-versioning.yml
- task: DownloadPipelineArtifact@2
displayName: Download MSIX Bundle Artifact

View File

@@ -92,10 +92,7 @@ stages:
generateSbom: ${{ parameters.generateSbom }}
codeSign: ${{ parameters.codeSign }}
beforeBuildSteps: # Right before we build, lay down the universal package and localizations
- task: PkgESSetupBuild@12
displayName: Package ES - Setup Build
inputs:
disableOutputRedirect: true
- template: ./build/pipelines/templates-v2/steps-setup-versioning.yml@self
- task: UniversalPackages@0
displayName: Download terminal-internal Universal Package
@@ -119,10 +116,7 @@ stages:
generateSbom: ${{ parameters.generateSbom }}
codeSign: ${{ parameters.codeSign }}
beforeBuildSteps:
- task: PkgESSetupBuild@12
displayName: Package ES - Setup Build
inputs:
disableOutputRedirect: true
- template: ./build/pipelines/templates-v2/steps-setup-versioning.yml@self
# WPF doesn't need the localizations or the universal package, but if it does... put them here.
- stage: Package

View File

@@ -130,10 +130,7 @@ extends:
codeSign: ${{ parameters.codeSign }}
signingIdentity: ${{ parameters.signingIdentity }}
beforeBuildSteps: # Right before we build, lay down the universal package and localizations
- task: PkgESSetupBuild@12
displayName: Package ES - Setup Build
inputs:
disableOutputRedirect: true
- template: ./build/pipelines/templates-v2/steps-setup-versioning.yml@self
- task: UniversalPackages@0
displayName: Download terminal-internal Universal Package
@@ -167,10 +164,7 @@ extends:
codeSign: ${{ parameters.codeSign }}
signingIdentity: ${{ parameters.signingIdentity }}
beforeBuildSteps:
- task: PkgESSetupBuild@12
displayName: Package ES - Setup Build
inputs:
disableOutputRedirect: true
- template: ./build/pipelines/templates-v2/steps-setup-versioning.yml@self
# WPF doesn't need the localizations or the universal package, but if it does... put them here.
- stage: Package

View File

@@ -19,4 +19,6 @@ steps:
AuthAKVName: ${{ parameters.signingIdentity.akvName }}
AuthCertName: ${{ parameters.signingIdentity.authCertName }}
AuthSignCertName: ${{ parameters.signingIdentity.signCertName }}
UseMSIAuthentication: ${{ coalesce(parameters.signingIdentity.useManagedIdentity, 'false') }}
EsrpClientId: ${{ parameters.signingIdentity.clientId }}
${{ insert }}: ${{ parameters.inputs }}

View File

@@ -0,0 +1,6 @@
steps:
- pwsh: |-
nuget install Microsoft.Windows.Terminal.Versioning -OutputDirectory _versioning
$VersionRoot = (Get-Item _versioning\Microsoft.Windows.*).FullName
& "$VersionRoot\build\Setup.ps1" -ProjectDirectory "$(Build.SourcesDirectory)" -Verbose
displayName: Set up versioning via M.W.T.V

View File

@@ -1,6 +1,6 @@
$VSInstances = ([xml](& 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -include packages -format xml))
$VSPackages = $VSInstances.instances.instance.packages.package
$LatestVCPackage = ($VSInstances.instances.instance.packages.package | ? { $_.id -eq "Microsoft.VisualCpp.CRT.Source" })
$LatestVCPackage = ($VSInstances.instances.instance.packages.package | ? { $_.id -eq "Microsoft.VisualCpp.Tools.Core" })
$LatestVCToolsVersion = $LatestVCPackage.version;
Write-Output "Latest VCToolsVersion: $LatestVCToolsVersion"

View File

@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88c12148..967b53dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -260,7 +260,7 @@ if (FMT_MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio")
join(netfxpath
"C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\"
".NETFramework\\v4.0")
- file(WRITE run-msbuild.bat "
+ file(WRITE "${CMAKE_BINARY_DIR}/run-msbuild.bat" "
${MSBUILD_SETUP}
${CMAKE_MAKE_PROGRAM} -p:FrameworkPathOverride=\"${netfxpath}\" %*")
endif ()

View File

@@ -0,0 +1,38 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO fmtlib/fmt
REF "${VERSION}"
SHA512 573b7de1bd224b7b1b60d44808a843db35d4bc4634f72a9edcb52cf68e99ca66c744fd5d5c97b4336ba70b94abdabac5fc253b245d0d5cd8bbe2a096bf941e39
HEAD_REF master
PATCHES
fix-write-batch.patch
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DFMT_CMAKE_DIR=share/fmt
-DFMT_TEST=OFF
-DFMT_DOC=OFF
-DFMT_PEDANTIC=ON
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup()
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/fmt/base.h"
"defined(FMT_SHARED)"
"1"
)
endif()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@@ -0,0 +1,8 @@
The package fmt provides CMake targets:
find_package(fmt CONFIG REQUIRED)
target_link_libraries(main PRIVATE fmt::fmt)
# Or use the header-only version
find_package(fmt CONFIG REQUIRED)
target_link_libraries(main PRIVATE fmt::fmt-header-only)

View File

@@ -0,0 +1,17 @@
{
"name": "fmt",
"version": "11.1.4",
"description": "{fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams.",
"homepage": "https://github.com/fmtlib/fmt",
"license": "MIT",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@@ -380,7 +380,7 @@ Here's the AppxManifest we're using:
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.18362.0" MaxVersionTested="10.0.22621.0" />
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.18362.0" MaxVersionTested="10.0.26100.0" />
<PackageDependency Name="Microsoft.VCLibs.140.00.Debug" MinVersion="14.0.27023.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
<PackageDependency Name="Microsoft.VCLibs.140.00.Debug.UWPDesktop" MinVersion="14.0.27027.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
</Dependencies>
@@ -517,7 +517,7 @@ This is because of a few key lines we already put in the appxmanifest:
```xml
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.18362.0" MaxVersionTested="10.0.22621.0" />
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.18362.0" MaxVersionTested="10.0.26100.0" />
<PackageDependency Name="Microsoft.VCLibs.140.00.Debug" MinVersion="14.0.27023.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
<PackageDependency Name="Microsoft.VCLibs.140.00.Debug.UWPDesktop" MinVersion="14.0.27027.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
</Dependencies>

View File

@@ -35,7 +35,8 @@
"enum": [
"Windows.Terminal.Wsl",
"Windows.Terminal.Azure",
"Windows.Terminal.PowershellCore"
"Windows.Terminal.PowershellCore",
"Windows.Terminal.VisualStudio"
],
"type": "string"
},
@@ -2355,11 +2356,25 @@
"description": "When set to true, the terminal will focus the pane on mouse hover.",
"type": "boolean"
},
"compatibility.allowHeadless": {
"default": false,
"description": "When set to true, Windows Terminal will run in the background. This allows globalSummon and quakeMode actions to work even when no windows are open.",
"type": "boolean"
},
"compatibility.isolatedMode": {
"default": false,
"description": "When set to true, Terminal windows will not be able to interact with each other (including global hotkeys, tab drag/drop, running commandlines in existing windows, etc.). This is a compatibility escape hatch for users who are running into certain windowing issues.",
"type": "boolean"
},
"compatibility.textMeasurement": {
"default": "graphemes",
"description": "This changes the way incoming text is grouped into cells. The \"graphemes\" option is the most modern and Unicode-correct way to do so, while \"wcswidth\" is a common approach on UNIX, and \"console\" replicates the way it used to work on Windows.",
"enum": [
"graphemes",
"wcswidth",
"console"
]
},
"copyFormatting": {
"default": true,
"description": "When set to `true`, the color and font formatting of selected text is also copied to your clipboard. When set to `false`, only plain text is copied to your clipboard. An array of specific formats can also be used. Supported array values include `html` and `rtf`. Plain text is always copied.",
@@ -2458,11 +2473,6 @@
"minimum": 1,
"type": "integer"
},
"startOnUserLogin": {
"default": false,
"description": "When set to true, this enables the launch of Terminal at startup. Setting this to false will disable the startup task entry. If the Terminal startup task entry is disabled either by org policy or by user action this setting will have no effect.",
"type": "boolean"
},
"firstWindowPreference": {
"default": "defaultProfile",
"description": "Defines what behavior the terminal takes when it starts. \"defaultProfile\" will have the terminal launch with one tab of the default profile, and \"persistedWindowLayout\" will cause the terminal to save its layout on close and reload it on open.",
@@ -2699,6 +2709,16 @@
"description": "When set to true, when opening a new tab or pane it will get reloaded environment variables.",
"type": "boolean"
},
"compatibility.allowDECRQCRA": {
"default": false,
"description": "When set to true, the terminal will support the DECRQCRA (Request Checksum of Rectangular Area) escape sequence.",
"type": "boolean"
},
"compatibility.allowOSC52": {
"default": true,
"description": "When set to true, VT applications will be allowed to set the contents of the local clipboard using OSC 52 (Manipulate Selection Data).",
"type": "boolean"
},
"unfocusedAppearance": {
"$ref": "#/$defs/AppearanceConfig",
"description": "Sets the appearance of the terminal when it is unfocused.",
@@ -3079,6 +3099,17 @@
"default": false,
"description": "When set to true, the window will have an acrylic material background. When set to false, the window will have a plain, untextured background.",
"type": "boolean"
},
"pathTranslationStyle": {
"default": "none",
"description": "Controls how file paths are transformed when they are dragged and dropped on the terminal. Possible values are \"none\", \"wsl\", \"cygwin\" and \"msys2\".",
"enum": [
"none",
"wsl",
"cygwin",
"msys2"
],
"type": "string"
}
}
},

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- (c) 2024 Microsoft Corporation -->
<policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.0" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<policyNamespaces>
<target prefix="terminal" namespace="Microsoft.Policies.WindowsTerminal" />
<using prefix="windows" namespace="Microsoft.Policies.Windows" />
</policyNamespaces>
<resources minRequiredRevision="1.0" />
<supportedOn>
<definitions>
<definition name="SUPPORTED_WindowsTerminal_1_21" displayName="$(string.SUPPORTED_WindowsTerminal_1_21)" />
<definition name="SUPPORTED_DefaultTerminalApplication" displayName="$(string.SUPPORTED_DefaultTerminalApplication)" />
</definitions>
</supportedOn>
<categories>
<category name="WindowsTerminal" displayName="$(string.WindowsTerminal)">
<parentCategory ref="windows:WindowsComponents" />
</category>
</categories>
<policies>
<policy name="DisabledProfileSources" class="Both" displayName="$(string.DisabledProfileSources)" explainText="$(string.DisabledProfileSourcesText)" presentation="$(presentation.DisabledProfileSources)" key="Software\Policies\Microsoft\Windows Terminal">
<parentCategory ref="WindowsTerminal" />
<supportedOn ref="SUPPORTED_WindowsTerminal_1_21" />
<elements>
<multiText id="DisabledProfileSources" valueName="DisabledProfileSources" required="true" />
</elements>
</policy>
<policy name="DefaultTerminalApplication" class="User" displayName="$(string.DefaultTerminalApplication)" explainText="$(string.DefaultTerminalApplicationText)" presentation="$(presentation.TermAppSelection)" key="Console\%%Startup">
<parentCategory ref="WindowsTerminal" />
<supportedOn ref="SUPPORTED_DefaultTerminalApplication" />
<elements>
<enum id="TermAppSelect" required="true" valueName="DelegationTerminal">
<item displayName="$(string.TermAppAutomatic)">
<value>
<string>{00000000-0000-0000-0000-000000000000}</string>
</value>
<valueList>
<item key="Console\%%Startup" valueName="DelegationConsole">
<value>
<string>{00000000-0000-0000-0000-000000000000}</string>
</value>
</item>
</valueList>
</item>
<item displayName="$(string.TermAppConsoleHost)">
<value>
<string>{B23D10C0-E52E-411E-9D5B-C09FDF709C7D}</string>
</value>
<valueList>
<item key="Console\%%Startup" valueName="DelegationConsole">
<value>
<string>{B23D10C0-E52E-411E-9D5B-C09FDF709C7D}</string>
</value>
</item>
</valueList>
</item>
<item displayName="$(string.TermAppWindowsTerminal)">
<value>
<string>{E12CFF52-A866-4C77-9A90-F570A7AA2C6B}</string>
</value>
<valueList>
<item key="Console\%%Startup" valueName="DelegationConsole">
<value>
<string>{2EACA947-7F5F-4CFA-BA87-8F7FBEEFBE69}</string>
</value>
</item>
</valueList>
</item>
<item displayName="$(string.TermAppWindowsTerminalPreview)">
<value>
<string>{86633F1F-6454-40EC-89CE-DA4EBA977EE2}</string>
</value>
<valueList>
<item key="Console\%%Startup" valueName="DelegationConsole">
<value>
<string>{06EC847C-C0A5-46B8-92CB-7C92F6E35CD5}</string>
</value>
</item>
</valueList>
</item>
</enum>
</elements>
</policy>
</policies>
</policyDefinitions>

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- (c) 2024 Microsoft Corporation -->
<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.0" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<displayName>Windows Terminal</displayName>
<description>Windows Terminal</description>
<resources>
<stringTable>
<string id="WindowsTerminal">Windows Terminal</string>
<string id="SUPPORTED_WindowsTerminal_1_21">At least Windows Terminal 1.21</string>
<string id="SUPPORTED_DefaultTerminalApplication">At least Windows 11 22H2 or Windows 10 22H2 (Build 19045.3031, KB5026435) with Windows Terminal 1.17</string>
<string id="DisabledProfileSources">Disabled Profile Sources</string>
<string id="DisabledProfileSourcesText">Profiles will not be generated from any sources listed here. Source names can be arbitrary strings. Potential candidates can be found as the "source" property on profile definitions in Windows Terminal's settings.json file.
Common sources are:
- Windows.Terminal.Azure
- Windows.Terminal.PowershellCore
- Windows.Terminal.Wsl
For instance, setting this policy to Windows.Terminal.Wsl will disable the builtin WSL integration of Windows Terminal.
Note: Existing profiles will disappear from Windows Terminal after adding their source to this policy.</string>
<string id="DefaultTerminalApplication">Default terminal application</string>
<string id="DefaultTerminalApplicationText">Select the default terminal application used in Windows.
If you select Windows Terminal Preview and it is not installed the system will fallback to the legacy Windows Console Host. (Please note that the settings interfaces showing "Let windows decide" in this case as configuration.)</string>
<string id="TermAppAutomatic">Automatic selection (Windows Terminal, if available)</string>
<string id="TermAppConsoleHost">Windows Console Host (legacy)</string>
<string id="TermAppWindowsTerminal">Windows Terminal</string>
<string id="TermAppWindowsTerminalPreview">Windows Terminal Preview (if available)</string>
</stringTable>
<presentationTable>
<presentation id="DisabledProfileSources">
<multiTextBox refId="DisabledProfileSources">List of disabled sources (one per line)</multiTextBox>
</presentation>
<presentation id="TermAppSelection">
<dropdownList refId="TermAppSelect" noSort="true" defaultItem="0">Select from the following options:</dropdownList>
</presentation>
</presentationTable>
</resources>
</policyDefinitionResources>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -8,5 +8,5 @@ Please consult the [license](https://raw.githubusercontent.com/microsoft/cascadi
### Fonts Included
* Cascadia Code, Cascadia Mono (2404.23)
* from microsoft/cascadia-code@1034791e5fc6e060a448d2b29cd94a6c683edb36
* Cascadia Code, Cascadia Mono (2407.24)
* from microsoft/cascadia-code@56bcca3f2c1e4cb19458954f0e2bb4635960df91

View File

@@ -27,7 +27,7 @@
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
</Dependencies>
<Resources>

View File

@@ -426,7 +426,7 @@ OutputCellIterator ROW::WriteCells(OutputCellIterator it, const til::CoordType c
THROW_HR_IF(E_INVALIDARG, limitRight.value_or(0) >= size());
// If we're given a right-side column limit, use it. Otherwise, the write limit is the final column index available in the char row.
const auto finalColumnInRow = limitRight.value_or(size() - 1);
const auto finalColumnInRow = gsl::narrow_cast<uint16_t>(limitRight.value_or(size() - 1));
auto currentColor = it->TextAttr();
uint16_t colorUses = 0;

View File

@@ -16,7 +16,7 @@ bool Search::IsStale(const Microsoft::Console::Render::IRenderData& renderData,
_lastMutationId != renderData.GetTextBuffer().GetLastMutationId();
}
bool Search::Reset(Microsoft::Console::Render::IRenderData& renderData, const std::wstring_view& needle, SearchFlag flags, bool reverse)
void Search::Reset(Microsoft::Console::Render::IRenderData& renderData, const std::wstring_view& needle, SearchFlag flags, bool reverse)
{
const auto& textBuffer = renderData.GetTextBuffer();
@@ -30,15 +30,15 @@ bool Search::Reset(Microsoft::Console::Render::IRenderData& renderData, const st
_results = std::move(result).value_or(std::vector<til::point_span>{});
_index = reverse ? gsl::narrow_cast<ptrdiff_t>(_results.size()) - 1 : 0;
_step = reverse ? -1 : 1;
return true;
}
void Search::MoveToCurrentSelection()
{
if (_renderData->IsSelectionActive())
{
MoveToPoint(_renderData->GetTextBuffer().ScreenToBufferPosition(_renderData->GetSelectionAnchor()));
}
else if (const auto span = _renderData->GetSearchHighlightFocused())
{
MoveToPoint(_step > 0 ? span->start : span->end);
}
}
void Search::MoveToPoint(const til::point anchor) noexcept

View File

@@ -36,9 +36,8 @@ public:
Search() = default;
bool IsStale(const Microsoft::Console::Render::IRenderData& renderData, const std::wstring_view& needle, SearchFlag flags) const noexcept;
bool Reset(Microsoft::Console::Render::IRenderData& renderData, const std::wstring_view& needle, SearchFlag flags, bool reverse);
void Reset(Microsoft::Console::Render::IRenderData& renderData, const std::wstring_view& needle, SearchFlag flags, bool reverse);
void MoveToCurrentSelection();
void MoveToPoint(til::point anchor) noexcept;
void MovePastPoint(til::point anchor) noexcept;
void FindNext(bool reverse) noexcept;

View File

@@ -451,14 +451,9 @@ size_t TextBuffer::FitTextIntoColumns(const std::wstring_view& chars, til::Coord
cwd.GraphemeNext(state, chars);
col += state.width;
// If we ran out of columns, we need to always return `columnLimit` and not `cols`,
// because if we tried inserting a wide glyph into just 1 remaining column it will
// fail to fit, but that remaining column still has been used up. When the caller sees
// `columns == columnLimit` they will line-wrap and continue inserting into the next row.
if (col > columnLimit)
{
columns = columnLimit;
return dist;
break;
}
dist += state.len;
@@ -466,7 +461,7 @@ size_t TextBuffer::FitTextIntoColumns(const std::wstring_view& chars, til::Coord
// But if we simply ran out of text we just need to return the actual number of columns.
columns = col;
return chars.size();
return dist;
}
// Pretend as if `position` is a regular cursor in the TextBuffer.

View File

@@ -38,7 +38,7 @@
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
</Dependencies>
<Resources>

View File

@@ -38,7 +38,7 @@
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
</Dependencies>
<Resources>

View File

@@ -39,7 +39,7 @@
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
</Dependencies>
<Resources>

View File

@@ -39,7 +39,7 @@
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
</Dependencies>
<Resources>

View File

@@ -154,7 +154,7 @@
<comment>{Locked=qps-ploc,qps-ploca,qps-plocm}</comment>
</data>
<data name="AppDescription" xml:space="preserve">
<value>Nová Terminál Windows</value>
<value>Nový Terminál Windows</value>
</data>
<data name="AppDescriptionPre" xml:space="preserve">
<value>Terminál Windows s náhledem připravovaných funkcí</value>
@@ -164,11 +164,11 @@
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the Canary version of Windows Terminal. Please mark one of the characters to be an accelerator key.</comment>
</data>
<data name="ShellExtension_OpenInTerminalMenuItem_Preview" xml:space="preserve">
<value>Otevřít náhled &amp;aplikace Terminal</value>
<value>Otevřít &amp;náhled Terminálu</value>
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the Preview version of Windows Terminal. Please mark one of the characters to be an accelerator key.</comment>
</data>
<data name="ShellExtension_OpenInTerminalMenuItem" xml:space="preserve">
<value>Otevřít v aplikaci &amp;Terminal</value>
<value>Otevřít v &amp;Terminálu</value>
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the non-preview version of Windows Terminal. Please mark one of the characters to be an accelerator key.</comment>
</data>
</root>

View File

@@ -118,7 +118,7 @@ namespace winrt::TerminalApp::implementation
void TerminalPage::_HandleCloseWindow(const IInspectable& /*sender*/,
const ActionEventArgs& args)
{
CloseRequested.raise(nullptr, nullptr);
CloseWindow();
args.Handled(true);
}

View File

@@ -83,8 +83,6 @@ static winrt::hstring _GetErrorText(SettingsLoadErrors error)
return _GetMessageText(static_cast<uint32_t>(error), settingsLoadErrorsLabels);
}
static constexpr std::wstring_view StartupTaskName = L"StartTerminalOnLoginTask";
namespace winrt::TerminalApp::implementation
{
// Function Description:
@@ -337,8 +335,16 @@ namespace winrt::TerminalApp::implementation
void AppLogic::_ApplyLanguageSettingChange() noexcept
try
{
const auto language = _settings.GlobalSettings().Language();
if (!IsPackaged())
{
if (!language.empty())
{
// We cannot use the packaged app API, PrimaryLanguageOverride, but we *can* tell the resource loader
// to set the Language for all loaded resources to the user's preferred language.
winrt::Windows::ApplicationModel::Resources::Core::ResourceContext::SetGlobalQualifierValue(L"Language", language);
}
return;
}
@@ -346,8 +352,6 @@ namespace winrt::TerminalApp::implementation
// NOTE: PrimaryLanguageOverride throws if this instance is unpackaged.
const auto primaryLanguageOverride = ApplicationLanguages::PrimaryLanguageOverride();
const auto language = _settings.GlobalSettings().Language();
if (primaryLanguageOverride != language)
{
ApplicationLanguages::PrimaryLanguageOverride(language);
@@ -355,40 +359,6 @@ namespace winrt::TerminalApp::implementation
}
CATCH_LOG()
safe_void_coroutine AppLogic::_ApplyStartupTaskStateChange()
try
{
// First, make sure we're running in a packaged context. This method
// won't work, and will crash mysteriously if we're running unpackaged.
if (!IsPackaged())
{
co_return;
}
const auto tryEnableStartupTask = _settings.GlobalSettings().StartOnUserLogin();
const auto task = co_await StartupTask::GetAsync(StartupTaskName);
switch (task.State())
{
case StartupTaskState::Disabled:
if (tryEnableStartupTask)
{
co_await task.RequestEnableAsync();
}
break;
case StartupTaskState::DisabledByUser:
// TODO: GH#6254: define UX for other StartupTaskStates
break;
case StartupTaskState::Enabled:
if (!tryEnableStartupTask)
{
task.Disable();
}
break;
}
}
CATCH_LOG();
// Method Description:
// - Reloads the settings from the settings.json file.
// - When this is called the first time, this initializes our settings. See
@@ -448,7 +418,6 @@ namespace winrt::TerminalApp::implementation
// TerminalSettings object.
_ApplyLanguageSettingChange();
_ApplyStartupTaskStateChange();
_ProcessLazySettingsChanges();
auto warnings{ winrt::multi_threaded_vector<SettingsLoadWarnings>() };
@@ -475,7 +444,6 @@ namespace winrt::TerminalApp::implementation
// Both LoadSettings and ReloadSettings are supposed to call this function,
// but LoadSettings skips it, so that the UI starts up faster.
// Now that the UI is present we can do them with a less significant UX impact.
_ApplyStartupTaskStateChange();
_ProcessLazySettingsChanges();
FILETIME creationTime, exitTime, kernelTime, userTime, now;

View File

@@ -103,7 +103,6 @@ namespace winrt::TerminalApp::implementation
const Microsoft::Terminal::Settings::Model::WindowingMode& windowingBehavior);
void _ApplyLanguageSettingChange() noexcept;
safe_void_coroutine _ApplyStartupTaskStateChange();
[[nodiscard]] HRESULT _TryLoadSettings() noexcept;
void _ProcessLazySettingsChanges();

View File

@@ -359,7 +359,7 @@ namespace winrt::TerminalApp::implementation
_switchToMode(CommandPaletteMode::CommandlineMode);
e.Handled(true);
}
else if (key == VirtualKey::C && ctrlDown)
else if ((key == VirtualKey::C || key == VirtualKey::Insert) && ctrlDown)
{
_searchBox().CopySelectionToClipboard();
e.Handled(true);

View File

@@ -23,6 +23,27 @@
<UserControl.Resources>
<ResourceDictionary>
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="2" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<!-- ParsedCommandLineText styles -->
<Style x:Key="ParsedCommandLineBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}" />
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}" />
</Style>
<DataTemplate x:Key="ListItemTemplate"
x:DataType="local:FilteredCommand">
<ListViewItem HorizontalContentAlignment="Stretch"
@@ -69,12 +90,12 @@
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
Background="{ThemeResource FlyoutPresenterBackground}"
Style="{ThemeResource KeyChordBorderStyle}"
Style="{StaticResource KeyChordBorderStyle}"
Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(Item.KeyChordText), Mode=OneWay}">
<TextBlock AutomationProperties.AccessibilityView="Raw"
FontSize="12"
Style="{ThemeResource KeyChordTextBlockStyle}"
Style="{StaticResource KeyChordTextBlockStyle}"
Text="{x:Bind Item.KeyChordText, Mode=OneWay}" />
</Border>
</Grid>
@@ -118,12 +139,12 @@
HorizontalAlignment="Right"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
Style="{ThemeResource KeyChordBorderStyle}"
Style="{StaticResource KeyChordBorderStyle}"
Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(Item.KeyChordText), Mode=OneWay}">
<TextBlock AutomationProperties.AccessibilityView="Raw"
FontSize="12"
Style="{ThemeResource KeyChordTextBlockStyle}"
Style="{StaticResource KeyChordTextBlockStyle}"
Text="{x:Bind Item.KeyChordText, Mode=OneWay}" />
</Border>
@@ -205,6 +226,13 @@
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsInputBroadcastActive, Mode=OneWay}" />
</StackPanel>
<Ellipse Grid.Column="4"
Width="8"
Height="8"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{x:Bind mtu:Converters.ColorToBrush(Item.(local:TabPaletteItem.TabStatus).TabColorIndicator), Mode=OneWay}" />
</Grid>
</DataTemplate>
@@ -212,79 +240,6 @@
GeneralItemTemplate="{StaticResource GeneralItemTemplate}"
NestedItemTemplate="{StaticResource NestedItemTemplate}"
TabItemTemplate="{StaticResource TabItemTemplate}" />
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="2" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<!-- ParsedCommandLineText styles -->
<Style x:Key="ParsedCommandLineBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}" />
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}" />
</Style>
<Style x:Key="ParsedCommandLineTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="2" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<!-- ParsedCommandLineText styles -->
<Style x:Key="ParsedCommandLineBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}" />
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}" />
</Style>
<Style x:Key="ParsedCommandLineTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<!-- KeyChordText styles (use XAML defaults for High Contrast theme) -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Border" />
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock" />
<!-- ParsedCommandLineText styles (use XAML defaults for High Contrast theme) -->
<Style x:Key="ParsedCommandLineBorderStyle"
TargetType="Border" />
<Style x:Key="ParsedCommandLineTextBlockStyle"
TargetType="TextBlock" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</UserControl.Resources>
@@ -368,7 +323,7 @@
Padding="16,12"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Style="{ThemeResource ParsedCommandLineBorderStyle}"
Style="{StaticResource ParsedCommandLineBorderStyle}"
Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(ParsedCommandLineText), Mode=OneWay}">
<ScrollViewer MaxHeight="200"

View File

@@ -60,9 +60,12 @@ namespace winrt::Microsoft::TerminalApp::implementation
DebugTapConnection::DebugTapConnection(ITerminalConnection wrappedConnection)
{
_outputRevoker = wrappedConnection.TerminalOutput(winrt::auto_revoke, { this, &DebugTapConnection::_OutputHandler });
_stateChangedRevoker = wrappedConnection.StateChanged(winrt::auto_revoke, [this](auto&& /*s*/, auto&& /*e*/) {
StateChanged.raise(*this, nullptr);
_outputRevoker = wrappedConnection.TerminalOutput(winrt::auto_revoke, { get_weak(), &DebugTapConnection::_OutputHandler });
_stateChangedRevoker = wrappedConnection.StateChanged(winrt::auto_revoke, [weak = get_weak()](auto&& /*s*/, auto&& /*e*/) {
if (const auto self = weak.get())
{
self->StateChanged.raise(*self, nullptr);
}
});
_wrappedConnection = wrappedConnection;
}

View File

@@ -162,10 +162,9 @@ winrt::com_ptr<IShellLinkW> Jumplist::_createShellLink(const std::wstring_view n
const std::wstring iconPath{ path.substr(0, commaPosition) };
// We dont want the comma included so add 1 to its position
int iconIndex = til::to_int(path.substr(commaPosition + 1));
if (iconIndex != til::to_int_error)
if (const auto iconIndex = til::parse_signed<int>(path.substr(commaPosition + 1)))
{
THROW_IF_FAILED(sh->SetIconLocation(iconPath.data(), iconIndex));
THROW_IF_FAILED(sh->SetIconLocation(iconPath.data(), *iconIndex));
}
}
else if (til::ends_with(path, L"exe") || til::ends_with(path, L"dll"))

View File

@@ -2956,13 +2956,13 @@ bool Pane::ContainsReadOnly() const
// - <none>
void Pane::CollectTaskbarStates(std::vector<winrt::TerminalApp::TaskbarState>& states)
{
if (_IsLeaf())
if (_content)
{
auto tbState{ winrt::make<winrt::TerminalApp::implementation::TaskbarState>(_content.TaskbarState(),
_content.TaskbarProgress()) };
states.push_back(tbState);
}
else
else if (_firstChild && _secondChild)
{
_firstChild->CollectTaskbarStates(states);
_secondChild->CollectTaskbarStates(states);

View File

@@ -154,7 +154,7 @@
<comment>{Locked=qps-ploc,qps-ploca,qps-plocm}</comment>
</data>
<data name="AppDescription" xml:space="preserve">
<value>Nová Terminál Windows</value>
<value>Nový Terminál Windows</value>
</data>
<data name="AppDescriptionPre" xml:space="preserve">
<value>Terminál Windows s náhledem připravovaných funkcí</value>
@@ -164,11 +164,11 @@
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the Canary version of Windows Terminal. Please mark one of the characters to be an accelerator key.</comment>
</data>
<data name="ShellExtension_OpenInTerminalMenuItem_Preview" xml:space="preserve">
<value>Otevřít náhled &amp;aplikace Terminal</value>
<value>Otevřít &amp;náhled Terminálu</value>
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the Preview version of Windows Terminal. Please mark one of the characters to be an accelerator key.</comment>
</data>
<data name="ShellExtension_OpenInTerminalMenuItem" xml:space="preserve">
<value>Otevřít v aplikaci &amp;Terminal</value>
<value>Otevřít v &amp;Terminálu</value>
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the non-preview version of Windows Terminal. Please mark one of the characters to be an accelerator key.</comment>
</data>
</root>

View File

@@ -192,6 +192,9 @@
<data name="TabCloseSubMenu" xml:space="preserve">
<value>Schließen</value>
</data>
<data name="TabMoveSubMenu" xml:space="preserve">
<value>Registerkarte verschieben</value>
</data>
<data name="TabCloseAfter" xml:space="preserve">
<value>Tabs nach rechts schließen</value>
</data>
@@ -936,4 +939,10 @@
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Bereich schließen</value>
</data>
<data name="TabMoveLeft" xml:space="preserve">
<value>Nach links</value>
</data>
<data name="TabMoveRight" xml:space="preserve">
<value>Nach rechts</value>
</data>
</root>

View File

@@ -193,6 +193,9 @@
<data name="TabCloseSubMenu" xml:space="preserve">
<value>Close</value>
</data>
<data name="TabMoveSubMenu" xml:space="preserve">
<value>Move tab</value>
</data>
<data name="TabCloseAfter" xml:space="preserve">
<value>Close tabs to the right</value>
</data>
@@ -941,4 +944,10 @@
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Close pane</value>
</data>
</root>
<data name="TabMoveLeft" xml:space="preserve">
<value>Move left</value>
</data>
<data name="TabMoveRight" xml:space="preserve">
<value>Move right</value>
</data>
</root>

View File

@@ -189,6 +189,9 @@
<data name="TabCloseSubMenu" xml:space="preserve">
<value>Cerrar</value>
</data>
<data name="TabMoveSubMenu" xml:space="preserve">
<value>Mover pestaña</value>
</data>
<data name="TabCloseAfter" xml:space="preserve">
<value>Cerrar las pestañas de la derecha</value>
</data>
@@ -933,4 +936,10 @@
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Cerrar panel</value>
</data>
<data name="TabMoveLeft" xml:space="preserve">
<value>Mover a la izquierda</value>
</data>
<data name="TabMoveRight" xml:space="preserve">
<value>Mover a la derecha</value>
</data>
</root>

View File

@@ -189,6 +189,9 @@
<data name="TabCloseSubMenu" xml:space="preserve">
<value>Fermer</value>
</data>
<data name="TabMoveSubMenu" xml:space="preserve">
<value>Déplacer longlet</value>
</data>
<data name="TabCloseAfter" xml:space="preserve">
<value>Fermer les onglets à droite</value>
</data>
@@ -933,4 +936,10 @@
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Fermer le volet</value>
</data>
<data name="TabMoveLeft" xml:space="preserve">
<value>Déplacer vers la gauche</value>
</data>
<data name="TabMoveRight" xml:space="preserve">
<value>Déplacer vers la droite</value>
</data>
</root>

View File

@@ -189,6 +189,9 @@
<data name="TabCloseSubMenu" xml:space="preserve">
<value>Chiudi</value>
</data>
<data name="TabMoveSubMenu" xml:space="preserve">
<value>Sposta scheda</value>
</data>
<data name="TabCloseAfter" xml:space="preserve">
<value>Chiudi schede a destra</value>
</data>
@@ -933,4 +936,10 @@
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Chiudi il riquadro</value>
</data>
<data name="TabMoveLeft" xml:space="preserve">
<value>Sposta a sinistra</value>
</data>
<data name="TabMoveRight" xml:space="preserve">
<value>Sposta a destra</value>
</data>
</root>

View File

@@ -190,6 +190,9 @@
<data name="TabCloseSubMenu" xml:space="preserve">
<value>閉じる</value>
</data>
<data name="TabMoveSubMenu" xml:space="preserve">
<value>タブの移動</value>
</data>
<data name="TabCloseAfter" xml:space="preserve">
<value>タブを右側に閉じる</value>
</data>
@@ -203,7 +206,7 @@
<value>ウィンドウを閉じる</value>
</data>
<data name="SplitTabText" xml:space="preserve">
<value>[分割] タブ</value>
<value>タブを分割</value>
</data>
<data name="SplitPaneText" xml:space="preserve">
<value>ウィンドウを分割する</value>
@@ -221,7 +224,7 @@
<value>リセット</value>
</data>
<data name="RenameTabText" xml:space="preserve">
<value>[名前の変更] タブ</value>
<value>タブ名を変更</value>
</data>
<data name="DuplicateTabText" xml:space="preserve">
<value>タブを複製する</value>
@@ -934,4 +937,10 @@
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>ウィンドウを閉じる</value>
</data>
<data name="TabMoveLeft" xml:space="preserve">
<value>左へ移動</value>
</data>
<data name="TabMoveRight" xml:space="preserve">
<value>右へ移動</value>
</data>
</root>

View File

@@ -118,7 +118,7 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="InitialJsonParseErrorText" xml:space="preserve">
<value>파일에서 설정을 로드 하지 못했습니다. 후행 쉼표를 포함여 구문 오류가 있는지 확인 합니다.</value>
<value>파일에서 설정을 로드하지 못했습니다. 후행 쉼표를 포함여 구문 오류가 있는지 확인합니다.</value>
</data>
<data name="MissingDefaultProfileText" xml:space="preserve">
<value>첫 번째 프로필을 사용하여 프로필 목록에서 기본 프로필을 찾을 수 없습니다. "defaultProfile"이 프로필 중 하나의 GUID와 일치하는지 확인합니다.</value>
@@ -189,6 +189,9 @@
<data name="TabCloseSubMenu" xml:space="preserve">
<value>닫기</value>
</data>
<data name="TabMoveSubMenu" xml:space="preserve">
<value>탭 이동</value>
</data>
<data name="TabCloseAfter" xml:space="preserve">
<value>오른쪽에 있는 탭 닫기</value>
</data>
@@ -319,7 +322,7 @@
<value>상위 창의 백분율로 크기를 지정합니다. (0,1) 사이 값만 유효합니다.</value>
</data>
<data name="CmdNewTabDesc" xml:space="preserve">
<value>새 작업 만들기</value>
<value>새 만들기</value>
</data>
<data name="CmdNTDesc" xml:space="preserve">
<value>"new-tab" 하위 명령의 별칭입니다.</value>
@@ -524,7 +527,7 @@
<value>경고</value>
</data>
<data name="CloseReadOnlyDialog.Content" xml:space="preserve">
<value>읽기 전용 터미널을 닫으려고 합니다. 계속하시겠어요?</value>
<value>읽기 전용 터미널을 닫으려고 합니다. 계속하시겠습니까?</value>
</data>
<data name="LargePasteDialog.CloseButtonText" xml:space="preserve">
<value>취소</value>
@@ -616,7 +619,7 @@
<comment>{0} will be replaced with a number.</comment>
</data>
<data name="CrimsonColorButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>홍</value>
<value>홍</value>
</data>
<data name="SteelBlueColorButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>강철색</value>
@@ -933,4 +936,10 @@
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>창 닫기</value>
</data>
<data name="TabMoveLeft" xml:space="preserve">
<value>왼쪽으로 이동</value>
</data>
<data name="TabMoveRight" xml:space="preserve">
<value>오른쪽으로 이동</value>
</data>
</root>

View File

@@ -189,6 +189,9 @@
<data name="TabCloseSubMenu" xml:space="preserve">
<value>Fechar</value>
</data>
<data name="TabMoveSubMenu" xml:space="preserve">
<value>Mover guia</value>
</data>
<data name="TabCloseAfter" xml:space="preserve">
<value>Fechar guias à direita</value>
</data>
@@ -933,4 +936,10 @@
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Fechar o painel</value>
</data>
<data name="TabMoveLeft" xml:space="preserve">
<value>Mover para a esquerda</value>
</data>
<data name="TabMoveRight" xml:space="preserve">
<value>Mover para a direita</value>
</data>
</root>

View File

@@ -193,6 +193,9 @@
<data name="TabCloseSubMenu" xml:space="preserve">
<value>Ćļôŝέ !</value>
</data>
<data name="TabMoveSubMenu" xml:space="preserve">
<value>Μòνë ťäв !!</value>
</data>
<data name="TabCloseAfter" xml:space="preserve">
<value>Ċĺοşέ ţаъş ťό ŧђé яΐğђт !!! !!! </value>
</data>
@@ -941,4 +944,10 @@
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Ćℓǿŝé ρдʼné !!!</value>
</data>
</root>
<data name="TabMoveLeft" xml:space="preserve">
<value>Μŏνê ĺэƒť !!!</value>
</data>
<data name="TabMoveRight" xml:space="preserve">
<value>Мóνε яίģнŧ !!!</value>
</data>
</root>

View File

@@ -193,6 +193,9 @@
<data name="TabCloseSubMenu" xml:space="preserve">
<value>Ćļôŝέ !</value>
</data>
<data name="TabMoveSubMenu" xml:space="preserve">
<value>Μòνë ťäв !!</value>
</data>
<data name="TabCloseAfter" xml:space="preserve">
<value>Ċĺοşέ ţаъş ťό ŧђé яΐğђт !!! !!! </value>
</data>
@@ -941,4 +944,10 @@
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Ćℓǿŝé ρдʼné !!!</value>
</data>
</root>
<data name="TabMoveLeft" xml:space="preserve">
<value>Μŏνê ĺэƒť !!!</value>
</data>
<data name="TabMoveRight" xml:space="preserve">
<value>Мóνε яίģнŧ !!!</value>
</data>
</root>

View File

@@ -193,6 +193,9 @@
<data name="TabCloseSubMenu" xml:space="preserve">
<value>Ćļôŝέ !</value>
</data>
<data name="TabMoveSubMenu" xml:space="preserve">
<value>Μòνë ťäв !!</value>
</data>
<data name="TabCloseAfter" xml:space="preserve">
<value>Ċĺοşέ ţаъş ťό ŧђé яΐğђт !!! !!! </value>
</data>
@@ -941,4 +944,10 @@
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Ćℓǿŝé ρдʼné !!!</value>
</data>
</root>
<data name="TabMoveLeft" xml:space="preserve">
<value>Μŏνê ĺэƒť !!!</value>
</data>
<data name="TabMoveRight" xml:space="preserve">
<value>Мóνε яίģнŧ !!!</value>
</data>
</root>

View File

@@ -189,6 +189,9 @@
<data name="TabCloseSubMenu" xml:space="preserve">
<value>Закрыть</value>
</data>
<data name="TabMoveSubMenu" xml:space="preserve">
<value>Переместить вкладку</value>
</data>
<data name="TabCloseAfter" xml:space="preserve">
<value>Закрыть вкладки справа</value>
</data>
@@ -933,4 +936,10 @@
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Закрыть панель</value>
</data>
<data name="TabMoveLeft" xml:space="preserve">
<value>Влево</value>
</data>
<data name="TabMoveRight" xml:space="preserve">
<value>Вправо</value>
</data>
</root>

View File

@@ -189,6 +189,9 @@
<data name="TabCloseSubMenu" xml:space="preserve">
<value>关闭</value>
</data>
<data name="TabMoveSubMenu" xml:space="preserve">
<value>移动选项卡</value>
</data>
<data name="TabCloseAfter" xml:space="preserve">
<value>关闭右侧标签页</value>
</data>
@@ -933,4 +936,10 @@
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>关闭窗格</value>
</data>
<data name="TabMoveLeft" xml:space="preserve">
<value>左移</value>
</data>
<data name="TabMoveRight" xml:space="preserve">
<value>右移</value>
</data>
</root>

View File

@@ -189,6 +189,9 @@
<data name="TabCloseSubMenu" xml:space="preserve">
<value>關閉</value>
</data>
<data name="TabMoveSubMenu" xml:space="preserve">
<value>移動索引標籤</value>
</data>
<data name="TabCloseAfter" xml:space="preserve">
<value>關閉右側的索引標籤</value>
</data>
@@ -933,4 +936,10 @@
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>關閉窗格</value>
</data>
<data name="TabMoveLeft" xml:space="preserve">
<value>左移</value>
</data>
<data name="TabMoveRight" xml:space="preserve">
<value>右移</value>
</data>
</root>

View File

@@ -230,6 +230,7 @@
VerticalScrollMode="Enabled"
Visibility="Visible">
<TextBlock x:Name="_descriptionComment"
Margin="0,0,20,0"
IsTextSelectionEnabled="True"
TextWrapping="WrapWholeWords" />
</ScrollViewer>

View File

@@ -7,6 +7,7 @@
#include "TabBase.g.cpp"
#include "Utils.h"
#include "ColorHelper.h"
#include "../inc/WindowingBehavior.h"
using namespace winrt;
using namespace winrt::Windows::UI::Xaml;
@@ -56,10 +57,72 @@ namespace winrt::TerminalApp::implementation
tab->RequestFocusActiveControl.raise();
}
});
_AppendMoveMenuItems(contextMenuFlyout);
_AppendCloseMenuItems(contextMenuFlyout);
TabViewItem().ContextFlyout(contextMenuFlyout);
}
void TabBase::_AppendMoveMenuItems(winrt::Windows::UI::Xaml::Controls::MenuFlyout flyout)
{
auto weakThis{ get_weak() };
// Move to new window
{
Controls::FontIcon moveTabToNewWindowTabSymbol;
moveTabToNewWindowTabSymbol.FontFamily(Media::FontFamily{ L"Segoe Fluent Icons, Segoe MDL2 Assets" });
moveTabToNewWindowTabSymbol.Glyph(L"\xE8A7");
_moveToNewWindowMenuItem.Click([weakThis](auto&&, auto&&) {
if (auto tab{ weakThis.get() })
{
MoveTabArgs args{ winrt::to_hstring(NewWindow), MoveTabDirection::Forward };
ActionAndArgs actionAndArgs{ ShortcutAction::MoveTab, args };
tab->_dispatch.DoAction(*tab, actionAndArgs);
}
});
_moveToNewWindowMenuItem.Text(RS_(L"MoveTabToNewWindowText"));
_moveToNewWindowMenuItem.Icon(moveTabToNewWindowTabSymbol);
const auto moveTabToNewWindowToolTip = RS_(L"MoveTabToNewWindowToolTip");
WUX::Controls::ToolTipService::SetToolTip(_moveToNewWindowMenuItem, box_value(moveTabToNewWindowToolTip));
Automation::AutomationProperties::SetHelpText(_moveToNewWindowMenuItem, moveTabToNewWindowToolTip);
}
// Move left
{
_moveLeftMenuItem.Click([weakThis](auto&&, auto&&) {
if (auto tab{ weakThis.get() })
{
MoveTabArgs args{ hstring{}, MoveTabDirection::Backward };
ActionAndArgs actionAndArgs{ ShortcutAction::MoveTab, args };
tab->_dispatch.DoAction(*tab, actionAndArgs);
}
});
_moveLeftMenuItem.Text(RS_(L"TabMoveLeft"));
}
// Move right
{
_moveRightMenuItem.Click([weakThis](auto&&, auto&&) {
if (auto tab{ weakThis.get() })
{
MoveTabArgs args{ hstring{}, MoveTabDirection::Forward };
ActionAndArgs actionAndArgs{ ShortcutAction::MoveTab, args };
tab->_dispatch.DoAction(*tab, actionAndArgs);
}
});
_moveRightMenuItem.Text(RS_(L"TabMoveRight"));
}
// Create a sub-menu for our extended move tab items.
Controls::MenuFlyoutSubItem moveSubMenu;
moveSubMenu.Text(RS_(L"TabMoveSubMenu"));
moveSubMenu.Items().Append(_moveToNewWindowMenuItem);
moveSubMenu.Items().Append(_moveRightMenuItem);
moveSubMenu.Items().Append(_moveLeftMenuItem);
flyout.Items().Append(moveSubMenu);
}
// Method Description:
// - Append the close menu items to the context menu flyout
// Arguments:
@@ -75,7 +138,9 @@ namespace winrt::TerminalApp::implementation
_closeTabsAfterMenuItem.Click([weakThis](auto&&, auto&&) {
if (auto tab{ weakThis.get() })
{
tab->_CloseTabsAfter();
CloseTabsAfterArgs args{ tab->_TabViewIndex };
ActionAndArgs closeTabsAfter{ ShortcutAction::CloseTabsAfter, args };
tab->_dispatch.DoAction(*tab, closeTabsAfter);
}
});
_closeTabsAfterMenuItem.Text(RS_(L"TabCloseAfter"));
@@ -88,7 +153,9 @@ namespace winrt::TerminalApp::implementation
_closeOtherTabsMenuItem.Click([weakThis](auto&&, auto&&) {
if (auto tab{ weakThis.get() })
{
tab->_CloseOtherTabs();
CloseOtherTabsArgs args{ tab->_TabViewIndex };
ActionAndArgs closeOtherTabs{ ShortcutAction::CloseOtherTabs, args };
tab->_dispatch.DoAction(*tab, closeOtherTabs);
}
});
_closeOtherTabsMenuItem.Text(RS_(L"TabCloseOther"));
@@ -129,33 +196,27 @@ namespace winrt::TerminalApp::implementation
}
// Method Description:
// - Enable the Close menu items based on tab index and total number of tabs
// - Enable menu items based on tab index and total number of tabs
// Arguments:
// - <none>
// Return Value:
// - <none>
void TabBase::_EnableCloseMenuItems()
void TabBase::_EnableMenuItems()
{
// close other tabs is enabled only if there are other tabs
_closeOtherTabsMenuItem.IsEnabled(TabViewNumTabs() > 1);
// close tabs after is enabled only if there are other tabs on the right
_closeTabsAfterMenuItem.IsEnabled(TabViewIndex() < TabViewNumTabs() - 1);
}
const auto tabIndex = TabViewIndex();
const auto numOfTabs = TabViewNumTabs();
void TabBase::_CloseTabsAfter()
{
CloseTabsAfterArgs args{ _TabViewIndex };
ActionAndArgs closeTabsAfter{ ShortcutAction::CloseTabsAfter, args };
// enabled if there are other tabs
_closeOtherTabsMenuItem.IsEnabled(numOfTabs > 1);
_dispatch.DoAction(closeTabsAfter);
}
// enabled if there are other tabs on the right
_closeTabsAfterMenuItem.IsEnabled(tabIndex < numOfTabs - 1);
void TabBase::_CloseOtherTabs()
{
CloseOtherTabsArgs args{ _TabViewIndex };
ActionAndArgs closeOtherTabs{ ShortcutAction::CloseOtherTabs, args };
// enabled if not left-most tab
_moveLeftMenuItem.IsEnabled(tabIndex > 0);
_dispatch.DoAction(closeOtherTabs);
// enabled if not last tab
_moveRightMenuItem.IsEnabled(tabIndex < numOfTabs - 1);
}
void TabBase::UpdateTabViewIndex(const uint32_t idx, const uint32_t numTabs)
@@ -164,7 +225,7 @@ namespace winrt::TerminalApp::implementation
TabViewIndex(idx);
TabViewNumTabs(numTabs);
_EnableCloseMenuItems();
_EnableMenuItems();
_UpdateSwitchToTabKeyChord();
}

View File

@@ -54,6 +54,9 @@ namespace winrt::TerminalApp::implementation
winrt::Windows::UI::Xaml::FocusState _focusState{ winrt::Windows::UI::Xaml::FocusState::Unfocused };
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _closeOtherTabsMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _closeTabsAfterMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _moveToNewWindowMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _moveRightMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _moveLeftMenuItem{};
winrt::TerminalApp::ShortcutActionDispatch _dispatch;
Microsoft::Terminal::Settings::Model::IActionMapView _actionMap{ nullptr };
winrt::hstring _keyChord{};
@@ -69,10 +72,9 @@ namespace winrt::TerminalApp::implementation
virtual void _MakeTabViewItem();
void _AppendMoveMenuItems(winrt::Windows::UI::Xaml::Controls::MenuFlyout flyout);
winrt::Windows::UI::Xaml::Controls::MenuFlyoutSubItem _AppendCloseMenuItems(winrt::Windows::UI::Xaml::Controls::MenuFlyout flyout);
void _EnableCloseMenuItems();
void _CloseTabsAfter();
void _CloseOtherTabs();
void _EnableMenuItems();
void _UpdateSwitchToTabKeyChord();
void _UpdateToolTip();

View File

@@ -196,7 +196,6 @@ namespace winrt::TerminalApp::implementation
til::typed_event<IInspectable, winrt::TerminalApp::RenameWindowRequestedArgs> RenameWindowRequested;
til::typed_event<IInspectable, IInspectable> SummonWindowRequested;
til::typed_event<IInspectable, IInspectable> CloseRequested;
til::typed_event<IInspectable, IInspectable> OpenSystemMenu;
til::typed_event<IInspectable, IInspectable> QuitRequested;
til::typed_event<IInspectable, winrt::Microsoft::Terminal::Control::ShowWindowArgs> ShowWindowChanged;

View File

@@ -101,7 +101,6 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, RenameWindowRequestedArgs> RenameWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> SummonWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> CloseRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> OpenSystemMenu;
event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Control.ShowWindowArgs> ShowWindowChanged;

View File

@@ -10,7 +10,6 @@
#include "Utils.h"
#include "ColorHelper.h"
#include "AppLogic.h"
#include "../inc/WindowingBehavior.h"
using namespace winrt;
using namespace winrt::Windows::UI::Xaml;
@@ -976,6 +975,7 @@ namespace winrt::TerminalApp::implementation
// active control in this tab. We'll just recalculate the
// current color anyways.
tab->_RecalculateAndApplyTabColor();
tab->_tabStatus.TabColorIndicator(tab->GetTabColor().value_or(Windows::UI::Colors::Transparent()));
}
});
@@ -1442,23 +1442,6 @@ namespace winrt::TerminalApp::implementation
Automation::AutomationProperties::SetHelpText(splitTabMenuItem, splitTabToolTip);
}
Controls::MenuFlyoutItem moveTabToNewWindowMenuItem;
{
// "Move tab to new window"
Controls::FontIcon moveTabToNewWindowTabSymbol;
moveTabToNewWindowTabSymbol.FontFamily(Media::FontFamily{ L"Segoe Fluent Icons, Segoe MDL2 Assets" });
moveTabToNewWindowTabSymbol.Glyph(L"\xE8A7");
moveTabToNewWindowMenuItem.Click({ get_weak(), &TerminalTab::_moveTabToNewWindowClicked });
moveTabToNewWindowMenuItem.Text(RS_(L"MoveTabToNewWindowText"));
moveTabToNewWindowMenuItem.Icon(moveTabToNewWindowTabSymbol);
const auto moveTabToNewWindowToolTip = RS_(L"MoveTabToNewWindowToolTip");
WUX::Controls::ToolTipService::SetToolTip(moveTabToNewWindowMenuItem, box_value(moveTabToNewWindowToolTip));
Automation::AutomationProperties::SetHelpText(moveTabToNewWindowMenuItem, moveTabToNewWindowToolTip);
}
Controls::MenuFlyoutItem closePaneMenuItem = _closePaneMenuItem;
{
// "Close pane"
@@ -1534,12 +1517,15 @@ namespace winrt::TerminalApp::implementation
contextMenuFlyout.Items().Append(renameTabMenuItem);
contextMenuFlyout.Items().Append(duplicateTabMenuItem);
contextMenuFlyout.Items().Append(splitTabMenuItem);
contextMenuFlyout.Items().Append(moveTabToNewWindowMenuItem);
_AppendMoveMenuItems(contextMenuFlyout);
contextMenuFlyout.Items().Append(exportTabMenuItem);
contextMenuFlyout.Items().Append(findMenuItem);
contextMenuFlyout.Items().Append(restartConnectionMenuItem);
contextMenuFlyout.Items().Append(menuSeparator);
auto closeSubMenu = _AppendCloseMenuItems(contextMenuFlyout);
closeSubMenu.Items().Append(closePaneMenuItem);
// GH#5750 - When the context menu is dismissed with ESC, toss the focus
// back to our control.
contextMenuFlyout.Closed([weakThis](auto&&, auto&&) {
@@ -1559,8 +1545,6 @@ namespace winrt::TerminalApp::implementation
}
}
});
auto closeSubMenu = _AppendCloseMenuItems(contextMenuFlyout);
closeSubMenu.Items().Append(closePaneMenuItem);
TabViewItem().ContextFlyout(contextMenuFlyout);
}
@@ -1617,6 +1601,7 @@ namespace winrt::TerminalApp::implementation
_runtimeTabColor.emplace(color);
_RecalculateAndApplyTabColor();
_tabStatus.TabColorIndicator(color);
}
// Method Description:
@@ -1633,6 +1618,7 @@ namespace winrt::TerminalApp::implementation
_runtimeTabColor.reset();
_RecalculateAndApplyTabColor();
_tabStatus.TabColorIndicator(GetTabColor().value_or(Windows::UI::Colors::Transparent()));
}
winrt::Windows::UI::Xaml::Media::Brush TerminalTab::_BackgroundBrush()
@@ -1998,13 +1984,6 @@ namespace winrt::TerminalApp::implementation
actionAndArgs.Action(ShortcutAction::ExportBuffer);
_dispatch.DoAction(*this, actionAndArgs);
}
void TerminalTab::_moveTabToNewWindowClicked(const winrt::Windows::Foundation::IInspectable& /* sender */,
const winrt::Windows::UI::Xaml::RoutedEventArgs& /* args */)
{
MoveTabArgs args{ winrt::to_hstring(NewWindow), MoveTabDirection::Forward };
ActionAndArgs actionAndArgs{ ShortcutAction::MoveTab, args };
_dispatch.DoAction(*this, actionAndArgs);
}
void TerminalTab::_findClicked(const winrt::Windows::Foundation::IInspectable& /* sender */,
const winrt::Windows::UI::Xaml::RoutedEventArgs& /* args */)
{

View File

@@ -196,7 +196,6 @@ namespace winrt::TerminalApp::implementation
void _splitTabClicked(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
void _closePaneClicked(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
void _exportTextClicked(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
void _moveTabToNewWindowClicked(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
void _findClicked(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
void _bubbleRestartTerminalRequested(TerminalApp::TerminalPaneContent sender, const winrt::Windows::Foundation::IInspectable& args);

View File

@@ -20,6 +20,7 @@ namespace winrt::TerminalApp::implementation
WINRT_OBSERVABLE_PROPERTY(bool, IsReadOnlyActive, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(uint32_t, ProgressValue, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(bool, IsInputBroadcastActive, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Color, TabColorIndicator, PropertyChanged.raise);
};
}

View File

@@ -15,5 +15,6 @@ namespace TerminalApp
UInt32 ProgressValue { get; set; };
Boolean IsReadOnlyActive { get; set; };
Boolean IsInputBroadcastActive { get; set; };
Windows.UI.Color TabColorIndicator { get; set; };
}
}

View File

@@ -223,7 +223,6 @@ namespace winrt::TerminalApp::implementation
FORWARDED_TYPED_EVENT(IdentifyWindowsRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, IdentifyWindowsRequested);
FORWARDED_TYPED_EVENT(RenameWindowRequested, Windows::Foundation::IInspectable, winrt::TerminalApp::RenameWindowRequestedArgs, _root, RenameWindowRequested);
FORWARDED_TYPED_EVENT(SummonWindowRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, SummonWindowRequested);
FORWARDED_TYPED_EVENT(CloseRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, CloseRequested);
FORWARDED_TYPED_EVENT(OpenSystemMenu, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, OpenSystemMenu);
FORWARDED_TYPED_EVENT(QuitRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, QuitRequested);
FORWARDED_TYPED_EVENT(ShowWindowChanged, Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Control::ShowWindowArgs, _root, ShowWindowChanged);

View File

@@ -127,7 +127,6 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, RenameWindowRequestedArgs> RenameWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> IsQuakeWindowChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> SummonWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> CloseRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> OpenSystemMenu;
event Windows.Foundation.TypedEventHandler<Object, Object> QuitRequested;
event Windows.Foundation.TypedEventHandler<Object, TerminalApp.SystemMenuChangeArgs> SystemMenuChangeRequested;

View File

@@ -27,6 +27,7 @@
#include <winrt/Windows.ApplicationModel.h>
#include <winrt/Windows.ApplicationModel.DataTransfer.h>
#include <winrt/Windows.ApplicationModel.Resources.Core.h>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.Foundation.Metadata.h>
@@ -40,6 +41,7 @@
#include <winrt/Windows.UI.Xaml.Automation.Peers.h>
#include <winrt/Windows.UI.Xaml.Controls.h>
#include <winrt/Windows.UI.Xaml.Controls.Primitives.h>
#include <winrt/Windows.UI.Xaml.Shapes.h>
#include <winrt/Windows.UI.Xaml.Data.h>
#include <winrt/Windows.UI.Xaml.Documents.h>
#include <winrt/Windows.UI.Xaml.Input.h>

View File

@@ -14,6 +14,13 @@ static DWORD g_cTerminalHandoffRegistration = 0;
// Mutex so we only do start/stop/establish one at a time.
static std::shared_mutex _mtx;
// This is the callback that will be called when a connection is received.
// Call this once during startup and don't ever change it again (race condition).
void CTerminalHandoff::s_setCallback(NewHandoffFunction callback) noexcept
{
_pfnHandoff = callback;
}
// Routine Description:
// - Starts listening for TerminalHandoff requests by registering
// our class and interface with COM.
@@ -21,24 +28,19 @@ static std::shared_mutex _mtx;
// - pfnHandoff - Function to callback when a handoff is received
// Return Value:
// - S_OK, E_NOT_VALID_STATE (start called when already started) or relevant COM registration error.
HRESULT CTerminalHandoff::s_StartListening(NewHandoffFunction pfnHandoff)
HRESULT CTerminalHandoff::s_StartListening()
try
{
std::unique_lock lock{ _mtx };
RETURN_HR_IF(E_NOT_VALID_STATE, _pfnHandoff != nullptr);
const auto classFactory = Make<SimpleClassFactory<CTerminalHandoff>>();
RETURN_IF_NULL_ALLOC(classFactory);
RETURN_LAST_ERROR_IF_NULL(classFactory);
ComPtr<IUnknown> unk;
RETURN_IF_FAILED(classFactory.As(&unk));
RETURN_IF_FAILED(CoRegisterClassObject(__uuidof(CTerminalHandoff), unk.Get(), CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &g_cTerminalHandoffRegistration));
_pfnHandoff = pfnHandoff;
return S_OK;
}
CATCH_RETURN()
@@ -53,15 +55,6 @@ CATCH_RETURN()
HRESULT CTerminalHandoff::s_StopListening()
{
std::unique_lock lock{ _mtx };
return s_StopListeningLocked();
}
// See s_StopListening()
HRESULT CTerminalHandoff::s_StopListeningLocked()
{
RETURN_HR_IF_NULL(E_NOT_VALID_STATE, _pfnHandoff);
_pfnHandoff = nullptr;
if (g_cTerminalHandoffRegistration)
{
@@ -92,22 +85,15 @@ HRESULT CTerminalHandoff::EstablishPtyHandoff(HANDLE* in, HANDLE* out, HANDLE si
{
try
{
std::unique_lock lock{ _mtx };
// s_StopListeningLocked sets _pfnHandoff to nullptr.
// localPfnHandoff is tested for nullness below.
#pragma warning(suppress : 26429) // Symbol '...' is never tested for nullness, it can be marked as not_null (f.23).
auto localPfnHandoff = _pfnHandoff;
// Because we are REGCLS_SINGLEUSE... we need to `CoRevokeClassObject` after we handle this ONE call.
// COM does not automatically clean that up for us. We must do it.
LOG_IF_FAILED(s_StopListeningLocked());
LOG_IF_FAILED(s_StopListening());
// Report an error if no one registered a handoff function before calling this.
THROW_HR_IF_NULL(E_NOT_VALID_STATE, localPfnHandoff);
THROW_HR_IF_NULL(E_NOT_VALID_STATE, _pfnHandoff);
// Call registered handler from when we started listening.
THROW_IF_FAILED(localPfnHandoff(in, out, signal, reference, server, client, startupInfo));
THROW_IF_FAILED(_pfnHandoff(in, out, signal, reference, server, client, startupInfo));
#pragma warning(suppress : 26477)
TraceLoggingWrite(

View File

@@ -38,11 +38,11 @@ struct __declspec(uuid(__CLSID_CTerminalHandoff))
#pragma endregion
static HRESULT s_StartListening(NewHandoffFunction pfnHandoff);
static HRESULT s_StopListening();
static void s_setCallback(NewHandoffFunction callback) noexcept;
static HRESULT s_StartListening();
private:
static HRESULT s_StopListeningLocked();
static HRESULT s_StopListening();
};
// Disable warnings from the CoCreatableClass macro as the value it provides for

View File

@@ -428,6 +428,20 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
TerminalOutput.raise(L"\r\n");
TerminalOutput.raise(badPathText);
}
// If the requested action requires elevation, display appropriate message
else if (hr == HRESULT_FROM_WIN32(ERROR_ELEVATION_REQUIRED))
{
const auto elevationText = RS_(L"ElevationRequired");
TerminalOutput.raise(L"\r\n");
TerminalOutput.raise(elevationText);
}
// If the requested executable was not found, display appropriate message
else if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
{
const auto fileNotFoundText = RS_(L"FileNotFound");
TerminalOutput.raise(L"\r\n");
TerminalOutput.raise(fileNotFoundText);
}
_transitionToState(ConnectionState::Failed);
@@ -772,12 +786,12 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
void ConptyConnection::StartInboundListener()
{
THROW_IF_FAILED(CTerminalHandoff::s_StartListening(&ConptyConnection::NewHandoff));
}
static const auto init = []() noexcept {
CTerminalHandoff::s_setCallback(&ConptyConnection::NewHandoff);
return true;
}();
void ConptyConnection::StopInboundListener()
{
THROW_IF_FAILED(CTerminalHandoff::s_StopListening());
CTerminalHandoff::s_StartListening();
}
// Function Description:

View File

@@ -35,7 +35,6 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
WORD ShowWindow() const noexcept;
static void StartInboundListener();
static void StopInboundListener();
static winrt::event_token NewConnection(const NewConnectionHandler& handler);
static void NewConnection(const winrt::event_token& token);

View File

@@ -22,7 +22,6 @@ namespace Microsoft.Terminal.TerminalConnection
static event NewConnectionHandler NewConnection;
static void StartInboundListener();
static void StopInboundListener();
static Windows.Foundation.Collections.ValueSet CreateSettings(String cmdline,
String startingDirectory,

View File

@@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>Sie können dieses Terminal jetzt mit STRG+D schließen oder zum Neustart die EINGABETASTE drücken.</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>[Fehler {0} beim Start von `{1}']</value>
@@ -220,4 +220,10 @@
<value>Auf das Startverzeichnis „{0}“ konnte nicht zugegriffen werden</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
<data name="ElevationRequired" xml:space="preserve">
<value>Für den angeforderten Vorgang sind erhöhte Rechte erforderlich.</value>
</data>
<data name="FileNotFound" xml:space="preserve">
<value>Die angegebene Datei wurde nicht gefunden.</value>
</data>
</root>

View File

@@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>You can now close this terminal with Ctrl+D, or press Enter to restart.</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>[error {0} when launching `{1}']</value>
@@ -220,4 +220,10 @@
<value>Could not access starting directory "{0}"</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
</root>
<data name="ElevationRequired" xml:space="preserve">
<value>The requested operation requires elevation.</value>
</data>
<data name="FileNotFound" xml:space="preserve">
<value>The system cannot find the file specified.</value>
</data>
</root>

View File

@@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>Ahora puede cerrar este terminal con Ctrl+D o presionar Entrar para reiniciar.</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>[error {0} al iniciar `{1}']</value>
@@ -220,4 +220,10 @@
<value>No se pudo obtener acceso al directorio inicial «{0}»</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
<data name="ElevationRequired" xml:space="preserve">
<value>La operación solicitada requiere elevación.</value>
</data>
<data name="FileNotFound" xml:space="preserve">
<value>El sistema no puede encontrar el archivo especificado.</value>
</data>
</root>

View File

@@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>Vous pouvez maintenant fermer ce terminal avec Ctrl+D, ou appuyez sur Entrée pour redémarrer.</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>[erreur {0} lors du lancement de `{1}']</value>
@@ -220,4 +220,10 @@
<value>Le démarrage du répertoire nest pas accessible «{0}»</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
<data name="ElevationRequired" xml:space="preserve">
<value>Lopération demandée nécessite une élévation.</value>
</data>
<data name="FileNotFound" xml:space="preserve">
<value>Le fichier spécifié est introuvable.</value>
</data>
</root>

View File

@@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>È ora possibile chiudere il terminale con CTRL+D oppure premere INVIO per riavviarlo.</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>[errore {0} durante l'avvio di `{1}']</value>
@@ -220,4 +220,10 @@
<value>Non è possibile accedere alla directory di avvio "{0}"</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
<data name="ElevationRequired" xml:space="preserve">
<value>Per l'operazione richiesta è necessaria l'elevazione dei privilegi.</value>
</data>
<data name="FileNotFound" xml:space="preserve">
<value>Impossibile trovare il file specificato.</value>
</data>
</root>

View File

@@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>このターミナルを Ctrl+D で閉じるか、Enter キーを押して再起動できます。</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>['{1}' の起動時にエラー {0} が発生しました]</value>
@@ -220,4 +220,10 @@
<value>先頭のディレクトリ "{0}" にアクセスできませんでした</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
<data name="ElevationRequired" xml:space="preserve">
<value>要求された操作には、権限の昇格が必要です。</value>
</data>
<data name="FileNotFound" xml:space="preserve">
<value>指定されたファイルが見つかりません。</value>
</data>
</root>

View File

@@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>이제 Ctrl+D 이 터미널을 닫거나 Enter 키를 눌러 다시 시작할 수 있습니다.</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>[{1}' 시작 시 {0} 오류 발생]</value>
@@ -220,4 +220,10 @@
<value>시작 디렉터리 "{0}"에 액세스할 수 없습니다.</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
<data name="ElevationRequired" xml:space="preserve">
<value>요청한 작업을 수행하려면 권한 상승이 필요합니다.</value>
</data>
<data name="FileNotFound" xml:space="preserve">
<value>시스템에서 지정된 파일을 찾을 수 없습니다.</value>
</data>
</root>

View File

@@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>Agora você pode fechar este terminal com Ctrl+D ou pressione Enter para reiniciar.</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>[erro {0} ao iniciar "{1}"]</value>
@@ -220,4 +220,10 @@
<value>Não foi possível acessar o diretório inicial "{0}"</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
<data name="ElevationRequired" xml:space="preserve">
<value>A operação solicitada exige elevação.</value>
</data>
<data name="FileNotFound" xml:space="preserve">
<value>O sistema não pode encontrar o arquivo especificado.</value>
</data>
</root>

View File

@@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>Ỳóŭ ćǻή иòω сĺøѕè ťнįş тёѓмîήªŀ ωīťђ Çťѓℓ+Ď, όг ргéšѕ Σñтèř το ґèšтªят. !!! !!! !!! !!! !!! !!! !!!</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>[℮ѓѓŏŕ {0} ωĥєй łåύñćђίηğ `{1}'] !!! !!! !!! </value>
@@ -220,4 +220,10 @@
<value>Ċőŭľđ йōť ª¢čеѕş şτāŗťΐиğ ðιѓεςтоŗγ "{0}" !!! !!! !!! !!!</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
</root>
<data name="ElevationRequired" xml:space="preserve">
<value>Ţнė ŗēqμĕѕŧєđ ôφ℮ґάтĩöй ŕєqΰїŗęś ėĺęνáτîøŋ. !!! !!! !!! !!! </value>
</data>
<data name="FileNotFound" xml:space="preserve">
<value>Ŧнё şγśţêм ςâлηόť ƒїлď ŧнэ ƒΐĺë śрéćιƒієð. !!! !!! !!! !!! </value>
</data>
</root>

View File

@@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>Ỳóŭ ćǻή иòω сĺøѕè ťнįş тёѓмîήªŀ ωīťђ Çťѓℓ+Ď, όг ргéšѕ Σñтèř το ґèšтªят. !!! !!! !!! !!! !!! !!! !!!</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>[℮ѓѓŏŕ {0} ωĥєй łåύñćђίηğ `{1}'] !!! !!! !!! </value>
@@ -220,4 +220,10 @@
<value>Ċőŭľđ йōť ª¢čеѕş şτāŗťΐиğ ðιѓεςтоŗγ "{0}" !!! !!! !!! !!!</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
</root>
<data name="ElevationRequired" xml:space="preserve">
<value>Ţнė ŗēqμĕѕŧєđ ôφ℮ґάтĩöй ŕєqΰїŗęś ėĺęνáτîøŋ. !!! !!! !!! !!! </value>
</data>
<data name="FileNotFound" xml:space="preserve">
<value>Ŧнё şγśţêм ςâлηόť ƒїлď ŧнэ ƒΐĺë śрéćιƒієð. !!! !!! !!! !!! </value>
</data>
</root>

View File

@@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>Ỳóŭ ćǻή иòω сĺøѕè ťнįş тёѓмîήªŀ ωīťђ Çťѓℓ+Ď, όг ргéšѕ Σñтèř το ґèšтªят. !!! !!! !!! !!! !!! !!! !!!</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>[℮ѓѓŏŕ {0} ωĥєй łåύñćђίηğ `{1}'] !!! !!! !!! </value>
@@ -220,4 +220,10 @@
<value>Ċőŭľđ йōť ª¢čеѕş şτāŗťΐиğ ðιѓεςтоŗγ "{0}" !!! !!! !!! !!!</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
</root>
<data name="ElevationRequired" xml:space="preserve">
<value>Ţнė ŗēqμĕѕŧєđ ôφ℮ґάтĩöй ŕєqΰїŗęś ėĺęνáτîøŋ. !!! !!! !!! !!! </value>
</data>
<data name="FileNotFound" xml:space="preserve">
<value>Ŧнё şγśţêм ςâлηόť ƒїлď ŧнэ ƒΐĺë śрéćιƒієð. !!! !!! !!! !!! </value>
</data>
</root>

View File

@@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>Теперь вы можете закрыть этот терминал с помощью клавиш CTRL+D. Или нажмите клавишу ВВОД для перезапуска.</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>[ошибка {0} при запуске "{1}"]</value>
@@ -220,4 +220,10 @@
<value>Не удалось получить доступ к запуску каталога "{0}"</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
<data name="ElevationRequired" xml:space="preserve">
<value>Запрошенная операция требует получения дополнительных прав.</value>
</data>
<data name="FileNotFound" xml:space="preserve">
<value>Не удается найти указанный файл.</value>
</data>
</root>

View File

@@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>现在可以使用Ctrl+D关闭此终端或按 Enter 重新启动。</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>[出现错误 {0} (启动“{1}”时)]</value>
@@ -220,4 +220,10 @@
<value>无法访问启动目录“{0}”</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
<data name="ElevationRequired" xml:space="preserve">
<value>请求的操作需要提升。</value>
</data>
<data name="FileNotFound" xml:space="preserve">
<value>系统找不到指定的文件。</value>
</data>
</root>

View File

@@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>您現在可以使用 Ctrl+D 關閉此終端機,或按 Enter 重新啟動。</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>[啟動 `{1}' 時發生錯誤 {0}]</value>
@@ -220,4 +220,10 @@
<value>無法存取開始目錄 "{0}"</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
<data name="ElevationRequired" xml:space="preserve">
<value>要求的操作需要提高權限。</value>
</data>
<data name="FileNotFound" xml:space="preserve">
<value>系統找不到指定的檔案。</value>
</data>
</root>

View File

@@ -139,23 +139,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// If we wait, a screen reader may try to get the AutomationPeer (aka the UIA Engine), and we won't be able to attach
// the UIA Engine to the renderer. This prevents us from signaling changes to the cursor or buffer.
{
// First create the render thread.
// Then stash a local pointer to the render thread so we can initialize it and enable it
// to paint itself *after* we hand off its ownership to the renderer.
// We split up construction and initialization of the render thread object this way
// because the renderer and render thread have circular references to each other.
auto renderThread = std::make_unique<::Microsoft::Console::Render::RenderThread>();
auto* const localPointerToThread = renderThread.get();
// Now create the renderer and initialize the render thread.
const auto& renderSettings = _terminal->GetRenderSettings();
_renderer = std::make_unique<::Microsoft::Console::Render::Renderer>(renderSettings, _terminal.get(), nullptr, 0, std::move(renderThread));
_renderer = std::make_unique<::Microsoft::Console::Render::Renderer>(renderSettings, _terminal.get());
_renderer->SetBackgroundColorChangedCallback([this]() { _rendererBackgroundColorChanged(); });
_renderer->SetFrameColorChangedCallback([this]() { _rendererTabColorChanged(); });
_renderer->SetRendererEnteredErrorStateCallback([this]() { RendererEnteredErrorState.raise(nullptr, nullptr); });
THROW_IF_FAILED(localPointerToThread->Initialize(_renderer.get()));
}
UpdateSettings(settings, unfocusedAppearance);
@@ -183,7 +173,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// thread is a workaround for us to hit GH#12607 less often.
shared->outputIdle = std::make_unique<til::debounced_func_trailing<>>(
std::chrono::milliseconds{ 100 },
[weakTerminal = std::weak_ptr{ _terminal }, weakThis = get_weak(), dispatcher = _dispatcher]() {
[this, weakThis = get_weak(), dispatcher = _dispatcher]() {
dispatcher.TryEnqueue(DispatcherQueuePriority::Normal, [weakThis]() {
if (const auto self = weakThis.get(); self && !self->_IsClosing())
{
@@ -191,11 +181,23 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
});
if (const auto t = weakTerminal.lock())
{
const auto lock = t->LockForWriting();
t->UpdatePatternsUnderLock();
}
// We can't use a `weak_ptr` to `_terminal` here, because it takes significant
// dependency on the lifetime of `this` (primarily on our `_renderer`).
// and a `weak_ptr` would allow it to outlive `this`.
// Theoretically `debounced_func_trailing` should call `WaitForThreadpoolTimerCallbacks()`
// with cancel=true on destruction, which should ensure that our use of `this` here is safe.
const auto lock = _terminal->LockForWriting();
_terminal->UpdatePatternsUnderLock();
});
// If you rapidly show/hide Windows Terminal, something about GotFocus()/LostFocus() gets broken.
// We'll then receive easily 10+ such calls from WinUI the next time the application is shown.
shared->focusChanged = std::make_unique<til::debounced_func_trailing<bool>>(
std::chrono::milliseconds{ 25 },
[this](const bool focused) {
// Theoretically `debounced_func_trailing` should call `WaitForThreadpoolTimerCallbacks()`
// with cancel=true on destruction, which should ensure that our use of `this` here is safe.
_focusChanged(focused);
});
// Scrollbar updates are also expensive (XAML), so we'll throttle them as well.
@@ -210,19 +212,35 @@ namespace winrt::Microsoft::Terminal::Control::implementation
});
}
// Safely disconnects event handlers from the connection and closes it. This is necessary because
// WinRT event revokers don't prevent pending calls from proceeding (thread-safe but not race-free).
void ControlCore::_closeConnection()
{
_connectionOutputEventRevoker.revoke();
_connectionStateChangedRevoker.revoke();
// One of the tasks for `ITerminalConnection::Close()` is to block until all pending
// callback calls have completed. This solves the race-condition issue mentioned above.
if (_connection)
{
_connection.Close();
_connection = nullptr;
}
}
ControlCore::~ControlCore()
{
Close();
_renderer.reset();
_renderEngine.reset();
// See notes about the _renderer member in the header file.
_renderer->TriggerTeardown();
}
void ControlCore::Detach()
{
// Disable the renderer, so that it doesn't try to start any new frames
// for our engines while we're not attached to anything.
_renderer->WaitForPaintCompletionAndDisable(INFINITE);
_renderer->TriggerTeardown();
// Clear out any throttled funcs that we had wired up to run on this UI
// thread. These will be recreated in _setupDispatcherAndCallbacks, when
@@ -262,8 +280,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
auto oldState = ConnectionState(); // rely on ControlCore's automatic null handling
// revoke ALL old handlers immediately
_connectionOutputEventRevoker.revoke();
_connectionStateChangedRevoker.revoke();
_closeConnection();
_connection = newConnection;
if (_connection)
@@ -352,7 +369,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
const auto vp = _renderEngine->GetViewportInCharacters(viewInPixels);
const auto width = vp.Width();
const auto height = vp.Height();
_connection.Resize(height, width);
if (_connection)
{
_connection.Resize(height, width);
}
if (_owningHwnd != 0)
{
@@ -406,6 +427,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{
if (_initializedTerminal.load(std::memory_order_relaxed))
{
// The lock must be held, because it calls into IRenderData which is shared state.
const auto lock = _terminal->LockForWriting();
_renderer->EnablePainting();
}
@@ -420,7 +442,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// - <none>
void ControlCore::_sendInputToConnection(std::wstring_view wstr)
{
_connection.WriteInput(winrt_wstring_to_array_view(wstr));
if (_connection)
{
_connection.WriteInput(winrt_wstring_to_array_view(wstr));
}
}
// Method Description:
@@ -457,7 +482,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
const wchar_t CtrlD = 0x4;
const wchar_t Enter = '\r';
if (_connection.State() >= winrt::Microsoft::Terminal::TerminalConnection::ConnectionState::Closed)
if (_connection && _connection.State() >= winrt::Microsoft::Terminal::TerminalConnection::ConnectionState::Closed)
{
if (ch == CtrlD)
{
@@ -1108,7 +1133,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation
return;
}
_connection.Resize(vp.Height(), vp.Width());
if (_connection)
{
_connection.Resize(vp.Height(), vp.Width());
}
// TermControl will call Search() once the OutputIdle even fires after 100ms.
// Until then we need to hide the now-stale search results from the renderer.
@@ -1688,38 +1716,41 @@ namespace winrt::Microsoft::Terminal::Control::implementation
SearchResults ControlCore::Search(SearchRequest request)
{
const auto lock = _terminal->LockForWriting();
SearchFlag flags{};
WI_SetFlagIf(flags, SearchFlag::CaseInsensitive, !request.CaseSensitive);
WI_SetFlagIf(flags, SearchFlag::RegularExpression, request.RegularExpression);
const auto searchInvalidated = _searcher.IsStale(*_terminal.get(), request.Text, flags);
if (searchInvalidated || !request.Reset)
if (searchInvalidated || !request.ResetOnly)
{
std::vector<til::point_span> oldResults;
til::point_span oldFocused;
if (const auto focused = _terminal->GetSearchHighlightFocused())
{
oldFocused = *focused;
}
if (searchInvalidated)
{
oldResults = _searcher.ExtractResults();
_searcher.Reset(*_terminal.get(), request.Text, flags, !request.GoForward);
if (SnapSearchResultToSelection())
{
_searcher.MoveToCurrentSelection();
SnapSearchResultToSelection(false);
}
_terminal->SetSearchHighlights(_searcher.Results());
}
else
if (!request.ResetOnly)
{
_searcher.FindNext(!request.GoForward);
}
if (const auto idx = _searcher.CurrentMatch(); idx >= 0)
{
_terminal->SetSearchHighlightFocused(gsl::narrow<size_t>(idx), request.ScrollOffset);
}
_terminal->SetSearchHighlightFocused(gsl::narrow<size_t>(std::max<ptrdiff_t>(0, _searcher.CurrentMatch())));
_renderer->TriggerSearchHighlight(oldResults);
if (const auto focused = _terminal->GetSearchHighlightFocused(); focused && *focused != oldFocused)
{
_terminal->ScrollToSearchHighlight(request.ScrollOffset);
}
}
int32_t totalMatches = 0;
@@ -1747,27 +1778,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{
const auto lock = _terminal->LockForWriting();
_terminal->SetSearchHighlights({});
_terminal->SetSearchHighlightFocused({}, 0);
_terminal->SetSearchHighlightFocused(0);
_renderer->TriggerSearchHighlight(_searcher.Results());
_searcher = {};
}
// Method Description:
// - Tells ControlCore to snap the current search result index to currently
// selected text if the search was started using it.
void ControlCore::SnapSearchResultToSelection(bool shouldSnap) noexcept
{
_snapSearchResultToSelection = shouldSnap;
}
// Method Description:
// - Returns true, if we should snap the current search result index to
// the currently selected text after a new search is started, else false.
bool ControlCore::SnapSearchResultToSelection() const noexcept
{
return _snapSearchResultToSelection;
}
void ControlCore::Close()
{
if (!_IsClosing())
@@ -1776,12 +1791,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// Ensure Close() doesn't hang, waiting for MidiAudio to finish playing an hour long song.
_midiAudio.BeginSkip();
// Stop accepting new output and state changes before we disconnect everything.
_connectionOutputEventRevoker.revoke();
_connectionStateChangedRevoker.revoke();
_connection.Close();
}
_closeConnection();
}
void ControlCore::PersistToPath(const wchar_t* path) const
@@ -1799,9 +1811,23 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
FILETIME lastWriteTime;
FILETIME localFileTime;
SYSTEMTIME lastWriteSystemTime;
if (!GetFileTime(file.get(), nullptr, nullptr, &lastWriteTime) ||
!FileTimeToSystemTime(&lastWriteTime, &lastWriteSystemTime))
// Get the last write time in UTC
if (!GetFileTime(file.get(), nullptr, nullptr, &lastWriteTime))
{
return;
}
// Convert UTC FILETIME to local FILETIME
if (!FileTimeToLocalFileTime(&lastWriteTime, &localFileTime))
{
return;
}
// Convert local FILETIME to SYSTEMTIME
if (!FileTimeToSystemTime(&localFileTime, &lastWriteSystemTime))
{
return;
}
@@ -1878,7 +1904,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
const auto weakThis{ get_weak() };
// Concurrent read of _dispatcher is safe, because Detach() calls WaitForPaintCompletionAndDisable()
// Concurrent read of _dispatcher is safe, because Detach() calls TriggerTeardown()
// which blocks until this call returns. _dispatcher will only be changed afterwards.
co_await wil::resume_foreground(_dispatcher);
@@ -1929,8 +1955,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void ControlCore::ResumeRendering()
{
// The lock must be held, because it calls into IRenderData which is shared state.
const auto lock = _terminal->LockForWriting();
_renderer->ResetErrorStateAndResume();
_renderer->EnablePainting();
}
bool ControlCore::IsVtMouseModeEnabled() const
@@ -2212,19 +2239,32 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// - <none>
void ControlCore::ClearBuffer(Control::ClearBufferType clearType)
{
if (clearType == Control::ClearBufferType::Scrollback || clearType == Control::ClearBufferType::All)
std::wstring_view command;
switch (clearType)
{
case ClearBufferType::Screen:
command = L"\x1b[H\x1b[2J";
break;
case ClearBufferType::Scrollback:
command = L"\x1b[3J";
break;
case ClearBufferType::All:
command = L"\x1b[H\x1b[2J\x1b[3J";
break;
}
{
const auto lock = _terminal->LockForWriting();
_terminal->EraseScrollback();
_terminal->Write(command);
}
if (clearType == Control::ClearBufferType::Screen || clearType == Control::ClearBufferType::All)
{
// Send a signal to conpty to clear the buffer.
if (auto conpty{ _connection.try_as<TerminalConnection::ConptyConnection>() })
{
// ConPTY will emit sequences to sync up our buffer with its new
// contents.
// Since the clearing of ConPTY occurs asynchronously, this call can result weird issues,
// where a console application still sees contents that we've already deleted, etc.
// The correct way would be for ConPTY to emit the appropriate CSI n J sequences.
conpty.ClearBuffer();
}
}
@@ -2471,13 +2511,21 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// - This is related to work done for GH#2988.
void ControlCore::GotFocus()
{
_focusChanged(true);
const auto shared = _shared.lock_shared();
if (shared->focusChanged)
{
(*shared->focusChanged)(true);
}
}
// See GotFocus.
void ControlCore::LostFocus()
{
_focusChanged(false);
const auto shared = _shared.lock_shared();
if (shared->focusChanged)
{
(*shared->focusChanged)(false);
}
}
void ControlCore::_focusChanged(bool focused)

View File

@@ -228,8 +228,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
SearchResults Search(SearchRequest request);
const std::vector<til::point_span>& SearchResultRows() const noexcept;
void ClearSearch();
void SnapSearchResultToSelection(bool snap) noexcept;
bool SnapSearchResultToSelection() const noexcept;
void LeftClickOnTerminal(const til::point terminalPosition,
const int numberOfClicks,
@@ -306,68 +304,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
struct SharedState
{
std::unique_ptr<til::debounced_func_trailing<>> outputIdle;
std::unique_ptr<til::debounced_func_trailing<bool>> focusChanged;
std::shared_ptr<ThrottledFuncTrailing<Control::ScrollPositionChangedArgs>> updateScrollBar;
};
std::atomic<bool> _initializedTerminal{ false };
bool _closing{ false };
TerminalConnection::ITerminalConnection _connection{ nullptr };
TerminalConnection::ITerminalConnection::TerminalOutput_revoker _connectionOutputEventRevoker;
TerminalConnection::ITerminalConnection::StateChanged_revoker _connectionStateChangedRevoker;
winrt::com_ptr<ControlSettings> _settings{ nullptr };
std::shared_ptr<::Microsoft::Terminal::Core::Terminal> _terminal{ nullptr };
std::wstring _pendingResponses;
// NOTE: _renderEngine must be ordered before _renderer.
//
// As _renderer has a dependency on _renderEngine (through a raw pointer)
// we must ensure the _renderer is deallocated first.
// (C++ class members are destroyed in reverse order.)
std::unique_ptr<::Microsoft::Console::Render::Atlas::AtlasEngine> _renderEngine{ nullptr };
std::unique_ptr<::Microsoft::Console::Render::Renderer> _renderer{ nullptr };
::Search _searcher;
bool _snapSearchResultToSelection;
winrt::handle _lastSwapChainHandle{ nullptr };
FontInfoDesired _desiredFont;
FontInfo _actualFont;
bool _builtinGlyphs = true;
bool _colorGlyphs = true;
CSSLengthPercentage _cellWidth;
CSSLengthPercentage _cellHeight;
// storage location for the leading surrogate of a utf-16 surrogate pair
std::optional<wchar_t> _leadingSurrogate{ std::nullopt };
std::optional<til::point> _lastHoveredCell{ std::nullopt };
// Track the last hyperlink ID we hovered over
uint16_t _lastHoveredId{ 0 };
bool _isReadOnly{ false };
std::optional<interval_tree::IntervalTree<til::point, size_t>::interval> _lastHoveredInterval{ std::nullopt };
// These members represent the size of the surface that we should be
// rendering to.
float _panelWidth{ 0 };
float _panelHeight{ 0 };
float _compositionScale{ 0 };
uint64_t _owningHwnd{ 0 };
winrt::Windows::System::DispatcherQueue _dispatcher{ nullptr };
til::shared_mutex<SharedState> _shared;
til::point _contextMenuBufferPosition{ 0, 0 };
Windows::Foundation::Collections::IVector<hstring> _cachedQuickFixes{ nullptr };
void _setupDispatcherAndCallbacks();
void _closeConnection();
bool _setFontSizeUnderLock(float fontSize);
void _updateFont();
@@ -393,12 +335,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void _terminalSearchMissingCommand(std::wstring_view missingCommand, const til::CoordType& bufferRow);
safe_void_coroutine _terminalCompletionsChanged(std::wstring_view menuJson, unsigned int replaceLength);
#pragma endregion
MidiAudio _midiAudio;
winrt::Windows::System::DispatcherQueueTimer _midiAudioSkipTimer{ nullptr };
#pragma region RendererCallbacks
void _rendererWarning(const HRESULT hr, wil::zwstring_view parameter);
safe_void_coroutine _renderEngineSwapChainChanged(const HANDLE handle);
@@ -409,6 +347,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void _raiseReadOnlyWarning();
void _updateAntiAliasingMode();
void _connectionOutputHandler(const hstring& hstr);
void _connectionStateChangedHandler(const TerminalConnection::ITerminalConnection&, const Windows::Foundation::IInspectable&);
void _updateHoveredCell(const std::optional<til::point> terminalPosition);
void _setOpacity(const float opacity, const bool focused = true);
@@ -440,6 +379,70 @@ namespace winrt::Microsoft::Terminal::Control::implementation
return _closing;
}
// Caches responses generated by our VT parser (= improved batching).
std::wstring _pendingResponses;
// Font stuff.
FontInfoDesired _desiredFont;
FontInfo _actualFont;
bool _builtinGlyphs = true;
bool _colorGlyphs = true;
CSSLengthPercentage _cellWidth;
CSSLengthPercentage _cellHeight;
// Rendering stuff.
winrt::handle _lastSwapChainHandle{ nullptr };
uint64_t _owningHwnd{ 0 };
float _panelWidth{ 0 };
float _panelHeight{ 0 };
float _compositionScale{ 0 };
// Audio stuff.
MidiAudio _midiAudio;
winrt::Windows::System::DispatcherQueueTimer _midiAudioSkipTimer{ nullptr };
// Other stuff.
winrt::Windows::System::DispatcherQueue _dispatcher{ nullptr };
winrt::com_ptr<ControlSettings> _settings{ nullptr };
til::point _contextMenuBufferPosition{ 0, 0 };
Windows::Foundation::Collections::IVector<hstring> _cachedQuickFixes{ nullptr };
::Search _searcher;
std::optional<interval_tree::IntervalTree<til::point, size_t>::interval> _lastHoveredInterval;
std::optional<wchar_t> _leadingSurrogate;
std::optional<til::point> _lastHoveredCell;
uint16_t _lastHoveredId{ 0 };
std::atomic<bool> _initializedTerminal{ false };
bool _isReadOnly{ false };
bool _closing{ false };
// ----------------------------------------------------------------------------------------
// These are ordered last to ensure they're destroyed first.
// This ensures that their respective contents stops taking dependency on the above.
// I recommend reading the following paragraphs in reverse order.
// ----------------------------------------------------------------------------------------
// ↑ This one is tricky - all of these are raw pointers:
// 1. _terminal depends on _renderer (for invalidations)
// 2. _renderer depends on _terminal (for IRenderData)
// = circular dependency = architectural flaw (lifetime issues) = TODO
// 3. _renderer depends on _renderEngine (AtlasEngine)
// To solve the knot, we manually stop the renderer in the destructor,
// which breaks 2. We can proceed then proceed to break 1. and then 3.
std::unique_ptr<::Microsoft::Console::Render::Atlas::AtlasEngine> _renderEngine{ nullptr }; // 3.
std::unique_ptr<::Microsoft::Console::Render::Renderer> _renderer{ nullptr }; // 3.
std::shared_ptr<::Microsoft::Terminal::Core::Terminal> _terminal{ nullptr }; // 1.
// ↑ MOST IMPORTANTLY: `_outputIdle` takes dependency on the raw `this` pointer (necessarily).
// Destroying SharedState here will block until all pending `debounced_func_trailing` calls are completed.
til::shared_mutex<SharedState> _shared;
// ↑ Prevent any more unnecessary `_outputIdle` calls.
// Technically none of these members are destroyed here. Instead, the destructor will call Close()
// which calls _closeConnection() which in turn manually & safely destroys them in the correct order.
TerminalConnection::ITerminalConnection::TerminalOutput_revoker _connectionOutputEventRevoker;
TerminalConnection::ITerminalConnection::StateChanged_revoker _connectionStateChangedRevoker;
TerminalConnection::ITerminalConnection _connection{ nullptr };
friend class ControlUnitTests::ControlCoreTests;
friend class ControlUnitTests::ControlInteractivityTests;
bool _inUnitTests{ false };

View File

@@ -55,7 +55,7 @@ namespace Microsoft.Terminal.Control
Boolean GoForward;
Boolean CaseSensitive;
Boolean RegularExpression;
Boolean Reset;
Boolean ResetOnly;
Int32 ScrollOffset;
};
@@ -148,7 +148,6 @@ namespace Microsoft.Terminal.Control
SearchResults Search(SearchRequest request);
void ClearSearch();
Boolean SnapSearchResultToSelection;
Microsoft.Terminal.Core.Color ForegroundColor { get; };
Microsoft.Terminal.Core.Color BackgroundColor { get; };

Some files were not shown because too many files have changed in this diff Show More