mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-14 02:01:01 +00:00
Compare commits
160 Commits
dev/pabhoj
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d14747ff2d | ||
|
|
1149f0a5de | ||
|
|
a0724f94b1 | ||
|
|
9fa8d3862f | ||
|
|
25075a49e3 | ||
|
|
6165a6b182 | ||
|
|
cc416acca1 | ||
|
|
5d6f259afb | ||
|
|
51ddf3b5e8 | ||
|
|
e10a98ca28 | ||
|
|
32a52438d6 | ||
|
|
e1cbaa5d83 | ||
|
|
d4b1b675c6 | ||
|
|
21fc05c844 | ||
|
|
a129767fe1 | ||
|
|
15bc02cb45 | ||
|
|
b4cf05a02c | ||
|
|
b8f270a4f7 | ||
|
|
7381196865 | ||
|
|
f8efd14e81 | ||
|
|
51f412f7c2 | ||
|
|
221c04f0ac | ||
|
|
93335d045c | ||
|
|
821eb1b645 | ||
|
|
2aeeef72f9 | ||
|
|
96f13a15de | ||
|
|
5fa2718b2f | ||
|
|
e1f785cedd | ||
|
|
b4270e545d | ||
|
|
a4c512f016 | ||
|
|
77a1f5a9e7 | ||
|
|
f486a5f7d4 | ||
|
|
6dde7d3b78 | ||
|
|
f18abeb62e | ||
|
|
f1dad37670 | ||
|
|
5d97c3ae36 | ||
|
|
be596f16a3 | ||
|
|
829176363c | ||
|
|
5438177a49 | ||
|
|
55cb7049ed | ||
|
|
8701c4ffa0 | ||
|
|
29dc1fdd9c | ||
|
|
ca70e49cdf | ||
|
|
ee9198c9a3 | ||
|
|
eae5fbd83d | ||
|
|
59ff525128 | ||
|
|
ea8753f4ee | ||
|
|
829688d06a | ||
|
|
a916704a6f | ||
|
|
9449d0b29e | ||
|
|
34cd29a0ce | ||
|
|
4995af3dc1 | ||
|
|
ed022e89db | ||
|
|
df34f34691 | ||
|
|
9357281507 | ||
|
|
edcd042913 | ||
|
|
99c6de5bbe | ||
|
|
7c593c5aac | ||
|
|
8673cd2abb | ||
|
|
72cad7f3e2 | ||
|
|
110e100384 | ||
|
|
b6c7410a33 | ||
|
|
7d751a54bd | ||
|
|
5aafc0172e | ||
|
|
6157302fbd | ||
|
|
8fc82582bf | ||
|
|
a8b4243a63 | ||
|
|
db9774c17e | ||
|
|
38f28e80d0 | ||
|
|
820b10fd2b | ||
|
|
2801e9af50 | ||
|
|
dcdc21381c | ||
|
|
dd2ebc5c09 | ||
|
|
dc3bb80c16 | ||
|
|
9b80830d56 | ||
|
|
161a6b8784 | ||
|
|
aab0fa00ab | ||
|
|
8905ac1164 | ||
|
|
94a2aa0100 | ||
|
|
b6f56d63f5 | ||
|
|
90a55ed3d9 | ||
|
|
9476d0f9fa | ||
|
|
c5a5064d61 | ||
|
|
412083818d | ||
|
|
a8251a913b | ||
|
|
6027eca9f3 | ||
|
|
2f29dc8f62 | ||
|
|
3c59c3c050 | ||
|
|
c2f9191fc3 | ||
|
|
5ddbb9897b | ||
|
|
a36598a3b5 | ||
|
|
04a613c9ee | ||
|
|
4aa4d4a989 | ||
|
|
24a35cedcf | ||
|
|
b29a985f54 | ||
|
|
684b91f5f1 | ||
|
|
f3527bedf2 | ||
|
|
e8a883fd41 | ||
|
|
42a0b133d3 | ||
|
|
89cb70f098 | ||
|
|
c37b848845 | ||
|
|
8771b985ae | ||
|
|
ca218d3d7a | ||
|
|
b2cf9d1bac | ||
|
|
840f9623e5 | ||
|
|
cf3bbf53e6 | ||
|
|
3ff08aea1f | ||
|
|
16b737f9f5 | ||
|
|
aceb042499 | ||
|
|
3e70851d82 | ||
|
|
97c6ecb5a6 | ||
|
|
17ea33c42e | ||
|
|
21e63adec5 | ||
|
|
a9db4e403f | ||
|
|
d20c217751 | ||
|
|
7600888118 | ||
|
|
4f8a3d1845 | ||
|
|
38783fa595 | ||
|
|
a0140ef644 | ||
|
|
490e2bfc06 | ||
|
|
c1cd6d3d1d | ||
|
|
d938f924bb | ||
|
|
e9520c02ea | ||
|
|
2060fd6b11 | ||
|
|
70996f35d0 | ||
|
|
a37dc26fd8 | ||
|
|
29e401f202 | ||
|
|
0d7e1293fa | ||
|
|
a72531014c | ||
|
|
2590ff1383 | ||
|
|
863cdd44f2 | ||
|
|
73721c7a90 | ||
|
|
deeba28fda | ||
|
|
b43e7b93ec | ||
|
|
c6e20e99d7 | ||
|
|
8b0fc20f83 | ||
|
|
77638840e4 | ||
|
|
bf074f3e40 | ||
|
|
425d6b017a | ||
|
|
d6b56ae818 | ||
|
|
27f775ee9e | ||
|
|
4da527c9b8 | ||
|
|
8a806e0ac9 | ||
|
|
64d4fbab17 | ||
|
|
8e4da6e938 | ||
|
|
1040035b55 | ||
|
|
08f9afe315 | ||
|
|
1e00843598 | ||
|
|
33556fb631 | ||
|
|
fb7b0e1218 | ||
|
|
51e21dd86a | ||
|
|
3e969d53ee | ||
|
|
b33bde1992 | ||
|
|
c56fb1b2d2 | ||
|
|
25392ea604 | ||
|
|
8ddb14bd01 | ||
|
|
3772fc3fc5 | ||
|
|
ba87ab52a7 | ||
|
|
3e6690290f | ||
|
|
a3a4464667 |
7
.github/actions/spelling/allow/allow.txt
vendored
7
.github/actions/spelling/allow/allow.txt
vendored
@@ -11,19 +11,21 @@ colorbrewer
|
||||
commandlines
|
||||
consvc
|
||||
copyable
|
||||
CText
|
||||
dalet
|
||||
dcs
|
||||
deselection
|
||||
dialytika
|
||||
diffing
|
||||
Dimidium
|
||||
dje
|
||||
downsides
|
||||
dze
|
||||
dzhe
|
||||
Emacspeak
|
||||
Fitt
|
||||
FTCS
|
||||
flac
|
||||
FTCS
|
||||
gantt
|
||||
gfm
|
||||
ghe
|
||||
@@ -59,8 +61,8 @@ Powerline
|
||||
ptys
|
||||
pwn
|
||||
pwshw
|
||||
QOL
|
||||
qof
|
||||
QOL
|
||||
qps
|
||||
quickfix
|
||||
rclt
|
||||
@@ -80,6 +82,7 @@ stakeholders
|
||||
subpage
|
||||
sustainability
|
||||
sxn
|
||||
Tencent
|
||||
TLDR
|
||||
tonos
|
||||
toolset
|
||||
|
||||
2
.github/actions/spelling/allow/apis.txt
vendored
2
.github/actions/spelling/allow/apis.txt
vendored
@@ -144,6 +144,7 @@ NCHITTEST
|
||||
NCLBUTTONDBLCLK
|
||||
NCMOUSELEAVE
|
||||
NCMOUSEMOVE
|
||||
NCPOINTERUPDATE
|
||||
NCRBUTTONDBLCLK
|
||||
NIF
|
||||
NIN
|
||||
@@ -289,4 +290,5 @@ xtree
|
||||
xutility
|
||||
YIcon
|
||||
YMax
|
||||
zstring
|
||||
zwstring
|
||||
|
||||
18
.github/actions/spelling/expect/expect.txt
vendored
18
.github/actions/spelling/expect/expect.txt
vendored
@@ -86,6 +86,7 @@ autoscrolling
|
||||
Autowrap
|
||||
AVerify
|
||||
awch
|
||||
AZCOPY
|
||||
azurecr
|
||||
AZZ
|
||||
backgrounded
|
||||
@@ -127,6 +128,7 @@ Blt
|
||||
blu
|
||||
BLUESCROLL
|
||||
bmi
|
||||
bodgy
|
||||
BODGY
|
||||
BOLDFONT
|
||||
Borland
|
||||
@@ -151,6 +153,7 @@ cac
|
||||
cacafire
|
||||
CALLCONV
|
||||
CANDRABINDU
|
||||
CANTCALLOUT
|
||||
capslock
|
||||
CARETBLINKINGENABLED
|
||||
CARRIAGERETURN
|
||||
@@ -163,6 +166,7 @@ CBN
|
||||
cbt
|
||||
Ccc
|
||||
CCCBB
|
||||
CCCDDD
|
||||
cch
|
||||
CCHAR
|
||||
CCmd
|
||||
@@ -214,6 +218,7 @@ codepages
|
||||
codepath
|
||||
coinit
|
||||
colorizing
|
||||
COLORONCOLOR
|
||||
COLORREFs
|
||||
colorschemes
|
||||
colorspec
|
||||
@@ -368,6 +373,7 @@ Dcd
|
||||
DColor
|
||||
dcommon
|
||||
DComposition
|
||||
DDDCCC
|
||||
dde
|
||||
DDESHARE
|
||||
DDevice
|
||||
@@ -853,6 +859,7 @@ inclusivity
|
||||
INCONTEXT
|
||||
INFOEX
|
||||
inheritcursor
|
||||
ININPUTSYNCCALL
|
||||
INITCOMMONCONTROLSEX
|
||||
INITDIALOG
|
||||
initguid
|
||||
@@ -1114,6 +1121,7 @@ Mypair
|
||||
Myval
|
||||
NAMELENGTH
|
||||
namestream
|
||||
NCACTIVATE
|
||||
NCCALCSIZE
|
||||
NCCREATE
|
||||
NCLBUTTONDOWN
|
||||
@@ -1145,6 +1153,8 @@ nfe
|
||||
NLSMODE
|
||||
nnn
|
||||
NOACTIVATE
|
||||
NOACTIVATEKEYBOARDLAYOUT
|
||||
NOACTIVATETIP
|
||||
NOAPPLYNOW
|
||||
NOCLIP
|
||||
NOCOMM
|
||||
@@ -1354,6 +1364,7 @@ PNMLINK
|
||||
pntm
|
||||
POBJECT
|
||||
Podcast
|
||||
POINTERUPDATE
|
||||
POINTSLIST
|
||||
policheck
|
||||
POLYTEXTW
|
||||
@@ -1412,6 +1423,7 @@ propvar
|
||||
propvariant
|
||||
propvarutil
|
||||
psa
|
||||
PSCRED
|
||||
PSECURITY
|
||||
pseudoconsole
|
||||
pseudoterminal
|
||||
@@ -1581,7 +1593,6 @@ scrolllock
|
||||
scrolloffset
|
||||
SCROLLSCALE
|
||||
SCROLLSCREENBUFFER
|
||||
scursor
|
||||
sddl
|
||||
SDKDDK
|
||||
securityappcontainer
|
||||
@@ -1673,6 +1684,7 @@ SMARTQUOTE
|
||||
SMTO
|
||||
snapcx
|
||||
snapcy
|
||||
snk
|
||||
SOLIDBOX
|
||||
Solutiondir
|
||||
somefile
|
||||
@@ -1794,11 +1806,13 @@ TEXTMETRICW
|
||||
textmode
|
||||
texttests
|
||||
TFunction
|
||||
TFCAT
|
||||
THUMBPOSITION
|
||||
THUMBTRACK
|
||||
tickit
|
||||
TIcon
|
||||
tilunittests
|
||||
TIPCAP
|
||||
titlebars
|
||||
TITLEISLINKNAME
|
||||
TJson
|
||||
@@ -1860,6 +1874,8 @@ UIACCESS
|
||||
uiacore
|
||||
uiautomationcore
|
||||
uielem
|
||||
UIELEMENTENABLED
|
||||
UIELEMENTENABLEDONLY
|
||||
UINTs
|
||||
uld
|
||||
uldash
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<clear />
|
||||
<!-- Dependencies that we can turn on to force override for testing purposes before uploading. -->
|
||||
<!--<add key="Static Package Dependencies" value="dep\packages" />-->
|
||||
<add key="TerminalDependencies" value="https://pkgs.dev.azure.com/shine-oss/terminal/_packaging/TerminalDependencies/nuget/v3/index.json" />
|
||||
<add key="TerminalDependencies" value="https://pkgs.dev.azure.com/shine-oss/terminal/_packaging/TerminalDependencies%40Local/nuget/v3/index.json" />
|
||||
</packageSources>
|
||||
<disabledPackageSources>
|
||||
<clear />
|
||||
|
||||
@@ -362,15 +362,6 @@ If you would like to ask a question that you feel doesn't warrant an issue
|
||||
|
||||
## Building the Code
|
||||
|
||||
This repository uses [git
|
||||
submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) for some of its
|
||||
dependencies. To make sure submodules are restored or updated, be sure to run
|
||||
the following prior to building:
|
||||
|
||||
```shell
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
OpenConsole.sln may be built from within Visual Studio or from the command-line
|
||||
using a set of convenience scripts & tools in the **/tools** directory:
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"DisableAutoPackageNameFormatting": false
|
||||
},
|
||||
"appSubmission": {
|
||||
"appId": "9N8G5RFZ9XK3",
|
||||
"productId": "00014050269303149694",
|
||||
"targetPublishMode": "NotSet",
|
||||
"targetPublishDate": null,
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"DisableAutoPackageNameFormatting": false
|
||||
},
|
||||
"appSubmission": {
|
||||
"appId": "9N0DX20HK701",
|
||||
"productId": "00013926773940052066",
|
||||
"targetPublishMode": "NotSet",
|
||||
"targetPublishDate": null,
|
||||
|
||||
BIN
build/config/272MSSharedLibSN2048.snk
Normal file
BIN
build/config/272MSSharedLibSN2048.snk
Normal file
Binary file not shown.
@@ -4,7 +4,7 @@
|
||||
"collection": "microsoft",
|
||||
"project": "OS",
|
||||
"repo": "os.2020",
|
||||
"name": "official/rs_we_adept_e4d2",
|
||||
"name": "official/ge_current_directwinpd_deep",
|
||||
"workitem": "38106206",
|
||||
"CheckinFiles": [
|
||||
{
|
||||
|
||||
@@ -6,6 +6,20 @@
|
||||
],
|
||||
"SigningInfo": {
|
||||
"Operations": [
|
||||
{
|
||||
"KeyCode": "CP-233904-SN",
|
||||
"OperationSetCode": "StrongNameSign",
|
||||
"ToolName": "sign",
|
||||
"ToolVersion": "1.0",
|
||||
"Parameters": []
|
||||
},
|
||||
{
|
||||
"KeyCode": "CP-233904-SN",
|
||||
"OperationSetCode": "StrongNameVerify",
|
||||
"ToolName": "sign",
|
||||
"ToolVersion": "1.0",
|
||||
"Parameters": []
|
||||
},
|
||||
{
|
||||
"KeyCode": "CP-230012",
|
||||
"OperationSetCode": "SigntoolSign",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"instanceUrl": "https://microsoft.visualstudio.com",
|
||||
"projectName": "OS",
|
||||
"areaPath": "OS\\Windows Client and Services\\WinPD\\DEEP-Developer Experience, Ecosystem and Partnerships\\SHINE\\Terminal",
|
||||
"areaPath": "OS\\Windows Client and Services\\WinPD\\DFX-Developer Fundamentals and Experiences\\DEFT\\SHINE\\Terminal",
|
||||
"notificationAliases": ["condev@microsoft.com", "duhowett@microsoft.com"]
|
||||
}
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -37,6 +37,8 @@ extends:
|
||||
akvName: $(SigningAKVName)
|
||||
authCertName: $(SigningAuthCertName)
|
||||
signCertName: $(SigningSignCertName)
|
||||
useManagedIdentity: $(SigningUseManagedIdentity)
|
||||
clientId: $(SigningOriginalClientId)
|
||||
publishSymbolsToPublic: true
|
||||
publishVpackToWindows: false
|
||||
symbolExpiryTime: 15
|
||||
|
||||
@@ -53,8 +53,12 @@ parameters:
|
||||
displayName: "Publish Symbols to MSDL"
|
||||
type: boolean
|
||||
default: true
|
||||
- name: createVpack
|
||||
displayName: "Create a VPack for Windows"
|
||||
type: boolean
|
||||
default: false
|
||||
- name: publishVpackToWindows
|
||||
displayName: "Publish VPack to Windows"
|
||||
displayName: "Publish above VPack to Windows"
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
@@ -85,8 +89,11 @@ extends:
|
||||
akvName: $(SigningAKVName)
|
||||
authCertName: $(SigningAuthCertName)
|
||||
signCertName: $(SigningSignCertName)
|
||||
useManagedIdentity: $(SigningUseManagedIdentity)
|
||||
clientId: $(SigningOriginalClientId)
|
||||
terminalInternalPackageVersion: ${{ parameters.terminalInternalPackageVersion }}
|
||||
publishSymbolsToPublic: ${{ parameters.publishSymbolsToPublic }}
|
||||
createVpack: ${{ parameters.createVpack }}
|
||||
publishVpackToWindows: ${{ parameters.publishVpackToWindows }}
|
||||
symbolPublishingSubscription: $(SymbolPublishingServiceConnection)
|
||||
symbolPublishingProject: $(SymbolPublishingProject)
|
||||
|
||||
@@ -75,18 +75,13 @@ jobs:
|
||||
}
|
||||
displayName: "Wrangle Unpackaged builds into place, rename"
|
||||
|
||||
- powershell: |-
|
||||
Get-PackageProvider -Name NuGet -ForceBootstrap
|
||||
Install-Module -Verbose -AllowClobber -Force Az.Accounts, Az.Storage, Az.Network, Az.Resources, Az.Compute
|
||||
displayName: Install Azure Module Dependencies
|
||||
|
||||
- task: AzureFileCopy@6
|
||||
- task: AzurePowerShell@5
|
||||
displayName: Publish to Storage Account
|
||||
inputs:
|
||||
sourcePath: _out/*
|
||||
Destination: AzureBlob
|
||||
azureSubscription: ${{ parameters.subscription }}
|
||||
storage: ${{ parameters.storageAccount }}
|
||||
ContainerName: ${{ parameters.storageContainer }}
|
||||
AdditionalArgumentsForBlobCopy: "--content-type application/octet-stream"
|
||||
|
||||
azurePowerShellVersion: LatestVersion
|
||||
pwsh: true
|
||||
ScriptType: InlineScript
|
||||
Inline: |-
|
||||
$Env:AZCOPY_AUTO_LOGIN_TYPE="PSCRED"
|
||||
& AzCopy copy "_out\*" "https://${{ parameters.storageAccount }}.blob.core.windows.net/${{ parameters.storageContainer }}/" --content-type application/octet-stream
|
||||
|
||||
@@ -147,6 +147,10 @@ jobs:
|
||||
ValidateSignature: true
|
||||
Verbosity: 'Verbose'
|
||||
|
||||
- pwsh: |-
|
||||
tar -c -v --format=zip -f "$(JobOutputDirectory)/GroupPolicyTemplates_$(XES_APPXMANIFESTVERSION).zip" -C "$(Build.SourcesDirectory)/policies" *
|
||||
displayName: Package GPO Templates
|
||||
|
||||
- ${{ parameters.afterBuildSteps }}
|
||||
|
||||
- ${{ if eq(parameters.publishArtifacts, true) }}:
|
||||
|
||||
@@ -52,11 +52,6 @@ jobs:
|
||||
itemPattern: '**/*.pdb'
|
||||
targetPath: '$(Build.SourcesDirectory)/bin'
|
||||
|
||||
- powershell: |-
|
||||
Get-PackageProvider -Name NuGet -ForceBootstrap
|
||||
Install-Module -Verbose -AllowClobber -Force Az.Accounts, Az.Storage, Az.Network, Az.Resources, Az.Compute
|
||||
displayName: Install Azure Module Dependencies
|
||||
|
||||
# Transit the Azure token from the Service Connection into a secret variable for the rest of the pipeline to use.
|
||||
- task: AzurePowerShell@5
|
||||
displayName: Generate an Azure Token
|
||||
@@ -66,7 +61,7 @@ jobs:
|
||||
pwsh: true
|
||||
ScriptType: InlineScript
|
||||
Inline: |-
|
||||
$AzToken = (Get-AzAccessToken -ResourceUrl api://30471ccf-0966-45b9-a979-065dbedb24c1).Token
|
||||
$AzToken = (Get-AzAccessToken -AsSecureString -ResourceUrl api://30471ccf-0966-45b9-a979-065dbedb24c1).Token | ConvertFrom-SecureString -AsPlainText
|
||||
Write-Host "##vso[task.setvariable variable=SymbolAccessToken;issecret=true]$AzToken"
|
||||
|
||||
|
||||
|
||||
@@ -69,10 +69,3 @@ jobs:
|
||||
artifact: $(JobOutputArtifactName)
|
||||
displayName: 'Publish VPack Manifest to Drop'
|
||||
|
||||
- task: PkgESFCIBGit@12
|
||||
displayName: 'Submit VPack Manifest to Windows'
|
||||
inputs:
|
||||
configPath: '$(Build.SourcesDirectory)\build\config\GitCheckin.json'
|
||||
artifactsDirectory: $(XES_VPACKMANIFESTDIRECTORY)
|
||||
prTimeOut: 5
|
||||
|
||||
|
||||
@@ -49,6 +49,9 @@ parameters:
|
||||
- name: symbolExpiryTime
|
||||
type: string
|
||||
default: 36530 # This is the default from PublishSymbols@2
|
||||
- name: createVpack
|
||||
type: boolean
|
||||
default: false
|
||||
- name: publishVpackToWindows
|
||||
type: boolean
|
||||
default: false
|
||||
@@ -78,7 +81,9 @@ extends:
|
||||
template: v2/Microsoft.NonOfficial.yml@templates
|
||||
parameters:
|
||||
featureFlags:
|
||||
WindowsHostVersion: 1ESWindows2022
|
||||
WindowsHostVersion:
|
||||
Version: 2022
|
||||
Network: R1
|
||||
platform:
|
||||
name: 'windows_undocked'
|
||||
product: 'Windows Terminal'
|
||||
@@ -183,8 +188,8 @@ extends:
|
||||
ob_outputDirectory: $(JobOutputDirectory)
|
||||
ob_artifactBaseName: $(JobOutputArtifactName)
|
||||
### This job is also in charge of submitting the vpack to Windows if it's enabled
|
||||
ob_createvpack_enabled: ${{ and(parameters.buildTerminal, parameters.publishVpackToWindows) }}
|
||||
ob_updateOSManifest_enabled: ${{ and(parameters.buildTerminal, parameters.publishVpackToWindows) }}
|
||||
ob_createvpack_enabled: ${{ and(parameters.buildTerminal, parameters.createVpack) }}
|
||||
ob_updateOSManifest_enabled: ${{ and(parameters.buildTerminal, parameters.createVpack, parameters.publishVpackToWindows) }}
|
||||
### If enabled above, these options are in play.
|
||||
ob_createvpack_packagename: 'WindowsTerminal.app'
|
||||
ob_createvpack_owneralias: 'conhost@microsoft.com'
|
||||
@@ -220,7 +225,7 @@ extends:
|
||||
New-Item "$(JobOutputDirectory)/vpack" -Type Directory
|
||||
displayName: Make sure the vpack directory exists
|
||||
|
||||
- ${{ if parameters.publishVpackToWindows }}:
|
||||
- ${{ if parameters.createVpack }}:
|
||||
- pwsh: |-
|
||||
Copy-Item -Verbose -Path "$(MsixBundlePath)" -Destination (Join-Path "$(JobOutputDirectory)/vpack" 'Microsoft.WindowsTerminal_8wekyb3d8bbwe.msixbundle')
|
||||
displayName: Stage msixbundle for vpack
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
steps:
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: Use NuGet 6.6.1
|
||||
inputs:
|
||||
versionSpec: 6.6.1
|
||||
- ${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}:
|
||||
- pwsh: |-
|
||||
Write-Host "Assuming NuGet is already installed..."
|
||||
& nuget.exe help
|
||||
displayName: Assume NuGet is fine
|
||||
|
||||
- ${{ else }}:
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: Use NuGet 6.6.1
|
||||
inputs:
|
||||
versionSpec: 6.6.1
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
@@ -1,8 +1,28 @@
|
||||
$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 = ($VSPackages | ? { $_.id -eq "Microsoft.VisualCpp.Tools.Core" })
|
||||
$LatestVCToolsVersion = $LatestVCPackage.version;
|
||||
|
||||
$VSRoot = (& 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property 'resolvedInstallationPath')
|
||||
$VCToolsRoot = Join-Path $VSRoot "VC\Tools\MSVC"
|
||||
|
||||
# We have observed a few instances where the VC tools package version actually
|
||||
# differs from the version on the files themselves. We might as well check
|
||||
# whether the version we just found _actually exists_ before we use it.
|
||||
# We'll use whichever highest version exists.
|
||||
$PackageVCToolPath = Join-Path $VCToolsRoot $LatestVCToolsVersion
|
||||
If ($Null -Eq (Get-Item $PackageVCToolPath -ErrorAction:Ignore)) {
|
||||
$VCToolsVersions = Get-ChildItem $VCToolsRoot | ForEach-Object {
|
||||
[Version]$_.Name
|
||||
} | Sort -Descending
|
||||
$LatestActualVCToolsVersion = $VCToolsVersions | Select -First 1
|
||||
|
||||
If ([Version]$LatestVCToolsVersion -Ne $LatestActualVCToolsVersion) {
|
||||
Write-Output "VC Tools Mismatch: Directory = $LatestActualVCToolsVersion, Package = $LatestVCToolsVersion"
|
||||
$LatestVCToolsVersion = $LatestActualVCToolsVersion.ToString(3)
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output "Latest VCToolsVersion: $LatestVCToolsVersion"
|
||||
Write-Output "Updating VCToolsVersion environment variable for job"
|
||||
Write-Output "##vso[task.setvariable variable=VCToolsVersion]$LatestVCToolsVersion"
|
||||
|
||||
@@ -7,5 +7,8 @@
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>23</VersionMinor>
|
||||
<VersionInfoProductName>Windows Terminal</VersionInfoProductName>
|
||||
<VersionInfoCulture>1033</VersionInfoCulture>
|
||||
<!-- The default has a spacing problem -->
|
||||
<VersionInfoCopyRight>\xa9 Microsoft Corporation. All rights reserved.</VersionInfoCopyRight>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<!-- Native packages -->
|
||||
<package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
|
||||
<package id="Microsoft.Taef" version="10.93.240607003" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.230207.1" targetFramework="native" />
|
||||
<package id="Microsoft.Internal.Windows.Terminal.ThemeHelpers" version="0.7.230706001" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
|
||||
<package id="Microsoft.Internal.Windows.Terminal.ThemeHelpers" version="0.8.250811004" targetFramework="native" />
|
||||
<package id="Microsoft.VisualStudio.Setup.Configuration.Native" version="2.3.2262" targetFramework="native" developmentDependency="true" />
|
||||
<package id="Microsoft.UI.Xaml" version="2.8.4" targetFramework="native" />
|
||||
<package id="Microsoft.Web.WebView2" version="1.0.1661.34" targetFramework="native" />
|
||||
|
||||
13
dep/vcpkg-overlay-ports/fmt/fix-write-batch.patch
Normal file
13
dep/vcpkg-overlay-ports/fmt/fix-write-batch.patch
Normal 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 ()
|
||||
38
dep/vcpkg-overlay-ports/fmt/portfile.cmake
Normal file
38
dep/vcpkg-overlay-ports/fmt/portfile.cmake
Normal 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")
|
||||
8
dep/vcpkg-overlay-ports/fmt/usage
Normal file
8
dep/vcpkg-overlay-ports/fmt/usage
Normal 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)
|
||||
17
dep/vcpkg-overlay-ports/fmt/vcpkg.json
Normal file
17
dep/vcpkg-overlay-ports/fmt/vcpkg.json
Normal 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
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2294,8 +2294,15 @@
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The ID of the command this keybinding should execute.",
|
||||
"type": "string"
|
||||
"description": "The ID of the command this keybinding should execute (or null to disable a default).",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"keys": {
|
||||
"description": "Defines the key combinations used to call the command. It must be composed of...\n -any number of modifiers (ctrl/alt/shift)\n -a non-modifier key",
|
||||
@@ -2373,11 +2380,6 @@
|
||||
"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.allowDECRQCRA": {
|
||||
"default": false,
|
||||
"description": "When set to true, the terminal will support the DECRQCRA (Request Checksum of Rectangular Area) escape sequence.",
|
||||
"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.",
|
||||
@@ -2446,6 +2448,7 @@
|
||||
"description": "Direct3D 11 provides a more performant and feature-rich experience, whereas Direct2D is more stable. The default option \"Automatic\" will pick the API that best fits your graphics hardware. If you experience significant issues, consider using Direct2D.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"automatic",
|
||||
"direct2d",
|
||||
"direct3d11"
|
||||
]
|
||||
@@ -2459,8 +2462,9 @@
|
||||
"type": "boolean"
|
||||
},
|
||||
"experimental.input.forceVT": {
|
||||
"description": "Force the terminal to use the legacy input encoding. Certain keys in some applications may stop working when enabling this setting.",
|
||||
"type": "boolean"
|
||||
"type": "boolean",
|
||||
"description": "[Deprecated] Replaced with the \"compatibility.input.forceVT\" profile setting.",
|
||||
"deprecated": true
|
||||
},
|
||||
"experimental.useBackgroundImageForWindow": {
|
||||
"default": false,
|
||||
@@ -2485,11 +2489,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.",
|
||||
@@ -2512,14 +2511,14 @@
|
||||
"type": "string"
|
||||
},
|
||||
"rowsToScroll": {
|
||||
"default": "system",
|
||||
"description": "This parameter once allowed you to override the systemwide \"choose how many lines to scroll at one time\" setting. It no longer does so. However, you can customize the number of lines to scroll in \"scrollUp\" and \"scrollDown\" bindings.",
|
||||
"maximum": 999,
|
||||
"minimum": 0,
|
||||
"type": [
|
||||
"integer",
|
||||
"string"
|
||||
],
|
||||
"description": "[Deprecated] This setting no longer has any effect. However, you can customize the number of lines to scroll using the \"rowsToScroll\" argument on the \"scrollUp\" and \"scrollDown\" actions.",
|
||||
"default": "system",
|
||||
"minimum": 0,
|
||||
"maximum": 999,
|
||||
"deprecated": true
|
||||
},
|
||||
"minimizeToNotificationArea": {
|
||||
@@ -2537,6 +2536,11 @@
|
||||
"description": "When set to true, the Terminal's tab row will display a shield icon when the Terminal is running with administrator privileges",
|
||||
"type": "boolean"
|
||||
},
|
||||
"showTabsFullscreen": {
|
||||
"default": false,
|
||||
"description": "When set to true, tabs remain visible in fullscreen mode. When set to false, tabs will be hidden when entering fullscreen mode.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"useAcrylicInTabRow": {
|
||||
"default": false,
|
||||
"description": "When set to true, the tab row will have an acrylic material background with 50% opacity.",
|
||||
@@ -2560,9 +2564,12 @@
|
||||
"$ref": "#/$defs/NewTabMenu"
|
||||
},
|
||||
"language": {
|
||||
"default": "",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"description": "Sets an override for the app's preferred language, expressed as a BCP-47 language tag like en-US.",
|
||||
"type": "string"
|
||||
"default": null
|
||||
},
|
||||
"theme": {
|
||||
"default": "dark",
|
||||
@@ -2626,19 +2633,19 @@
|
||||
"type": "boolean"
|
||||
},
|
||||
"useTabSwitcher": {
|
||||
"description": "[Deprecated] Replaced with the \"tabSwitcherMode\" setting.",
|
||||
"default": true,
|
||||
"description": "Deprecated. Please use \"tabSwitcherMode\" instead.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"mru",
|
||||
"inOrder",
|
||||
"disabled"
|
||||
],
|
||||
"type": "string"
|
||||
]
|
||||
}
|
||||
],
|
||||
"deprecated": true
|
||||
@@ -2695,12 +2702,12 @@
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"acrylicOpacity": {
|
||||
"type": "number",
|
||||
"description": "[Deprecated] Replaced with the \"opacity\" setting.",
|
||||
"default": 0.5,
|
||||
"description": "[deprecated] Please use `opacity` instead.",
|
||||
"deprecated": true,
|
||||
"maximum": 1,
|
||||
"minimum": 0,
|
||||
"type": "number"
|
||||
"maximum": 1,
|
||||
"deprecated": true
|
||||
},
|
||||
"antialiasingMode": {
|
||||
"default": "grayscale",
|
||||
@@ -2726,6 +2733,21 @@
|
||||
"description": "When set to true, when opening a new tab or pane it will get reloaded environment variables.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"compatibility.input.forceVT": {
|
||||
"default": false,
|
||||
"description": "Force the terminal to use the legacy input encoding. Certain keys in some applications may stop working when enabling this setting.",
|
||||
"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.",
|
||||
@@ -2887,27 +2909,32 @@
|
||||
"type": "boolean"
|
||||
},
|
||||
"experimental.autoMarkPrompts": {
|
||||
"deprecated": true,
|
||||
"description": "This has been replaced by autoMarkPrompts in 1.21",
|
||||
"type": "boolean"
|
||||
"type": "boolean",
|
||||
"description": "[Deprecated] Replaced with the \"autoMarkPrompts\" setting.",
|
||||
"deprecated": true
|
||||
},
|
||||
"experimental.retroTerminalEffect": {
|
||||
"description": "When set to true, enable retro terminal effects. This is an experimental feature, and its continued existence is not guaranteed.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"experimental.showMarksOnScrollbar": {
|
||||
"deprecated": true,
|
||||
"description": "This has been replaced by showMarksOnScrollbar in 1.21",
|
||||
"type": "boolean"
|
||||
"type": "boolean",
|
||||
"description": "[Deprecated] Replaced with the \"showMarksOnScrollbar\" setting.",
|
||||
"deprecated": true
|
||||
},
|
||||
"showMarksOnScrollbar": {
|
||||
"default": false,
|
||||
"description": "When set to true, marks added to the buffer via the addMark action will appear on the scrollbar.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"experimental.rainbowSuggestions": {
|
||||
"type": "boolean",
|
||||
"description": "Enables displaying command suggestions in the terminal in RGB (all the colors of the rainbow!).",
|
||||
"default": false
|
||||
},
|
||||
"experimental.rightClickContextMenu": {
|
||||
"default": false,
|
||||
"description": "When set to true, right-clicking on the terminal will show a context menu. When set to false, right-click will copy",
|
||||
"description": "When true, right-click shows a context menu; otherwise, it pastes from the clipboard or copies selection.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"experimental.repositionCursorWithMouse": {
|
||||
@@ -2920,23 +2947,29 @@
|
||||
"type": "string"
|
||||
},
|
||||
"fontFace": {
|
||||
"default": "Cascadia Mono",
|
||||
"description": "[deprecated] Define 'face' within the 'font' object instead.",
|
||||
"type": "string",
|
||||
"description": "[Deprecated] Replaced with the \"face\" setting within the \"font\" object.",
|
||||
"default": "Cascadia Mono",
|
||||
"deprecated": true
|
||||
},
|
||||
"fontSize": {
|
||||
"default": 12,
|
||||
"description": "[deprecated] Define 'size' within the 'font' object instead.",
|
||||
"minimum": 1,
|
||||
"type": "number",
|
||||
"description": "[Deprecated] Replaced with the \"size\" setting within the \"font\" object.",
|
||||
"default": 12,
|
||||
"minimum": 1,
|
||||
"deprecated": true
|
||||
},
|
||||
"fontWeight": {
|
||||
"description": "[Deprecated] Replaced with the \"weight\" setting within the \"font\" object.",
|
||||
"default": "normal",
|
||||
"description": "[deprecated] Define 'weight' within the 'font' object instead.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "integer",
|
||||
"minimum": 100,
|
||||
"maximum": 990
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"thin",
|
||||
"extra-light",
|
||||
@@ -2949,13 +2982,7 @@
|
||||
"extra-bold",
|
||||
"black",
|
||||
"extra-black"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"maximum": 990,
|
||||
"minimum": 100,
|
||||
"type": "integer"
|
||||
]
|
||||
}
|
||||
],
|
||||
"deprecated": true
|
||||
@@ -3066,7 +3093,10 @@
|
||||
},
|
||||
"answerbackMessage": {
|
||||
"description": "The response that is sent when an ENQ control character is received.",
|
||||
"type": "string"
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"source": {
|
||||
"description": "Stores the name of the profile generator that originated this profile.",
|
||||
@@ -3109,12 +3139,13 @@
|
||||
},
|
||||
"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\".",
|
||||
"description": "Controls how file paths are transformed when they are dragged and dropped on the terminal. Possible values are \"none\", \"wsl\", \"cygwin\", \"msys2\" and \"mingw\".",
|
||||
"enum": [
|
||||
"none",
|
||||
"wsl",
|
||||
"cygwin",
|
||||
"msys2"
|
||||
"msys2",
|
||||
"mingw"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<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>
|
||||
@@ -24,5 +25,61 @@
|
||||
<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>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<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.
|
||||
|
||||
@@ -18,11 +19,22 @@ Common sources are:
|
||||
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.
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.230207.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
|
||||
<package id="Microsoft.UI.Xaml" version="2.8.4" targetFramework="native" />
|
||||
<package id="Microsoft.Web.WebView2" version="1.0.1661.34" targetFramework="native" />
|
||||
</packages>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.230207.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
|
||||
<package id="Microsoft.UI.Xaml" version="2.8.4" targetFramework="native" />
|
||||
<package id="Microsoft.Web.WebView2" version="1.0.1661.34" targetFramework="native" />
|
||||
</packages>
|
||||
|
||||
@@ -186,18 +186,20 @@ bool ImageSlice::_copyCells(const ImageSlice& srcSlice, const til::CoordType src
|
||||
}
|
||||
|
||||
// The used destination before and after the written area must be erased.
|
||||
if (dstUsedBegin < dstWriteBegin)
|
||||
// If this results in the entire range being erased, we return true to let
|
||||
// the caller know that the slice should be deleted.
|
||||
if (dstUsedBegin < dstWriteBegin && _eraseCells(dstUsedBegin, dstWriteBegin))
|
||||
{
|
||||
_eraseCells(dstUsedBegin, dstWriteBegin);
|
||||
return true;
|
||||
}
|
||||
if (dstUsedEnd > dstWriteEnd)
|
||||
if (dstUsedEnd > dstWriteEnd && _eraseCells(dstWriteEnd, dstUsedEnd))
|
||||
{
|
||||
_eraseCells(dstWriteEnd, dstUsedEnd);
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the beginning column is now not less than the end, that means the
|
||||
// content has been entirely erased, so we return true to let the caller
|
||||
// know that the slice should be deleted.
|
||||
// At this point, if the beginning column is not less than the end, that
|
||||
// means this was an empty slice into which nothing was copied, so we can
|
||||
// again return true to let the caller know it should be deleted.
|
||||
return _columnBegin >= _columnEnd;
|
||||
}
|
||||
|
||||
@@ -210,10 +212,19 @@ void ImageSlice::EraseBlock(TextBuffer& buffer, const til::rect rect)
|
||||
}
|
||||
}
|
||||
|
||||
void ImageSlice::EraseCells(TextBuffer& buffer, const til::point at, const size_t distance)
|
||||
void ImageSlice::EraseCells(TextBuffer& buffer, const til::point at, const til::CoordType distance)
|
||||
{
|
||||
auto& row = buffer.GetMutableRowByOffset(at.y);
|
||||
EraseCells(row, at.x, gsl::narrow_cast<til::CoordType>(at.x + distance));
|
||||
auto x = at.x;
|
||||
auto y = at.y;
|
||||
auto distanceRemaining = distance;
|
||||
while (distanceRemaining > 0)
|
||||
{
|
||||
auto& row = buffer.GetMutableRowByOffset(y);
|
||||
EraseCells(row, x, x + distanceRemaining);
|
||||
distanceRemaining -= (static_cast<til::CoordType>(row.size()) - x);
|
||||
x = 0;
|
||||
y++;
|
||||
}
|
||||
}
|
||||
|
||||
void ImageSlice::EraseCells(ROW& row, const til::CoordType columnBegin, const til::CoordType columnEnd)
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
static void CopyRow(const ROW& srcRow, ROW& dstRow);
|
||||
static void CopyCells(const ROW& srcRow, const til::CoordType srcColumn, ROW& dstRow, const til::CoordType dstColumnBegin, const til::CoordType dstColumnEnd);
|
||||
static void EraseBlock(TextBuffer& buffer, const til::rect rect);
|
||||
static void EraseCells(TextBuffer& buffer, const til::point at, const size_t distance);
|
||||
static void EraseCells(TextBuffer& buffer, const til::point at, const til::CoordType distance);
|
||||
static void EraseCells(ROW& row, const til::CoordType columnBegin, const til::CoordType columnEnd);
|
||||
|
||||
private:
|
||||
|
||||
@@ -80,11 +80,12 @@ constexpr OutIt copy_n_small(InIt first, Diff count, OutIt dest)
|
||||
return dest;
|
||||
}
|
||||
|
||||
CharToColumnMapper::CharToColumnMapper(const wchar_t* chars, const uint16_t* charOffsets, ptrdiff_t lastCharOffset, til::CoordType currentColumn) noexcept :
|
||||
CharToColumnMapper::CharToColumnMapper(const wchar_t* chars, const uint16_t* charOffsets, ptrdiff_t charsLength, til::CoordType currentColumn, til::CoordType columnCount) noexcept :
|
||||
_chars{ chars },
|
||||
_charOffsets{ charOffsets },
|
||||
_lastCharOffset{ lastCharOffset },
|
||||
_currentColumn{ currentColumn }
|
||||
_charsLength{ charsLength },
|
||||
_currentColumn{ currentColumn },
|
||||
_columnCount{ columnCount }
|
||||
{
|
||||
}
|
||||
|
||||
@@ -92,7 +93,7 @@ CharToColumnMapper::CharToColumnMapper(const wchar_t* chars, const uint16_t* cha
|
||||
// This function in particular returns the glyph's first column.
|
||||
til::CoordType CharToColumnMapper::GetLeadingColumnAt(ptrdiff_t targetOffset) noexcept
|
||||
{
|
||||
targetOffset = clamp(targetOffset, 0, _lastCharOffset);
|
||||
targetOffset = clamp(targetOffset, 0, _charsLength);
|
||||
|
||||
// This code needs to fulfill two conditions on top of the obvious (a forward/backward search):
|
||||
// A: We never want to stop on a column that is marked with CharOffsetsTrailer (= "GetLeadingColumn").
|
||||
@@ -130,10 +131,14 @@ til::CoordType CharToColumnMapper::GetLeadingColumnAt(ptrdiff_t targetOffset) no
|
||||
til::CoordType CharToColumnMapper::GetTrailingColumnAt(ptrdiff_t offset) noexcept
|
||||
{
|
||||
auto col = GetLeadingColumnAt(offset);
|
||||
// This loop is a little redundant with the forward search loop in GetLeadingColumnAt()
|
||||
// but it's realistically not worth caring about this. This code is not a bottleneck.
|
||||
for (; WI_IsFlagSet(_charOffsets[col + 1], CharOffsetsTrailer); ++col)
|
||||
|
||||
if (col < _columnCount)
|
||||
{
|
||||
// This loop is a little redundant with the forward search loop in GetLeadingColumnAt()
|
||||
// but it's realistically not worth caring about this. This code is not a bottleneck.
|
||||
for (; WI_IsFlagSet(_charOffsets[col + 1], CharOffsetsTrailer); ++col)
|
||||
{
|
||||
}
|
||||
}
|
||||
return col;
|
||||
}
|
||||
@@ -426,7 +431,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;
|
||||
@@ -937,12 +942,12 @@ void ROW::_resizeChars(uint16_t colEndDirty, uint16_t chBegDirty, size_t chEndDi
|
||||
}
|
||||
}
|
||||
|
||||
til::small_rle<TextAttribute, uint16_t, 1>& ROW::Attributes() noexcept
|
||||
RowAttributes& ROW::Attributes() noexcept
|
||||
{
|
||||
return _attr;
|
||||
}
|
||||
|
||||
const til::small_rle<TextAttribute, uint16_t, 1>& ROW::Attributes() const noexcept
|
||||
const RowAttributes& ROW::Attributes() const noexcept
|
||||
{
|
||||
return _attr;
|
||||
}
|
||||
@@ -1114,6 +1119,9 @@ std::wstring_view ROW::GetText() const noexcept
|
||||
return { _chars.data(), width };
|
||||
}
|
||||
|
||||
// Arguments:
|
||||
// - columnBegin: inclusive
|
||||
// - columnEnd: exclusive
|
||||
std::wstring_view ROW::GetText(til::CoordType columnBegin, til::CoordType columnEnd) const noexcept
|
||||
{
|
||||
const auto columns = GetReadableColumnCount();
|
||||
@@ -1219,15 +1227,15 @@ T ROW::_adjustForward(T column) const noexcept
|
||||
}
|
||||
|
||||
// Creates a CharToColumnMapper given an offset into _chars.data().
|
||||
// In other words, for a 120 column ROW with just ASCII text, the offset should be [0,120).
|
||||
// In other words, for a 120 column ROW with just ASCII text, the offset should be [0,120].
|
||||
CharToColumnMapper ROW::_createCharToColumnMapper(ptrdiff_t offset) const noexcept
|
||||
{
|
||||
const auto charsSize = _charSize();
|
||||
const auto lastChar = gsl::narrow_cast<ptrdiff_t>(charsSize - 1);
|
||||
const auto lastChar = gsl::narrow_cast<ptrdiff_t>(charsSize);
|
||||
// We can sort of guess what column belongs to what offset because BMP glyphs are very common and
|
||||
// UTF-16 stores them in 1 char. In other words, usually a ROW will have N chars for N columns.
|
||||
const auto guessedColumn = gsl::narrow_cast<til::CoordType>(clamp(offset, 0, _columnCount));
|
||||
return CharToColumnMapper{ _chars.data(), _charOffsets.data(), lastChar, guessedColumn };
|
||||
return CharToColumnMapper{ _chars.data(), _charOffsets.data(), lastChar, guessedColumn, _columnCount };
|
||||
}
|
||||
|
||||
const std::optional<ScrollbarData>& ROW::GetScrollbarData() const noexcept
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
class ROW;
|
||||
class TextBuffer;
|
||||
|
||||
// Because MarkKind::Output gets set only on the actually written text,
|
||||
// most rows will end up having at least 2 runs: The start of the line
|
||||
// with MarkKind::Output and the rest of the line with MarkKind::None.
|
||||
using RowAttributes = til::small_rle<TextAttribute, uint16_t, 2>;
|
||||
|
||||
enum class DelimiterClass
|
||||
{
|
||||
ControlChar,
|
||||
@@ -71,7 +76,7 @@ struct RowCopyTextFromState
|
||||
// into a ROW's text this class can tell you what cell that pointer belongs to.
|
||||
struct CharToColumnMapper
|
||||
{
|
||||
CharToColumnMapper(const wchar_t* chars, const uint16_t* charOffsets, ptrdiff_t lastCharOffset, til::CoordType currentColumn) noexcept;
|
||||
CharToColumnMapper(const wchar_t* chars, const uint16_t* charOffsets, ptrdiff_t lastCharOffset, til::CoordType currentColumn, til::CoordType columnCount) noexcept;
|
||||
|
||||
til::CoordType GetLeadingColumnAt(ptrdiff_t targetOffset) noexcept;
|
||||
til::CoordType GetTrailingColumnAt(ptrdiff_t offset) noexcept;
|
||||
@@ -85,8 +90,9 @@ private:
|
||||
|
||||
const wchar_t* _chars;
|
||||
const uint16_t* _charOffsets;
|
||||
ptrdiff_t _lastCharOffset;
|
||||
ptrdiff_t _charsLength;
|
||||
til::CoordType _currentColumn;
|
||||
til::CoordType _columnCount;
|
||||
};
|
||||
|
||||
class ROW final
|
||||
@@ -148,8 +154,8 @@ public:
|
||||
void ReplaceText(RowWriteState& state);
|
||||
void CopyTextFrom(RowCopyTextFromState& state);
|
||||
|
||||
til::small_rle<TextAttribute, uint16_t, 1>& Attributes() noexcept;
|
||||
const til::small_rle<TextAttribute, uint16_t, 1>& Attributes() const noexcept;
|
||||
RowAttributes& Attributes() noexcept;
|
||||
const RowAttributes& Attributes() const noexcept;
|
||||
TextAttribute GetAttrByColumn(til::CoordType column) const;
|
||||
std::vector<uint16_t> GetHyperlinks() const;
|
||||
ImageSlice* SetImageSlice(ImageSlice::Pointer imageSlice) noexcept;
|
||||
@@ -297,7 +303,7 @@ private:
|
||||
std::span<uint16_t> _charOffsets;
|
||||
// _attr is a run-length-encoded vector of TextAttribute with a decompressed
|
||||
// length equal to _columnCount (= 1 TextAttribute per column).
|
||||
til::small_rle<TextAttribute, uint16_t, 1> _attr;
|
||||
RowAttributes _attr;
|
||||
// The width of the row in visual columns.
|
||||
uint16_t _columnCount = 0;
|
||||
// Stores double-width/height (DECSWL/DECDWL/DECDHL) attributes.
|
||||
|
||||
@@ -232,6 +232,11 @@ void TextAttribute::SetRightVerticalDisplayed(const bool isDisplayed) noexcept
|
||||
WI_UpdateFlag(_attrs, CharacterAttributes::RightGridline, isDisplayed);
|
||||
}
|
||||
|
||||
bool TextAttribute::IsBold(const bool intenseIsBold) const noexcept
|
||||
{
|
||||
return IsIntense() && (intenseIsBold || !_foreground.CanBeBrightened());
|
||||
}
|
||||
|
||||
bool TextAttribute::IsIntense() const noexcept
|
||||
{
|
||||
return WI_IsFlagSet(_attrs, CharacterAttributes::Intense);
|
||||
|
||||
@@ -115,6 +115,7 @@ public:
|
||||
return memcmp(this, &other, sizeof(TextAttribute)) != 0;
|
||||
}
|
||||
|
||||
bool IsBold(const bool intenseIsBold) const noexcept;
|
||||
bool IsLegacy() const noexcept;
|
||||
bool IsIntense() const noexcept;
|
||||
bool IsFaint() const noexcept;
|
||||
|
||||
@@ -411,16 +411,13 @@ Microsoft::Console::ICU::unique_uregex Microsoft::Console::ICU::CreateRegex(cons
|
||||
return unique_uregex{ re };
|
||||
}
|
||||
|
||||
// Returns an inclusive point range given a text start and end position.
|
||||
// Returns a half-open [beg,end) range given a text start and end position.
|
||||
// This function is designed to be used with uregex_start64/uregex_end64.
|
||||
til::point_span Microsoft::Console::ICU::BufferRangeFromMatch(UText* ut, URegularExpression* re)
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
const auto nativeIndexBeg = uregex_start64(re, 0, &status);
|
||||
auto nativeIndexEnd = uregex_end64(re, 0, &status);
|
||||
|
||||
// The parameters are given as a half-open [beg,end) range, but the point_span we return in closed [beg,end].
|
||||
nativeIndexEnd--;
|
||||
const auto nativeIndexEnd = uregex_end64(re, 0, &status);
|
||||
|
||||
const auto& textBuffer = *static_cast<const TextBuffer*>(ut->context);
|
||||
til::point_span ret;
|
||||
@@ -439,7 +436,7 @@ til::point_span Microsoft::Console::ICU::BufferRangeFromMatch(UText* ut, URegula
|
||||
if (utextAccess(ut, nativeIndexEnd, true))
|
||||
{
|
||||
const auto y = accessCurrentRow(ut);
|
||||
ret.end.x = textBuffer.GetRowByOffset(y).GetTrailingColumnAtCharOffset(ut->chunkOffset);
|
||||
ret.end.x = textBuffer.GetRowByOffset(y).GetLeadingColumnAtCharOffset(ut->chunkOffset);
|
||||
ret.end.y = y;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1118,6 +1118,14 @@ void TextBuffer::TriggerNewTextNotification(const std::wstring_view newText)
|
||||
}
|
||||
}
|
||||
|
||||
void TextBuffer::TriggerSelection()
|
||||
{
|
||||
if (_isActiveBuffer && _renderer)
|
||||
{
|
||||
_renderer->TriggerSelection();
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - get delimiter class for buffer cell position
|
||||
// - used for double click selection and uia word navigation
|
||||
@@ -1132,6 +1140,213 @@ DelimiterClass TextBuffer::_GetDelimiterClassAt(const til::point pos, const std:
|
||||
return GetRowByOffset(realPos.y).DelimiterClassAt(realPos.x, wordDelimiters);
|
||||
}
|
||||
|
||||
til::point TextBuffer::GetWordStart2(til::point pos, const std::wstring_view wordDelimiters, bool includeWhitespace, std::optional<til::point> limitOptional) const
|
||||
{
|
||||
const auto bufferSize{ GetSize() };
|
||||
const auto limit{ limitOptional.value_or(bufferSize.BottomInclusiveRightExclusive()) };
|
||||
|
||||
if (pos < bufferSize.Origin())
|
||||
{
|
||||
// can't move further back, so return early at origin
|
||||
return bufferSize.Origin();
|
||||
}
|
||||
else if (pos >= limit)
|
||||
{
|
||||
// clamp to limit,
|
||||
// but still do movement
|
||||
pos = limit;
|
||||
}
|
||||
|
||||
// Consider the delimiter classes represented as these chars:
|
||||
// - ControlChar: "_"
|
||||
// - DelimiterChar: "D"
|
||||
// - RegularChar: "C"
|
||||
// Expected results ("|" is the position):
|
||||
// includeWhitespace: true false
|
||||
// CCC___| --> |CCC___ CCC|___
|
||||
// DDD___| --> |DDD___ DDD|___
|
||||
// ___CCC| --> ___|CCC ___|CCC
|
||||
// DDDCCC| --> DDD|CCC DDD|CCC
|
||||
// ___DDD| --> ___|DDD ___|DDD
|
||||
// CCCDDD| --> CCC|DDD CCC|DDD
|
||||
// So the heuristic we use is:
|
||||
// 1. move to the beginning of the delimiter class run
|
||||
// 2. (includeWhitespace) if we were on a ControlChar, go back one more delimiter class run
|
||||
const auto initialDelimiter = bufferSize.IsInBounds(pos) ? _GetDelimiterClassAt(pos, wordDelimiters) : DelimiterClass::ControlChar;
|
||||
pos = _GetDelimiterClassRunStart(pos, wordDelimiters);
|
||||
if (!includeWhitespace || pos.x == bufferSize.Left())
|
||||
{
|
||||
// Special case:
|
||||
// we're at the left boundary (and end of a delimiter class run),
|
||||
// we already know we can't wrap, so return early
|
||||
return pos;
|
||||
}
|
||||
else if (initialDelimiter == DelimiterClass::ControlChar)
|
||||
{
|
||||
bufferSize.DecrementInExclusiveBounds(pos);
|
||||
pos = _GetDelimiterClassRunStart(pos, wordDelimiters);
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
til::point TextBuffer::GetWordEnd2(til::point pos, const std::wstring_view wordDelimiters, bool includeWhitespace, std::optional<til::point> limitOptional) const
|
||||
{
|
||||
const auto bufferSize{ GetSize() };
|
||||
const auto limit{ limitOptional.value_or(bufferSize.BottomInclusiveRightExclusive()) };
|
||||
|
||||
if (pos >= limit)
|
||||
{
|
||||
// can't move further forward,
|
||||
// so return early at limit
|
||||
return limit;
|
||||
}
|
||||
else if (const auto origin{ bufferSize.Origin() }; pos < origin)
|
||||
{
|
||||
// clamp to origin,
|
||||
// but still do movement
|
||||
pos = origin;
|
||||
}
|
||||
|
||||
// Consider the delimiter classes represented as these chars:
|
||||
// - ControlChar: "_"
|
||||
// - DelimiterChar: "D"
|
||||
// - RegularChar: "C"
|
||||
// Expected results ("|" is the position):
|
||||
// includeWhitespace: true false
|
||||
// |CCC___ --> CCC___| CCC|___
|
||||
// |DDD___ --> DDD___| DDD|___
|
||||
// |___CCC --> ___|CCC ___|CCC
|
||||
// |DDDCCC --> DDD|CCC DDD|CCC
|
||||
// |___DDD --> ___|DDD ___|DDD
|
||||
// |CCCDDD --> CCC|DDD CCC|DDD
|
||||
// So the heuristic we use is:
|
||||
// 1. move to the end of the delimiter class run
|
||||
// 2. (includeWhitespace) if the next delimiter class run is a ControlChar, go forward one more delimiter class run
|
||||
pos = _GetDelimiterClassRunEnd(pos, wordDelimiters);
|
||||
if (!includeWhitespace || pos.x == bufferSize.RightExclusive())
|
||||
{
|
||||
// Special case:
|
||||
// we're at the right boundary (and end of a delimiter class run),
|
||||
// we already know we can't wrap, so return early
|
||||
return pos;
|
||||
}
|
||||
|
||||
if (const auto nextDelimClass = bufferSize.IsInBounds(pos) ? _GetDelimiterClassAt(pos, wordDelimiters) : DelimiterClass::ControlChar;
|
||||
nextDelimClass == DelimiterClass::ControlChar)
|
||||
{
|
||||
return _GetDelimiterClassRunEnd(pos, wordDelimiters);
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
bool TextBuffer::IsWordBoundary(const til::point pos, const std::wstring_view wordDelimiters) const
|
||||
{
|
||||
const auto bufferSize = GetSize();
|
||||
if (!bufferSize.IsInExclusiveBounds(pos))
|
||||
{
|
||||
// not in bounds
|
||||
return false;
|
||||
}
|
||||
|
||||
// buffer boundaries are always word boundaries
|
||||
if (pos == bufferSize.Origin() || pos == bufferSize.BottomInclusiveRightExclusive())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// at beginning of the row, but we didn't wrap
|
||||
if (pos.x == bufferSize.Left())
|
||||
{
|
||||
const auto& row = GetRowByOffset(pos.y - 1);
|
||||
if (!row.WasWrapForced())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// at end of the row, but we didn't wrap
|
||||
if (pos.x == bufferSize.RightExclusive())
|
||||
{
|
||||
const auto& row = GetRowByOffset(pos.y);
|
||||
if (!row.WasWrapForced())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// we can treat text as contiguous,
|
||||
// use DecrementInBounds (not exclusive) here
|
||||
auto prevPos = pos;
|
||||
bufferSize.DecrementInBounds(prevPos);
|
||||
const auto prevDelimiterClass = _GetDelimiterClassAt(prevPos, wordDelimiters);
|
||||
|
||||
// if we changed delimiter class
|
||||
// and the current delimiter class is not a control char,
|
||||
// we're at a word boundary
|
||||
const auto currentDelimiterClass = _GetDelimiterClassAt(pos, wordDelimiters);
|
||||
return prevDelimiterClass != currentDelimiterClass && currentDelimiterClass != DelimiterClass::ControlChar;
|
||||
}
|
||||
|
||||
til::point TextBuffer::_GetDelimiterClassRunStart(til::point pos, const std::wstring_view wordDelimiters) const
|
||||
{
|
||||
const auto bufferSize = GetSize();
|
||||
const auto initialDelimClass = bufferSize.IsInBounds(pos) ? _GetDelimiterClassAt(pos, wordDelimiters) : DelimiterClass::ControlChar;
|
||||
for (auto nextPos = pos; nextPos != bufferSize.Origin(); pos = nextPos)
|
||||
{
|
||||
bufferSize.DecrementInExclusiveBounds(nextPos);
|
||||
|
||||
if (nextPos.x == bufferSize.RightExclusive())
|
||||
{
|
||||
// wrapped onto previous line,
|
||||
// check if it was forced to wrap
|
||||
const auto& row = GetRowByOffset(nextPos.y);
|
||||
if (!row.WasWrapForced())
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
else if (_GetDelimiterClassAt(nextPos, wordDelimiters) != initialDelimClass)
|
||||
{
|
||||
// if we changed delim class, we're done (don't apply move)
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Get the exclusive position for the end of the current delimiter class run
|
||||
// Arguments:
|
||||
// - pos - the buffer position being within the current delimiter class
|
||||
// - wordDelimiters - what characters are we considering for the separation of words
|
||||
til::point TextBuffer::_GetDelimiterClassRunEnd(til::point pos, const std::wstring_view wordDelimiters) const
|
||||
{
|
||||
const auto bufferSize = GetSize();
|
||||
const auto initialDelimClass = bufferSize.IsInBounds(pos) ? _GetDelimiterClassAt(pos, wordDelimiters) : DelimiterClass::ControlChar;
|
||||
for (auto nextPos = pos; nextPos != bufferSize.BottomInclusiveRightExclusive(); pos = nextPos)
|
||||
{
|
||||
bufferSize.IncrementInExclusiveBounds(nextPos);
|
||||
|
||||
if (nextPos.x == bufferSize.Left())
|
||||
{
|
||||
// wrapped onto next line,
|
||||
// check if it was forced to wrap or switched delimiter class
|
||||
const auto& row = GetRowByOffset(pos.y);
|
||||
if (!row.WasWrapForced() || _GetDelimiterClassAt(nextPos, wordDelimiters) != initialDelimClass)
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
else if (bufferSize.IsInBounds(nextPos) && _GetDelimiterClassAt(nextPos, wordDelimiters) != initialDelimClass)
|
||||
{
|
||||
// if we changed delim class,
|
||||
// apply the move and return
|
||||
return nextPos;
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Get the til::point for the beginning of the word you are on
|
||||
// Arguments:
|
||||
@@ -1520,13 +1735,14 @@ til::point TextBuffer::GetGlyphStart(const til::point pos, std::optional<til::po
|
||||
const auto limit{ limitOptional.value_or(bufferSize.EndExclusive()) };
|
||||
|
||||
// Clamp pos to limit
|
||||
if (bufferSize.CompareInBounds(resultPos, limit, true) > 0)
|
||||
if (resultPos > limit)
|
||||
{
|
||||
resultPos = limit;
|
||||
return limit;
|
||||
}
|
||||
|
||||
// limit is exclusive, so we need to move back to be within valid bounds
|
||||
if (resultPos != limit && GetCellDataAt(resultPos)->DbcsAttr() == DbcsAttribute::Trailing)
|
||||
// if we're on a trailing byte, move to the leading byte
|
||||
if (bufferSize.IsInBounds(resultPos) &&
|
||||
GetCellDataAt(resultPos)->DbcsAttr() == DbcsAttribute::Trailing)
|
||||
{
|
||||
bufferSize.DecrementInBounds(resultPos, true);
|
||||
}
|
||||
@@ -1548,12 +1764,13 @@ til::point TextBuffer::GetGlyphEnd(const til::point pos, bool accessibilityMode,
|
||||
const auto limit{ limitOptional.value_or(bufferSize.EndExclusive()) };
|
||||
|
||||
// Clamp pos to limit
|
||||
if (bufferSize.CompareInBounds(resultPos, limit, true) > 0)
|
||||
if (resultPos > limit)
|
||||
{
|
||||
resultPos = limit;
|
||||
return limit;
|
||||
}
|
||||
|
||||
if (resultPos != limit && GetCellDataAt(resultPos)->DbcsAttr() == DbcsAttribute::Leading)
|
||||
if (bufferSize.IsInBounds(resultPos) &&
|
||||
GetCellDataAt(resultPos)->DbcsAttr() == DbcsAttribute::Leading)
|
||||
{
|
||||
bufferSize.IncrementInBounds(resultPos, true);
|
||||
}
|
||||
@@ -1610,6 +1827,31 @@ bool TextBuffer::MoveToNextGlyph(til::point& pos, bool allowExclusiveEnd, std::o
|
||||
return success;
|
||||
}
|
||||
|
||||
bool TextBuffer::MoveToNextGlyph2(til::point& pos, std::optional<til::point> limitOptional) const
|
||||
{
|
||||
const auto bufferSize = GetSize();
|
||||
const auto limit{ limitOptional.value_or(bufferSize.BottomInclusiveRightExclusive()) };
|
||||
|
||||
if (pos >= limit)
|
||||
{
|
||||
// Corner Case: we're on/past the limit
|
||||
// Clamp us to the limit
|
||||
pos = limit;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Try to move forward, but if we hit the buffer boundary, we fail to move.
|
||||
const bool success = bufferSize.IncrementInExclusiveBounds(pos);
|
||||
if (success &&
|
||||
bufferSize.IsInBounds(pos) &&
|
||||
GetCellDataAt(pos)->DbcsAttr() == DbcsAttribute::Trailing)
|
||||
{
|
||||
// Move again if we're on a wide glyph
|
||||
bufferSize.IncrementInExclusiveBounds(pos);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Update pos to be the beginning of the previous glyph/character. This is used for accessibility
|
||||
// Arguments:
|
||||
@@ -1642,6 +1884,31 @@ bool TextBuffer::MoveToPreviousGlyph(til::point& pos, std::optional<til::point>
|
||||
return success;
|
||||
}
|
||||
|
||||
bool TextBuffer::MoveToPreviousGlyph2(til::point& pos, std::optional<til::point> limitOptional) const
|
||||
{
|
||||
const auto bufferSize = GetSize();
|
||||
const auto limit{ limitOptional.value_or(bufferSize.BottomInclusiveRightExclusive()) };
|
||||
|
||||
if (pos >= limit)
|
||||
{
|
||||
// Corner Case: we're on/past the limit
|
||||
// Clamp us to the limit
|
||||
pos = limit;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Try to move backward, but if we hit the buffer boundary, we fail to move.
|
||||
const bool success = bufferSize.DecrementInExclusiveBounds(pos);
|
||||
if (success &&
|
||||
bufferSize.IsInBounds(pos) &&
|
||||
GetCellDataAt(pos)->DbcsAttr() == DbcsAttribute::Trailing)
|
||||
{
|
||||
// Move again if we're on a wide glyph
|
||||
bufferSize.DecrementInExclusiveBounds(pos);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Determines the line-by-line rectangles based on two COORDs
|
||||
// - expands the rectangles to support wide glyphs
|
||||
@@ -1660,12 +1927,10 @@ const std::vector<til::inclusive_rect> TextBuffer::GetTextRects(til::point start
|
||||
{
|
||||
std::vector<til::inclusive_rect> textRects;
|
||||
|
||||
const auto bufferSize = GetSize();
|
||||
|
||||
// (0,0) is the top-left of the screen
|
||||
// the physically "higher" coordinate is closer to the top-left
|
||||
// the physically "lower" coordinate is closer to the bottom-right
|
||||
const auto [higherCoord, lowerCoord] = bufferSize.CompareInBounds(start, end) <= 0 ?
|
||||
const auto [higherCoord, lowerCoord] = start <= end ?
|
||||
std::make_tuple(start, end) :
|
||||
std::make_tuple(end, start);
|
||||
|
||||
@@ -1686,6 +1951,7 @@ const std::vector<til::inclusive_rect> TextBuffer::GetTextRects(til::point start
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto bufferSize = GetSize();
|
||||
textRow.left = (row == higherCoord.y) ? higherCoord.x : bufferSize.Left();
|
||||
textRow.right = (row == lowerCoord.y) ? lowerCoord.x : bufferSize.RightInclusive();
|
||||
}
|
||||
@@ -1710,7 +1976,7 @@ const std::vector<til::inclusive_rect> TextBuffer::GetTextRects(til::point start
|
||||
// - Else if a blockSelection, returns spans corresponding to each line in the block selection
|
||||
// Arguments:
|
||||
// - start: beginning of the text region of interest (inclusive)
|
||||
// - end: the other end of the text region of interest (inclusive)
|
||||
// - end: the other end of the text region of interest (exclusive)
|
||||
// - blockSelection: when enabled, get spans for each line covered by the block
|
||||
// - bufferCoordinates: when enabled, treat the coordinates as relative to
|
||||
// the buffer rather than the screen.
|
||||
@@ -1780,49 +2046,27 @@ void TextBuffer::_ExpandTextRow(til::inclusive_rect& textRow) const
|
||||
|
||||
// expand left side of rect
|
||||
til::point targetPoint{ textRow.left, textRow.top };
|
||||
if (GetCellDataAt(targetPoint)->DbcsAttr() == DbcsAttribute::Trailing)
|
||||
if (bufferSize.IsInBounds(targetPoint) && GetCellDataAt(targetPoint)->DbcsAttr() == DbcsAttribute::Trailing)
|
||||
{
|
||||
if (targetPoint.x == bufferSize.Left())
|
||||
{
|
||||
bufferSize.IncrementInBounds(targetPoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
bufferSize.DecrementInBounds(targetPoint);
|
||||
}
|
||||
bufferSize.DecrementInExclusiveBounds(targetPoint);
|
||||
textRow.left = targetPoint.x;
|
||||
}
|
||||
|
||||
// expand right side of rect
|
||||
targetPoint = { textRow.right, textRow.bottom };
|
||||
if (GetCellDataAt(targetPoint)->DbcsAttr() == DbcsAttribute::Leading)
|
||||
if (bufferSize.IsInBounds(targetPoint) && GetCellDataAt(targetPoint)->DbcsAttr() == DbcsAttribute::Trailing)
|
||||
{
|
||||
if (targetPoint.x == bufferSize.RightInclusive())
|
||||
{
|
||||
bufferSize.DecrementInBounds(targetPoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
bufferSize.IncrementInBounds(targetPoint);
|
||||
}
|
||||
bufferSize.IncrementInExclusiveBounds(targetPoint);
|
||||
textRow.right = targetPoint.x;
|
||||
}
|
||||
}
|
||||
|
||||
size_t TextBuffer::SpanLength(const til::point coordStart, const til::point coordEnd) const
|
||||
{
|
||||
const auto bufferSize = GetSize();
|
||||
// The coords are inclusive, so to get the (inclusive) length we add 1.
|
||||
const auto length = bufferSize.CompareInBounds(coordEnd, coordStart) + 1;
|
||||
return gsl::narrow<size_t>(length);
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Retrieves the plain text data between the specified coordinates.
|
||||
// Arguments:
|
||||
// - trimTrailingWhitespace - remove the trailing whitespace at the end of the result.
|
||||
// - start - where to start getting text (should be at or prior to "end")
|
||||
// - end - where to end getting text
|
||||
// - start - where to start getting text (should be at or prior to "end") (inclusive)
|
||||
// - end - where to end getting text (exclusive)
|
||||
// Return Value:
|
||||
// - Just the text.
|
||||
std::wstring TextBuffer::GetPlainText(const til::point start, const til::point end) const
|
||||
@@ -1851,7 +2095,7 @@ std::tuple<til::CoordType, til::CoordType, bool> TextBuffer::_RowCopyHelper(cons
|
||||
const auto maxX = req.bufferCoordinates ? req.maxX : ScreenToBufferLineInclusive(til::point{ req.maxX, iRow }, lineRendition).x;
|
||||
|
||||
rowBeg = minX;
|
||||
rowEnd = maxX + 1; // +1 to get an exclusive end
|
||||
rowEnd = maxX;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1860,7 +2104,7 @@ std::tuple<til::CoordType, til::CoordType, bool> TextBuffer::_RowCopyHelper(cons
|
||||
const auto end = req.bufferCoordinates ? req.end : ScreenToBufferLineInclusive(req.end, lineRendition);
|
||||
|
||||
rowBeg = iRow != beg.y ? 0 : beg.x;
|
||||
rowEnd = iRow != end.y ? row.GetReadableColumnCount() : end.x + 1; // +1 to get an exclusive end
|
||||
rowEnd = iRow != end.y ? row.GetReadableColumnCount() : end.x;
|
||||
}
|
||||
|
||||
// Our selection mechanism doesn't stick to glyph boundaries at the moment.
|
||||
@@ -1905,7 +2149,7 @@ std::wstring TextBuffer::GetPlainText(const CopyRequest& req) const
|
||||
const auto& row = GetRowByOffset(iRow);
|
||||
const auto& [rowBeg, rowEnd, addLineBreak] = _RowCopyHelper(req, iRow, row);
|
||||
|
||||
// save selected text
|
||||
// save selected text (exclusive end)
|
||||
selectedText += row.GetText(rowBeg, rowEnd);
|
||||
|
||||
if (addLineBreak && iRow != req.end.y)
|
||||
@@ -2034,7 +2278,7 @@ std::string TextBuffer::GenHTML(const CopyRequest& req,
|
||||
fmt::format_to(std::back_inserter(htmlBuilder), FMT_COMPILE("color:{};"), fgHex);
|
||||
fmt::format_to(std::back_inserter(htmlBuilder), FMT_COMPILE("background-color:{};"), bgHex);
|
||||
|
||||
if (isIntenseBold && attr.IsIntense())
|
||||
if (attr.IsBold(isIntenseBold))
|
||||
{
|
||||
htmlBuilder += "font-weight:bold;";
|
||||
}
|
||||
@@ -2284,7 +2528,7 @@ std::string TextBuffer::GenRTF(const CopyRequest& req,
|
||||
fmt::format_to(std::back_inserter(contentBuilder), FMT_COMPILE("\\cf{}"), fgIdx);
|
||||
fmt::format_to(std::back_inserter(contentBuilder), FMT_COMPILE("\\chshdng0\\chcbpat{}"), bgIdx);
|
||||
|
||||
if (isIntenseBold && attr.IsIntense())
|
||||
if (attr.IsBold(isIntenseBold))
|
||||
{
|
||||
contentBuilder += "\\b";
|
||||
}
|
||||
|
||||
@@ -170,9 +170,15 @@ public:
|
||||
void TriggerScroll();
|
||||
void TriggerScroll(const til::point delta);
|
||||
void TriggerNewTextNotification(const std::wstring_view newText);
|
||||
void TriggerSelection();
|
||||
|
||||
til::point GetWordStart(const til::point target, const std::wstring_view wordDelimiters, bool accessibilityMode = false, std::optional<til::point> limitOptional = std::nullopt) const;
|
||||
til::point GetWordEnd(const til::point target, const std::wstring_view wordDelimiters, bool accessibilityMode = false, std::optional<til::point> limitOptional = std::nullopt) const;
|
||||
|
||||
til::point GetWordStart2(til::point pos, const std::wstring_view wordDelimiters, bool includeWhitespace, std::optional<til::point> limitOptional = std::nullopt) const;
|
||||
til::point GetWordEnd2(til::point pos, const std::wstring_view wordDelimiters, bool includeWhitespace, std::optional<til::point> limitOptional = std::nullopt) const;
|
||||
|
||||
bool IsWordBoundary(const til::point pos, const std::wstring_view wordDelimiters) const;
|
||||
bool MoveToNextWord(til::point& pos, const std::wstring_view wordDelimiters, std::optional<til::point> limitOptional = std::nullopt) const;
|
||||
bool MoveToPreviousWord(til::point& pos, const std::wstring_view wordDelimiters) const;
|
||||
|
||||
@@ -180,6 +186,8 @@ public:
|
||||
til::point GetGlyphEnd(const til::point pos, bool accessibilityMode = false, std::optional<til::point> limitOptional = std::nullopt) const;
|
||||
bool MoveToNextGlyph(til::point& pos, bool allowBottomExclusive = false, std::optional<til::point> limitOptional = std::nullopt) const;
|
||||
bool MoveToPreviousGlyph(til::point& pos, std::optional<til::point> limitOptional = std::nullopt) const;
|
||||
bool MoveToNextGlyph2(til::point& pos, std::optional<til::point> limitOptional = std::nullopt) const;
|
||||
bool MoveToPreviousGlyph2(til::point& pos, std::optional<til::point> limitOptional = std::nullopt) const;
|
||||
|
||||
const std::vector<til::inclusive_rect> GetTextRects(til::point start, til::point end, bool blockSelection, bool bufferCoordinates) const;
|
||||
std::vector<til::point_span> GetTextSpans(til::point start, til::point end, bool blockSelection, bool bufferCoordinates) const;
|
||||
@@ -191,8 +199,6 @@ public:
|
||||
std::wstring GetCustomIdFromId(uint16_t id) const;
|
||||
void CopyHyperlinkMaps(const TextBuffer& OtherBuffer);
|
||||
|
||||
size_t SpanLength(const til::point coordStart, const til::point coordEnd) const;
|
||||
|
||||
std::wstring GetPlainText(til::point start, til::point end) const;
|
||||
|
||||
struct CopyRequest
|
||||
@@ -322,6 +328,8 @@ private:
|
||||
void _SetFirstRowIndex(const til::CoordType FirstRowIndex) noexcept;
|
||||
void _ExpandTextRow(til::inclusive_rect& selectionRow) const;
|
||||
DelimiterClass _GetDelimiterClassAt(const til::point pos, const std::wstring_view wordDelimiters) const;
|
||||
til::point _GetDelimiterClassRunStart(til::point pos, const std::wstring_view wordDelimiters) const;
|
||||
til::point _GetDelimiterClassRunEnd(til::point pos, const std::wstring_view wordDelimiters) const;
|
||||
til::point _GetWordStartForAccessibility(const til::point target, const std::wstring_view wordDelimiters) const;
|
||||
til::point _GetWordStartForSelection(const til::point target, const std::wstring_view wordDelimiters) const;
|
||||
til::point _GetWordEndForAccessibility(const til::point target, const std::wstring_view wordDelimiters, const til::point limit) const;
|
||||
|
||||
@@ -49,15 +49,15 @@ class UTextAdapterTests
|
||||
return { { beg, 0 }, { end, 0 } };
|
||||
};
|
||||
|
||||
auto expected = std::vector{ s(0, 2), s(8, 10) };
|
||||
auto expected = std::vector{ s(0, 3), s(8, 11) };
|
||||
auto actual = buffer.SearchText(L"abc", SearchFlag::None);
|
||||
VERIFY_ARE_EQUAL(expected, actual);
|
||||
|
||||
expected = std::vector{ s(5, 5) };
|
||||
expected = std::vector{ s(5, 6) };
|
||||
actual = buffer.SearchText(L"𝒷", SearchFlag::None);
|
||||
VERIFY_ARE_EQUAL(expected, actual);
|
||||
|
||||
expected = std::vector{ s(12, 15) };
|
||||
expected = std::vector{ s(12, 16) };
|
||||
actual = buffer.SearchText(L"ネコ", SearchFlag::None);
|
||||
VERIFY_ARE_EQUAL(expected, actual);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<ProjectName>elevate-shim</ProjectName>
|
||||
<TargetName>elevate-shim</TargetName>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<VersionInfoFileDescription>Windows Terminal Administrator Launch Helper</VersionInfoFileDescription>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
|
||||
|
||||
@@ -287,7 +287,7 @@ namespace TerminalAppLocalTests
|
||||
NewTabArgs args{ newTerminalArgs };
|
||||
ActionAndArgs newTabAction{ ShortcutAction::NewTab, args };
|
||||
// push the arg onto the front
|
||||
page->_startupActions.Append(newTabAction);
|
||||
page->_startupActions.push_back(std::move(newTabAction));
|
||||
Log::Comment(L"Added a single newTab action");
|
||||
|
||||
auto app = ::winrt::Windows::UI::Xaml::Application::Current();
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<PropertyGroup Label="NuGet Dependencies">
|
||||
<!-- TerminalCppWinrt is intentionally not set -->
|
||||
<TerminalMUX>true</TerminalMUX>
|
||||
<TerminalThemeHelpers>true</TerminalThemeHelpers>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(SolutionDir)\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<SubSystem>Console</SubSystem>
|
||||
<!-- suppress a bunch of Windows Universal properties from cppwinrt.props -->
|
||||
<OpenConsoleUniversalApp>false</OpenConsoleUniversalApp>
|
||||
<VersionInfoFileDescription>Windows Terminal Open Here Shell Extension</VersionInfoFileDescription>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="NuGet Dependencies">
|
||||
<TerminalCppWinrt>true</TerminalCppWinrt>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:TerminalApp"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mtu="using:Microsoft.Terminal.UI"
|
||||
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
|
||||
x:Uid="AboutDialog"
|
||||
DefaultButton="Close"
|
||||
@@ -17,6 +18,9 @@
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock IsTextSelectionEnabled="True">
|
||||
<TextBlock.ContextFlyout>
|
||||
<mtu:TextMenuFlyout />
|
||||
</TextBlock.ContextFlyout>
|
||||
<Run AutomationProperties.HeadingLevel="1"
|
||||
Text="{x:Bind ApplicationDisplayName}" /> <LineBreak />
|
||||
<Run x:Uid="AboutDialog_VersionLabel" />
|
||||
@@ -39,7 +43,7 @@
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Vertical"
|
||||
Visibility="{x:Bind UpdatesAvailable, Mode=OneWay}">
|
||||
<TextBlock IsTextSelectionEnabled="False">
|
||||
<TextBlock>
|
||||
<Run x:Uid="AboutDialog_UpdateAvailableLabel" />
|
||||
</TextBlock>
|
||||
<!-- <Button x:Uid="AboutDialog_InstallUpdateButton"
|
||||
@@ -59,4 +63,3 @@
|
||||
Click="_ThirdPartyNoticesOnClick" />
|
||||
</StackPanel>
|
||||
</ContentDialog>
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -752,13 +752,11 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
if (const auto& realArgs = actionArgs.ActionArgs().try_as<ExecuteCommandlineArgs>())
|
||||
{
|
||||
auto actions = winrt::single_threaded_vector<ActionAndArgs>(
|
||||
TerminalPage::ConvertExecuteCommandlineToActions(realArgs));
|
||||
|
||||
if (actions.Size() != 0)
|
||||
auto actions = ConvertExecuteCommandlineToActions(realArgs);
|
||||
if (!actions.empty())
|
||||
{
|
||||
actionArgs.Handled(true);
|
||||
ProcessStartupActions(actions, false);
|
||||
ProcessStartupActions(std::move(actions));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -900,7 +898,10 @@ namespace winrt::TerminalApp::implementation
|
||||
co_return;
|
||||
}
|
||||
|
||||
// Hop to the BG thread
|
||||
// ShellExecuteExW may block, so do it on a background thread.
|
||||
//
|
||||
// NOTE: All remaining code of this function doesn't touch `this`, so we don't need weak/strong_ref.
|
||||
// NOTE NOTE: Don't touch `this` when you make changes here.
|
||||
co_await winrt::resume_background();
|
||||
|
||||
// This will get us the correct exe for dev/preview/release. If you
|
||||
@@ -1453,6 +1454,8 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
safe_void_coroutine TerminalPage::_doHandleSuggestions(SuggestionsArgs realArgs)
|
||||
{
|
||||
const auto weak = get_weak();
|
||||
const auto dispatcher = Dispatcher();
|
||||
const auto source = realArgs.Source();
|
||||
std::vector<Command> commandsCollection;
|
||||
Control::CommandHistoryContext context{ nullptr };
|
||||
@@ -1519,7 +1522,12 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
co_await wil::resume_foreground(Dispatcher());
|
||||
co_await wil::resume_foreground(dispatcher);
|
||||
const auto strong = weak.get();
|
||||
if (!strong)
|
||||
{
|
||||
co_return;
|
||||
}
|
||||
|
||||
// Open the palette with all these commands in it.
|
||||
_OpenSuggestions(_GetActiveControl(),
|
||||
|
||||
@@ -961,18 +961,6 @@ std::vector<ActionAndArgs>& AppCommandlineArgs::GetStartupActions()
|
||||
return _startupActions;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Returns whether we should start listening for inbound PTY connections
|
||||
// coming from the operating system default application feature.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - True if the listener should be started. False otherwise.
|
||||
bool AppCommandlineArgs::IsHandoffListener() const noexcept
|
||||
{
|
||||
return _isHandoffListener;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Get the string of text that should be displayed to the user on exit. This
|
||||
// is usually helpful for cases where the user entered some sort of invalid
|
||||
@@ -1015,34 +1003,28 @@ bool AppCommandlineArgs::ShouldExitEarly() const noexcept
|
||||
// - <none>
|
||||
void AppCommandlineArgs::ValidateStartupCommands()
|
||||
{
|
||||
// Only check over the actions list for the potential to add a new-tab
|
||||
// command if we are not starting for the purposes of receiving an inbound
|
||||
// handoff connection from the operating system.
|
||||
if (!_isHandoffListener)
|
||||
// If we only have a single x-save command, then set our target to the
|
||||
// current terminal window. This will prevent us from spawning a new
|
||||
// window just to save the commandline.
|
||||
if (_startupActions.size() == 1 &&
|
||||
_startupActions.front().Action() == ShortcutAction::SaveSnippet &&
|
||||
_windowTarget.empty())
|
||||
{
|
||||
// If we only have a single x-save command, then set our target to the
|
||||
// current terminal window. This will prevent us from spawning a new
|
||||
// window just to save the commandline.
|
||||
if (_startupActions.size() == 1 &&
|
||||
_startupActions.front().Action() == ShortcutAction::SaveSnippet &&
|
||||
_windowTarget.empty())
|
||||
{
|
||||
_windowTarget = "0";
|
||||
}
|
||||
// If we parsed no commands, or the first command we've parsed is not a new
|
||||
// tab action, prepend a new-tab command to the front of the list.
|
||||
// (also, we don't need to do this if the only action is a x-save)
|
||||
else if (_startupActions.empty() ||
|
||||
(_startupActions.front().Action() != ShortcutAction::NewTab &&
|
||||
_startupActions.front().Action() != ShortcutAction::SaveSnippet))
|
||||
{
|
||||
// Build the NewTab action from the values we've parsed on the commandline.
|
||||
NewTerminalArgs newTerminalArgs{};
|
||||
NewTabArgs args{ newTerminalArgs };
|
||||
ActionAndArgs newTabAction{ ShortcutAction::NewTab, args };
|
||||
// push the arg onto the front
|
||||
_startupActions.insert(_startupActions.begin(), 1, newTabAction);
|
||||
}
|
||||
_windowTarget = "0";
|
||||
}
|
||||
// If we parsed no commands, or the first command we've parsed is not a new
|
||||
// tab action, prepend a new-tab command to the front of the list.
|
||||
// (also, we don't need to do this if the only action is a x-save)
|
||||
else if (_startupActions.empty() ||
|
||||
(_startupActions.front().Action() != ShortcutAction::NewTab &&
|
||||
_startupActions.front().Action() != ShortcutAction::SaveSnippet))
|
||||
{
|
||||
// Build the NewTab action from the values we've parsed on the commandline.
|
||||
NewTerminalArgs newTerminalArgs{};
|
||||
NewTabArgs args{ newTerminalArgs };
|
||||
ActionAndArgs newTabAction{ ShortcutAction::NewTab, args };
|
||||
// push the arg onto the front
|
||||
_startupActions.insert(_startupActions.begin(), 1, newTabAction);
|
||||
}
|
||||
}
|
||||
std::optional<uint32_t> AppCommandlineArgs::GetPersistedLayoutIdx() const noexcept
|
||||
@@ -1082,13 +1064,9 @@ std::optional<til::size> AppCommandlineArgs::GetSize() const noexcept
|
||||
// - 0 if the commandline was successfully parsed
|
||||
int AppCommandlineArgs::ParseArgs(winrt::array_view<const winrt::hstring> args)
|
||||
{
|
||||
for (const auto& arg : args)
|
||||
if (args.size() == 2 && args[1] == L"-Embedding")
|
||||
{
|
||||
if (arg == L"-Embedding")
|
||||
{
|
||||
_isHandoffListener = true;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto commands = ::TerminalApp::AppCommandlineArgs::BuildCommands(args);
|
||||
@@ -1195,7 +1173,6 @@ void AppCommandlineArgs::FullResetState()
|
||||
_startupActions.clear();
|
||||
_exitMessage = "";
|
||||
_shouldExitEarly = false;
|
||||
_isHandoffListener = false;
|
||||
|
||||
_windowTarget = {};
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ public:
|
||||
|
||||
void ValidateStartupCommands();
|
||||
std::vector<winrt::Microsoft::Terminal::Settings::Model::ActionAndArgs>& GetStartupActions();
|
||||
bool IsHandoffListener() const noexcept;
|
||||
const std::string& GetExitMessage() const noexcept;
|
||||
bool ShouldExitEarly() const noexcept;
|
||||
|
||||
@@ -132,7 +131,6 @@ private:
|
||||
std::optional<winrt::Microsoft::Terminal::Settings::Model::LaunchMode> _launchMode{ std::nullopt };
|
||||
std::optional<winrt::Microsoft::Terminal::Settings::Model::LaunchPosition> _position{ std::nullopt };
|
||||
std::optional<til::size> _size{ std::nullopt };
|
||||
bool _isHandoffListener{ false };
|
||||
std::vector<winrt::Microsoft::Terminal::Settings::Model::ActionAndArgs> _startupActions;
|
||||
std::string _exitMessage;
|
||||
bool _shouldExitEarly{ false };
|
||||
|
||||
@@ -81,8 +81,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:
|
||||
@@ -137,15 +135,24 @@ namespace winrt::TerminalApp::implementation
|
||||
_isElevated = ::Microsoft::Console::Utils::IsRunningElevated();
|
||||
_canDragDrop = ::Microsoft::Console::Utils::CanUwpDragDrop();
|
||||
|
||||
_reloadSettings = std::make_shared<ThrottledFuncTrailing<>>(winrt::Windows::System::DispatcherQueue::GetForCurrentThread(), std::chrono::milliseconds(100), [weakSelf = get_weak()]() {
|
||||
if (auto self{ weakSelf.get() })
|
||||
{
|
||||
self->ReloadSettings();
|
||||
}
|
||||
});
|
||||
_reloadSettings = std::make_shared<ThrottledFunc<>>(
|
||||
DispatcherQueue::GetForCurrentThread(),
|
||||
til::throttled_func_options{
|
||||
.delay = std::chrono::milliseconds{ 100 },
|
||||
.debounce = true,
|
||||
.trailing = true,
|
||||
},
|
||||
[weakSelf = get_weak()]() {
|
||||
if (auto self{ weakSelf.get() })
|
||||
{
|
||||
self->ReloadSettings();
|
||||
}
|
||||
});
|
||||
|
||||
_languageProfileNotifier = winrt::make_self<LanguageProfileNotifier>([this]() {
|
||||
_reloadSettings->Run();
|
||||
// TODO: This is really bad, because we reset any current user customizations.
|
||||
// See GH#11522.
|
||||
ReloadSettingsThrottled();
|
||||
});
|
||||
|
||||
// Do this here, rather than at the top of main. This will prevent us from
|
||||
@@ -184,8 +191,6 @@ namespace winrt::TerminalApp::implementation
|
||||
// this as a MTA, before the app is Create()'d
|
||||
WINRT_ASSERT(_loadedInitialSettings);
|
||||
|
||||
_ApplyLanguageSettingChange();
|
||||
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider,
|
||||
"AppCreated",
|
||||
@@ -327,7 +332,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
if (modifiedBasename == settingsBasename)
|
||||
{
|
||||
_reloadSettings->Run();
|
||||
ReloadSettingsThrottled();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -335,8 +340,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;
|
||||
}
|
||||
|
||||
@@ -344,8 +357,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);
|
||||
@@ -353,40 +364,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
|
||||
@@ -424,7 +401,7 @@ namespace winrt::TerminalApp::implementation
|
||||
auto ev = winrt::make_self<SettingsLoadEventArgs>(true,
|
||||
static_cast<uint64_t>(_settingsLoadedResult),
|
||||
_settingsLoadExceptionText,
|
||||
warnings,
|
||||
warnings.GetView(),
|
||||
_settings);
|
||||
SettingsChanged.raise(*this, *ev);
|
||||
return;
|
||||
@@ -435,6 +412,9 @@ namespace winrt::TerminalApp::implementation
|
||||
_settings.LogSettingChanges(true);
|
||||
}
|
||||
|
||||
_ApplyLanguageSettingChange();
|
||||
_ProcessLazySettingsChanges();
|
||||
|
||||
if (initialLoad)
|
||||
{
|
||||
// Register for directory change notification.
|
||||
@@ -445,10 +425,6 @@ namespace winrt::TerminalApp::implementation
|
||||
// Here, we successfully reloaded the settings, and created a new
|
||||
// TerminalSettings object.
|
||||
|
||||
_ApplyLanguageSettingChange();
|
||||
_ApplyStartupTaskStateChange();
|
||||
_ProcessLazySettingsChanges();
|
||||
|
||||
auto warnings{ winrt::multi_threaded_vector<SettingsLoadWarnings>() };
|
||||
for (auto&& warn : _warnings)
|
||||
{
|
||||
@@ -457,11 +433,16 @@ namespace winrt::TerminalApp::implementation
|
||||
auto ev = winrt::make_self<SettingsLoadEventArgs>(!initialLoad,
|
||||
_settingsLoadedResult,
|
||||
_settingsLoadExceptionText,
|
||||
warnings,
|
||||
warnings.GetView(),
|
||||
_settings);
|
||||
SettingsChanged.raise(*this, *ev);
|
||||
}
|
||||
|
||||
void AppLogic::ReloadSettingsThrottled()
|
||||
{
|
||||
_reloadSettings->Run();
|
||||
}
|
||||
|
||||
// This is a continuation of AppLogic::Create() and includes the more expensive parts.
|
||||
void AppLogic::NotifyRootInitialized()
|
||||
{
|
||||
@@ -473,7 +454,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;
|
||||
@@ -525,7 +505,7 @@ namespace winrt::TerminalApp::implementation
|
||||
auto ev = winrt::make_self<SettingsLoadEventArgs>(false,
|
||||
_settingsLoadedResult,
|
||||
_settingsLoadExceptionText,
|
||||
warnings,
|
||||
warnings.GetView(),
|
||||
_settings);
|
||||
|
||||
auto window = winrt::make_self<implementation::TerminalWindow>(*ev, _contentManager);
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace winrt::TerminalApp::implementation
|
||||
bool IsRunningElevated() const noexcept;
|
||||
bool CanDragDrop() const noexcept;
|
||||
void ReloadSettings();
|
||||
void ReloadSettingsThrottled();
|
||||
void NotifyRootInitialized();
|
||||
|
||||
bool HasSettingsStartupActions() const noexcept;
|
||||
@@ -64,7 +65,7 @@ namespace winrt::TerminalApp::implementation
|
||||
bool _hasSettingsStartupActions{ false };
|
||||
::TerminalApp::AppCommandlineArgs _settingsAppArgs;
|
||||
|
||||
std::shared_ptr<ThrottledFuncTrailing<>> _reloadSettings;
|
||||
std::shared_ptr<ThrottledFunc<>> _reloadSettings;
|
||||
|
||||
std::vector<Microsoft::Terminal::Settings::Model::SettingsLoadWarnings> _warnings{};
|
||||
|
||||
@@ -76,12 +77,10 @@ namespace winrt::TerminalApp::implementation
|
||||
TerminalApp::ContentManager _contentManager{ winrt::make<implementation::ContentManager>() };
|
||||
|
||||
void _ApplyLanguageSettingChange() noexcept;
|
||||
safe_void_coroutine _ApplyStartupTaskStateChange();
|
||||
|
||||
[[nodiscard]] HRESULT _TryLoadSettings() noexcept;
|
||||
void _ProcessLazySettingsChanges();
|
||||
void _RegisterSettingsChange();
|
||||
safe_void_coroutine _DispatchReloadSettings();
|
||||
|
||||
void _setupFolderPathEnvVar();
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace TerminalApp
|
||||
Boolean HasSettingsStartupActions();
|
||||
|
||||
void ReloadSettings();
|
||||
void ReloadSettingsThrottled();
|
||||
Microsoft.Terminal.Settings.Model.CascadiaSettings Settings { get; };
|
||||
|
||||
TerminalWindow CreateNewWindow();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -284,7 +284,11 @@
|
||||
IsSpellCheckEnabled="False"
|
||||
PlaceholderText="{x:Bind SearchBoxPlaceholderText, Mode=OneWay}"
|
||||
Text=""
|
||||
TextChanged="_filterTextChanged" />
|
||||
TextChanged="_filterTextChanged">
|
||||
<TextBox.ContextFlyout>
|
||||
<mtu:TextMenuFlyout />
|
||||
</TextBox.ContextFlyout>
|
||||
</TextBox>
|
||||
|
||||
<TextBlock x:Name="_prefixCharacter"
|
||||
Grid.Row="0"
|
||||
|
||||
@@ -34,9 +34,15 @@ namespace winrt::Microsoft::TerminalApp::implementation
|
||||
// before actually starting the connection to the client app. This
|
||||
// will ensure both controls are initialized before the client app
|
||||
// is.
|
||||
const auto weak = get_weak();
|
||||
co_await winrt::resume_background();
|
||||
_pairedTap->_start.wait();
|
||||
const auto strong = weak.get();
|
||||
if (!strong)
|
||||
{
|
||||
co_return;
|
||||
}
|
||||
|
||||
_pairedTap->_start.wait();
|
||||
_wrappedConnection.Start();
|
||||
}
|
||||
void WriteInput(const winrt::array_view<const char16_t> buffer)
|
||||
@@ -60,9 +66,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;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,9 @@ safe_void_coroutine Jumplist::UpdateJumplist(const CascadiaSettings& settings) n
|
||||
// make sure to capture the settings _before_ the co_await
|
||||
const auto strongSettings = settings;
|
||||
|
||||
// Explorer APIs may block, so do it on a background thread.
|
||||
//
|
||||
// NOTE: Jumplist has no members, so we don't need to hold onto `this` here.
|
||||
co_await winrt::resume_background();
|
||||
|
||||
try
|
||||
|
||||
@@ -78,6 +78,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void MarkdownPaneContent::_loadText()
|
||||
{
|
||||
auto block = WUX::Controls::TextBlock();
|
||||
block.ContextFlyout(winrt::Microsoft::Terminal::UI::TextMenuFlyout{});
|
||||
block.IsTextSelectionEnabled(true);
|
||||
block.FontFamily(WUX::Media::FontFamily{ L"Cascadia Code" });
|
||||
block.Text(FileContents());
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:TerminalApp"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mtu="using:Microsoft.Terminal.UI"
|
||||
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
|
||||
mc:Ignorable="d">
|
||||
|
||||
@@ -51,7 +52,11 @@
|
||||
Grid.Column="0"
|
||||
Margin="4"
|
||||
PlaceholderText="Enter a path to a markdown file..."
|
||||
Text="Z:\dev\simple-test.md" />
|
||||
Text="Z:\dev\simple-test.md">
|
||||
<TextBox.ContextFlyout>
|
||||
<mtu:TextMenuFlyout />
|
||||
</TextBox.ContextFlyout>
|
||||
</TextBox>
|
||||
<StackPanel Grid.Column="1"
|
||||
Orientation="Horizontal">
|
||||
<Button Margin="4"
|
||||
@@ -105,7 +110,11 @@
|
||||
FontFamily="Cascadia Code"
|
||||
IsSpellCheckEnabled="False"
|
||||
Text="{x:Bind FileContents, Mode=TwoWay}"
|
||||
Visibility="{x:Bind Editing}" />
|
||||
Visibility="{x:Bind Editing}">
|
||||
<TextBox.ContextFlyout>
|
||||
<mtu:TextMenuFlyout />
|
||||
</TextBox.ContextFlyout>
|
||||
</TextBox>
|
||||
|
||||
<ScrollViewer x:Name="_scrollViewer"
|
||||
Grid.Column="1"
|
||||
|
||||
@@ -35,17 +35,23 @@ namespace winrt::TerminalApp::implementation
|
||||
// (which should be the default, see:
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-trackmouseevent#remarks)
|
||||
unsigned int hoverTimeoutMillis{ 400 };
|
||||
LOG_IF_WIN32_BOOL_FALSE(SystemParametersInfoW(SPI_GETMOUSEHOVERTIME, 0, &hoverTimeoutMillis, 0));
|
||||
const auto toolTipInterval = std::chrono::milliseconds(hoverTimeoutMillis);
|
||||
if (FAILED(SystemParametersInfoW(SPI_GETMOUSEHOVERTIME, 0, &hoverTimeoutMillis, 0)))
|
||||
{
|
||||
hoverTimeoutMillis = 400;
|
||||
}
|
||||
|
||||
// Create a ThrottledFunc for opening the tooltip after the hover
|
||||
// timeout. If we hover another button, we should make sure to call
|
||||
// Run() with the new button. Calling `_displayToolTip.Run(nullptr)`,
|
||||
// which will cause us to not display a tooltip, which is used when we
|
||||
// leave the control entirely.
|
||||
_displayToolTip = std::make_shared<ThrottledFuncTrailing<Controls::Button>>(
|
||||
_displayToolTip = std::make_shared<ThrottledFunc<Controls::Button>>(
|
||||
dispatcher,
|
||||
toolTipInterval,
|
||||
til::throttled_func_options{
|
||||
.delay = std::chrono::milliseconds{ hoverTimeoutMillis },
|
||||
.debounce = true,
|
||||
.trailing = true,
|
||||
},
|
||||
[weakThis = get_weak()](Controls::Button button) {
|
||||
// If we provide a button, then open the tooltip on that button.
|
||||
// We can "dismiss" this throttled func by calling it with null,
|
||||
@@ -83,6 +89,18 @@ namespace winrt::TerminalApp::implementation
|
||||
CloseClick.raise(*this, e);
|
||||
}
|
||||
|
||||
bool MinMaxCloseControl::Focused() const
|
||||
{
|
||||
return _focused;
|
||||
}
|
||||
|
||||
void MinMaxCloseControl::Focused(bool focused)
|
||||
{
|
||||
_focused = focused;
|
||||
|
||||
ReleaseButtons();
|
||||
}
|
||||
|
||||
void MinMaxCloseControl::SetWindowVisualState(WindowVisualState visualState)
|
||||
{
|
||||
// Look up the heights we should use for the caption buttons from our
|
||||
@@ -164,25 +182,25 @@ namespace winrt::TerminalApp::implementation
|
||||
// animate the fade in/out transition between colors.
|
||||
case CaptionButton::Minimize:
|
||||
VisualStateManager::GoToState(MinimizeButton(), L"PointerOver", true);
|
||||
VisualStateManager::GoToState(MaximizeButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(CloseButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(MaximizeButton(), _normalState(), true);
|
||||
VisualStateManager::GoToState(CloseButton(), _normalState(), true);
|
||||
|
||||
_displayToolTip->Run(MinimizeButton());
|
||||
closeToolTipForButton(MaximizeButton());
|
||||
closeToolTipForButton(CloseButton());
|
||||
break;
|
||||
case CaptionButton::Maximize:
|
||||
VisualStateManager::GoToState(MinimizeButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(MinimizeButton(), _normalState(), true);
|
||||
VisualStateManager::GoToState(MaximizeButton(), L"PointerOver", true);
|
||||
VisualStateManager::GoToState(CloseButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(CloseButton(), _normalState(), true);
|
||||
|
||||
closeToolTipForButton(MinimizeButton());
|
||||
_displayToolTip->Run(MaximizeButton());
|
||||
closeToolTipForButton(CloseButton());
|
||||
break;
|
||||
case CaptionButton::Close:
|
||||
VisualStateManager::GoToState(MinimizeButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(MaximizeButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(MinimizeButton(), _normalState(), true);
|
||||
VisualStateManager::GoToState(MaximizeButton(), _normalState(), true);
|
||||
VisualStateManager::GoToState(CloseButton(), L"PointerOver", true);
|
||||
|
||||
closeToolTipForButton(MinimizeButton());
|
||||
@@ -205,17 +223,17 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
case CaptionButton::Minimize:
|
||||
VisualStateManager::GoToState(MinimizeButton(), L"Pressed", true);
|
||||
VisualStateManager::GoToState(MaximizeButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(CloseButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(MaximizeButton(), _normalState(), true);
|
||||
VisualStateManager::GoToState(CloseButton(), _normalState(), true);
|
||||
break;
|
||||
case CaptionButton::Maximize:
|
||||
VisualStateManager::GoToState(MinimizeButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(MinimizeButton(), _normalState(), true);
|
||||
VisualStateManager::GoToState(MaximizeButton(), L"Pressed", true);
|
||||
VisualStateManager::GoToState(CloseButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(CloseButton(), _normalState(), true);
|
||||
break;
|
||||
case CaptionButton::Close:
|
||||
VisualStateManager::GoToState(MinimizeButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(MaximizeButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(MinimizeButton(), _normalState(), true);
|
||||
VisualStateManager::GoToState(MaximizeButton(), _normalState(), true);
|
||||
VisualStateManager::GoToState(CloseButton(), L"Pressed", true);
|
||||
break;
|
||||
}
|
||||
@@ -228,9 +246,9 @@ namespace winrt::TerminalApp::implementation
|
||||
void MinMaxCloseControl::ReleaseButtons()
|
||||
{
|
||||
_displayToolTip->Run(nullptr);
|
||||
VisualStateManager::GoToState(MinimizeButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(MaximizeButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(CloseButton(), L"Normal", true);
|
||||
VisualStateManager::GoToState(MinimizeButton(), _normalState(), true);
|
||||
VisualStateManager::GoToState(MaximizeButton(), _normalState(), true);
|
||||
VisualStateManager::GoToState(CloseButton(), _normalState(), true);
|
||||
|
||||
closeToolTipForButton(MinimizeButton());
|
||||
closeToolTipForButton(MaximizeButton());
|
||||
@@ -238,4 +256,11 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
_lastPressedButton = std::nullopt;
|
||||
}
|
||||
|
||||
const winrt::param::hstring& MinMaxCloseControl::_normalState() const
|
||||
{
|
||||
static const winrt::param::hstring normal = L"Normal";
|
||||
static const winrt::param::hstring unfocused = L"Unfocused";
|
||||
return (_focused ? normal : unfocused);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@ namespace winrt::TerminalApp::implementation
|
||||
void PressButton(CaptionButton button);
|
||||
void ReleaseButtons();
|
||||
|
||||
bool Focused() const;
|
||||
void Focused(bool focused);
|
||||
|
||||
void _MinimizeClick(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _MaximizeClick(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
@@ -32,8 +35,12 @@ namespace winrt::TerminalApp::implementation
|
||||
til::typed_event<TerminalApp::MinMaxCloseControl, winrt::Windows::UI::Xaml::RoutedEventArgs> MaximizeClick;
|
||||
til::typed_event<TerminalApp::MinMaxCloseControl, winrt::Windows::UI::Xaml::RoutedEventArgs> CloseClick;
|
||||
|
||||
std::shared_ptr<ThrottledFuncTrailing<winrt::Windows::UI::Xaml::Controls::Button>> _displayToolTip{ nullptr };
|
||||
bool _focused{ false };
|
||||
std::shared_ptr<ThrottledFunc<winrt::Windows::UI::Xaml::Controls::Button>> _displayToolTip{ nullptr };
|
||||
std::optional<CaptionButton> _lastPressedButton{ std::nullopt };
|
||||
|
||||
private:
|
||||
const winrt::param::hstring& _normalState() const;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace TerminalApp
|
||||
void HoverButton(CaptionButton button);
|
||||
void PressButton(CaptionButton button);
|
||||
void ReleaseButtons();
|
||||
Boolean Focused { get; set; };
|
||||
|
||||
event Windows.Foundation.TypedEventHandler<MinMaxCloseControl, Windows.UI.Xaml.RoutedEventArgs> MinimizeClick;
|
||||
event Windows.Foundation.TypedEventHandler<MinMaxCloseControl, Windows.UI.Xaml.RoutedEventArgs> MaximizeClick;
|
||||
|
||||
@@ -32,6 +32,10 @@
|
||||
ResourceKey="SystemControlForegroundBaseHighBrush" />
|
||||
<StaticResource x:Key="CaptionButtonForegroundPressed"
|
||||
ResourceKey="SystemControlForegroundBaseHighBrush" />
|
||||
<StaticResource x:Key="CaptionButtonForegroundUnfocusedColor"
|
||||
ResourceKey="TextFillColorDisabled" />
|
||||
<SolidColorBrush x:Key="CaptionButtonForegroundUnfocused"
|
||||
Color="{ThemeResource CaptionButtonForegroundUnfocusedColor}" />
|
||||
<SolidColorBrush x:Key="CaptionButtonBackground"
|
||||
Color="Transparent" />
|
||||
<Color x:Key="CaptionButtonBackgroundColor">Transparent</Color>
|
||||
@@ -66,6 +70,10 @@
|
||||
ResourceKey="SystemControlForegroundBaseHighBrush" />
|
||||
<StaticResource x:Key="CaptionButtonForegroundPressed"
|
||||
ResourceKey="SystemControlForegroundBaseHighBrush" />
|
||||
<StaticResource x:Key="CaptionButtonForegroundUnfocusedColor"
|
||||
ResourceKey="TextFillColorDisabled" />
|
||||
<SolidColorBrush x:Key="CaptionButtonForegroundUnfocused"
|
||||
Color="{ThemeResource CaptionButtonForegroundUnfocusedColor}" />
|
||||
<SolidColorBrush x:Key="CaptionButtonBackground"
|
||||
Color="Transparent" />
|
||||
<Color x:Key="CaptionButtonBackgroundColor">Transparent</Color>
|
||||
@@ -103,6 +111,10 @@
|
||||
Color="{ThemeResource SystemColorHighlightTextColor}" />
|
||||
<SolidColorBrush x:Key="CaptionButtonForegroundPressed"
|
||||
Color="{ThemeResource SystemColorHighlightTextColor}" />
|
||||
<SolidColorBrush x:Key="CaptionButtonForegroundUnfocused"
|
||||
Color="{ThemeResource SystemColorButtonTextColor}" />
|
||||
<StaticResource x:Key="CaptionButtonForegroundUnfocusedColor"
|
||||
ResourceKey="SystemColorButtonTextColor" />
|
||||
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver"
|
||||
Color="{ThemeResource SystemColorHighlightColor}" />
|
||||
<SolidColorBrush x:Key="CloseButtonForegroundPointerOver"
|
||||
@@ -189,6 +201,20 @@
|
||||
Duration="0:0:0.1" />
|
||||
</Storyboard>
|
||||
</VisualTransition>
|
||||
|
||||
<VisualTransition From="PointerOver"
|
||||
To="Unfocused">
|
||||
<Storyboard>
|
||||
<ColorAnimation Storyboard.TargetName="ButtonBaseElement"
|
||||
Storyboard.TargetProperty="(UIElement.Background).(SolidColorBrush.Color)"
|
||||
To="{ThemeResource CaptionButtonBackgroundColor}"
|
||||
Duration="0:0:0.15" />
|
||||
<ColorAnimation Storyboard.TargetName="ButtonIcon"
|
||||
Storyboard.TargetProperty="(UIElement.Foreground).(SolidColorBrush.Color)"
|
||||
To="{ThemeResource CaptionButtonForegroundUnfocusedColor}"
|
||||
Duration="0:0:0.1" />
|
||||
</Storyboard>
|
||||
</VisualTransition>
|
||||
</VisualStateGroup.Transitions>
|
||||
|
||||
<VisualState x:Name="Normal">
|
||||
@@ -198,6 +224,13 @@
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="Unfocused">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ButtonBaseElement.Background" Value="{ThemeResource CaptionButtonBackground}" />
|
||||
<Setter Target="ButtonIcon.Foreground" Value="{ThemeResource CaptionButtonForegroundUnfocused}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="PointerOver">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ButtonBaseElement.Background" Value="{ThemeResource CaptionButtonBackgroundPointerOver}" />
|
||||
|
||||
@@ -697,12 +697,24 @@ bool Pane::SwapPanes(std::shared_ptr<Pane> first, std::shared_ptr<Pane> second)
|
||||
// Refocus the last pane if there was a pane focused
|
||||
if (const auto focus = first->GetActivePane())
|
||||
{
|
||||
focus->_Focus();
|
||||
// GH#18184: manually focus the pane and content.
|
||||
// _Focus() results in no-op because the pane was _lastActive
|
||||
focus->GotFocus.raise(focus, FocusState::Programmatic);
|
||||
if (const auto& lastContent{ focus->GetLastFocusedContent() })
|
||||
{
|
||||
lastContent.Focus(FocusState::Programmatic);
|
||||
}
|
||||
}
|
||||
|
||||
if (const auto focus = second->GetActivePane())
|
||||
{
|
||||
focus->_Focus();
|
||||
// GH#18184: manually focus the pane and content.
|
||||
// _Focus() results in no-op because the pane was _lastActive
|
||||
focus->GotFocus.raise(focus, FocusState::Programmatic);
|
||||
if (const auto& lastContent{ focus->GetLastFocusedContent() })
|
||||
{
|
||||
lastContent.Focus(FocusState::Programmatic);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1402,6 +1414,13 @@ void Pane::_CloseChild(const bool closeFirst)
|
||||
|
||||
// take the control, profile, id and isDefTermSession of the pane that _wasn't_ closed.
|
||||
_setPaneContent(remainingChild->_takePaneContent());
|
||||
if (!_content)
|
||||
{
|
||||
// GH#18071: our content is still null after taking the other pane's content,
|
||||
// so just notify our parent that we're closed.
|
||||
Closed.raise(nullptr, nullptr);
|
||||
return;
|
||||
}
|
||||
_id = remainingChild->Id();
|
||||
|
||||
// Revoke the old event handlers. Remove both the handlers for the panes
|
||||
|
||||
@@ -15,19 +15,6 @@ using namespace winrt::Windows::Foundation;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
CommandlineArgs::CommandlineArgs(winrt::array_view<const winrt::hstring> args, winrt::hstring currentDirectory, uint32_t showWindowCommand, winrt::hstring envString) :
|
||||
_args{ args.begin(), args.end() },
|
||||
_cwd{ std::move(currentDirectory) },
|
||||
ShowWindowCommand{ showWindowCommand },
|
||||
CurrentEnvironment{ std::move(envString) }
|
||||
{
|
||||
_parseResult = _parsed.ParseArgs(_args);
|
||||
if (_parseResult == 0)
|
||||
{
|
||||
_parsed.ValidateStartupCommands();
|
||||
}
|
||||
}
|
||||
|
||||
::TerminalApp::AppCommandlineArgs& CommandlineArgs::ParsedArgs() noexcept
|
||||
{
|
||||
return _parsed;
|
||||
@@ -56,6 +43,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void CommandlineArgs::Commandline(const winrt::array_view<const winrt::hstring>& value)
|
||||
{
|
||||
_args = { value.begin(), value.end() };
|
||||
_parseResult = _parsed.ParseArgs(_args);
|
||||
}
|
||||
|
||||
winrt::com_array<winrt::hstring> CommandlineArgs::Commandline()
|
||||
|
||||
@@ -13,21 +13,17 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
struct CommandlineArgs : public CommandlineArgsT<CommandlineArgs>
|
||||
{
|
||||
CommandlineArgs() = default;
|
||||
CommandlineArgs(winrt::array_view<const winrt::hstring> args, winrt::hstring currentDirectory, uint32_t showWindowCommand, winrt::hstring envString);
|
||||
|
||||
::TerminalApp::AppCommandlineArgs& ParsedArgs() noexcept;
|
||||
winrt::com_array<winrt::hstring>& CommandlineRef() noexcept;
|
||||
|
||||
// These bits are exposed via WinRT:
|
||||
public:
|
||||
int32_t ExitCode() const noexcept;
|
||||
winrt::hstring ExitMessage() const;
|
||||
winrt::hstring TargetWindow() const;
|
||||
|
||||
til::property<winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection> Connection;
|
||||
void Commandline(const winrt::array_view<const winrt::hstring>& value);
|
||||
winrt::com_array<winrt::hstring> Commandline();
|
||||
|
||||
til::property<winrt::hstring> CurrentDirectory;
|
||||
til::property<winrt::hstring> CurrentEnvironment;
|
||||
til::property<uint32_t> ShowWindowCommand{ static_cast<uint32_t>(SW_NORMAL) }; // SW_NORMAL is 1, 0 is SW_HIDE
|
||||
@@ -36,7 +32,6 @@ namespace winrt::TerminalApp::implementation
|
||||
::TerminalApp::AppCommandlineArgs _parsed;
|
||||
int32_t _parseResult = 0;
|
||||
winrt::com_array<winrt::hstring> _args;
|
||||
winrt::hstring _cwd;
|
||||
};
|
||||
|
||||
struct RequestReceiveContentArgs : RequestReceiveContentArgsT<RequestReceiveContentArgs>
|
||||
@@ -87,11 +82,9 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
WINRT_PROPERTY(uint64_t, Id);
|
||||
WINRT_PROPERTY(winrt::hstring, WindowName);
|
||||
WINRT_PROPERTY(TerminalApp::CommandlineArgs, Command);
|
||||
WINRT_PROPERTY(TerminalApp::CommandlineArgs, Command, nullptr);
|
||||
WINRT_PROPERTY(winrt::hstring, Content);
|
||||
WINRT_PROPERTY(Windows::Foundation::IReference<Windows::Foundation::Rect>, InitialBounds);
|
||||
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -6,16 +6,16 @@ namespace TerminalApp
|
||||
runtimeclass CommandlineArgs
|
||||
{
|
||||
CommandlineArgs();
|
||||
CommandlineArgs(String[] args, String cwd, UInt32 showWindowCommand, String env);
|
||||
|
||||
Int32 ExitCode { get; };
|
||||
String ExitMessage { get; };
|
||||
String TargetWindow { get; };
|
||||
|
||||
Microsoft.Terminal.TerminalConnection.ITerminalConnection Connection;
|
||||
String[] Commandline;
|
||||
String CurrentDirectory { get; };
|
||||
UInt32 ShowWindowCommand { get; };
|
||||
String CurrentEnvironment { get; };
|
||||
String CurrentDirectory;
|
||||
UInt32 ShowWindowCommand;
|
||||
String CurrentEnvironment;
|
||||
};
|
||||
|
||||
enum MonitorBehavior
|
||||
|
||||
@@ -852,7 +852,7 @@
|
||||
<value>Déplacer l'onglet vers une nouvelle fenêtre </value>
|
||||
</data>
|
||||
<data name="RunAsAdminFlyout.Text" xml:space="preserve">
|
||||
<value>Exécuter en temps qu'administrateur (restreint)</value>
|
||||
<value>Exécuter en tant qu'administrateur (restreint)</value>
|
||||
<comment>This text is displayed on context menu for profile entries in add new tab button.</comment>
|
||||
</data>
|
||||
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
|
||||
|
||||
@@ -185,7 +185,7 @@
|
||||
<value>終了</value>
|
||||
</data>
|
||||
<data name="MultiplePanes" xml:space="preserve">
|
||||
<value>複数ウィンドウ</value>
|
||||
<value>複数ペイン</value>
|
||||
</data>
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>閉じる</value>
|
||||
@@ -203,13 +203,13 @@
|
||||
<value>タブを閉じる</value>
|
||||
</data>
|
||||
<data name="PaneClose" xml:space="preserve">
|
||||
<value>ウィンドウを閉じる</value>
|
||||
<value>ペインを閉じる</value>
|
||||
</data>
|
||||
<data name="SplitTabText" xml:space="preserve">
|
||||
<value>[分割] タブ</value>
|
||||
<value>タブを分割</value>
|
||||
</data>
|
||||
<data name="SplitPaneText" xml:space="preserve">
|
||||
<value>ウィンドウを分割する</value>
|
||||
<value>ペインを分割する</value>
|
||||
</data>
|
||||
<data name="SearchWebText" xml:space="preserve">
|
||||
<value>Web 検索</value>
|
||||
@@ -224,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>
|
||||
@@ -282,7 +282,7 @@
|
||||
<value>同じ名前ですが大文字と小文字が異なる環境変数が複数見つかりました。使用される値は 1 つだけです。</value>
|
||||
</data>
|
||||
<data name="CmdCommandArgDesc" xml:space="preserve">
|
||||
<value>新しいタブまたはウィンドウで生成されるオプションのコマンドと引数</value>
|
||||
<value>新しいタブまたはペインで生成されるオプションのコマンドと引数</value>
|
||||
</data>
|
||||
<data name="SaveSnippetDesc" xml:space="preserve">
|
||||
<value>コマンド ラインを入力アクションとして保存する</value>
|
||||
@@ -310,17 +310,17 @@
|
||||
<value>指定されたインデックスのタブにフォーカスを移動する</value>
|
||||
</data>
|
||||
<data name="CmdMovePaneTabArgDesc" xml:space="preserve">
|
||||
<value>フォーカスされたウィンドウを指定されたインデックスのタブに移動する</value>
|
||||
<value>フォーカスされたペインを指定されたインデックスのタブに移動する</value>
|
||||
</data>
|
||||
<data name="CmdMovePaneDesc" xml:space="preserve">
|
||||
<value>フォーカスされたウィンドウを別のタブに移動する</value>
|
||||
<value>フォーカスされたペインを別のタブに移動する</value>
|
||||
</data>
|
||||
<data name="CmdMPDesc" xml:space="preserve">
|
||||
<value>"move-pane" サブコマンドのエイリアス。</value>
|
||||
<comment>{Locked="\"move-pane\""}</comment>
|
||||
</data>
|
||||
<data name="CmdSplitPaneSizeArgDesc" xml:space="preserve">
|
||||
<value>サイズを親ウィンドウに対する割合として指定します。有効な値は (0,1) の間で、排他的です。</value>
|
||||
<value>サイズを親ペインに対する割合として指定します。有効な値は (0,1) の間で、排他的です。</value>
|
||||
</data>
|
||||
<data name="CmdNewTabDesc" xml:space="preserve">
|
||||
<value>新しいタブの作成</value>
|
||||
@@ -330,14 +330,14 @@
|
||||
<comment>{Locked="\"new-tab\""}</comment>
|
||||
</data>
|
||||
<data name="CmdFocusPaneDesc" xml:space="preserve">
|
||||
<value>別のウィンドウにフォーカスを移動する</value>
|
||||
<value>別のペインにフォーカスを移動する</value>
|
||||
</data>
|
||||
<data name="CmdFPDesc" xml:space="preserve">
|
||||
<value>"focus-pane" サブコマンドのエイリアス。</value>
|
||||
<comment>{Locked="\"focus-pane\""}</comment>
|
||||
</data>
|
||||
<data name="CmdFocusPaneTargetArgDesc" xml:space="preserve">
|
||||
<value>指定されたインデックスのウィンドウをフォーカスする</value>
|
||||
<value>指定されたインデックスのペインをフォーカスする</value>
|
||||
</data>
|
||||
<data name="CmdProfileArgDesc" xml:space="preserve">
|
||||
<value>指定されたプロファイルで開きます。プロファイルの名前または GUID を指定できます</value>
|
||||
@@ -346,20 +346,20 @@
|
||||
<value>WT_SESSION 変数を設定します; GUID である必要があります</value>
|
||||
</data>
|
||||
<data name="CmdSplitPaneDesc" xml:space="preserve">
|
||||
<value>新しい分割ウィンドウの作成</value>
|
||||
<value>新しい分割ペインの作成</value>
|
||||
</data>
|
||||
<data name="CmdSPDesc" xml:space="preserve">
|
||||
<value>"split-pane" サブコマンドのエイリアス。</value>
|
||||
<comment>{Locked="\"split-pane\""}</comment>
|
||||
</data>
|
||||
<data name="CmdSplitPaneHorizontalArgDesc" xml:space="preserve">
|
||||
<value>新しいウィンドウを水平方向に分割して作成します ([-]と考えてください)</value>
|
||||
<value>新しいペインを水平方向に分割して作成します ([-]と考えてください)</value>
|
||||
</data>
|
||||
<data name="CmdSplitPaneVerticalArgDesc" xml:space="preserve">
|
||||
<value>新しいウィンドウを垂直方向に分割して作成します ([|]と考えてください)</value>
|
||||
<value>新しいペインを垂直方向に分割して作成します ([|]と考えてください)</value>
|
||||
</data>
|
||||
<data name="CmdSplitPaneDuplicateArgDesc" xml:space="preserve">
|
||||
<value>フォーカスされたウィンドウのプロファイルを複製して、新しいウィンドウを作成します</value>
|
||||
<value>フォーカスされたペインのプロファイルを複製して、新しいペインを作成します</value>
|
||||
</data>
|
||||
<data name="CmdStartingDirArgDesc" xml:space="preserve">
|
||||
<value>プロファイルの "startingDirectory" の設定ではなく、指定されたディレクトリで開きます</value>
|
||||
@@ -377,7 +377,7 @@
|
||||
<comment>{Locked="\"tabTitle\""}</comment>
|
||||
</data>
|
||||
<data name="CmdInheritEnvDesc" xml:space="preserve">
|
||||
<value>新しい環境ブロックを作成するのではなく、新しいタブまたはウィンドウを作成するときに、ターミナル独自の環境変数を継承します。これは、"command" が渡されたときに既定で設定されます。 </value>
|
||||
<value>新しい環境ブロックを作成するのではなく、新しいタブまたはペインを作成するときに、ターミナル独自の環境変数を継承します。これは、"command" が渡されたときに既定で設定されます。 </value>
|
||||
<comment>{Locked="\"command\""}</comment>
|
||||
</data>
|
||||
<data name="CmdColorSchemeArgDesc" xml:space="preserve">
|
||||
@@ -394,7 +394,7 @@
|
||||
<value>ウィンドウを全画面表示モードで起動する</value>
|
||||
</data>
|
||||
<data name="CmdMoveFocusDesc" xml:space="preserve">
|
||||
<value>指定した方向にある隣のウィンドウにフォーカスを移動する</value>
|
||||
<value>指定した方向にある隣のペインにフォーカスを移動する</value>
|
||||
</data>
|
||||
<data name="CmdMFDesc" xml:space="preserve">
|
||||
<value>"move-focus" サブコマンドのエイリアス。</value>
|
||||
@@ -404,10 +404,10 @@
|
||||
<value>フォーカスを移動する方向</value>
|
||||
</data>
|
||||
<data name="CmdSwapPaneDesc" xml:space="preserve">
|
||||
<value>フォーカスされたウィンドウを、指定された方向の隣接するウィンドウと入れ替える</value>
|
||||
<value>フォーカスされたペインを、指定された方向の隣接するペインと入れ替える</value>
|
||||
</data>
|
||||
<data name="CmdSwapPaneDirectionArgDesc" xml:space="preserve">
|
||||
<value>フォーカスされたウィンドウを移動する方向</value>
|
||||
<value>フォーカスされたペインを移動する方向</value>
|
||||
</data>
|
||||
<data name="CmdFocusDesc" xml:space="preserve">
|
||||
<value>ウィンドウをフォーカス モードで起動</value>
|
||||
@@ -822,7 +822,7 @@
|
||||
<value>設定ページを開きます</value>
|
||||
</data>
|
||||
<data name="SplitTabToolTip" xml:space="preserve">
|
||||
<value>現在のディレクトリのアクティブなプロファイルを使用して新しいウィンドウを開きます</value>
|
||||
<value>現在のディレクトリのアクティブなプロファイルを使用して新しいペインを開きます</value>
|
||||
</data>
|
||||
<data name="TabCloseAfterToolTip" xml:space="preserve">
|
||||
<value>このタブの右側にあるすべてのタブを閉じます</value>
|
||||
@@ -837,10 +837,10 @@
|
||||
<value>なし</value>
|
||||
</data>
|
||||
<data name="ClosePaneText" xml:space="preserve">
|
||||
<value>ウィンドウを閉じる</value>
|
||||
<value>ペインを閉じる</value>
|
||||
</data>
|
||||
<data name="ClosePaneToolTip" xml:space="preserve">
|
||||
<value>複数のウィンドウが存在する場合は、アクティブなウィンドウを閉じます</value>
|
||||
<value>複数のペインが存在する場合は、アクティブなペインを閉じます</value>
|
||||
</data>
|
||||
<data name="TabColorClearButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.FullDescription" xml:space="preserve">
|
||||
<value>タブの色をリセット</value>
|
||||
@@ -857,7 +857,7 @@
|
||||
<comment>This text is displayed on context menu for profile entries in add new tab button.</comment>
|
||||
</data>
|
||||
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
|
||||
<value>アクティブなウィンドウを [{0}] タブに移動しました</value>
|
||||
<value>アクティブなペインを [{0}] タブに移動しました</value>
|
||||
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab the pane was moved to.</comment>
|
||||
</data>
|
||||
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
|
||||
@@ -873,19 +873,19 @@
|
||||
<comment>{Locked="{0}"}{Locked="{1}"}This text is read out by screen readers upon a successful tab movement. {0} is the name of the tab. {1} is the new tab index in the tab row.</comment>
|
||||
</data>
|
||||
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow" xml:space="preserve">
|
||||
<value>アクティブなウィンドウを "{1}" ウィンドウの [{0}] タブに移動しました</value>
|
||||
<value>アクティブなペインを "{1}" ウィンドウの [{0}] タブに移動しました</value>
|
||||
<comment>{Locked="{0}"}{Locked="{1}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab the pane was moved to. {1} is the name of the window the pane was moved to. Replaced in 1.19 by TerminalPage_PaneMovedAnnouncement_ExistingWindow2</comment>
|
||||
</data>
|
||||
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
|
||||
<value>アクティブなウィンドウを "{0}" ウィンドウに移動しました</value>
|
||||
<value>アクティブなペインを "{0}" ウィンドウに移動しました</value>
|
||||
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window the pane was moved to.</comment>
|
||||
</data>
|
||||
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
|
||||
<value>アクティブなウィンドウを新しいウィンドウに移動しました</value>
|
||||
<value>アクティブなペインを新しいウィンドウに移動しました</value>
|
||||
<comment>This text is read out by screen readers upon a successful pane movement to a new window.</comment>
|
||||
</data>
|
||||
<data name="TerminalPage_PaneMovedAnnouncement_NewTab" xml:space="preserve">
|
||||
<value>アクティブなウィンドウを新しいタブに移動しました</value>
|
||||
<value>アクティブなペインを新しいタブに移動しました</value>
|
||||
<comment>This text is read out by screen readers upon a successful pane movement to a new tab within the existing window.</comment>
|
||||
</data>
|
||||
<data name="CmdAppendCommandLineDesc" xml:space="preserve">
|
||||
@@ -895,7 +895,7 @@
|
||||
<value>接続の再起動</value>
|
||||
</data>
|
||||
<data name="RestartConnectionToolTip" xml:space="preserve">
|
||||
<value>アクティブウィンドウ接続を再起動します</value>
|
||||
<value>アクティブ ペイン接続を再起動します</value>
|
||||
</data>
|
||||
<data name="SnippetPaneTitle.Text" xml:space="preserve">
|
||||
<value>抜粋</value>
|
||||
@@ -926,10 +926,10 @@
|
||||
<value>操作の保存に失敗しました</value>
|
||||
</data>
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>ウィンドウを閉じる</value>
|
||||
<value>ペインを閉じる</value>
|
||||
</data>
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>ウィンドウを閉じる</value>
|
||||
<value>ペインを閉じる</value>
|
||||
</data>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>左へ移動</value>
|
||||
@@ -937,4 +937,4 @@
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>右へ移動</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace winrt::TerminalApp::implementation
|
||||
_root.Background(bg.try_as<Media::Brush>());
|
||||
|
||||
_box = winrt::Windows::UI::Xaml::Controls::TextBox{};
|
||||
_box.ContextFlyout(winrt::Microsoft::Terminal::UI::TextMenuFlyout{});
|
||||
_box.Margin({ 10, 10, 10, 10 });
|
||||
_box.AcceptsReturn(true);
|
||||
_box.TextWrapping(TextWrapping::Wrap);
|
||||
|
||||
@@ -12,14 +12,14 @@ namespace winrt::TerminalApp::implementation
|
||||
WINRT_PROPERTY(bool, Reload, false);
|
||||
WINRT_PROPERTY(uint64_t, Result, S_OK);
|
||||
WINRT_PROPERTY(winrt::hstring, ExceptionText, L"");
|
||||
WINRT_PROPERTY(winrt::Windows::Foundation::Collections::IVector<Microsoft::Terminal::Settings::Model::SettingsLoadWarnings>, Warnings, nullptr);
|
||||
WINRT_PROPERTY(winrt::Windows::Foundation::Collections::IVectorView<Microsoft::Terminal::Settings::Model::SettingsLoadWarnings>, Warnings, nullptr);
|
||||
WINRT_PROPERTY(Microsoft::Terminal::Settings::Model::CascadiaSettings, NewSettings, nullptr);
|
||||
|
||||
public:
|
||||
SettingsLoadEventArgs(bool reload,
|
||||
uint64_t result,
|
||||
winrt::hstring exceptionText,
|
||||
winrt::Windows::Foundation::Collections::IVector<Microsoft::Terminal::Settings::Model::SettingsLoadWarnings> warnings,
|
||||
winrt::Windows::Foundation::Collections::IVectorView<Microsoft::Terminal::Settings::Model::SettingsLoadWarnings> warnings,
|
||||
Microsoft::Terminal::Settings::Model::CascadiaSettings newSettings) :
|
||||
_Reload{ reload },
|
||||
_Result{ result },
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "pch.h"
|
||||
#include "ShortcutActionDispatch.h"
|
||||
#include "WtExeUtils.h"
|
||||
|
||||
#include "ShortcutActionDispatch.g.cpp"
|
||||
|
||||
@@ -53,11 +54,22 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
if (handled)
|
||||
{
|
||||
#if defined(WT_BRANDING_RELEASE)
|
||||
constexpr uint8_t branding = 3;
|
||||
#elif defined(WT_BRANDING_PREVIEW)
|
||||
constexpr uint8_t branding = 2;
|
||||
#elif defined(WT_BRANDING_CANARY)
|
||||
constexpr uint8_t branding = 1;
|
||||
#else
|
||||
constexpr uint8_t branding = 0;
|
||||
#endif
|
||||
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider,
|
||||
"ActionDispatched",
|
||||
TraceLoggingDescription("Event emitted when an action was successfully performed"),
|
||||
TraceLoggingValue(static_cast<int>(actionAndArgs.Action()), "Action"),
|
||||
TraceLoggingValue(branding, "Branding"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
}
|
||||
|
||||
@@ -47,13 +47,22 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
_settings = settings;
|
||||
|
||||
const auto dispatcher = Dispatcher();
|
||||
const auto weak = get_weak();
|
||||
|
||||
// You'd think that `FilterToSendInput(queryString)` would work. It
|
||||
// doesn't! That uses the queryString as the current command the user
|
||||
// has typed, then relies on the suggestions UI to _also_ filter with that
|
||||
// string.
|
||||
|
||||
const auto tasks = co_await _settings.GlobalSettings().ActionMap().FilterToSnippets(winrt::hstring{}, winrt::hstring{}); // IVector<Model::Command>
|
||||
co_await wil::resume_foreground(Dispatcher());
|
||||
co_await wil::resume_foreground(dispatcher);
|
||||
|
||||
const auto strong = weak.get();
|
||||
if (!strong)
|
||||
{
|
||||
co_return;
|
||||
}
|
||||
|
||||
_allTasks.Clear();
|
||||
for (const auto& t : tasks)
|
||||
|
||||
@@ -182,7 +182,6 @@
|
||||
Grid.Column="1"
|
||||
Margin="12,0,12,6"
|
||||
FontFamily="Cascadia Mono, Consolas"
|
||||
IsTextSelectionEnabled="False"
|
||||
Style="{ThemeResource BodyTextBlockStyle}"
|
||||
Text="{x:Bind Input}"
|
||||
Visibility="{Binding ElementName=rootItem, Path=IsSelected}" />
|
||||
@@ -263,7 +262,11 @@
|
||||
Margin="8,0,8,8"
|
||||
AllowFocusOnInteraction="True"
|
||||
TextChanged="_filterTextChanged"
|
||||
Visibility="{x:Bind HasSnippets, Mode=OneWay}" />
|
||||
Visibility="{x:Bind HasSnippets, Mode=OneWay}">
|
||||
<TextBox.ContextFlyout>
|
||||
<mtu:TextMenuFlyout />
|
||||
</TextBox.ContextFlyout>
|
||||
</TextBox>
|
||||
|
||||
<mux:TreeView x:Name="_treeView"
|
||||
Grid.Row="2"
|
||||
|
||||
@@ -141,7 +141,11 @@
|
||||
PlaceholderText="{x:Bind SearchBoxPlaceholderText, Mode=OneWay}"
|
||||
Text=""
|
||||
TextChanged="_filterTextChanged"
|
||||
Visibility="Collapsed" />
|
||||
Visibility="Collapsed">
|
||||
<TextBox.ContextFlyout>
|
||||
<mtu:TextMenuFlyout />
|
||||
</TextBox.ContextFlyout>
|
||||
</TextBox>
|
||||
|
||||
<StackPanel Grid.Row="1"
|
||||
Margin="8,0,8,8"
|
||||
@@ -224,14 +228,23 @@
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
IsTextSelectionEnabled="True"
|
||||
TextWrapping="WrapWholeWords" />
|
||||
TextWrapping="WrapWholeWords">
|
||||
<TextBlock.ContextFlyout>
|
||||
<mtu:TextMenuFlyout />
|
||||
</TextBlock.ContextFlyout>
|
||||
</TextBlock>
|
||||
<ScrollViewer MaxHeight="64"
|
||||
VerticalScrollBarVisibility="Visible"
|
||||
VerticalScrollMode="Enabled"
|
||||
Visibility="Visible">
|
||||
<TextBlock x:Name="_descriptionComment"
|
||||
Margin="0,0,20,0"
|
||||
IsTextSelectionEnabled="True"
|
||||
TextWrapping="WrapWholeWords" />
|
||||
TextWrapping="WrapWholeWords">
|
||||
<TextBlock.ContextFlyout>
|
||||
<mtu:TextMenuFlyout />
|
||||
</TextBlock.ContextFlyout>
|
||||
</TextBlock>
|
||||
</ScrollViewer>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
ASSERT_UI_THREAD();
|
||||
|
||||
// NOTE: `TerminalPage::_HandleCloseTabRequested` relies on the content being null after this call.
|
||||
Content(nullptr);
|
||||
}
|
||||
|
||||
@@ -540,7 +541,7 @@ namespace winrt::TerminalApp::implementation
|
||||
const auto& currentDictionary = v.as<ResourceDictionary>();
|
||||
|
||||
// TabViewItem.Background
|
||||
currentDictionary.Insert(winrt::box_value(L"TabViewItemHeaderBackground"), deselectedTabBrush);
|
||||
currentDictionary.Insert(winrt::box_value(L"TabViewItemHeaderBackground"), selectedTabBrush);
|
||||
currentDictionary.Insert(winrt::box_value(L"TabViewItemHeaderBackgroundSelected"), selectedTabBrush);
|
||||
currentDictionary.Insert(winrt::box_value(L"TabViewItemHeaderBackgroundPointerOver"), isHighContrast ? fontBrush : hoverTabBrush);
|
||||
currentDictionary.Insert(winrt::box_value(L"TabViewItemHeaderBackgroundPressed"), selectedTabBrush);
|
||||
|
||||
@@ -17,8 +17,8 @@ namespace TerminalApp
|
||||
UInt32 TabViewIndex;
|
||||
UInt32 TabViewNumTabs;
|
||||
|
||||
overridable void Focus(Windows.UI.Xaml.FocusState focusState);
|
||||
overridable void Shutdown();
|
||||
void Focus(Windows.UI.Xaml.FocusState focusState);
|
||||
void Shutdown();
|
||||
|
||||
void SetDispatch(ShortcutActionDispatch dispatch);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:TerminalApp"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mtu="using:Microsoft.Terminal.UI"
|
||||
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
|
||||
MinHeight="16"
|
||||
mc:Ignorable="d">
|
||||
@@ -67,6 +68,10 @@
|
||||
IsSpellCheckEnabled="False"
|
||||
LostFocus="RenameBoxLostFocusHandler"
|
||||
MaxLength="1024"
|
||||
Visibility="Collapsed" />
|
||||
Visibility="Collapsed">
|
||||
<TextBox.ContextFlyout>
|
||||
<mtu:TextMenuFlyout />
|
||||
</TextBox.ContextFlyout>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
@@ -158,6 +158,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// Set this tab's icon to the icon from the content
|
||||
_UpdateTabIcon(*newTabImpl);
|
||||
|
||||
// This is necessary, because WinUI does not have support for middle clicks.
|
||||
// Its Tapped event doesn't provide the information what button was used either.
|
||||
tabViewItem.PointerPressed({ this, &TerminalPage::_OnTabPointerPressed });
|
||||
tabViewItem.PointerReleased({ this, &TerminalPage::_OnTabPointerReleased });
|
||||
tabViewItem.PointerExited({ this, &TerminalPage::_OnTabPointerExited });
|
||||
@@ -243,10 +245,12 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Handle changes in tab layout.
|
||||
void TerminalPage::_UpdateTabView()
|
||||
{
|
||||
// Never show the tab row when we're fullscreen. Otherwise:
|
||||
// Show tabs when there's more than 1, or the user has chosen to always
|
||||
// show the tab bar.
|
||||
const auto isVisible = (!_isFullscreen && !_isInFocusMode) &&
|
||||
// The tab row should only be visible if:
|
||||
// - we're not in focus mode
|
||||
// - we're not in full screen, or the user has enabled fullscreen tabs
|
||||
// - there is more than one tab, or the user has chosen to always show tabs
|
||||
const auto isVisible = !_isInFocusMode &&
|
||||
(!_isFullscreen || _showTabsFullscreen) &&
|
||||
(_settings.GlobalSettings().ShowTabsInTitlebar() ||
|
||||
(_tabs.Size() > 1) ||
|
||||
_settings.GlobalSettings().AlwaysShowTabs());
|
||||
@@ -399,12 +403,18 @@ namespace winrt::TerminalApp::implementation
|
||||
// - tab: the tab to remove
|
||||
winrt::Windows::Foundation::IAsyncAction TerminalPage::_HandleCloseTabRequested(winrt::TerminalApp::TabBase tab)
|
||||
{
|
||||
winrt::com_ptr<TerminalPage> strong;
|
||||
|
||||
if (tab.ReadOnly())
|
||||
{
|
||||
const auto weak = get_weak();
|
||||
|
||||
auto warningResult = co_await _ShowCloseReadOnlyDialog();
|
||||
|
||||
strong = weak.get();
|
||||
|
||||
// If the user didn't explicitly click on close tab - leave
|
||||
if (warningResult != ContentDialogResult::Primary)
|
||||
if (!strong || warningResult != ContentDialogResult::Primary)
|
||||
{
|
||||
co_return;
|
||||
}
|
||||
@@ -715,10 +725,14 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
if (pane->ContainsReadOnly())
|
||||
{
|
||||
const auto weak = get_weak();
|
||||
|
||||
auto warningResult = co_await _ShowCloseReadOnlyDialog();
|
||||
|
||||
const auto strong = weak.get();
|
||||
|
||||
// If the user didn't explicitly click on close tab - leave
|
||||
if (warningResult != ContentDialogResult::Primary)
|
||||
if (!strong || warningResult != ContentDialogResult::Primary)
|
||||
{
|
||||
co_return false;
|
||||
}
|
||||
@@ -776,9 +790,13 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
if (const auto pane{ terminalTab->GetActivePane() })
|
||||
{
|
||||
const auto weak = get_weak();
|
||||
if (co_await _PaneConfirmCloseReadOnly(pane))
|
||||
{
|
||||
_HandleClosePaneRequested(pane);
|
||||
if (const auto strong = weak.get())
|
||||
{
|
||||
_HandleClosePaneRequested(pane);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -836,9 +854,22 @@ namespace winrt::TerminalApp::implementation
|
||||
// - tabs - tabs to remove
|
||||
safe_void_coroutine TerminalPage::_RemoveTabs(const std::vector<winrt::TerminalApp::TabBase> tabs)
|
||||
{
|
||||
const auto weak = get_weak();
|
||||
|
||||
for (auto& tab : tabs)
|
||||
{
|
||||
co_await _HandleCloseTabRequested(tab);
|
||||
winrt::Windows::Foundation::IAsyncAction action{ nullptr };
|
||||
if (const auto strong = weak.get())
|
||||
{
|
||||
action = _HandleCloseTabRequested(tab);
|
||||
}
|
||||
|
||||
if (!action)
|
||||
{
|
||||
co_return;
|
||||
}
|
||||
|
||||
co_await action;
|
||||
}
|
||||
}
|
||||
// Method Description:
|
||||
@@ -901,19 +932,44 @@ namespace winrt::TerminalApp::implementation
|
||||
if (_tabPointerMiddleButtonPressed && !eventArgs.GetCurrentPoint(nullptr).Properties().IsMiddleButtonPressed())
|
||||
{
|
||||
_tabPointerMiddleButtonPressed = false;
|
||||
if (const auto tabViewItem{ sender.try_as<MUX::Controls::TabViewItem>() })
|
||||
if (auto tabViewItem{ sender.try_as<MUX::Controls::TabViewItem>() })
|
||||
{
|
||||
tabViewItem.ReleasePointerCapture(eventArgs.Pointer());
|
||||
auto tab = _GetTabByTabViewItem(tabViewItem);
|
||||
if (!_tabPointerMiddleButtonExited && tab)
|
||||
if (!_tabPointerMiddleButtonExited)
|
||||
{
|
||||
_HandleCloseTabRequested(tab);
|
||||
_OnTabPointerReleasedCloseTab(std::move(tabViewItem));
|
||||
}
|
||||
}
|
||||
eventArgs.Handled(true);
|
||||
}
|
||||
}
|
||||
|
||||
safe_void_coroutine TerminalPage::_OnTabPointerReleasedCloseTab(winrt::Microsoft::UI::Xaml::Controls::TabViewItem sender)
|
||||
{
|
||||
// WinUI asynchronously updates its tab view items, so it may happen that we're given a
|
||||
// `TabViewItem` that still contains a `TabBase` which has actually already been removed.
|
||||
// First we must yield once, to flush out whatever TabView is currently doing.
|
||||
const auto weak = get_weak();
|
||||
co_await wil::resume_foreground(Dispatcher());
|
||||
const auto strong = weak.get();
|
||||
if (!strong)
|
||||
{
|
||||
co_return;
|
||||
}
|
||||
|
||||
const auto tab = _GetTabByTabViewItem(sender);
|
||||
if (!tab)
|
||||
{
|
||||
co_return;
|
||||
}
|
||||
|
||||
// `tab.Shutdown()` in `_RemoveTab()` sets the content to null = This checks if the tab is closed.
|
||||
if (tab.Content())
|
||||
{
|
||||
_HandleCloseTabRequested(tab);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Tracking pointer state for tab remove
|
||||
// Arguments:
|
||||
@@ -989,6 +1045,8 @@ namespace winrt::TerminalApp::implementation
|
||||
auto profile = tab_impl->GetFocusedProfile();
|
||||
_UpdateBackground(profile);
|
||||
}
|
||||
|
||||
_adjustProcessPriorityThrottled->Run();
|
||||
}
|
||||
CATCH_LOG();
|
||||
}
|
||||
|
||||
@@ -51,8 +51,10 @@ namespace winrt::TerminalApp::implementation
|
||||
_tabStatusChangedRevoker = status.PropertyChanged(winrt::auto_revoke, [weakThis{ get_weak() }](auto& /*sender*/, auto& /*e*/) {
|
||||
// Sometimes nested bindings do not get updated,
|
||||
// thus let's notify property changed on TabStatus when one of its properties changes
|
||||
auto item{ weakThis.get() };
|
||||
item->PropertyChanged.raise(*item, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"TabStatus" });
|
||||
if (auto item{ weakThis.get() })
|
||||
{
|
||||
item->PropertyChanged.raise(*item, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"TabStatus" });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,8 +70,7 @@
|
||||
FontSize="12">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip Placement="Mouse">
|
||||
<TextBlock IsTextSelectionEnabled="False"
|
||||
TextWrapping="Wrap">
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
<Run x:Uid="NewTabRun" /> <LineBreak />
|
||||
<Run x:Uid="NewPaneRun"
|
||||
FontStyle="Italic" /> <LineBreak />
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
<TerminalCppWinrt>true</TerminalCppWinrt>
|
||||
<TerminalMUX>true</TerminalMUX>
|
||||
<TerminalWinGetInterop>true</TerminalWinGetInterop>
|
||||
<TerminalThemeHelpers>true</TerminalThemeHelpers>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
|
||||
<Import Project="$(OpenConsoleDir)src\common.nugetversions.props" />
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
#include "TerminalPage.h"
|
||||
|
||||
#include <LibraryResources.h>
|
||||
#include <TerminalThemeHelpers.h>
|
||||
#include <TerminalCore/ControlKeyStates.hpp>
|
||||
#include <til/latch.h>
|
||||
#include <til/unicode.h>
|
||||
#include <Utils.h>
|
||||
|
||||
#include "../../types/inc/utils.hpp"
|
||||
@@ -62,7 +63,6 @@ namespace winrt::TerminalApp::implementation
|
||||
TerminalPage::TerminalPage(TerminalApp::WindowProperties properties, const TerminalApp::ContentManager& manager) :
|
||||
_tabs{ winrt::single_threaded_observable_vector<TerminalApp::TabBase>() },
|
||||
_mruTabs{ winrt::single_threaded_observable_vector<TerminalApp::TabBase>() },
|
||||
_startupActions{ winrt::single_threaded_vector<ActionAndArgs>() },
|
||||
_manager{ manager },
|
||||
_hostingHwnd{},
|
||||
_WindowProperties{ std::move(properties) }
|
||||
@@ -104,6 +104,17 @@ namespace winrt::TerminalApp::implementation
|
||||
// before restoring previous tabs in that scenario.
|
||||
}
|
||||
}
|
||||
|
||||
_adjustProcessPriorityThrottled = std::make_shared<ThrottledFunc<>>(
|
||||
DispatcherQueue::GetForCurrentThread(),
|
||||
til::throttled_func_options{
|
||||
.delay = std::chrono::milliseconds{ 100 },
|
||||
.debounce = true,
|
||||
.trailing = true,
|
||||
},
|
||||
[=]() {
|
||||
_adjustProcessPriority();
|
||||
});
|
||||
_hostingHwnd = hwnd;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -239,6 +250,14 @@ namespace winrt::TerminalApp::implementation
|
||||
_newTabButton.Click([weakThis{ get_weak() }](auto&&, auto&&) {
|
||||
if (auto page{ weakThis.get() })
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider,
|
||||
"NewTabMenuDefaultButtonClicked",
|
||||
TraceLoggingDescription("Event emitted when the default button from the new tab split button is invoked"),
|
||||
TraceLoggingValue(page->NumberOfTabs(), "TabCount", "The count of tabs currently opened in this window"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
|
||||
page->_OpenNewTerminalViaDropdown(NewTerminalArgs());
|
||||
}
|
||||
});
|
||||
@@ -269,6 +288,7 @@ namespace winrt::TerminalApp::implementation
|
||||
_layoutUpdatedRevoker = _tabContent.LayoutUpdated(winrt::auto_revoke, { this, &TerminalPage::_OnFirstLayout });
|
||||
|
||||
_isAlwaysOnTop = _settings.GlobalSettings().AlwaysOnTop();
|
||||
_showTabsFullscreen = _settings.GlobalSettings().ShowTabsFullscreen();
|
||||
|
||||
// DON'T set up Toasts/TeachingTips here. They should be loaded and
|
||||
// initialized the first time they're opened, in whatever method opens
|
||||
@@ -293,12 +313,11 @@ namespace winrt::TerminalApp::implementation
|
||||
// - true if we're not elevated but all relevant pane-spawning actions are elevated
|
||||
bool TerminalPage::ShouldImmediatelyHandoffToElevated(const CascadiaSettings& settings) const
|
||||
{
|
||||
// GH#12267: Don't forget about defterm handoff here. If we're being
|
||||
// created for embedding, then _yea_, we don't need to handoff to an
|
||||
// elevated window.
|
||||
if (!_startupActions || IsRunningElevated() || _shouldStartInboundListener || _startupActions.Size() == 0)
|
||||
if (_startupActions.empty() || _startupConnection || IsRunningElevated())
|
||||
{
|
||||
// there aren't startup actions, or we're elevated. In that case, go for it.
|
||||
// No point in handing off if we got no startup actions, or we're already elevated.
|
||||
// Also, we shouldn't need to elevate handoff ConPTY connections.
|
||||
assert(!_startupConnection);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -374,7 +393,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
void TerminalPage::HandoffToElevated(const CascadiaSettings& settings)
|
||||
{
|
||||
if (!_startupActions)
|
||||
if (_startupActions.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -488,46 +507,16 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
_startupState = StartupState::InStartup;
|
||||
|
||||
ProcessStartupActions(_startupActions, true);
|
||||
|
||||
// If we were told that the COM server needs to be started to listen for incoming
|
||||
// default application connections, start it now.
|
||||
// This MUST be done after we've registered the event listener for the new connections
|
||||
// or the COM server might start receiving requests on another thread and dispatch
|
||||
// them to nowhere.
|
||||
_StartInboundListener();
|
||||
}
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Will start the listener for inbound console handoffs if we have already determined
|
||||
// that we should do so.
|
||||
// NOTE: Must be after TerminalPage::_OnNewConnection has been connected up.
|
||||
// Arguments:
|
||||
// - <unused> - Looks at _shouldStartInboundListener
|
||||
// Return Value:
|
||||
// - <none> - May fail fast if setup fails as that would leave us in a weird state.
|
||||
void TerminalPage::_StartInboundListener()
|
||||
{
|
||||
if (_shouldStartInboundListener)
|
||||
{
|
||||
_shouldStartInboundListener = false;
|
||||
|
||||
// Hook up inbound connection event handler
|
||||
_newConnectionRevoker = ConptyConnection::NewConnection(winrt::auto_revoke, { this, &TerminalPage::_OnNewConnection });
|
||||
|
||||
try
|
||||
if (_startupConnection)
|
||||
{
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ConptyConnection::StartInboundListener();
|
||||
CreateTabFromConnection(std::move(_startupConnection));
|
||||
}
|
||||
// If we failed to start the listener, it will throw.
|
||||
// We don't want to fail fast here because if a peasant has some trouble with
|
||||
// starting the listener, we don't want it to crash and take all its tabs down
|
||||
// with it.
|
||||
catch (...)
|
||||
else if (!_startupActions.empty())
|
||||
{
|
||||
LOG_CAUGHT_EXCEPTION();
|
||||
ProcessStartupActions(std::move(_startupActions));
|
||||
}
|
||||
|
||||
_CompleteInitialization();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,84 +534,81 @@ namespace winrt::TerminalApp::implementation
|
||||
// nt -d .` from inside another directory to work as expected.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
safe_void_coroutine TerminalPage::ProcessStartupActions(Windows::Foundation::Collections::IVector<ActionAndArgs> actions,
|
||||
const bool initial,
|
||||
const winrt::hstring cwd,
|
||||
const winrt::hstring env)
|
||||
safe_void_coroutine TerminalPage::ProcessStartupActions(std::vector<ActionAndArgs> actions, const winrt::hstring cwd, const winrt::hstring env)
|
||||
{
|
||||
auto weakThis{ get_weak() };
|
||||
|
||||
// Handle it on a subsequent pass of the UI thread.
|
||||
co_await wil::resume_foreground(Dispatcher(), CoreDispatcherPriority::Normal);
|
||||
const auto strong = get_strong();
|
||||
|
||||
// If the caller provided a CWD, "switch" to that directory, then switch
|
||||
// back once we're done. This looks weird though, because we have to set
|
||||
// up the scope_exit _first_. We'll release the scope_exit if we don't
|
||||
// actually need it.
|
||||
|
||||
// back once we're done.
|
||||
auto originalVirtualCwd{ _WindowProperties.VirtualWorkingDirectory() };
|
||||
auto restoreCwd = wil::scope_exit([&originalVirtualCwd, this]() {
|
||||
// ignore errors, we'll just power on through. We'd rather do
|
||||
// something rather than fail silently if the directory doesn't
|
||||
// actually exist.
|
||||
_WindowProperties.VirtualWorkingDirectory(originalVirtualCwd);
|
||||
});
|
||||
|
||||
// Literally the same thing with env vars too
|
||||
auto originalVirtualEnv{ _WindowProperties.VirtualEnvVars() };
|
||||
auto restoreEnv = wil::scope_exit([&originalVirtualEnv, this]() {
|
||||
_WindowProperties.VirtualEnvVars(originalVirtualEnv);
|
||||
auto restoreCwd = wil::scope_exit([&]() {
|
||||
if (!cwd.empty())
|
||||
{
|
||||
// ignore errors, we'll just power on through. We'd rather do
|
||||
// something rather than fail silently if the directory doesn't
|
||||
// actually exist.
|
||||
_WindowProperties.VirtualWorkingDirectory(originalVirtualCwd);
|
||||
_WindowProperties.VirtualEnvVars(originalVirtualEnv);
|
||||
}
|
||||
});
|
||||
|
||||
if (cwd.empty())
|
||||
{
|
||||
// We didn't actually need to change the virtual CWD, so we don't
|
||||
// need to restore it
|
||||
restoreCwd.release();
|
||||
}
|
||||
else
|
||||
if (!cwd.empty())
|
||||
{
|
||||
_WindowProperties.VirtualWorkingDirectory(cwd);
|
||||
}
|
||||
|
||||
if (env.empty())
|
||||
{
|
||||
restoreEnv.release();
|
||||
}
|
||||
else
|
||||
{
|
||||
_WindowProperties.VirtualEnvVars(env);
|
||||
}
|
||||
|
||||
if (auto page{ weakThis.get() })
|
||||
for (size_t i = 0; i < actions.size(); ++i)
|
||||
{
|
||||
for (const auto& action : actions)
|
||||
if (i != 0)
|
||||
{
|
||||
if (auto page{ weakThis.get() })
|
||||
{
|
||||
_actionDispatch->DoAction(action);
|
||||
}
|
||||
else
|
||||
{
|
||||
co_return;
|
||||
}
|
||||
// Each action may rely on the XAML layout of a preceding action.
|
||||
// Most importantly, this is the case for the combination of NewTab + SplitPane,
|
||||
// as the former appears to only have a layout size after at least 1 resume_foreground,
|
||||
// while the latter relies on that information. This is also why it uses Low priority.
|
||||
//
|
||||
// Curiously, this does not seem to be required when using startupActions, but only when
|
||||
// tearing out a tab (this currently creates a new window with injected startup actions).
|
||||
// This indicates that this is really more of an architectural issue and not a fundamental one.
|
||||
co_await wil::resume_foreground(Dispatcher(), CoreDispatcherPriority::Low);
|
||||
}
|
||||
|
||||
// GH#6586: now that we're done processing all startup commands,
|
||||
// focus the active control. This will work as expected for both
|
||||
// commandline invocations and for `wt` action invocations.
|
||||
if (const auto& terminalTab{ _GetFocusedTabImpl() })
|
||||
_actionDispatch->DoAction(actions[i]);
|
||||
}
|
||||
|
||||
// GH#6586: now that we're done processing all startup commands,
|
||||
// focus the active control. This will work as expected for both
|
||||
// commandline invocations and for `wt` action invocations.
|
||||
if (const auto& terminalTab{ _GetFocusedTabImpl() })
|
||||
{
|
||||
if (const auto& content{ terminalTab->GetActiveContent() })
|
||||
{
|
||||
if (const auto& content{ terminalTab->GetActiveContent() })
|
||||
{
|
||||
content.Focus(FocusState::Programmatic);
|
||||
}
|
||||
content.Focus(FocusState::Programmatic);
|
||||
}
|
||||
}
|
||||
if (initial)
|
||||
}
|
||||
|
||||
void TerminalPage::CreateTabFromConnection(ITerminalConnection connection)
|
||||
{
|
||||
NewTerminalArgs newTerminalArgs;
|
||||
|
||||
if (const auto conpty = connection.try_as<ConptyConnection>())
|
||||
{
|
||||
_CompleteInitialization();
|
||||
newTerminalArgs.Commandline(conpty.Commandline());
|
||||
newTerminalArgs.TabTitle(conpty.StartingTitle());
|
||||
}
|
||||
|
||||
// GH #12370: We absolutely cannot allow a defterm connection to
|
||||
// auto-elevate. Defterm doesn't work for elevated scenarios in the
|
||||
// first place. If we try accepting the connection, the spawning an
|
||||
// elevated version of the Terminal with that profile... that's a
|
||||
// recipe for disaster. We won't ever open up a tab in this window.
|
||||
newTerminalArgs.Elevate(false);
|
||||
const auto newPane = _MakePane(newTerminalArgs, nullptr, std::move(connection));
|
||||
newPane->WalkTree([](const auto& pane) {
|
||||
pane->FinalizeConfigurationGivenDefault();
|
||||
});
|
||||
_CreateNewTabFromPane(newPane);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -650,7 +636,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// GH#12267: Make sure that we don't instantly close ourselves when
|
||||
// we're readying to accept a defterm connection. In that case, we don't
|
||||
// have a tab yet, but will once we're initialized.
|
||||
if (_tabs.Size() == 0 && !_shouldStartInboundListener && !_isEmbeddingInboundListener)
|
||||
if (_tabs.Size() == 0)
|
||||
{
|
||||
CloseWindowRequested.raise(*this, nullptr);
|
||||
co_return;
|
||||
@@ -869,14 +855,36 @@ namespace winrt::TerminalApp::implementation
|
||||
// Since the previous focus location might be discarded in the background,
|
||||
// e.g., the command palette will be dismissed by the menu,
|
||||
// and then closing the fly-out will move the focus to wrong location.
|
||||
newTabFlyout.Opening([this](auto&&, auto&&) {
|
||||
_FocusCurrentTab(true);
|
||||
newTabFlyout.Opening([weakThis{ get_weak() }](auto&&, auto&&) {
|
||||
if (auto page{ weakThis.get() })
|
||||
{
|
||||
page->_FocusCurrentTab(true);
|
||||
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider,
|
||||
"NewTabMenuOpened",
|
||||
TraceLoggingDescription("Event emitted when the new tab menu is opened"),
|
||||
TraceLoggingValue(page->NumberOfTabs(), "TabCount", "The Count of tabs currently opened in this window"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
}
|
||||
});
|
||||
// Necessary for fly-out sub items to get focus on a tab before collapsing. Related to #15049
|
||||
newTabFlyout.Closing([this](auto&&, auto&&) {
|
||||
if (!_commandPaletteIs(Visibility::Visible))
|
||||
newTabFlyout.Closing([weakThis{ get_weak() }](auto&&, auto&&) {
|
||||
if (auto page{ weakThis.get() })
|
||||
{
|
||||
_FocusCurrentTab(true);
|
||||
if (!page->_commandPaletteIs(Visibility::Visible))
|
||||
{
|
||||
page->_FocusCurrentTab(true);
|
||||
}
|
||||
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider,
|
||||
"NewTabMenuClosed",
|
||||
TraceLoggingDescription("Event emitted when the new tab menu is closed"),
|
||||
TraceLoggingValue(page->NumberOfTabs(), "TabCount", "The Count of tabs currently opened in this window"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
}
|
||||
});
|
||||
_newTabButton.Flyout(newTabFlyout);
|
||||
@@ -1082,6 +1090,15 @@ namespace winrt::TerminalApp::implementation
|
||||
profileMenuItem.Click([profileIndex, weakThis{ get_weak() }](auto&&, auto&&) {
|
||||
if (auto page{ weakThis.get() })
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider,
|
||||
"NewTabMenuItemClicked",
|
||||
TraceLoggingDescription("Event emitted when an item from the new tab menu is invoked"),
|
||||
TraceLoggingValue(page->NumberOfTabs(), "TabCount", "The count of tabs currently opened in this window"),
|
||||
TraceLoggingValue("Profile", "ItemType", "The type of item that was clicked in the new tab menu"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
|
||||
NewTerminalArgs newTerminalArgs{ profileIndex };
|
||||
page->_OpenNewTerminalViaDropdown(newTerminalArgs);
|
||||
}
|
||||
@@ -1128,6 +1145,15 @@ namespace winrt::TerminalApp::implementation
|
||||
actionMenuItem.Click([action, weakThis{ get_weak() }](auto&&, auto&&) {
|
||||
if (auto page{ weakThis.get() })
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider,
|
||||
"NewTabMenuItemClicked",
|
||||
TraceLoggingDescription("Event emitted when an item from the new tab menu is invoked"),
|
||||
TraceLoggingValue(page->NumberOfTabs(), "TabCount", "The count of tabs currently opened in this window"),
|
||||
TraceLoggingValue("Action", "ItemType", "The type of item that was clicked in the new tab menu"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
|
||||
page->_actionDispatch->DoAction(action.ActionAndArgs());
|
||||
}
|
||||
});
|
||||
@@ -1189,6 +1215,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
const auto dispatchToElevatedWindow = ctrlPressed && !IsRunningElevated();
|
||||
|
||||
auto sessionType = "";
|
||||
if ((shiftPressed || dispatchToElevatedWindow) && !debugTap)
|
||||
{
|
||||
// Manually fill in the evaluated profile.
|
||||
@@ -1206,10 +1233,12 @@ namespace winrt::TerminalApp::implementation
|
||||
if (dispatchToElevatedWindow)
|
||||
{
|
||||
_OpenElevatedWT(newTerminalArgs);
|
||||
sessionType = "ElevatedWindow";
|
||||
}
|
||||
else
|
||||
{
|
||||
_OpenNewWindow(newTerminalArgs);
|
||||
sessionType = "Window";
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1228,12 +1257,23 @@ namespace winrt::TerminalApp::implementation
|
||||
SplitDirection::Automatic,
|
||||
0.5f,
|
||||
newPane);
|
||||
sessionType = "Pane";
|
||||
}
|
||||
else
|
||||
{
|
||||
_CreateNewTabFromPane(newPane);
|
||||
sessionType = "Tab";
|
||||
}
|
||||
}
|
||||
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider,
|
||||
"NewTabMenuCreatedNewTerminalSession",
|
||||
TraceLoggingDescription("Event emitted when a new terminal was created via the new tab menu"),
|
||||
TraceLoggingValue(NumberOfTabs(), "NewTabCount", "The count of tabs currently opened in this window"),
|
||||
TraceLoggingValue(sessionType, "SessionType", "The type of session that was created"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
}
|
||||
|
||||
std::wstring TerminalPage::_evaluatePathForCwd(const std::wstring_view path)
|
||||
@@ -1440,6 +1480,30 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
target = SettingsTarget::DefaultsFile;
|
||||
}
|
||||
|
||||
const auto targetAsString = [&target]() {
|
||||
switch (target)
|
||||
{
|
||||
case SettingsTarget::SettingsFile:
|
||||
return "SettingsFile";
|
||||
case SettingsTarget::DefaultsFile:
|
||||
return "DefaultsFile";
|
||||
case SettingsTarget::SettingsUI:
|
||||
default:
|
||||
return "UI";
|
||||
}
|
||||
}();
|
||||
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider,
|
||||
"NewTabMenuItemClicked",
|
||||
TraceLoggingDescription("Event emitted when an item from the new tab menu is invoked"),
|
||||
TraceLoggingValue(NumberOfTabs(), "TabCount", "The count of tabs currently opened in this window"),
|
||||
TraceLoggingValue("Settings", "ItemType", "The type of item that was clicked in the new tab menu"),
|
||||
TraceLoggingValue(targetAsString, "SettingsTarget", "The target settings file or UI"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
|
||||
_LaunchSettings(target);
|
||||
}
|
||||
|
||||
@@ -1451,6 +1515,15 @@ namespace winrt::TerminalApp::implementation
|
||||
auto p = LoadCommandPalette();
|
||||
p.EnableCommandPaletteMode(CommandPaletteLaunchMode::Action);
|
||||
p.Visibility(Visibility::Visible);
|
||||
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider,
|
||||
"NewTabMenuItemClicked",
|
||||
TraceLoggingDescription("Event emitted when an item from the new tab menu is invoked"),
|
||||
TraceLoggingValue(NumberOfTabs(), "TabCount", "The count of tabs currently opened in this window"),
|
||||
TraceLoggingValue("CommandPalette", "ItemType", "The type of item that was clicked in the new tab menu"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -1463,6 +1536,15 @@ namespace winrt::TerminalApp::implementation
|
||||
const RoutedEventArgs&)
|
||||
{
|
||||
_ShowAboutDialog();
|
||||
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider,
|
||||
"NewTabMenuItemClicked",
|
||||
TraceLoggingDescription("Event emitted when an item from the new tab menu is invoked"),
|
||||
TraceLoggingValue(NumberOfTabs(), "TabCount", "The count of tabs currently opened in this window"),
|
||||
TraceLoggingValue("About", "ItemType", "The type of item that was clicked in the new tab menu"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -1782,16 +1864,22 @@ namespace winrt::TerminalApp::implementation
|
||||
auto tab{ weakTab.get() };
|
||||
if (page && tab)
|
||||
{
|
||||
if (args.PropertyName() == L"Title")
|
||||
const auto propertyName = args.PropertyName();
|
||||
if (propertyName == L"Title")
|
||||
{
|
||||
page->_UpdateTitle(*tab);
|
||||
}
|
||||
else if (args.PropertyName() == L"Content")
|
||||
else if (propertyName == L"Content")
|
||||
{
|
||||
if (*tab == page->_GetFocusedTab())
|
||||
{
|
||||
page->_tabContent.Children().Clear();
|
||||
page->_tabContent.Children().Append(tab->Content());
|
||||
const auto children = page->_tabContent.Children();
|
||||
|
||||
children.Clear();
|
||||
if (auto content = tab->Content())
|
||||
{
|
||||
page->_tabContent.Children().Append(std::move(content));
|
||||
}
|
||||
|
||||
tab->Focus(FocusState::Programmatic);
|
||||
}
|
||||
@@ -1871,7 +1959,7 @@ namespace winrt::TerminalApp::implementation
|
||||
return false;
|
||||
}
|
||||
|
||||
TermControl TerminalPage::_GetActiveControl()
|
||||
TermControl TerminalPage::_GetActiveControl() const
|
||||
{
|
||||
if (const auto terminalTab{ _GetFocusedTabImpl() })
|
||||
{
|
||||
@@ -1956,7 +2044,15 @@ namespace winrt::TerminalApp::implementation
|
||||
if (!_displayingCloseDialog)
|
||||
{
|
||||
_displayingCloseDialog = true;
|
||||
|
||||
const auto weak = get_weak();
|
||||
auto warningResult = co_await _ShowQuitDialog();
|
||||
const auto strong = weak.get();
|
||||
if (!strong)
|
||||
{
|
||||
co_return;
|
||||
}
|
||||
|
||||
_displayingCloseDialog = false;
|
||||
|
||||
if (warningResult != ContentDialogResult::Primary)
|
||||
@@ -1987,6 +2083,12 @@ namespace winrt::TerminalApp::implementation
|
||||
actions.insert(actions.end(), std::make_move_iterator(tabActions.begin()), std::make_move_iterator(tabActions.end()));
|
||||
}
|
||||
|
||||
// Avoid persisting a window with zero tabs, because `BuildStartupActions` happened to return an empty vector.
|
||||
if (actions.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// if the focused tab was not the last tab, restore that
|
||||
auto idx = _GetFocusedTabIndex();
|
||||
if (idx && idx != tabCount - 1)
|
||||
@@ -2312,7 +2414,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// for it. The Title change will be propagated upwards through the tab's
|
||||
// PropertyChanged event handler.
|
||||
void TerminalPage::_activePaneChanged(winrt::TerminalApp::TerminalTab sender,
|
||||
Windows::Foundation::IInspectable args)
|
||||
Windows::Foundation::IInspectable /*args*/)
|
||||
{
|
||||
if (const auto tab{ _GetTerminalTabImpl(sender) })
|
||||
{
|
||||
@@ -2329,6 +2431,8 @@ namespace winrt::TerminalApp::implementation
|
||||
auto profile = tab->GetFocusedProfile();
|
||||
_UpdateBackground(profile);
|
||||
}
|
||||
|
||||
_adjustProcessPriorityThrottled->Run();
|
||||
}
|
||||
|
||||
uint32_t TerminalPage::NumberOfTabs() const
|
||||
@@ -2779,8 +2883,20 @@ namespace winrt::TerminalApp::implementation
|
||||
if (const auto strongThis = weakThis.get())
|
||||
{
|
||||
// We have to initialize the dialog here to be able to change the text of the text block within it
|
||||
FindName(L"MultiLinePasteDialog").try_as<WUX::Controls::ContentDialog>();
|
||||
ClipboardText().Text(text);
|
||||
std::ignore = FindName(L"MultiLinePasteDialog");
|
||||
|
||||
// WinUI absolutely cannot deal with large amounts of text (at least O(n), possibly O(n^2),
|
||||
// so we limit the string length here and add an ellipsis if necessary.
|
||||
auto clipboardText = text;
|
||||
if (clipboardText.size() > 1024)
|
||||
{
|
||||
const std::wstring_view view{ text };
|
||||
// Make sure we don't cut in the middle of a surrogate pair
|
||||
const auto len = til::utf16_iterate_prev(view, 512);
|
||||
clipboardText = til::hstring_format(FMT_COMPILE(L"{}\n…"), view.substr(0, len));
|
||||
}
|
||||
|
||||
ClipboardText().Text(std::move(clipboardText));
|
||||
|
||||
// The vertical offset on the scrollbar does not reset automatically, so reset it manually
|
||||
ClipboardContentScrollViewer().ScrollToVerticalOffset(0);
|
||||
@@ -2796,7 +2912,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
// Clear the clipboard text so it doesn't lie around in memory
|
||||
ClipboardText().Text(L"");
|
||||
ClipboardText().Text({});
|
||||
|
||||
if (warningResult != ContentDialogResult::Primary)
|
||||
{
|
||||
@@ -2976,8 +3092,12 @@ namespace winrt::TerminalApp::implementation
|
||||
// - eventArgs: the arguments specifying how to set the progress indicator
|
||||
safe_void_coroutine TerminalPage::_SetTaskbarProgressHandler(const IInspectable /*sender*/, const IInspectable /*eventArgs*/)
|
||||
{
|
||||
const auto weak = get_weak();
|
||||
co_await wil::resume_foreground(Dispatcher());
|
||||
SetTaskbarProgress.raise(*this, nullptr);
|
||||
if (const auto strong = weak.get())
|
||||
{
|
||||
SetTaskbarProgress.raise(*this, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -3050,6 +3170,12 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
co_return;
|
||||
}
|
||||
|
||||
const auto weak = get_weak();
|
||||
const auto dispatcher = Dispatcher();
|
||||
|
||||
// All of the code until resume_foreground is static and
|
||||
// doesn't touch `this`, so we don't need weak/strong_ref.
|
||||
co_await winrt::resume_background();
|
||||
|
||||
// no packages were found, nothing to suggest
|
||||
@@ -3067,7 +3193,12 @@ namespace winrt::TerminalApp::implementation
|
||||
suggestions.emplace_back(fmt::format(FMT_COMPILE(L"winget install --id {} -s winget"), pkg.CatalogPackage().Id()));
|
||||
}
|
||||
|
||||
co_await wil::resume_foreground(Dispatcher());
|
||||
co_await wil::resume_foreground(dispatcher);
|
||||
const auto strong = weak.get();
|
||||
if (!strong)
|
||||
{
|
||||
co_return;
|
||||
}
|
||||
|
||||
auto term = _GetActiveControl();
|
||||
if (!term)
|
||||
@@ -3147,6 +3278,9 @@ namespace winrt::TerminalApp::implementation
|
||||
// UI) thread. This is IMPORTANT, because the Windows.Storage API's
|
||||
// (used for retrieving the path to the file) will crash on the UI
|
||||
// thread, because the main thread is a STA.
|
||||
//
|
||||
// NOTE: All remaining code of this function doesn't touch `this`, so we don't need weak/strong_ref.
|
||||
// NOTE NOTE: Don't touch `this` when you make changes here.
|
||||
co_await winrt::resume_background();
|
||||
|
||||
auto openFile = [](const auto& filePath) {
|
||||
@@ -3599,6 +3733,8 @@ namespace winrt::TerminalApp::implementation
|
||||
_isAlwaysOnTop = _settings.GlobalSettings().AlwaysOnTop();
|
||||
AlwaysOnTopChanged.raise(*this, nullptr);
|
||||
|
||||
_showTabsFullscreen = _settings.GlobalSettings().ShowTabsFullscreen();
|
||||
|
||||
// Settings AllowDependentAnimations will affect whether animations are
|
||||
// enabled application-wide, so we don't need to check it each time we
|
||||
// want to create an animation.
|
||||
@@ -3655,34 +3791,14 @@ namespace winrt::TerminalApp::implementation
|
||||
// - actions: a list of Actions to process on startup.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::SetStartupActions(std::vector<ActionAndArgs>& actions)
|
||||
void TerminalPage::SetStartupActions(std::vector<ActionAndArgs> actions)
|
||||
{
|
||||
// The fastest way to copy all the actions out of the std::vector and
|
||||
// put them into a winrt::IVector is by making a copy, then moving the
|
||||
// copy into the winrt vector ctor.
|
||||
auto listCopy = actions;
|
||||
_startupActions = winrt::single_threaded_vector<ActionAndArgs>(std::move(listCopy));
|
||||
_startupActions = std::move(actions);
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Notifies this Terminal Page that it should start the incoming connection
|
||||
// listener for command-line tools attempting to join this Terminal
|
||||
// through the default application channel.
|
||||
// Arguments:
|
||||
// - isEmbedding - True if COM started us to be a server. False if we're doing it of our own accord.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::SetInboundListener(bool isEmbedding)
|
||||
void TerminalPage::SetStartupConnection(ITerminalConnection connection)
|
||||
{
|
||||
_shouldStartInboundListener = true;
|
||||
_isEmbeddingInboundListener = isEmbedding;
|
||||
|
||||
// If the page has already passed the NotInitialized state,
|
||||
// then it is ready-enough for us to just start this immediately.
|
||||
if (_startupState != StartupState::NotInitialized)
|
||||
{
|
||||
_StartInboundListener();
|
||||
}
|
||||
_startupConnection = std::move(connection);
|
||||
}
|
||||
|
||||
winrt::TerminalApp::IDialogPresenter TerminalPage::DialogPresenter() const
|
||||
@@ -4023,6 +4139,37 @@ namespace winrt::TerminalApp::implementation
|
||||
return _isAlwaysOnTop;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Returns true if the tab row should be visible when we're in full screen
|
||||
// state.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - true if the tab row should be visible in full screen state
|
||||
bool TerminalPage::ShowTabsFullscreen() const
|
||||
{
|
||||
return _showTabsFullscreen;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Updates the visibility of the tab row when in fullscreen state.
|
||||
void TerminalPage::SetShowTabsFullscreen(bool newShowTabsFullscreen)
|
||||
{
|
||||
if (_showTabsFullscreen == newShowTabsFullscreen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_showTabsFullscreen = newShowTabsFullscreen;
|
||||
|
||||
// if we're currently in fullscreen, update tab view to make
|
||||
// sure tabs are given the correct visibility
|
||||
if (_isFullscreen)
|
||||
{
|
||||
_UpdateTabView();
|
||||
}
|
||||
}
|
||||
|
||||
void TerminalPage::SetFullscreen(bool newFullscreen)
|
||||
{
|
||||
if (_isFullscreen == newFullscreen)
|
||||
@@ -4053,68 +4200,6 @@ namespace winrt::TerminalApp::implementation
|
||||
ChangeMaximizeRequested.raise(*this, nullptr);
|
||||
}
|
||||
|
||||
HRESULT TerminalPage::_OnNewConnection(const ConptyConnection& connection)
|
||||
{
|
||||
_newConnectionRevoker.revoke();
|
||||
|
||||
// We need to be on the UI thread in order for _OpenNewTab to run successfully.
|
||||
// HasThreadAccess will return true if we're currently on a UI thread and false otherwise.
|
||||
// When we're on a COM thread, we'll need to dispatch the calls to the UI thread
|
||||
// and wait on it hence the locking mechanism.
|
||||
if (!Dispatcher().HasThreadAccess())
|
||||
{
|
||||
til::latch latch{ 1 };
|
||||
auto finalVal = S_OK;
|
||||
|
||||
Dispatcher().RunAsync(CoreDispatcherPriority::Normal, [&]() {
|
||||
finalVal = _OnNewConnection(connection);
|
||||
latch.count_down();
|
||||
});
|
||||
|
||||
latch.wait();
|
||||
return finalVal;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
NewTerminalArgs newTerminalArgs;
|
||||
newTerminalArgs.Commandline(connection.Commandline());
|
||||
newTerminalArgs.TabTitle(connection.StartingTitle());
|
||||
// GH #12370: We absolutely cannot allow a defterm connection to
|
||||
// auto-elevate. Defterm doesn't work for elevated scenarios in the
|
||||
// first place. If we try accepting the connection, the spawning an
|
||||
// elevated version of the Terminal with that profile... that's a
|
||||
// recipe for disaster. We won't ever open up a tab in this window.
|
||||
newTerminalArgs.Elevate(false);
|
||||
const auto newPane = _MakePane(newTerminalArgs, nullptr, connection);
|
||||
newPane->WalkTree([](const auto& pane) {
|
||||
pane->FinalizeConfigurationGivenDefault();
|
||||
});
|
||||
_CreateNewTabFromPane(newPane);
|
||||
|
||||
// Request a summon of this window to the foreground
|
||||
SummonWindowRequested.raise(*this, nullptr);
|
||||
|
||||
// TEMPORARY SOLUTION
|
||||
// If the connection has requested for the window to be maximized,
|
||||
// manually maximize it here. Ideally, we should be _initializing_
|
||||
// the session maximized, instead of manually maximizing it after initialization.
|
||||
// However, because of the current way our defterm handoff works,
|
||||
// we are unable to get the connection info before the terminal session
|
||||
// has already started.
|
||||
|
||||
// Make sure that there were no other tabs already existing (in
|
||||
// the case that we are in glomming mode), because we don't want
|
||||
// to be maximizing other existing sessions that did not ask for it.
|
||||
if (_tabs.Size() == 1 && connection.ShowWindow() == SW_SHOWMAXIMIZED)
|
||||
{
|
||||
RequestSetMaximized(true);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
CATCH_RETURN()
|
||||
}
|
||||
|
||||
TerminalApp::IPaneContent TerminalPage::_makeSettingsContent()
|
||||
{
|
||||
if (auto app{ winrt::Windows::UI::Xaml::Application::Current().try_as<winrt::TerminalApp::App>() })
|
||||
@@ -4145,6 +4230,13 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
});
|
||||
|
||||
sui.ShowLoadWarningsDialog([weakThis{ get_weak() }](auto&& /*s*/, const Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Terminal::Settings::Model::SettingsLoadWarnings>& warnings) {
|
||||
if (auto page{ weakThis.get() })
|
||||
{
|
||||
page->ShowLoadWarningsDialog.raise(*page, warnings);
|
||||
}
|
||||
});
|
||||
|
||||
return *settingsContent;
|
||||
}
|
||||
|
||||
@@ -4567,14 +4659,23 @@ namespace winrt::TerminalApp::implementation
|
||||
// - sender: the ICoreState instance containing the connection state
|
||||
// Return Value:
|
||||
// - <none>
|
||||
safe_void_coroutine TerminalPage::_ConnectionStateChangedHandler(const IInspectable& sender, const IInspectable& /*args*/) const
|
||||
safe_void_coroutine TerminalPage::_ConnectionStateChangedHandler(const IInspectable& sender, const IInspectable& /*args*/)
|
||||
{
|
||||
if (const auto coreState{ sender.try_as<winrt::Microsoft::Terminal::Control::ICoreState>() })
|
||||
{
|
||||
const auto newConnectionState = coreState.ConnectionState();
|
||||
const auto weak = get_weak();
|
||||
co_await wil::resume_foreground(Dispatcher());
|
||||
const auto strong = weak.get();
|
||||
if (!strong)
|
||||
{
|
||||
co_return;
|
||||
}
|
||||
|
||||
_adjustProcessPriorityThrottled->Run();
|
||||
|
||||
if (newConnectionState == ConnectionState::Failed && !_IsMessageDismissed(InfoBarMessage::CloseOnExitInfo))
|
||||
{
|
||||
co_await wil::resume_foreground(Dispatcher());
|
||||
if (const auto infoBar = FindName(L"CloseOnExitInfoBar").try_as<MUX::Controls::InfoBar>())
|
||||
{
|
||||
infoBar.IsOpen(true);
|
||||
@@ -4839,6 +4940,94 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void TerminalPage::_adjustProcessPriority() const
|
||||
{
|
||||
// Windowing is single-threaded, so this will not cause a race condition.
|
||||
static bool supported{ true };
|
||||
|
||||
if (!supported || !_hostingHwnd.has_value())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::array<HANDLE, 32> processes;
|
||||
auto it = processes.begin();
|
||||
const auto end = processes.end();
|
||||
|
||||
auto&& appendFromControl = [&](auto&& control) {
|
||||
if (it == end)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (control)
|
||||
{
|
||||
if (const auto conn{ control.Connection() })
|
||||
{
|
||||
if (const auto pty{ conn.try_as<winrt::Microsoft::Terminal::TerminalConnection::ConptyConnection>() })
|
||||
{
|
||||
if (const uint64_t process{ pty.RootProcessHandle() }; process != 0)
|
||||
{
|
||||
*it++ = reinterpret_cast<HANDLE>(process);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
auto&& appendFromTab = [&](auto&& tabImpl) {
|
||||
if (const auto pane{ tabImpl->GetRootPane() })
|
||||
{
|
||||
pane->WalkTree([&](auto&& child) {
|
||||
if (const auto& control{ child->GetTerminalControl() })
|
||||
{
|
||||
appendFromControl(control);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (!_activated)
|
||||
{
|
||||
// When a window is out of focus, we want to attach all of the processes
|
||||
// under it to the window so they all go into the background at the same time.
|
||||
for (auto&& tab : _tabs)
|
||||
{
|
||||
if (auto tabImpl{ _GetTerminalTabImpl(tab) })
|
||||
{
|
||||
appendFromTab(tabImpl);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// When a window is in focus, propagate our foreground boost (if we have one)
|
||||
// to current all panes in the current tab.
|
||||
if (auto tabImpl{ _GetFocusedTabImpl() })
|
||||
{
|
||||
appendFromTab(tabImpl);
|
||||
}
|
||||
}
|
||||
|
||||
const auto count{ gsl::narrow_cast<DWORD>(it - processes.begin()) };
|
||||
const auto hr = TerminalTrySetWindowAssociatedProcesses(_hostingHwnd.value(), count, count ? processes.data() : nullptr);
|
||||
if (S_FALSE == hr)
|
||||
{
|
||||
// Don't bother trying again or logging. The wrapper tells us it's unsupported.
|
||||
supported = false;
|
||||
return;
|
||||
}
|
||||
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider,
|
||||
"CalledNewQoSAPI",
|
||||
TraceLoggingValue(reinterpret_cast<uintptr_t>(_hostingHwnd.value()), "hwnd"),
|
||||
TraceLoggingValue(count),
|
||||
TraceLoggingHResult(hr));
|
||||
#ifdef _DEBUG
|
||||
OutputDebugStringW(fmt::format(FMT_COMPILE(L"Submitted {} processes to TerminalTrySetWindowAssociatedProcesses; return=0x{:08x}\n"), count, hr).c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
void TerminalPage::WindowActivated(const bool activated)
|
||||
{
|
||||
// Stash if we're activated. Use that when we reload
|
||||
@@ -4846,6 +5035,8 @@ namespace winrt::TerminalApp::implementation
|
||||
_activated = activated;
|
||||
_updateThemeColors();
|
||||
|
||||
_adjustProcessPriorityThrottled->Run();
|
||||
|
||||
if (const auto& tab{ _GetFocusedTabImpl() })
|
||||
{
|
||||
if (tab->TabStatus().IsInputBroadcastActive())
|
||||
@@ -4865,8 +5056,6 @@ namespace winrt::TerminalApp::implementation
|
||||
safe_void_coroutine TerminalPage::_ControlCompletionsChangedHandler(const IInspectable sender,
|
||||
const CompletionsChangedEventArgs args)
|
||||
{
|
||||
// This will come in on a background (not-UI, not output) thread.
|
||||
|
||||
// This won't even get hit if the velocity flag is disabled - we gate
|
||||
// registering for the event based off of
|
||||
// Feature_ShellCompletions::IsEnabled back in _RegisterTerminalEvents
|
||||
@@ -5235,8 +5424,8 @@ namespace winrt::TerminalApp::implementation
|
||||
_sendDraggedTabToWindow(winrt::to_hstring(args.TargetWindow()), args.TabIndex(), std::nullopt);
|
||||
}
|
||||
|
||||
void TerminalPage::_onTabDroppedOutside(winrt::IInspectable sender,
|
||||
winrt::MUX::Controls::TabViewTabDroppedOutsideEventArgs e)
|
||||
void TerminalPage::_onTabDroppedOutside(winrt::IInspectable /*sender*/,
|
||||
winrt::MUX::Controls::TabViewTabDroppedOutsideEventArgs /*e*/)
|
||||
{
|
||||
// Get the current pointer point from the CoreWindow
|
||||
const auto& pointerPoint{ CoreWindow::GetForCurrentThread().PointerPosition() };
|
||||
@@ -5303,6 +5492,14 @@ namespace winrt::TerminalApp::implementation
|
||||
runAsAdminItem.Click([profileIndex, weakThis{ get_weak() }](auto&&, auto&&) {
|
||||
if (auto page{ weakThis.get() })
|
||||
{
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider,
|
||||
"NewTabMenuItemElevateSubmenuItemClicked",
|
||||
TraceLoggingDescription("Event emitted when the elevate submenu item from the new tab menu is invoked"),
|
||||
TraceLoggingValue(page->NumberOfTabs(), "TabCount", "The count of tabs currently opened in this window"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
|
||||
NewTerminalArgs args{ profileIndex };
|
||||
args.Elevate(true);
|
||||
page->_OpenNewTerminalViaDropdown(args);
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ThrottledFunc.h>
|
||||
|
||||
#include "TerminalPage.g.h"
|
||||
#include "TerminalTab.h"
|
||||
#include "AppKeyBindings.h"
|
||||
@@ -121,14 +123,16 @@ namespace winrt::TerminalApp::implementation
|
||||
bool FocusMode() const;
|
||||
bool Fullscreen() const;
|
||||
bool AlwaysOnTop() const;
|
||||
bool ShowTabsFullscreen() const;
|
||||
void SetShowTabsFullscreen(bool newShowTabsFullscreen);
|
||||
void SetFullscreen(bool);
|
||||
void SetFocusMode(const bool inFocusMode);
|
||||
void Maximized(bool newMaximized);
|
||||
void RequestSetMaximized(bool newMaximized);
|
||||
|
||||
void SetStartupActions(std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs>& actions);
|
||||
void SetStartupActions(std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs> actions);
|
||||
void SetStartupConnection(winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection connection);
|
||||
|
||||
void SetInboundListener(bool isEmbedding);
|
||||
static std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs> ConvertExecuteCommandlineToActions(const Microsoft::Terminal::Settings::Model::ExecuteCommandlineArgs& args);
|
||||
|
||||
winrt::TerminalApp::IDialogPresenter DialogPresenter() const;
|
||||
@@ -144,10 +148,10 @@ namespace winrt::TerminalApp::implementation
|
||||
void ActionSaveFailed(winrt::hstring message);
|
||||
void ShowTerminalWorkingDirectory();
|
||||
|
||||
safe_void_coroutine ProcessStartupActions(Windows::Foundation::Collections::IVector<Microsoft::Terminal::Settings::Model::ActionAndArgs> actions,
|
||||
const bool initial,
|
||||
safe_void_coroutine ProcessStartupActions(std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs> actions,
|
||||
const winrt::hstring cwd = winrt::hstring{},
|
||||
const winrt::hstring env = winrt::hstring{});
|
||||
void CreateTabFromConnection(winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection connection);
|
||||
|
||||
TerminalApp::WindowProperties WindowProperties() const noexcept { return _WindowProperties; };
|
||||
|
||||
@@ -182,10 +186,10 @@ namespace winrt::TerminalApp::implementation
|
||||
til::typed_event<IInspectable, IInspectable> SummonWindowRequested;
|
||||
til::typed_event<IInspectable, winrt::Microsoft::Terminal::Control::WindowSizeChangedEventArgs> WindowSizeChanged;
|
||||
|
||||
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;
|
||||
til::typed_event<Windows::Foundation::IInspectable, Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Terminal::Settings::Model::SettingsLoadWarnings>> ShowLoadWarningsDialog;
|
||||
|
||||
til::typed_event<Windows::Foundation::IInspectable, winrt::TerminalApp::RequestMoveContentArgs> RequestMoveContent;
|
||||
til::typed_event<Windows::Foundation::IInspectable, winrt::TerminalApp::RequestReceiveContentArgs> RequestReceiveContent;
|
||||
@@ -229,6 +233,7 @@ namespace winrt::TerminalApp::implementation
|
||||
bool _isFullscreen{ false };
|
||||
bool _isMaximized{ false };
|
||||
bool _isAlwaysOnTop{ false };
|
||||
bool _showTabsFullscreen{ false };
|
||||
|
||||
std::optional<uint32_t> _loadFromPersistedLayoutIdx{};
|
||||
|
||||
@@ -253,9 +258,8 @@ namespace winrt::TerminalApp::implementation
|
||||
winrt::Windows::UI::Xaml::Controls::Grid::LayoutUpdated_revoker _layoutUpdatedRevoker;
|
||||
StartupState _startupState{ StartupState::NotInitialized };
|
||||
|
||||
Windows::Foundation::Collections::IVector<Microsoft::Terminal::Settings::Model::ActionAndArgs> _startupActions;
|
||||
bool _shouldStartInboundListener{ false };
|
||||
bool _isEmbeddingInboundListener{ false };
|
||||
std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs> _startupActions;
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection _startupConnection{ nullptr };
|
||||
|
||||
std::shared_ptr<Toast> _windowIdToast{ nullptr };
|
||||
std::shared_ptr<Toast> _actionSavedToast{ nullptr };
|
||||
@@ -279,8 +283,6 @@ namespace winrt::TerminalApp::implementation
|
||||
winrt::Windows::Foundation::Point dragOffset{ 0, 0 };
|
||||
} _stashed;
|
||||
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ConptyConnection::NewConnection_revoker _newConnectionRevoker;
|
||||
|
||||
safe_void_coroutine _NewTerminalByDrop(const Windows::Foundation::IInspectable&, winrt::Windows::UI::Xaml::DragEventArgs e);
|
||||
|
||||
__declspec(noinline) CommandPalette _loadCommandPaletteSlowPath();
|
||||
@@ -359,8 +361,11 @@ namespace winrt::TerminalApp::implementation
|
||||
bool _MovePane(const Microsoft::Terminal::Settings::Model::MovePaneArgs args);
|
||||
bool _MoveTab(winrt::com_ptr<TerminalTab> tab, const Microsoft::Terminal::Settings::Model::MoveTabArgs args);
|
||||
|
||||
std::shared_ptr<ThrottledFunc<>> _adjustProcessPriorityThrottled;
|
||||
void _adjustProcessPriority() const;
|
||||
|
||||
template<typename F>
|
||||
bool _ApplyToActiveControls(F f)
|
||||
bool _ApplyToActiveControls(F f) const
|
||||
{
|
||||
if (const auto tab{ _GetFocusedTabImpl() })
|
||||
{
|
||||
@@ -379,7 +384,7 @@ namespace winrt::TerminalApp::implementation
|
||||
return false;
|
||||
}
|
||||
|
||||
winrt::Microsoft::Terminal::Control::TermControl _GetActiveControl();
|
||||
winrt::Microsoft::Terminal::Control::TermControl _GetActiveControl() const;
|
||||
std::optional<uint32_t> _GetFocusedTabIndex() const noexcept;
|
||||
std::optional<uint32_t> _GetTabIndex(const TerminalApp::TabBase& tab) const noexcept;
|
||||
TerminalApp::TabBase _GetFocusedTab() const noexcept;
|
||||
@@ -431,6 +436,7 @@ namespace winrt::TerminalApp::implementation
|
||||
bool _tabPointerMiddleButtonExited{ false };
|
||||
void _OnTabPointerPressed(const IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs);
|
||||
void _OnTabPointerReleased(const IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs);
|
||||
safe_void_coroutine _OnTabPointerReleasedCloseTab(winrt::Microsoft::UI::Xaml::Controls::TabViewItem sender);
|
||||
void _OnTabPointerEntered(const IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs);
|
||||
void _OnTabPointerExited(const IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs);
|
||||
|
||||
@@ -465,8 +471,6 @@ namespace winrt::TerminalApp::implementation
|
||||
void _SetNewTabButtonColor(const Windows::UI::Color& color, const Windows::UI::Color& accentColor);
|
||||
void _ClearNewTabButtonColor();
|
||||
|
||||
void _StartInboundListener();
|
||||
|
||||
safe_void_coroutine _CompleteInitialization();
|
||||
|
||||
void _FocusActiveControl(IInspectable sender, IInspectable eventArgs);
|
||||
@@ -508,7 +512,7 @@ namespace winrt::TerminalApp::implementation
|
||||
const winrt::Microsoft::Terminal::Settings::Model::Profile& profile);
|
||||
void _OpenElevatedWT(winrt::Microsoft::Terminal::Settings::Model::NewTerminalArgs newTerminalArgs);
|
||||
|
||||
safe_void_coroutine _ConnectionStateChangedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
|
||||
safe_void_coroutine _ConnectionStateChangedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args);
|
||||
void _CloseOnExitInfoDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
|
||||
void _KeyboardServiceWarningInfoDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
|
||||
static bool _IsMessageDismissed(const winrt::Microsoft::Terminal::Settings::Model::InfoBarMessage& message);
|
||||
@@ -524,7 +528,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
void _ShowWindowChangedHandler(const IInspectable sender, const winrt::Microsoft::Terminal::Control::ShowWindowArgs args);
|
||||
Windows::Foundation::IAsyncAction _SearchMissingCommandHandler(const IInspectable sender, const winrt::Microsoft::Terminal::Control::SearchMissingCommandEventArgs args);
|
||||
Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Management::Deployment::MatchResult>> _FindPackageAsync(hstring query);
|
||||
static Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Management::Deployment::MatchResult>> _FindPackageAsync(hstring query);
|
||||
|
||||
void _WindowSizeChanged(const IInspectable sender, const winrt::Microsoft::Terminal::Control::WindowSizeChangedEventArgs args);
|
||||
void _windowPropertyChanged(const IInspectable& sender, const winrt::Windows::UI::Xaml::Data::PropertyChangedEventArgs& args);
|
||||
|
||||
@@ -95,9 +95,9 @@ namespace TerminalApp
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> SummonWindowRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Control.WindowSizeChangedEventArgs> WindowSizeChanged;
|
||||
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> CloseRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> OpenSystemMenu;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Control.ShowWindowArgs> ShowWindowChanged;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Windows.Foundation.Collections.IVectorView<Microsoft.Terminal.Settings.Model.SettingsLoadWarnings> > ShowLoadWarningsDialog;
|
||||
|
||||
event Windows.Foundation.TypedEventHandler<Object, RequestMoveContentArgs> RequestMoveContent;
|
||||
event Windows.Foundation.TypedEventHandler<Object, RequestReceiveContentArgs> RequestReceiveContent;
|
||||
|
||||
@@ -137,6 +137,9 @@
|
||||
DefaultButton="Primary">
|
||||
<TextBlock IsTextSelectionEnabled="True"
|
||||
TextWrapping="WrapWholeWords">
|
||||
<TextBlock.ContextFlyout>
|
||||
<mtu:TextMenuFlyout />
|
||||
</TextBlock.ContextFlyout>
|
||||
<Run x:Name="NoticeMessage" />
|
||||
</TextBlock>
|
||||
</ContentDialog>
|
||||
@@ -148,6 +151,9 @@
|
||||
DefaultButton="Primary">
|
||||
<TextBlock IsTextSelectionEnabled="True"
|
||||
TextWrapping="WrapWholeWords">
|
||||
<TextBlock.ContextFlyout>
|
||||
<mtu:TextMenuFlyout />
|
||||
</TextBlock.ContextFlyout>
|
||||
<Run x:Name="CouldNotOpenUriReason" /> <LineBreak />
|
||||
<Run x:Name="UnopenedUri"
|
||||
FontFamily="Cascadia Mono" />
|
||||
@@ -191,7 +197,11 @@
|
||||
<TextBox x:Name="WindowRenamerTextBox"
|
||||
KeyDown="_WindowRenamerKeyDown"
|
||||
KeyUp="_WindowRenamerKeyUp"
|
||||
Text="{x:Bind WindowProperties.WindowName, Mode=OneWay}" />
|
||||
Text="{x:Bind WindowProperties.WindowName, Mode=OneWay}">
|
||||
<TextBox.ContextFlyout>
|
||||
<mtu:TextMenuFlyout />
|
||||
</TextBox.ContextFlyout>
|
||||
</TextBox>
|
||||
</mux:TeachingTip.Content>
|
||||
</mux:TeachingTip>
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace winrt::TerminalApp::implementation
|
||||
NewTerminalArgs args{};
|
||||
const auto& controlSettings = _control.Settings();
|
||||
|
||||
args.Profile(controlSettings.ProfileName());
|
||||
args.Profile(::Microsoft::Console::Utils::GuidToString(_profile.Guid()));
|
||||
// If we know the user's working directory use it instead of the profile.
|
||||
if (const auto dir = _control.WorkingDirectory(); !dir.empty())
|
||||
{
|
||||
@@ -339,8 +339,12 @@ namespace winrt::TerminalApp::implementation
|
||||
RestartTerminalRequested.raise(*this, nullptr);
|
||||
}
|
||||
|
||||
void TerminalPaneContent::UpdateSettings(const CascadiaSettings& /*settings*/)
|
||||
void TerminalPaneContent::UpdateSettings(const CascadiaSettings& settings)
|
||||
{
|
||||
// Reload our profile from the settings model to propagate bell mode, icon, and close on exit mode (anything that uses _profile).
|
||||
const auto profile{ settings.FindProfile(_profile.Guid()) };
|
||||
_profile = profile ? profile : settings.ProfileDefaults();
|
||||
|
||||
if (const auto& settings{ _cache.TryLookup(_profile) })
|
||||
{
|
||||
_control.UpdateControlSettings(settings.DefaultSettings(), settings.UnfocusedSettings());
|
||||
|
||||
@@ -851,6 +851,9 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
ASSERT_UI_THREAD();
|
||||
|
||||
// Don't forget to call the overridden function. :)
|
||||
TabBase::Shutdown();
|
||||
|
||||
if (_rootPane)
|
||||
{
|
||||
_rootPane->Shutdown();
|
||||
@@ -943,27 +946,48 @@ namespace winrt::TerminalApp::implementation
|
||||
void TerminalTab::_AttachEventHandlersToContent(const uint32_t paneId, const TerminalApp::IPaneContent& content)
|
||||
{
|
||||
auto weakThis{ get_weak() };
|
||||
auto dispatcher = TabViewItem().Dispatcher();
|
||||
auto dispatcher = DispatcherQueue::GetForCurrentThread();
|
||||
ContentEventTokens events{};
|
||||
|
||||
auto throttledTitleChanged = std::make_shared<ThrottledFunc<>>(
|
||||
dispatcher,
|
||||
til::throttled_func_options{
|
||||
.delay = std::chrono::milliseconds{ 200 },
|
||||
.leading = true,
|
||||
.trailing = true,
|
||||
},
|
||||
[weakThis]() {
|
||||
if (const auto tab = weakThis.get())
|
||||
{
|
||||
tab->UpdateTitle();
|
||||
}
|
||||
});
|
||||
|
||||
events.TitleChanged = content.TitleChanged(
|
||||
winrt::auto_revoke,
|
||||
[dispatcher, weakThis](auto&&, auto&&) -> safe_void_coroutine {
|
||||
// The lambda lives in the `std::function`-style container owned by `control`. That is, when the
|
||||
// `control` gets destroyed the lambda struct also gets destroyed. In other words, we need to
|
||||
// copy `weakThis` onto the stack, because that's the only thing that gets captured in coroutines.
|
||||
// See: https://devblogs.microsoft.com/oldnewthing/20211103-00/?p=105870
|
||||
const auto weakThisCopy = weakThis;
|
||||
co_await wil::resume_foreground(dispatcher);
|
||||
// Check if Tab's lifetime has expired
|
||||
if (auto tab{ weakThisCopy.get() })
|
||||
[func = std::move(throttledTitleChanged)](auto&&, auto&&) {
|
||||
func->Run();
|
||||
});
|
||||
|
||||
auto throttledTaskbarProgressChanged = std::make_shared<ThrottledFunc<>>(
|
||||
dispatcher,
|
||||
til::throttled_func_options{
|
||||
.delay = std::chrono::milliseconds{ 200 },
|
||||
.trailing = true,
|
||||
},
|
||||
[weakThis]() {
|
||||
if (const auto tab = weakThis.get())
|
||||
{
|
||||
// The title of the control changed, but not necessarily the title of the tab.
|
||||
// Set the tab's text to the active panes' text.
|
||||
tab->UpdateTitle();
|
||||
tab->_UpdateProgressState();
|
||||
}
|
||||
});
|
||||
|
||||
events.TaskbarProgressChanged = content.TaskbarProgressChanged(
|
||||
winrt::auto_revoke,
|
||||
[func = std::move(throttledTaskbarProgressChanged)](auto&&, auto&&) {
|
||||
func->Run();
|
||||
});
|
||||
|
||||
events.TabColorChanged = content.TabColorChanged(
|
||||
winrt::auto_revoke,
|
||||
[dispatcher, weakThis](auto&&, auto&&) -> safe_void_coroutine {
|
||||
@@ -979,18 +1003,6 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
});
|
||||
|
||||
events.TaskbarProgressChanged = content.TaskbarProgressChanged(
|
||||
winrt::auto_revoke,
|
||||
[dispatcher, weakThis](auto&&, auto&&) -> safe_void_coroutine {
|
||||
const auto weakThisCopy = weakThis;
|
||||
co_await wil::resume_foreground(dispatcher);
|
||||
// Check if Tab's lifetime has expired
|
||||
if (auto tab{ weakThisCopy.get() })
|
||||
{
|
||||
tab->_UpdateProgressState();
|
||||
}
|
||||
});
|
||||
|
||||
events.ConnectionStateChanged = content.ConnectionStateChanged(
|
||||
winrt::auto_revoke,
|
||||
[dispatcher, weakThis](auto&&, auto&&) -> safe_void_coroutine {
|
||||
|
||||
@@ -144,7 +144,6 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
// Now that we know we can do XAML, build our page.
|
||||
_root = winrt::make_self<TerminalPage>(*_WindowProperties, _manager);
|
||||
_dialog = ContentDialog{};
|
||||
|
||||
// Pass in information about the initial state of the window.
|
||||
// * If we were supposed to start from serialized "content", do that,
|
||||
@@ -152,38 +151,23 @@ namespace winrt::TerminalApp::implementation
|
||||
// instead.
|
||||
// * if we have commandline arguments, Pass commandline args into the
|
||||
// TerminalPage.
|
||||
if (!_initialContentArgs.empty())
|
||||
if (_startupConnection)
|
||||
{
|
||||
_root->SetStartupActions(_initialContentArgs);
|
||||
_root->SetStartupConnection(std::move(_startupConnection));
|
||||
}
|
||||
else
|
||||
else if (!_initialContentArgs.empty())
|
||||
{
|
||||
_root->SetStartupActions(std::move(_initialContentArgs));
|
||||
}
|
||||
else if (const auto& layout = LoadPersistedLayout())
|
||||
{
|
||||
// layout will only ever be non-null if there were >0 tabs persisted in
|
||||
// .TabLayout(). We can re-evaluate that as a part of TODO: GH#12633
|
||||
if (const auto& layout = LoadPersistedLayout())
|
||||
{
|
||||
std::vector<Settings::Model::ActionAndArgs> actions;
|
||||
for (const auto& a : layout.TabLayout())
|
||||
{
|
||||
actions.emplace_back(a);
|
||||
}
|
||||
_root->SetStartupActions(actions);
|
||||
}
|
||||
else if (_appArgs)
|
||||
{
|
||||
_root->SetStartupActions(_appArgs->ParsedArgs().GetStartupActions());
|
||||
}
|
||||
_root->SetStartupActions(wil::to_vector(layout.TabLayout()));
|
||||
}
|
||||
|
||||
// Check if we were started as a COM server for inbound connections of console sessions
|
||||
// coming out of the operating system default application feature. If so,
|
||||
// tell TerminalPage to start the listener as we have to make sure it has the chance
|
||||
// to register a handler to hear about the requests first and is all ready to receive
|
||||
// them before the COM server registers itself. Otherwise, the request might come
|
||||
// in and be routed to an event with no handlers or a non-ready Page.
|
||||
if (_appArgs && _appArgs->ParsedArgs().IsHandoffListener())
|
||||
else if (_appArgs)
|
||||
{
|
||||
_root->SetInboundListener(true);
|
||||
_root->SetStartupActions(_appArgs->ParsedArgs().GetStartupActions());
|
||||
}
|
||||
|
||||
return _root->Initialize(hwnd);
|
||||
@@ -220,6 +204,7 @@ namespace winrt::TerminalApp::implementation
|
||||
_root->Initialized({ get_weak(), &TerminalWindow::_pageInitialized });
|
||||
_root->WindowSizeChanged({ get_weak(), &TerminalWindow::_WindowSizeChanged });
|
||||
_root->RenameWindowRequested({ get_weak(), &TerminalWindow::_RenameWindowRequested });
|
||||
_root->ShowLoadWarningsDialog({ get_weak(), &TerminalWindow::_ShowLoadWarningsDialog });
|
||||
_root->Create();
|
||||
|
||||
AppLogic::Current()->SettingsChanged({ get_weak(), &TerminalWindow::UpdateSettingsHandler });
|
||||
@@ -289,6 +274,11 @@ namespace winrt::TerminalApp::implementation
|
||||
return _settings.GlobalSettings().AlwaysOnTop();
|
||||
}
|
||||
|
||||
bool TerminalWindow::GetInitialShowTabsFullscreen()
|
||||
{
|
||||
return _settings.GlobalSettings().ShowTabsFullscreen();
|
||||
}
|
||||
|
||||
bool TerminalWindow::GetMinimizeToNotificationArea()
|
||||
{
|
||||
return _settings.GlobalSettings().MinimizeToNotificationArea();
|
||||
@@ -308,6 +298,15 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
return _settings.GlobalSettings().CurrentTheme();
|
||||
}
|
||||
|
||||
// WinUI can't show 2 dialogs simultaneously. Yes, really. If you do, you get an exception.
|
||||
// As such, we must dismiss whatever dialog is currently being shown.
|
||||
//
|
||||
// This limit is of course per-thread and not per-window. Yes... really. See:
|
||||
// https://github.com/microsoft/microsoft-ui-xaml/issues/794
|
||||
// The consequence is that we use a static variable to keep track of the shown dialog.
|
||||
static ContentDialog s_activeDialog{ nullptr };
|
||||
|
||||
// Method Description:
|
||||
// - Show a ContentDialog with buttons to take further action. Uses the
|
||||
// FrameworkElements provided as the title and content of this dialog, and
|
||||
@@ -323,21 +322,41 @@ namespace winrt::TerminalApp::implementation
|
||||
// - an IAsyncOperation with the dialog result
|
||||
winrt::Windows::Foundation::IAsyncOperation<ContentDialogResult> TerminalWindow::ShowDialog(winrt::WUX::Controls::ContentDialog dialog)
|
||||
{
|
||||
// DON'T release this lock in a wil::scope_exit. The scope_exit will get
|
||||
// called when we await, which is not what we want.
|
||||
std::unique_lock lock{ _dialogLock, std::try_to_lock };
|
||||
if (!lock)
|
||||
const auto weak = get_weak();
|
||||
const auto dispatcher = _root->Dispatcher();
|
||||
const auto root = _root->XamlRoot();
|
||||
|
||||
// As mentioned on s_activeDialog, dismissing the active dialog is necessary.
|
||||
// We repeat it a few times in case the resume_foreground failed to work,
|
||||
// but I found that one iteration will always be enough in practice.
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
if (!s_activeDialog)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
s_activeDialog.Hide();
|
||||
|
||||
// Wait for the current dialog to be hidden.
|
||||
co_await wil::resume_foreground(dispatcher, CoreDispatcherPriority::Low);
|
||||
}
|
||||
|
||||
// If two sources call ShowDialog() simultaneously, it may happen that both enter the above loop,
|
||||
// but it's crucial that only one of them continues below as only 1 dialog can be shown at a time.
|
||||
// Thankfully, everything runs on the UI thread, so only 1 caller will exit the above loop at a time.
|
||||
// So, if s_activeDialog is still set at this point, we must have lost the race.
|
||||
if (s_activeDialog)
|
||||
{
|
||||
// Another dialog is visible.
|
||||
co_return ContentDialogResult::None;
|
||||
}
|
||||
|
||||
_dialog = dialog;
|
||||
s_activeDialog = dialog;
|
||||
|
||||
// IMPORTANT: This is necessary as documented in the ContentDialog MSDN docs.
|
||||
// Since we're hosting the dialog in a Xaml island, we need to connect it to the
|
||||
// xaml tree somehow.
|
||||
dialog.XamlRoot(_root->XamlRoot());
|
||||
dialog.XamlRoot(root);
|
||||
|
||||
// IMPORTANT: Set the requested theme of the dialog, because the
|
||||
// PopupRoot isn't directly in the Xaml tree of our root. So the dialog
|
||||
@@ -351,34 +370,40 @@ namespace winrt::TerminalApp::implementation
|
||||
// theme on each element up to the root. We're relying a bit on Xaml's implementation
|
||||
// details here, but it does have the desired effect.
|
||||
// It's not enough to set the theme on the dialog alone.
|
||||
auto themingLambda{ [this](const Windows::Foundation::IInspectable& sender, const RoutedEventArgs&) {
|
||||
auto theme{ _settings.GlobalSettings().CurrentTheme() };
|
||||
auto requestedTheme{ theme.RequestedTheme() };
|
||||
auto element{ sender.try_as<winrt::Windows::UI::Xaml::FrameworkElement>() };
|
||||
while (element)
|
||||
auto themingLambda{ [weak](const Windows::Foundation::IInspectable& sender, const RoutedEventArgs&) {
|
||||
if (const auto strong = weak.get())
|
||||
{
|
||||
element.RequestedTheme(requestedTheme);
|
||||
element = element.Parent().try_as<winrt::Windows::UI::Xaml::FrameworkElement>();
|
||||
auto theme{ strong->_settings.GlobalSettings().CurrentTheme() };
|
||||
auto requestedTheme{ theme.RequestedTheme() };
|
||||
auto element{ sender.try_as<winrt::Windows::UI::Xaml::FrameworkElement>() };
|
||||
while (element)
|
||||
{
|
||||
element.RequestedTheme(requestedTheme);
|
||||
element = element.Parent().try_as<winrt::Windows::UI::Xaml::FrameworkElement>();
|
||||
}
|
||||
}
|
||||
} };
|
||||
|
||||
themingLambda(dialog, nullptr); // if it's already in the tree
|
||||
auto loadedRevoker{ dialog.Loaded(winrt::auto_revoke, themingLambda) }; // if it's not yet in the tree
|
||||
auto result = ContentDialogResult::None;
|
||||
|
||||
// Display the dialog.
|
||||
co_return co_await dialog.ShowAsync(Controls::ContentDialogPlacement::Popup);
|
||||
// Extra scope to drop the revoker before resetting the s_activeDialog to null.
|
||||
{
|
||||
themingLambda(dialog, nullptr); // if it's already in the tree
|
||||
auto loadedRevoker{ dialog.Loaded(winrt::auto_revoke, themingLambda) }; // if it's not yet in the tree
|
||||
result = co_await dialog.ShowAsync(Controls::ContentDialogPlacement::Popup);
|
||||
}
|
||||
|
||||
// After the dialog is dismissed, the dialog lock (held by `lock`) will
|
||||
// be released so another can be shown
|
||||
s_activeDialog = nullptr;
|
||||
co_return result;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Dismiss the (only) visible ContentDialog
|
||||
void TerminalWindow::DismissDialog()
|
||||
{
|
||||
if (auto localDialog = std::exchange(_dialog, nullptr))
|
||||
if (s_activeDialog)
|
||||
{
|
||||
localDialog.Hide();
|
||||
s_activeDialog.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -401,6 +426,7 @@ namespace winrt::TerminalApp::implementation
|
||||
auto buttonText = RS_(L"Ok");
|
||||
|
||||
Controls::TextBlock warningsTextBlock;
|
||||
warningsTextBlock.ContextFlyout(winrt::Microsoft::Terminal::UI::TextMenuFlyout{});
|
||||
// Make sure you can copy-paste
|
||||
warningsTextBlock.IsTextSelectionEnabled(true);
|
||||
// Make sure the lines of text wrap
|
||||
@@ -444,12 +470,13 @@ namespace winrt::TerminalApp::implementation
|
||||
// validating the settings.
|
||||
// - Only one dialog can be visible at a time. If another dialog is visible
|
||||
// when this is called, nothing happens. See ShowDialog for details
|
||||
void TerminalWindow::_ShowLoadWarningsDialog(const Windows::Foundation::Collections::IVector<SettingsLoadWarnings>& warnings)
|
||||
void TerminalWindow::_ShowLoadWarningsDialog(const IInspectable&, const Windows::Foundation::Collections::IVectorView<SettingsLoadWarnings>& warnings)
|
||||
{
|
||||
auto title = RS_(L"SettingsValidateErrorTitle");
|
||||
auto buttonText = RS_(L"Ok");
|
||||
|
||||
Controls::TextBlock warningsTextBlock;
|
||||
warningsTextBlock.ContextFlyout(winrt::Microsoft::Terminal::UI::TextMenuFlyout{});
|
||||
// Make sure you can copy-paste
|
||||
warningsTextBlock.IsTextSelectionEnabled(true);
|
||||
// Make sure the lines of text wrap
|
||||
@@ -504,7 +531,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
else if (settingsLoadedResult == S_FALSE)
|
||||
{
|
||||
_ShowLoadWarningsDialog(_initialLoadResult.Warnings());
|
||||
_ShowLoadWarningsDialog(nullptr, _initialLoadResult.Warnings());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -790,7 +817,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
else if (args.Result() == S_FALSE)
|
||||
{
|
||||
_ShowLoadWarningsDialog(args.Warnings());
|
||||
_ShowLoadWarningsDialog(nullptr, args.Warnings());
|
||||
}
|
||||
else if (args.Result() == S_OK)
|
||||
{
|
||||
@@ -868,6 +895,11 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
// Manually bubble the OnDirectKeyEvent event up through the focus tree.
|
||||
auto xamlRoot{ _root->XamlRoot() };
|
||||
if (!xamlRoot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto focusedObject{ Windows::UI::Xaml::Input::FocusManager::GetFocusedElement(xamlRoot) };
|
||||
do
|
||||
{
|
||||
@@ -981,6 +1013,11 @@ namespace winrt::TerminalApp::implementation
|
||||
return _root ? _root->AlwaysOnTop() : false;
|
||||
}
|
||||
|
||||
bool TerminalWindow::ShowTabsFullscreen() const
|
||||
{
|
||||
return _root ? _root->ShowTabsFullscreen() : false;
|
||||
}
|
||||
|
||||
void TerminalWindow::SetSettingsStartupArgs(const std::vector<ActionAndArgs>& actions)
|
||||
{
|
||||
for (const auto& action : actions)
|
||||
@@ -1013,6 +1050,7 @@ namespace winrt::TerminalApp::implementation
|
||||
int32_t TerminalWindow::SetStartupCommandline(TerminalApp::CommandlineArgs args)
|
||||
{
|
||||
_appArgs = winrt::get_self<CommandlineArgs>(args);
|
||||
_startupConnection = args.Connection();
|
||||
auto& parsedArgs = _appArgs->ParsedArgs();
|
||||
|
||||
_WindowProperties->SetInitialCwd(_appArgs->CurrentDirectory());
|
||||
@@ -1022,6 +1060,11 @@ namespace winrt::TerminalApp::implementation
|
||||
// (or called TerminalWindow::Initialize)
|
||||
if (_appArgs->ExitCode() == 0)
|
||||
{
|
||||
// The existing logic (before this commit) strictly relied on
|
||||
// ValidateStartupCommands() only to be called for new windows.
|
||||
// It modifies the actions it stores.
|
||||
parsedArgs.ValidateStartupCommands();
|
||||
|
||||
// If the size of the arguments list is 1,
|
||||
// then it contains only the executable name and no other arguments.
|
||||
_hasCommandLineArguments = _appArgs->CommandlineRef().size() > 1;
|
||||
@@ -1044,12 +1087,8 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
_contentBounds = bounds;
|
||||
|
||||
const auto& args = _contentStringToActions(content, true);
|
||||
|
||||
for (const auto& action : args)
|
||||
{
|
||||
_initialContentArgs.push_back(action);
|
||||
}
|
||||
const auto args = _contentStringToActions(content, true);
|
||||
_initialContentArgs = wil::to_vector(args);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -1075,15 +1114,18 @@ namespace winrt::TerminalApp::implementation
|
||||
if (_appArgs->ExitCode() == 0)
|
||||
{
|
||||
auto& parsedArgs = _appArgs->ParsedArgs();
|
||||
auto actions = winrt::single_threaded_vector<ActionAndArgs>(std::move(parsedArgs.GetStartupActions()));
|
||||
auto& actions = parsedArgs.GetStartupActions();
|
||||
|
||||
_root->ProcessStartupActions(actions, false, _appArgs->CurrentDirectory(), _appArgs->CurrentEnvironment());
|
||||
|
||||
if (parsedArgs.IsHandoffListener())
|
||||
if (auto conn = args.Connection())
|
||||
{
|
||||
_root->SetInboundListener(true);
|
||||
_root->CreateTabFromConnection(std::move(conn));
|
||||
}
|
||||
else if (!actions.empty())
|
||||
{
|
||||
_root->ProcessStartupActions(actions, _appArgs->CurrentDirectory(), _appArgs->CurrentEnvironment());
|
||||
}
|
||||
}
|
||||
|
||||
// Return the result of parsing with commandline, though it may or may not be used.
|
||||
return _appArgs->ExitCode();
|
||||
}
|
||||
@@ -1190,7 +1232,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto& args = ActionAndArgs::Deserialize(content);
|
||||
const auto args = ActionAndArgs::Deserialize(content);
|
||||
if (args == nullptr ||
|
||||
args.Size() == 0)
|
||||
{
|
||||
@@ -1234,9 +1276,9 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
const bool replaceFirstWithNewTab = tabIndex >= _root->NumberOfTabs();
|
||||
|
||||
const auto& args = _contentStringToActions(content, replaceFirstWithNewTab);
|
||||
auto args = _contentStringToActions(content, replaceFirstWithNewTab);
|
||||
|
||||
_root->AttachContent(args, tabIndex);
|
||||
_root->AttachContent(std::move(args), tabIndex);
|
||||
}
|
||||
}
|
||||
void TerminalWindow::SendContentToOther(winrt::TerminalApp::RequestReceiveContentArgs args)
|
||||
|
||||
@@ -89,6 +89,7 @@ namespace winrt::TerminalApp::implementation
|
||||
bool Fullscreen() const;
|
||||
void Maximized(bool newMaximized);
|
||||
bool AlwaysOnTop() const;
|
||||
bool ShowTabsFullscreen() const;
|
||||
bool AutoHideWindow();
|
||||
void IdentifyWindow();
|
||||
|
||||
@@ -106,6 +107,7 @@ namespace winrt::TerminalApp::implementation
|
||||
Microsoft::Terminal::Settings::Model::LaunchMode GetLaunchMode();
|
||||
bool GetShowTabsInTitlebar();
|
||||
bool GetInitialAlwaysOnTop();
|
||||
bool GetInitialShowTabsFullscreen();
|
||||
float CalcSnappedDimension(const bool widthOrHeight, const float dimension) const;
|
||||
|
||||
Windows::UI::Xaml::UIElement GetRoot() noexcept;
|
||||
@@ -165,10 +167,9 @@ namespace winrt::TerminalApp::implementation
|
||||
// ALSO: If you add any UIElements as roots here, make sure they're
|
||||
// updated in _ApplyTheme. The root currently is _root.
|
||||
winrt::com_ptr<TerminalPage> _root{ nullptr };
|
||||
winrt::Windows::UI::Xaml::Controls::ContentDialog _dialog{ nullptr };
|
||||
std::shared_mutex _dialogLock;
|
||||
|
||||
wil::com_ptr<CommandlineArgs> _appArgs{ nullptr };
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection _startupConnection{ nullptr };
|
||||
bool _hasCommandLineArguments{ false };
|
||||
bool _gotSettingsStartupActions{ false };
|
||||
std::vector<winrt::Microsoft::Terminal::Settings::Model::ActionAndArgs> _settingsStartupArgs{};
|
||||
@@ -189,7 +190,7 @@ namespace winrt::TerminalApp::implementation
|
||||
const winrt::hstring& contentKey,
|
||||
HRESULT settingsLoadedResult,
|
||||
const winrt::hstring& exceptionText);
|
||||
void _ShowLoadWarningsDialog(const Windows::Foundation::Collections::IVector<Microsoft::Terminal::Settings::Model::SettingsLoadWarnings>& warnings);
|
||||
void _ShowLoadWarningsDialog(const IInspectable& sender, const Windows::Foundation::Collections::IVectorView<Microsoft::Terminal::Settings::Model::SettingsLoadWarnings>& warnings);
|
||||
|
||||
bool _IsKeyboardServiceEnabled();
|
||||
|
||||
@@ -219,7 +220,6 @@ namespace winrt::TerminalApp::implementation
|
||||
FORWARDED_TYPED_EVENT(SetTaskbarProgress, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, SetTaskbarProgress);
|
||||
FORWARDED_TYPED_EVENT(IdentifyWindowsRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, IdentifyWindowsRequested);
|
||||
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);
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace TerminalApp
|
||||
{
|
||||
Boolean Reload { get; };
|
||||
UInt64 Result { get; };
|
||||
IVector<Microsoft.Terminal.Settings.Model.SettingsLoadWarnings> Warnings { get; };
|
||||
IVectorView<Microsoft.Terminal.Settings.Model.SettingsLoadWarnings> Warnings { get; };
|
||||
String ExceptionText { get; };
|
||||
|
||||
Microsoft.Terminal.Settings.Model.CascadiaSettings NewSettings { get; };
|
||||
@@ -69,6 +69,7 @@ namespace TerminalApp
|
||||
void Maximized(Boolean newMaximized);
|
||||
Boolean AlwaysOnTop { get; };
|
||||
Boolean AutoHideWindow { get; };
|
||||
Boolean ShowTabsFullscreen { get; };
|
||||
|
||||
void IdentifyWindow();
|
||||
void SetPersistedLayoutIdx(UInt32 idx);
|
||||
@@ -82,6 +83,7 @@ namespace TerminalApp
|
||||
Microsoft.Terminal.Settings.Model.LaunchMode GetLaunchMode();
|
||||
Boolean GetShowTabsInTitlebar();
|
||||
Boolean GetInitialAlwaysOnTop();
|
||||
Boolean GetInitialShowTabsFullscreen();
|
||||
Single CalcSnappedDimension(Boolean widthOrHeight, Single dimension);
|
||||
void TitlebarClicked();
|
||||
void CloseWindow();
|
||||
@@ -122,7 +124,6 @@ namespace TerminalApp
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> IdentifyWindowsRequested;
|
||||
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;
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
#include "TitlebarControl.g.cpp"
|
||||
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
TitlebarControl::TitlebarControl(uint64_t handle) :
|
||||
@@ -52,6 +54,16 @@ namespace winrt::TerminalApp::implementation
|
||||
return static_cast<float>(minMaxCloseWidth) / 3.0f;
|
||||
}
|
||||
|
||||
bool TitlebarControl::Focused()
|
||||
{
|
||||
return MinMaxCloseControl().Focused();
|
||||
}
|
||||
|
||||
void TitlebarControl::Focused(bool focused)
|
||||
{
|
||||
MinMaxCloseControl().Focused(focused);
|
||||
}
|
||||
|
||||
IInspectable TitlebarControl::Content()
|
||||
{
|
||||
return ContentRoot().Content();
|
||||
@@ -77,6 +89,11 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void TitlebarControl::FullscreenChanged(const bool fullscreen)
|
||||
{
|
||||
MinMaxCloseControl().Visibility(fullscreen ? Visibility::Collapsed : Visibility::Visible);
|
||||
}
|
||||
|
||||
void TitlebarControl::_OnMaximizeOrRestore(byte flag)
|
||||
{
|
||||
POINT point1 = {};
|
||||
|
||||
@@ -17,11 +17,15 @@ namespace winrt::TerminalApp::implementation
|
||||
void ReleaseButtons();
|
||||
float CaptionButtonWidth();
|
||||
|
||||
bool Focused();
|
||||
void Focused(bool focused);
|
||||
|
||||
IInspectable Content();
|
||||
void Content(IInspectable content);
|
||||
|
||||
void SetWindowVisualState(WindowVisualState visualState);
|
||||
void Root_SizeChanged(const IInspectable& sender, const Windows::UI::Xaml::SizeChangedEventArgs& e);
|
||||
void FullscreenChanged(const bool fullscreen);
|
||||
|
||||
void Minimize_Click(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void Maximize_Click(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
|
||||
@@ -22,12 +22,14 @@ namespace TerminalApp
|
||||
{
|
||||
TitlebarControl(UInt64 parentWindowHandle);
|
||||
void SetWindowVisualState(WindowVisualState visualState);
|
||||
void FullscreenChanged(Boolean fullscreen);
|
||||
|
||||
void HoverButton(CaptionButton button);
|
||||
void PressButton(CaptionButton button);
|
||||
void ClickButton(CaptionButton button);
|
||||
void ReleaseButtons();
|
||||
Single CaptionButtonWidth { get; };
|
||||
Boolean Focused { get; set; };
|
||||
|
||||
IInspectable Content;
|
||||
Windows.UI.Xaml.Controls.Border DragBar { get; };
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user