mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-10 08:11:06 +00:00
Compare commits
91 Commits
dev/migrie
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7243ee6157 | ||
|
|
b8b412ceb0 | ||
|
|
a277b56f6a | ||
|
|
2d00432dab | ||
|
|
793e4170a6 | ||
|
|
3bf217419e | ||
|
|
13236a2d91 | ||
|
|
4948f25d40 | ||
|
|
5cc4805439 | ||
|
|
ac9d69790f | ||
|
|
1642360c4c | ||
|
|
1a56bc5101 | ||
|
|
ec6dc8dd67 | ||
|
|
f1b75e5557 | ||
|
|
e110c5b639 | ||
|
|
a47bb0d0dc | ||
|
|
d7d15db93b | ||
|
|
e5239f8931 | ||
|
|
970d2d0514 | ||
|
|
df6c43fc69 | ||
|
|
2844209834 | ||
|
|
f40aa7d957 | ||
|
|
741ea4d96a | ||
|
|
fbfb83bb97 | ||
|
|
2687865790 | ||
|
|
6dcc1762ee | ||
|
|
102f612689 | ||
|
|
199992a867 | ||
|
|
efa02f35e2 | ||
|
|
ddf46f2727 | ||
|
|
0bd085d11b | ||
|
|
78cda41828 | ||
|
|
9165c00d49 | ||
|
|
93b5dff5f8 | ||
|
|
31757a44ee | ||
|
|
a2244246b5 | ||
|
|
988f64ab15 | ||
|
|
b796060c55 | ||
|
|
7506a3ab2d | ||
|
|
997b4acce5 | ||
|
|
287db8a483 | ||
|
|
07f7717112 | ||
|
|
39c71d6421 | ||
|
|
c0e6c259fc | ||
|
|
6d636056a0 | ||
|
|
20a6c7078b | ||
|
|
eec6a882d6 | ||
|
|
bc9e43a19d | ||
|
|
858359e62e | ||
|
|
5fbd5392e7 | ||
|
|
28284e824f | ||
|
|
61e6927f34 | ||
|
|
95693e9079 | ||
|
|
eb40b51b79 | ||
|
|
521d968a75 | ||
|
|
a657cb0192 | ||
|
|
d137d3fb5e | ||
|
|
171524da77 | ||
|
|
ec726e7ba7 | ||
|
|
0d6c4df9fc | ||
|
|
dad68edc03 | ||
|
|
14098d71f2 | ||
|
|
60a4837548 | ||
|
|
d072314d83 | ||
|
|
0d17769b89 | ||
|
|
ce850cae18 | ||
|
|
cd86c0f671 | ||
|
|
4b0ebbc087 | ||
|
|
9edf55de75 | ||
|
|
71cbdc8a1f | ||
|
|
f4e0d9f2bd | ||
|
|
eb5c26cc69 | ||
|
|
223af3a54a | ||
|
|
6e87e0bad0 | ||
|
|
ad2358dc35 | ||
|
|
c9468aa48a | ||
|
|
e3f4ec88ec | ||
|
|
96173b9210 | ||
|
|
af943bdf94 | ||
|
|
79904361b3 | ||
|
|
a7d2885e4b | ||
|
|
b63102fb40 | ||
|
|
bc73b9a35a | ||
|
|
9611433a98 | ||
|
|
6b936d9a74 | ||
|
|
d891e052f1 | ||
|
|
d8379ff1d5 | ||
|
|
57c3953aca | ||
|
|
fa25dfbf7a | ||
|
|
87f5034db1 | ||
|
|
7af134cc7f |
@@ -11,7 +11,7 @@ AlignOperands: true
|
||||
AlignTrailingComments: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
#AllowShortLambdasOnASingleLine: Inline
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29001.49
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.2.32422.2
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Terminal", "Terminal", "{59840756-302F-44DF-AA47-441A9D673202}"
|
||||
EndProject
|
||||
@@ -406,6 +406,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{61901E80
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RendererAtlas", "src\renderer\atlas\atlas.vcxproj", "{8222900C-8B6C-452A-91AC-BE95DB04B95F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InteractivityOneCore", "src\interactivity\onecore\lib\onecore.LIB.vcxproj", "{06EC74CB-9A12-428C-B551-8537EC964726}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RendererWddmCon", "src\renderer\wddmcon\lib\wddmcon.vcxproj", "{75C6F576-18E9-4566-978A-F0A301CAC090}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
AuditMode|Any CPU = AuditMode|Any CPU
|
||||
@@ -3375,6 +3379,76 @@ Global
|
||||
{8222900C-8B6C-452A-91AC-BE95DB04B95F}.Release|x64.Build.0 = Release|x64
|
||||
{8222900C-8B6C-452A-91AC-BE95DB04B95F}.Release|x86.ActiveCfg = Release|Win32
|
||||
{8222900C-8B6C-452A-91AC-BE95DB04B95F}.Release|x86.Build.0 = Release|Win32
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|Any CPU.ActiveCfg = AuditMode|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|ARM.ActiveCfg = AuditMode|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|DotNet_x64Test.ActiveCfg = AuditMode|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|DotNet_x86Test.ActiveCfg = AuditMode|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|x64.ActiveCfg = AuditMode|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|x64.Build.0 = AuditMode|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|x86.ActiveCfg = AuditMode|Win32
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|ARM.ActiveCfg = Debug|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|DotNet_x64Test.ActiveCfg = Debug|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|DotNet_x86Test.ActiveCfg = Debug|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|x64.Build.0 = Debug|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|x86.Build.0 = Debug|Win32
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Fuzzing|Any CPU.ActiveCfg = Fuzzing|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Fuzzing|ARM.ActiveCfg = Fuzzing|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Fuzzing|ARM64.ActiveCfg = Fuzzing|ARM64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Fuzzing|DotNet_x64Test.ActiveCfg = Fuzzing|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Fuzzing|DotNet_x86Test.ActiveCfg = Fuzzing|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Fuzzing|x64.ActiveCfg = Fuzzing|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Fuzzing|x86.ActiveCfg = Fuzzing|Win32
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|ARM.ActiveCfg = Release|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|DotNet_x64Test.ActiveCfg = Release|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|DotNet_x86Test.ActiveCfg = Release|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|x64.ActiveCfg = Release|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|x64.Build.0 = Release|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|x86.ActiveCfg = Release|Win32
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|x86.Build.0 = Release|Win32
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.AuditMode|Any CPU.ActiveCfg = AuditMode|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.AuditMode|ARM.ActiveCfg = AuditMode|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.AuditMode|DotNet_x64Test.ActiveCfg = AuditMode|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.AuditMode|DotNet_x86Test.ActiveCfg = AuditMode|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.AuditMode|x64.ActiveCfg = AuditMode|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.AuditMode|x86.ActiveCfg = AuditMode|Win32
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|ARM.ActiveCfg = Debug|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|DotNet_x64Test.ActiveCfg = Debug|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|DotNet_x86Test.ActiveCfg = Debug|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|x64.Build.0 = Debug|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|x86.Build.0 = Debug|Win32
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|Any CPU.ActiveCfg = Fuzzing|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|ARM.ActiveCfg = Fuzzing|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|ARM64.ActiveCfg = Fuzzing|ARM64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|DotNet_x64Test.ActiveCfg = Fuzzing|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|DotNet_x86Test.ActiveCfg = Fuzzing|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|x64.ActiveCfg = Fuzzing|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|x64.Build.0 = Fuzzing|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|x86.ActiveCfg = Fuzzing|Win32
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|ARM.ActiveCfg = Release|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|DotNet_x64Test.ActiveCfg = Release|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|DotNet_x86Test.ActiveCfg = Release|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|x64.ActiveCfg = Release|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|x64.Build.0 = Release|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|x86.ActiveCfg = Release|Win32
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -3476,6 +3550,8 @@ Global
|
||||
{9CF74355-F018-4C19-81AD-9DC6B7F2C6F5} = {89CDCC5C-9F53-4054-97A4-639D99F169CD}
|
||||
{61901E80-E97D-4D61-A9BB-E8F2FDA8B40C} = {59840756-302F-44DF-AA47-441A9D673202}
|
||||
{8222900C-8B6C-452A-91AC-BE95DB04B95F} = {05500DEF-2294-41E3-AF9A-24E580B82836}
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726} = {E8F24881-5E37-4362-B191-A3BA0ED7F4EB}
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090} = {05500DEF-2294-41E3-AF9A-24E580B82836}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3140B1B7-C8EE-43D1-A772-D82A7061A271}
|
||||
|
||||
51
build/config/ESRPSigning_ConPTY.json
Normal file
51
build/config/ESRPSigning_ConPTY.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"Version": "1.0.0",
|
||||
"UseMinimatch": false,
|
||||
"SignBatches": [
|
||||
{
|
||||
"MatchedPath": [
|
||||
"conpty.dll",
|
||||
"OpenConsole.exe"
|
||||
],
|
||||
"SigningInfo": {
|
||||
"Operations": [
|
||||
{
|
||||
"KeyCode": "CP-230012",
|
||||
"OperationSetCode": "SigntoolSign",
|
||||
"Parameters": [
|
||||
{
|
||||
"parameterName": "OpusName",
|
||||
"parameterValue": "Microsoft"
|
||||
},
|
||||
{
|
||||
"parameterName": "OpusInfo",
|
||||
"parameterValue": "http://www.microsoft.com"
|
||||
},
|
||||
{
|
||||
"parameterName": "FileDigest",
|
||||
"parameterValue": "/fd \"SHA256\""
|
||||
},
|
||||
{
|
||||
"parameterName": "PageHash",
|
||||
"parameterValue": "/NPH"
|
||||
},
|
||||
{
|
||||
"parameterName": "TimeStamp",
|
||||
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
|
||||
}
|
||||
],
|
||||
"ToolName": "sign",
|
||||
"ToolVersion": "1.0"
|
||||
},
|
||||
{
|
||||
"KeyCode": "CP-230012",
|
||||
"OperationSetCode": "SigntoolVerify",
|
||||
"Parameters": [],
|
||||
"ToolName": "sign",
|
||||
"ToolVersion": "1.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -4,5 +4,5 @@
|
||||
<package id="Microsoft.Taef" version="10.60.210621002" targetFramework="native" />
|
||||
<package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
|
||||
<!-- This cannot be included in another project that depends on XAML (as it would be a duplicate package ID) -->
|
||||
<package id="Microsoft.UI.Xaml" version="2.7.0" targetFramework="native" />
|
||||
<package id="Microsoft.UI.Xaml" version="2.7.3" targetFramework="native" />
|
||||
</packages>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Optional, defaults to main. Name of the branch which will be used for calculating branch point. -->
|
||||
<PGOBranch>main</PGOBranch>
|
||||
<PGOBranch>release-1.14</PGOBranch>
|
||||
|
||||
<!-- Mandatory. Name of the NuGet package which will contain PGO databases for consumption by build system. -->
|
||||
<PGOPackageName>Microsoft.Internal.Windows.Terminal.PGODatabase</PGOPackageName>
|
||||
|
||||
@@ -30,6 +30,10 @@ parameters:
|
||||
displayName: "Build Windows Terminal VPack"
|
||||
type: boolean
|
||||
default: false
|
||||
- name: buildConPTY
|
||||
displayName: "Build ConPTY NuGet"
|
||||
type: boolean
|
||||
default: false
|
||||
- name: buildWPF
|
||||
displayName: "Build Terminal WPF Control"
|
||||
type: boolean
|
||||
@@ -60,6 +64,35 @@ parameters:
|
||||
|
||||
variables:
|
||||
TerminalInternalPackageVersion: "0.0.7"
|
||||
# If we are building a branch called "release-*", change the NuGet suffix
|
||||
# to "preview". If we don't do that, XES will set the suffix to "release1"
|
||||
# because it truncates the value after the first period.
|
||||
# We also want to disable the suffix entirely if we're Release branded while
|
||||
# on a release branch.
|
||||
# main is special, however. XES ignores main. Since we never produce actual
|
||||
# shipping builds from main, we want to force it to have a beta label as
|
||||
# well.
|
||||
#
|
||||
# In effect:
|
||||
# BRANCH / BRANDING | Release | Preview
|
||||
# ------------------|----------------------------|-----------------------------
|
||||
# release-* | 1.12.20220427 | 1.13.20220427-preview
|
||||
# main | 1.14.20220427-experimental | 1.14.20220427-experimental
|
||||
# all others | 1.14.20220427-mybranch | 1.14.20220427-mybranch
|
||||
${{ if startsWith(variables['Build.SourceBranchName'], 'release-') }}:
|
||||
${{ if eq(parameters.branding, 'Release') }}:
|
||||
NoNuGetPackBetaVersion: true
|
||||
${{ else }}:
|
||||
NuGetPackBetaVersion: preview
|
||||
${{ elseif eq(variables['Build.SourceBranchName'], 'main') }}:
|
||||
NuGetPackBetaVersion: experimental
|
||||
# The NuGet packages have to use *somebody's* DLLs. We used to force them to
|
||||
# use the Win10 build outputs, but if there isn't a Win10 build we should use
|
||||
# the Win11 one.
|
||||
${{ if containsValue(parameters.buildWindowsVersions, 'Win10') }}:
|
||||
TerminalBestVersionForNuGetPackages: Win10
|
||||
${{ else }}:
|
||||
TerminalBestVersionForNuGetPackages: Win11
|
||||
|
||||
name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr)
|
||||
resources:
|
||||
@@ -193,6 +226,15 @@ jobs:
|
||||
msbuildArgs: /p:WindowsTerminalOfficialBuild=true /p:WindowsTerminalBranding=${{ parameters.branding }};PGOBuildMode=${{ parameters.pgoBuildMode }} /p:WindowsTerminalReleaseBuild=true /t:Terminal\wpf\PublicTerminalCore
|
||||
platform: $(BuildPlatform)
|
||||
configuration: $(BuildConfiguration)
|
||||
- ${{ if eq(parameters.buildConPTY, true) }}:
|
||||
- task: VSBuild@1
|
||||
displayName: Build solution **\OpenConsole.sln for ConPTY
|
||||
inputs:
|
||||
solution: '**\OpenConsole.sln'
|
||||
vsVersion: 16.0
|
||||
msbuildArgs: /p:WindowsTerminalOfficialBuild=true /p:WindowsTerminalBranding=${{ parameters.branding }};PGOBuildMode=${{ parameters.pgoBuildMode }} /p:WindowsTerminalReleaseBuild=true /t:Conhost\Host_EXE;Conhost\winconpty_DLL
|
||||
platform: $(BuildPlatform)
|
||||
configuration: $(BuildConfiguration)
|
||||
- task: PowerShell@2
|
||||
displayName: Source Index PDBs
|
||||
inputs:
|
||||
@@ -237,6 +279,24 @@ jobs:
|
||||
inputs:
|
||||
PathtoPublish: $(Build.ArtifactStagingDirectory)/appx
|
||||
ArtifactName: appx-$(BuildPlatform)-$(BuildConfiguration)-$(TerminalTargetWindowsVersion)
|
||||
- ${{ if eq(parameters.buildConPTY, true) }}:
|
||||
- task: CopyFiles@2
|
||||
displayName: Copy ConPTY to Artifacts
|
||||
inputs:
|
||||
Contents: |-
|
||||
$(Build.SourcesDirectory)/bin/**/conpty.dll
|
||||
$(Build.SourcesDirectory)/bin/**/conpty.lib
|
||||
$(Build.SourcesDirectory)/bin/**/conpty.pdb
|
||||
$(Build.SourcesDirectory)/bin/**/OpenConsole.exe
|
||||
$(Build.SourcesDirectory)/bin/**/OpenConsole.pdb
|
||||
TargetFolder: $(Build.ArtifactStagingDirectory)/conpty
|
||||
OverWrite: true
|
||||
flattenFolders: true
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: Publish Artifact (ConPTY)
|
||||
inputs:
|
||||
PathtoPublish: $(Build.ArtifactStagingDirectory)/conpty
|
||||
ArtifactName: conpty-dll-$(BuildPlatform)-$(BuildConfiguration)-$(TerminalTargetWindowsVersion)
|
||||
- ${{ if eq(parameters.buildWPF, true) }}:
|
||||
- task: CopyFiles@2
|
||||
displayName: Copy PublicTerminalCore.dll to Artifacts
|
||||
@@ -343,6 +403,97 @@ jobs:
|
||||
PathtoPublish: $(System.ArtifactsDirectory)
|
||||
ArtifactName: appxbundle-signed-$(TerminalTargetWindowsVersion)
|
||||
|
||||
- ${{ if eq(parameters.buildConPTY, true) }}:
|
||||
- job: PackageAndSignConPTY
|
||||
strategy:
|
||||
matrix:
|
||||
${{ each config in parameters.buildConfigurations }}:
|
||||
${{ config }}:
|
||||
BuildConfiguration: ${{ config }}
|
||||
displayName: Create NuGet Package (ConPTY)
|
||||
dependsOn: Build
|
||||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
fetchDepth: 1
|
||||
submodules: true
|
||||
persistCredentials: True
|
||||
- task: PkgESSetupBuild@12
|
||||
displayName: Package ES - Setup Build
|
||||
inputs:
|
||||
disableOutputRedirect: true
|
||||
- ${{ each platform in parameters.buildPlatforms }}:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download ${{ platform }} ConPTY binaries
|
||||
inputs:
|
||||
artifactName: conpty-dll-${{ platform }}-$(BuildConfiguration)-$(TerminalBestVersionForNuGetPackages)
|
||||
downloadPath: bin\${{ platform }}\$(BuildConfiguration)\
|
||||
extractTars: false
|
||||
- task: PowerShell@2
|
||||
displayName: Move downloaded artifacts around
|
||||
inputs:
|
||||
targetType: inline
|
||||
# Find all artifact files and move them up a directory. Ugh.
|
||||
script: |-
|
||||
Get-ChildItem bin -Recurse -Directory -Filter conpty-dll-* | % {
|
||||
$_ | Get-ChildItem -Recurse -File | % {
|
||||
Move-Item -Verbose $_.FullName $_.Directory.Parent.FullName
|
||||
}
|
||||
}
|
||||
Move-Item bin\x86 bin\Win32
|
||||
|
||||
- task: EsrpCodeSigning@1
|
||||
displayName: Submit ConPTY libraries and OpenConsole for code signing
|
||||
inputs:
|
||||
ConnectedServiceName: 9d6d2960-0793-4d59-943e-78dcb434840a
|
||||
FolderPath: '$(Build.SourcesDirectory)/bin'
|
||||
signType: batchSigning
|
||||
batchSignPolicyFile: '$(Build.SourcesDirectory)\build\config\ESRPSigning_ConPTY.json'
|
||||
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: Use NuGet 5.10.0
|
||||
inputs:
|
||||
versionSpec: 5.10.0
|
||||
- task: NuGetCommand@2
|
||||
displayName: NuGet pack
|
||||
inputs:
|
||||
command: pack
|
||||
packagesToPack: $(Build.SourcesDirectory)\src\winconpty\package\winconpty.nuspec
|
||||
packDestination: '$(Build.ArtifactStagingDirectory)/nupkg'
|
||||
versioningScheme: byEnvVar
|
||||
versionEnvVar: XES_PACKAGEVERSIONNUMBER
|
||||
- task: EsrpCodeSigning@1
|
||||
displayName: Submit *.nupkg to ESRP for code signing
|
||||
inputs:
|
||||
ConnectedServiceName: 9d6d2960-0793-4d59-943e-78dcb434840a
|
||||
FolderPath: $(Build.ArtifactStagingDirectory)/nupkg
|
||||
Pattern: '*.nupkg'
|
||||
UseMinimatch: true
|
||||
signConfigType: inlineSignParams
|
||||
inlineOperation: >-
|
||||
[
|
||||
{
|
||||
"KeyCode": "CP-401405",
|
||||
"OperationCode": "NuGetSign",
|
||||
"Parameters": {},
|
||||
"ToolName": "sign",
|
||||
"ToolVersion": "1.0"
|
||||
},
|
||||
{
|
||||
"KeyCode": "CP-401405",
|
||||
"OperationCode": "NuGetVerify",
|
||||
"Parameters": {},
|
||||
"ToolName": "sign",
|
||||
"ToolVersion": "1.0"
|
||||
}
|
||||
]
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: Publish Artifact (nupkg)
|
||||
inputs:
|
||||
PathtoPublish: $(Build.ArtifactStagingDirectory)\nupkg
|
||||
ArtifactName: conpty-nupkg-$(BuildConfiguration)
|
||||
|
||||
|
||||
- ${{ if eq(parameters.buildWPF, true) }}:
|
||||
- job: PackageAndSignWPF
|
||||
strategy:
|
||||
@@ -366,7 +517,7 @@ jobs:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download ${{ platform }} PublicTerminalCore
|
||||
inputs:
|
||||
artifactName: wpf-dll-${{ platform }}-$(BuildConfiguration)-Win10
|
||||
artifactName: wpf-dll-${{ platform }}-$(BuildConfiguration)-$(TerminalBestVersionForNuGetPackages)
|
||||
itemPattern: '**/*.dll'
|
||||
downloadPath: bin\${{ platform }}\$(BuildConfiguration)\
|
||||
extractTars: false
|
||||
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
If ($Arch -Eq "x86") { $Arch = "Win32" }
|
||||
|
||||
Write-Host "##vso[task.setvariable variable=RationalizedBuildPlatform]${Arch}"
|
||||
- steps: restore-nuget-steps.yml
|
||||
- template: restore-nuget-steps.yml
|
||||
- task: UniversalPackages@0
|
||||
displayName: Download terminal-internal Universal Package
|
||||
inputs:
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
|
||||
This version should be tracked in all project packages.config files for projects that depend on Xaml.
|
||||
-->
|
||||
<TerminalMUXVersion>2.7.2-prerelease.220406002</TerminalMUXVersion>
|
||||
<TerminalMUXVersion>2.7.3-prerelease.220816001</TerminalMUXVersion>
|
||||
<!--
|
||||
For the Windows 11-specific build, we're targeting the public version of Microsoft.UI.Xaml.
|
||||
This version emits a package dependency instead of embedding the dependency in our own package.
|
||||
|
||||
This version should be tracked in build/packages.config.
|
||||
-->
|
||||
<TerminalMUXVersion Condition="'$(TerminalTargetWindowsVersion)'=='Win11'">2.7.1</TerminalMUXVersion>
|
||||
<TerminalMUXVersion Condition="'$(TerminalTargetWindowsVersion)'=='Win11'">2.7.3</TerminalMUXVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
76
dep/Console/ConIoSrv.h
Normal file
76
dep/Console/ConIoSrv.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT license.
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ntlpcapi.h>
|
||||
|
||||
#define CIS_ALPC_PORT_NAME L""
|
||||
|
||||
#define CIS_EVENT_TYPE_INPUT (0)
|
||||
#define CIS_EVENT_TYPE_FOCUS (1)
|
||||
#define CIS_EVENT_TYPE_FOCUS_ACK (2)
|
||||
|
||||
#define CIS_MSG_TYPE_GETDISPLAYSIZE (3)
|
||||
#define CIS_MSG_TYPE_GETFONTSIZE (4)
|
||||
#define CIS_MSG_TYPE_SETCURSOR (5)
|
||||
#define CIS_MSG_TYPE_UPDATEDISPLAY (6)
|
||||
|
||||
#define CIS_MSG_ATTR_FLAGS (0)
|
||||
|
||||
#define CIS_MSG_ATTR_BUFFER_SIZE (1024)
|
||||
|
||||
#define CIS_DISPLAY_MODE_NONE (0)
|
||||
#define CIS_DISPLAY_MODE_BGFX (1)
|
||||
#define CIS_DISPLAY_MODE_DIRECTX (2)
|
||||
|
||||
typedef struct {
|
||||
PORT_MESSAGE AlpcHeader;
|
||||
UCHAR Type;
|
||||
|
||||
union {
|
||||
struct {
|
||||
CD_IO_DISPLAY_SIZE DisplaySize;
|
||||
|
||||
NTSTATUS ReturnValue;
|
||||
} GetDisplaySizeParams;
|
||||
|
||||
struct {
|
||||
CD_IO_FONT_SIZE FontSize;
|
||||
|
||||
NTSTATUS ReturnValue;
|
||||
} GetFontSizeParams;
|
||||
|
||||
struct {
|
||||
CD_IO_CURSOR_INFORMATION CursorInformation;
|
||||
|
||||
NTSTATUS ReturnValue;
|
||||
} SetCursorParams;
|
||||
|
||||
struct {
|
||||
SHORT RowIndex;
|
||||
|
||||
NTSTATUS ReturnValue;
|
||||
} UpdateDisplayParams;
|
||||
|
||||
struct {
|
||||
USHORT DisplayMode;
|
||||
} GetDisplayModeParams;
|
||||
};
|
||||
} CIS_MSG, *PCIS_MSG;
|
||||
|
||||
typedef struct {
|
||||
UCHAR Type;
|
||||
|
||||
union {
|
||||
struct {
|
||||
INPUT_RECORD Record;
|
||||
} InputEvent;
|
||||
|
||||
struct {
|
||||
BOOLEAN IsActive;
|
||||
} FocusEvent;
|
||||
};
|
||||
} CIS_EVENT, *PCIS_EVENT;
|
||||
@@ -158,8 +158,8 @@ typedef struct _CD_IO_DISPLAY_SIZE {
|
||||
} CD_IO_DISPLAY_SIZE, *PCD_IO_DISPLAY_SIZE;
|
||||
|
||||
typedef struct _CD_IO_CHARACTER {
|
||||
WCHAR Character;
|
||||
USHORT Atribute;
|
||||
WCHAR Character;
|
||||
USHORT Attribute;
|
||||
} CD_IO_CHARACTER, *PCD_IO_CHARACTER;
|
||||
|
||||
typedef struct _CD_IO_ROW_INFORMATION {
|
||||
@@ -175,6 +175,11 @@ typedef struct _CD_IO_CURSOR_INFORMATION {
|
||||
BOOLEAN IsVisible;
|
||||
} CD_IO_CURSOR_INFORMATION, *PCD_IO_CURSOR_INFORMATION;
|
||||
|
||||
typedef struct _CD_IO_FONT_SIZE {
|
||||
ULONG Width;
|
||||
ULONG Height;
|
||||
} CD_IO_FONT_SIZE, *PCD_IO_FONT_SIZE;
|
||||
|
||||
#define IOCTL_CONDRV_READ_IO \
|
||||
CTL_CODE(FILE_DEVICE_CONSOLE, 1, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
||||
|
||||
@@ -213,3 +218,6 @@ typedef struct _CD_IO_CURSOR_INFORMATION {
|
||||
|
||||
#define IOCTL_CONDRV_LAUNCH_SERVER \
|
||||
CTL_CODE(FILE_DEVICE_CONSOLE, 13, METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_CONDRV_GET_FONT_SIZE \
|
||||
CTL_CODE(FILE_DEVICE_CONSOLE, 14, METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
|
||||
24
dep/Console/csrmsg.h
Normal file
24
dep/Console/csrmsg.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT license.
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ntcsrmsg.h>
|
||||
|
||||
typedef enum _USER_API_NUMBER {
|
||||
UserpEndTask,
|
||||
} USER_API_NUMBER, *PUSER_API_NUMBER;
|
||||
|
||||
typedef struct _ENDTASKMSG {
|
||||
HANDLE ProcessId;
|
||||
ULONG ConsoleEventCode;
|
||||
ULONG ConsoleFlags;
|
||||
} ENDTASKMSG, *PENDTASKMSG;
|
||||
|
||||
typedef struct _USER_API_MSG {
|
||||
union {
|
||||
ENDTASKMSG EndTask;
|
||||
} u;
|
||||
} USER_API_MSG, *PUSER_API_MSG;
|
||||
15
dep/Console/ntcsrdll.h
Normal file
15
dep/Console/ntcsrdll.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT license.
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ntcsrmsg.h>
|
||||
|
||||
NTSTATUS CsrClientCallServer(
|
||||
PCSR_API_MSG m,
|
||||
PCSR_CAPTURE_HEADER CaptureBuffer OPTIONAL,
|
||||
ULONG ApiNumber,
|
||||
ULONG ArgLength
|
||||
);
|
||||
16
dep/Console/ntcsrmsg.h
Normal file
16
dep/Console/ntcsrmsg.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT license.
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ntlpcapi.h>
|
||||
|
||||
typedef struct _CSR_CAPTURE_HEADER {
|
||||
} CSR_CAPTURE_HEADER, *PCSR_CAPTURE_HEADER;
|
||||
|
||||
typedef struct _CSR_API_MSG {
|
||||
} CSR_API_MSG, *PCSR_API_MSG;
|
||||
|
||||
#define CSR_MAKE_API_NUMBER(DllIndex, ApiIndex) 0
|
||||
126
dep/Console/ntlpcapi.h
Normal file
126
dep/Console/ntlpcapi.h
Normal file
@@ -0,0 +1,126 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT license.
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define OB_FILE_OBJECT_TYPE 1
|
||||
|
||||
typedef struct _PORT_MESSAGE {
|
||||
union {
|
||||
struct {
|
||||
SHORT DataLength;
|
||||
SHORT TotalLength;
|
||||
} s1;
|
||||
} u1;
|
||||
union {
|
||||
ULONG ZeroInit;
|
||||
} u2;
|
||||
union {
|
||||
CLIENT_ID ClientId;
|
||||
};
|
||||
ULONG MessageId;
|
||||
} PORT_MESSAGE, *PPORT_MESSAGE;
|
||||
|
||||
#define ALPC_MSGFLG_SYNC_REQUEST 0
|
||||
#define ALPC_PORFLG_ACCEPT_DUP_HANDLES 1
|
||||
#define ALPC_PORFLG_ACCEPT_INDIRECT_HANDLES 2
|
||||
|
||||
typedef struct _ALPC_DATA_VIEW_ATTR {
|
||||
PVOID ViewBase;
|
||||
SIZE_T ViewSize;
|
||||
} ALPC_DATA_VIEW_ATTR, *PALPC_DATA_VIEW_ATTR;
|
||||
|
||||
typedef struct _ALPC_CONTEXT_ATTR {
|
||||
} ALPC_CONTEXT_ATTR, *PALPC_CONTEXT_ATTR;
|
||||
|
||||
#define ALPC_INDIRECT_HANDLE_MAX 512
|
||||
|
||||
typedef struct _ALPC_HANDLE_ATTR {
|
||||
union {
|
||||
ULONG HandleCount;
|
||||
};
|
||||
} ALPC_HANDLE_ATTR, *PALPC_HANDLE_ATTR;
|
||||
|
||||
#define ALPC_FLG_MSG_DATAVIEW_ATTR 1
|
||||
#define ALPC_FLG_MSG_HANDLE_ATTR 2
|
||||
|
||||
typedef struct _ALPC_MESSAGE_ATTRIBUTES {
|
||||
} ALPC_MESSAGE_ATTRIBUTES, *PALPC_MESSAGE_ATTRIBUTES;
|
||||
|
||||
typedef struct _ALPC_PORT_ATTRIBUTES {
|
||||
ULONG Flags;
|
||||
SECURITY_QUALITY_OF_SERVICE SecurityQos;
|
||||
SIZE_T MaxMessageLength;
|
||||
SIZE_T MemoryBandwidth;
|
||||
SIZE_T MaxPoolUsage;
|
||||
SIZE_T MaxSectionSize;
|
||||
SIZE_T MaxViewSize;
|
||||
SIZE_T MaxTotalSectionSize;
|
||||
ULONG DupObjectTypes;
|
||||
#ifdef _WIN64
|
||||
ULONG Reserved;
|
||||
#endif
|
||||
} ALPC_PORT_ATTRIBUTES, *PALPC_PORT_ATTRIBUTES;
|
||||
|
||||
typedef enum _ALPC_MESSAGE_INFORMATION_CLASS {
|
||||
AlpcMessageHandleInformation
|
||||
} ALPC_MESSAGE_INFORMATION_CLASS;
|
||||
|
||||
typedef struct _ALPC_MESSAGE_HANDLE_INFORMATION {
|
||||
ULONG Index;
|
||||
ULONG Handle;
|
||||
} ALPC_MESSAGE_HANDLE_INFORMATION, *PALPC_MESSAGE_HANDLE_INFORMATION;
|
||||
|
||||
NTSTATUS AlpcInitializeMessageAttribute(
|
||||
ULONG AttributeFlags,
|
||||
PALPC_MESSAGE_ATTRIBUTES Buffer,
|
||||
SIZE_T BufferSize,
|
||||
PSIZE_T RequiredBufferSize
|
||||
);
|
||||
|
||||
PVOID AlpcGetMessageAttribute(
|
||||
PALPC_MESSAGE_ATTRIBUTES Buffer,
|
||||
ULONG AttributeFlag
|
||||
);
|
||||
|
||||
#define ALPC_GET_DATAVIEW_ATTRIBUTES(MsgAttr) \
|
||||
((PALPC_DATA_VIEW_ATTR)AlpcGetMessageAttribute(MsgAttr, ALPC_FLG_MSG_DATAVIEW_ATTR))
|
||||
|
||||
#define ALPC_GET_HANDLE_ATTRIBUTES(MsgAttr) \
|
||||
((PALPC_HANDLE_ATTR)AlpcGetMessageAttribute(MsgAttr, ALPC_FLG_MSG_HANDLE_ATTR))
|
||||
|
||||
NTSTATUS NtAlpcConnectPort(
|
||||
PHANDLE PortHandle,
|
||||
PUNICODE_STRING PortName,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
PALPC_PORT_ATTRIBUTES PortAttributes,
|
||||
ULONG Flags,
|
||||
PSID RequiredServerSid,
|
||||
PPORT_MESSAGE ConnectionMessage,
|
||||
PSIZE_T BufferLength,
|
||||
PALPC_MESSAGE_ATTRIBUTES OutMessageAttributes,
|
||||
PALPC_MESSAGE_ATTRIBUTES InMessageAttributes,
|
||||
PLARGE_INTEGER Timeout
|
||||
);
|
||||
|
||||
NTSTATUS NtAlpcSendWaitReceivePort(
|
||||
HANDLE PortHandle,
|
||||
ULONG Flags,
|
||||
PPORT_MESSAGE SendMessage,
|
||||
PALPC_MESSAGE_ATTRIBUTES SendMessageAttributes,
|
||||
PPORT_MESSAGE ReceiveMessage,
|
||||
PSIZE_T BufferLength,
|
||||
PALPC_MESSAGE_ATTRIBUTES ReceiveMessageAttributes,
|
||||
PLARGE_INTEGER Timeout
|
||||
);
|
||||
|
||||
NTSTATUS NtAlpcQueryInformationMessage(
|
||||
HANDLE PortHandle,
|
||||
PPORT_MESSAGE PortMessage,
|
||||
ALPC_MESSAGE_INFORMATION_CLASS MessageInformationClass,
|
||||
PVOID MessageInformation,
|
||||
ULONG Length,
|
||||
PULONG ReturnLength
|
||||
);
|
||||
@@ -10,13 +10,13 @@
|
||||
<package id="Microsoft.VCRTForwarders.140" version="1.0.4" targetFramework="native" />
|
||||
<package id="Microsoft.Internal.Windows.Terminal.ThemeHelpers" version="0.6.220404001" targetFramework="native" />
|
||||
<package id="Microsoft.VisualStudio.Setup.Configuration.Native" version="2.3.2262" targetFramework="native" developmentDependency="true" />
|
||||
<package id="Microsoft.UI.Xaml" version="2.7.2-prerelease.220406002" targetFramework="native" />
|
||||
<package id="Microsoft.UI.Xaml" version="2.7.3-prerelease.220816001" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.220201.1" targetFramework="native" developmentDependency="true" />
|
||||
|
||||
<!-- Managed packages -->
|
||||
<package id="Appium.WebDriver" version="3.0.0.2" targetFramework="net45" />
|
||||
<package id="Castle.Core" version="4.1.1" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
|
||||
<package id="Selenium.Support" version="3.5.0" targetFramework="net45" />
|
||||
<package id="Selenium.WebDriver" version="3.5.0" targetFramework="net45" />
|
||||
</packages>
|
||||
|
||||
@@ -54,6 +54,24 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"BellSound": {
|
||||
"default": "",
|
||||
"description": "Sets the file location of the sound played when the application emits a BEL character. If the path is invalid no sound will be played. This property also accepts an array of sounds and the terminal will pick one at random.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"AppearanceConfig": {
|
||||
"properties": {
|
||||
"colorScheme": {
|
||||
@@ -332,6 +350,7 @@
|
||||
"tabSearch",
|
||||
"toggleAlwaysOnTop",
|
||||
"toggleFocusMode",
|
||||
"selectAll",
|
||||
"setFocusMode",
|
||||
"toggleFullscreen",
|
||||
"setFullScreen",
|
||||
@@ -1689,6 +1708,11 @@
|
||||
"description": "Force the terminal to use the legacy input encoding. Certain keys in some applications may stop working when enabling this setting.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"experimental.useBackgroundImageForWindow": {
|
||||
"default": false,
|
||||
"description": "When set to true, the background image for the currently focused profile is expanded to encompass the entire window, beneath other panes.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"initialCols": {
|
||||
"default": 120,
|
||||
"description": "The number of columns displayed in the window upon first load. If \"launchMode\" is set to \"maximized\" (or \"maximizedFocus\"), this property is ignored.",
|
||||
@@ -1986,6 +2010,10 @@
|
||||
"description": "Controls what happens when the application emits a BEL character. When set to \"all\", the Terminal will play a sound, flash the taskbar icon (if the terminal window is not in focus) and flash the window. An array of specific behaviors can also be used. Supported array values include `audible`, `window` and `taskbar`. When set to \"none\", nothing will happen.",
|
||||
"$ref": "#/$defs/BellStyle"
|
||||
},
|
||||
"bellSound": {
|
||||
"description": "Sets the sound played when the application emits a BEL. When set to an array, the terminal will pick one of those sounds at random.",
|
||||
"$ref": "#/$defs/BellSound"
|
||||
},
|
||||
"closeOnExit": {
|
||||
"default": "graceful",
|
||||
"description": "Sets how the profile reacts to termination or failure to launch. Possible values:\n -\"graceful\" (close when exit is typed or the process exits normally)\n -\"always\" (always close)\n -\"never\" (never close).\ntrue and false are accepted as synonyms for \"graceful\" and \"never\" respectively.",
|
||||
@@ -2383,4 +2411,4 @@
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,370 @@
|
||||
---
|
||||
author: Michael Niksa @miniksa
|
||||
created on: 2022-02-24
|
||||
last updated: 2022-02-24
|
||||
issue id: 12570
|
||||
---
|
||||
|
||||
# Show Hide operations on GetConsoleWindow via PTY
|
||||
|
||||
## Abstract
|
||||
|
||||
To maintain compatibility with command-line tools, utilities, and tests that desire to
|
||||
manipulate the final presentation window of their output through retrieving the raw
|
||||
console window handle and performing `user32` operations against it like [ShowWindow](https://docs.microsoft.com//windows/win32/api/winuser/nf-winuser-showwindow),
|
||||
we will create a compatibility layer that captures this intent and translates it into
|
||||
the nearest equivalent in the cross-platform virtual terminal language and implement the
|
||||
understanding of these sequences in our own Windows Terminal.
|
||||
|
||||
## Inspiration
|
||||
|
||||
When attempting to enable the Windows Terminal as the default terminal application on Windows
|
||||
(to supersede the execution of command-line utilities inside the classic console host window),
|
||||
we discovered that there were a bunch of automated tests, tools, and utilities that relied on
|
||||
showing and hiding the console window using the `::GetConsoleWindow()` API in conjunction with
|
||||
`::ShowWindow()`.
|
||||
|
||||
When we initially invented the ConPTY, we worked to ensure that we built to the common
|
||||
denominator that would work cross-platform in all scenarios, avoiding situations that were
|
||||
dependent on Windows-isms like `user32k` including the full knowledge of how windowing occurs
|
||||
specific to the Windows platform.
|
||||
|
||||
We also understood that on Windows, the [**CreateProcess**](https://docs.microsoft.com/windows/win32/procthread/process-creation-flags) API provides ample flags specifically
|
||||
for command-line applications to command the need for (or lack thereof) a window on startup
|
||||
such as `CREATE_NEW_CONSOLE`, `CREATE_NO_WINDOW`, and `DETACHED_PROCESS`. The understanding
|
||||
was that people who didn't need or want a window, or otherwise needed to manipulate the
|
||||
console session, would use those flags on process creation to dictate the session. Additionally,
|
||||
the `::CreateProcess` call will accept information in `STARTUPINFO` or `STARTUPINFOEX` that
|
||||
can dictate the placement, size, and visibility of a window... including some fields specific
|
||||
to console sessions. We had accepted those as ways applications would specify their intent.
|
||||
|
||||
Those assumptions have proven incorrect. Because it was too easy to just `::CreateProcess` in
|
||||
the default manner and then get access to the session after-the-fact and manipulate it with
|
||||
APIs like `::GetConsoleWindow()`, tooling and tests organically grew to make use of this process.
|
||||
Instead of requesting up front that they didn't need a window or the overhead of a console session,
|
||||
they would create one anyway by default and then manipulate it afterward to hide it, move it off-
|
||||
screen, or otherwise push it around. Overall, this is terrible for their performance and overall
|
||||
reliability because they've obscured their intent by not asking for it upfront and impacted their
|
||||
performance by having the entire subsystem spin up interactive work when they intend to not use it.
|
||||
But Windows is the place for compatibility, so we must react and compensate for the existing
|
||||
non-ideal situation.
|
||||
|
||||
We will implement a mechanism to compensate for these that attempts to capture the intent of the
|
||||
requests from the calling applications against the ConPTY and translates them into the "universal"
|
||||
Virtual Terminal language to the best of its ability to make the same effects as prior to the
|
||||
change to the new PTY + Terminal platform.
|
||||
|
||||
## Solution Design
|
||||
|
||||
Overall, there are three processes involved in this situation:
|
||||
|
||||
1. The client command-line application utility, tool, or test that will manipulate the window.
|
||||
1. The console host (`conhost.exe` or `openconsole.exe`) operating in PTY mode.
|
||||
1. The terminal (`windowsterminal.exe` when it's Windows Terminal, but could be a third party).
|
||||
|
||||
The following diagram shows the components and how they will interact.
|
||||
|
||||
```txt
|
||||
┌─────────────────┐ ┌──────────────────┐ ┌──────────────────────┐
|
||||
│ │ 1 │ │ │ │
|
||||
│ Command-Line ├─────────────────► │ Console Host │ │ Windows Terminal │
|
||||
│ Tool or │ │ as ConPTY │ │ Backend │
|
||||
│ Utility │ 2 │ │ 6 │ │
|
||||
│ │ ◄─────────────────┤ ├─────────────────► │ │
|
||||
│ │ │ │ │ │
|
||||
│ │ │ │ │ │
|
||||
│ │ │ │ 9 │ │
|
||||
│ │ │ │ ◄─────────────────┤ │
|
||||
│ │ │ │ │ │
|
||||
└─────┬───────────┘ └───────────┬──────┘ └─────────────────┬────┘
|
||||
│ ▲ │ ▲ │
|
||||
│ │ │ │ │
|
||||
│ │ │10 │ │7
|
||||
│3 5│ │ │8 │
|
||||
│ │ ▼ │ ▼
|
||||
│ ┌───┴────┐ ┌──┴────┬───────┬─────────────────────────┐
|
||||
▼ │ Hidden │ │ │ │ v^x│
|
||||
┌─────────────────┐ │ Fake │ ├───────┴───────┴─────────────────────────┤
|
||||
│ │ 4 │ PTY │ │ │
|
||||
│ ├──────────────────────► │ Window │ │ │
|
||||
│ user32.dll │ └────────┘ │ Windows Terminal │
|
||||
│ Window APIs │ │ Displayed Window │
|
||||
│ │ │ │
|
||||
│ │ │ │
|
||||
└─────────────────┘ │ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
└─────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
1. The command-line tool calls `::GetConsoleWindow()` on the PTY host
|
||||
2. The PTY host returns the raw `HWND` to the *Hidden Fake PTY Window* in its control
|
||||
3. The command-line tool calls `::ShowWindow()` on the `user32.dll` API surface to manipulate that window.
|
||||
4. `user32.dll` sends a message to the window message queue on the *Fake PTY Window*
|
||||
5. The PTY host retrieves the message from the queue and translates it to a virtual terminal message
|
||||
6. The Windows Terminal connection layer receives the virtual terminal message and decodes it into a window operation.
|
||||
7. The true displayed *Windows Terminal Window* is told to change its status to show or hide.
|
||||
8. The changed Show/Hide status is returned to the back-end on completion.
|
||||
9. The Windows Terminal connection layer returns that information to the PTY host so it can remain in-the-know.
|
||||
10. The PTY updates its *Fake PTY Window* status to match the real one so it continues to receive appropriate messages from `user32`.
|
||||
|
||||
This can be conceptually understood in a few phases:
|
||||
|
||||
- The client application grabs a handle and attempts to send a command via a back-channel through user32.
|
||||
- User32 decides what message to send based on the window state of the handle.
|
||||
- The message is translated by the PTY and propagated to the true visible window.
|
||||
- The visible window state is returned back to the hidden/fake window to remain in synchronization so the next call to user32 can make the correct decision.
|
||||
|
||||
The communication between the PTY and the hosting terminal application occurs with a virtual terminal sequence.
|
||||
Fortunately, *xterm* had already invented and implemented one for this behavior called **XTWINOPS** which means
|
||||
we should be able to utilize that one and not worry about inventing our own Microsoft-specific thing. This ensures
|
||||
that there is some precedence for what we're doing, guarantees a major third party terminal can support the same
|
||||
sequence, and induces a high probability of other terminals already using it given *xterm* is the defacto standard
|
||||
for terminal emulation.
|
||||
|
||||
Information about **XTWINOPS** can be found at [Xterm control sequences](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html). Search for *XTWINOPS*.
|
||||
The sequence is **CSI** *Ps*; *Ps*; *Ps* **t**. It starts with the common "control sequence initiator" of `ESC [` (`0x1B 0x5B`).
|
||||
Then between 1 and 3 numerical parameters are given, separated by semicolons (`0x3B`).
|
||||
And finally, the sequence is terminated with `t` (`0x74`).
|
||||
|
||||
Specifically, the two parameter commands of `1` for *De-iconify window* and `2` for *Iconify window* appear relevant to our interests.
|
||||
In `user32` parlance, "iconify" traditionally corresponds to minimize/restore state and is a good proxy for overall visibility of the window.
|
||||
|
||||
The theory then is to detect when the assorted calls to `::ShowWindow()` against the *Fake PTY Window* are asking for a command that
|
||||
maps to either "iconify" or "deiconify" and translate them into the corresponding message over the VT channel to the attached terminal.
|
||||
|
||||
To detect this, we need to use some heuristics inside the [window procedure](https://docs.microsoft.com/windows/win32/winmsg/window-procedures) for the window owned by the PTY.
|
||||
Unfortunately, calls to `::ShowWindow()` on research with the team that owns `user32` do not go straight into the window message queue. Instead, they're dispatched straight into `win32k` to be analyzed and then trigger an array of follow on window messages into the queue depending on the `HWND`'s current state. Most specifically, they vary based on the `WS_VISIBLE` state of the `HWND`. (See [Window Styles](https://docs.microsoft.com/windows/win32/winmsg/window-styles) for details on the `WS_VISIBLE` flag.)
|
||||
|
||||
I evaluated a handful of messages with the help of the IXP Essentials team to see which ones would telegraph the changes from `::ShowWindow()` into our window procedure:
|
||||
|
||||
- [WM_QUERYOPEN](https://docs.microsoft.com/windows/win32/winmsg/wm-queryopen) - This one allows us to accept/reject a minimize/restore call. Not really useful for finding out current state
|
||||
- [WM_SYSCOMMAND](https://docs.microsoft.com/windows/win32/menurc/wm-syscommand) - This one is what is called when the minimize, maximize/restore, and exit buttons are called in the window toolbar. But apparently it is not generated for these requests coming from outside the window itself through the `user32` APIs.
|
||||
- [WM_SHOWWINDOW](https://docs.microsoft.com/windows/win32/winmsg/wm-showwindow) - This one provides some insight in certain transitions, specifically around force hiding and showing. When the `lParam` is `0`, we're supposed to know that someone explicitly called `::ShowWindow()` to show or hide with the `wParam` being a `BOOL` where `TRUE` is "show" and `FALSE` is "hide". We can translate that into *de-iconify* and *iconify* respectively.
|
||||
- [WM_WINDOWPOSCHANGING](https://docs.microsoft.com/windows/win32/winmsg/wm-windowposchanging) - This one I evaluated extensively as it looked to provide us insight into how the window was about to change before it did so and offered us the opportunity to veto some of those changes (for instance, if we wanted to remain invisible while propagating a "show" message). I'll detail more about this one in a sub-heading below.
|
||||
- [WM_SIZE](https://docs.microsoft.com/windows/win32/winmsg/wm-size) - This one has a `wParam` that specifically sends `SIZE_MINIMIZED` (`1`) and `SIZE_RESTORED` (`0`) that should translate into *iconify* and *de-iconify respectively.
|
||||
|
||||
#### WM_WINDOWPOSCHANGING data
|
||||
|
||||
In investigating `WM_WINDOWPOSCHANGING`, I built a table of some of the states I observed while receiving messages from an external caller that was using `::ShowWindow()`:
|
||||
|
||||
|integer|constant|flags|Should Hide?|minimizing|maximizing|showing|hiding|activating|`0x8000`|`SWP_NOCOPYBITS`|`SWP_SHOWWINDOW`|`SWP_FRAMECHANGED`|`SWP_NOACTIVATE`|`SWP_NOZORDER`|`SWP_NOMOVE`|`SWP_NOSIZE`|
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
|0|`SW_HIDE`|?|YES|?|?|?|?|?|?|?|?|?|?|?|?|?|
|
||||
|1|`SW_NORMAL`|`0x43`|NO|F|F|T|F|T|||X||||X|X|
|
||||
|2|`SW_SHOWMINIMIZED`|`0x8160`|YES|T|F|T|F|T|X|X|X|X|||||
|
||||
|3|`SW_SHOWMAXIMIZED`|`0x8160`|NO|F|T|T|F|T|X|X|X|X|||||
|
||||
|4|`SW_SHOWNOACTIVATE`|`0x8070`|NO|F|F|T|F|F|X||X|X|X||||
|
||||
|5|`SW_SHOW`|`0x43`|NO|F|F|T|F|T|||X||||X|X|
|
||||
|6|`SW_MINIMIZE`|`0x8170`|YES|T|F|T|F|F|X|X|X|X|X||||
|
||||
|7|`SW_SHOWMINNOACTIVE`|`0x57`|YES|T|F|T|F|F|||X||X|X|X|X|
|
||||
|8|`SW_SHOWNA`|`0x53`|NO|F|F|T|F|F|||X||X||X|X|
|
||||
|9|`SW_RESTORE`|`0x8160`|NO|F|F|T|F|T|||X|X|||||
|
||||
|10|`SW_SHOWDEFAULT`|`0x43`|NO|F|F|T|F|T|||X||||X|X|
|
||||
|11|`SW_FORCEMINIMIZE`|?|YES|?|?|?|?|?|?|?|?|?|?|?|?|?|
|
||||
|
||||
The headings are as follows:
|
||||
|
||||
- integer - The value of the Show Window constant `SW_*` (see [ShowWindow](https://docs.microsoft.com/windows/win32/api/winuser/nf-winuser-showwindow))
|
||||
- constant - The name of the Show Window constant
|
||||
- flags - The `lParam` field is a pointer to a [**WINDOWPOS**](https://docs.microsoft.com/windows/win32/api/winuser/ns-winuser-windowpos) structure during this message. This the `UINT flags` field of that structure.
|
||||
- Should Hide? - Whether or not I believe that the window should hide if this constant is seen. (Conversely, should show on the opposite.)
|
||||
- minimizing - This is the `BOOL` response from a call to [**IsIconic()**](https://docs.microsoft.com/windows/win32/api/winuser/nf-winuser-isiconic) during this message.
|
||||
- maximizing - This is the `BOOL` response from a call to [**IsZoomed()**](https://docs.microsoft.com/windows/win32/api/winuser/nf-winuser-iszoomed) during this message.
|
||||
- showing - This is whether `SWP_SHOWWINDOW` is set on the `WINDOWPOS.flags` field during this message.
|
||||
- hiding - This is whether `SWP_HIDEWINDOW` is set on the `WINDOWPOS.flags` field during this message.
|
||||
- activating - This is the inverse of whether `SWP_NOACTIVATE` is set on the `WINDOWPOS.flags` field during this message.
|
||||
- Remaining headings are `flags` values expanded to `X` is set and blank is unset. See [**SetWindowPos()**](https://docs.microsoft.com/windows/win32/api/winuser/nf-winuser-setwindowpos) for the definitions of all the flags.
|
||||
|
||||
From this data collection, I noticed a few things:
|
||||
|
||||
- The data in this table was unstable. The fields varied depending on the order in which I called the various constants against `ShowWindow()`. This is just one particular capture.
|
||||
- Some of the states, I wouldn't see any message data at all (`SW_HIDE` and `SW_FORCEMINIMIZE`).
|
||||
- There didn't seem to be a definitive way to use this data to reliably decide when to show or hide the window. I didn't have a reliable way of pulling this together with my *Should Hide?* column.
|
||||
|
||||
On further investigation, it became apparent that the values received were sometimes not coming through or varying because the `WS_VISIBLE` state of the `HWND` affected how `win32k` decided to dispatch messages and what values they contained. This is where I determined that steps #8-10 in the diagram above were going to be necessary: to report the state of the real window back to the *fake window* so it could report status to `user32` and `win32k` and receive state-appropriate messages.
|
||||
|
||||
For reporting back #8-10, I initially was going to use the `XTWINOPS` call with parameter `11`. The PTY could ask the attached terminal for its state and expect to hear back an answer of either `1` or `2` in the same format message depending on the state. However, on further consideration, I realized that the real window could change at a moments notice without prompting from the PTY, so I instead wrote the PTY to always listen for this and had the Windows Terminal send this back down unprompted.
|
||||
|
||||
#### Refined WM_SHOWWINDOW and WM_SIZE data
|
||||
|
||||
Upon setting up the synchronization for #8-10, I then tried again to build the table using just the two window messages that were giving me reliable data: `WM_SHOWWINDOW` and `WM_SIZE`:
|
||||
|
||||
|integer|constant|Should Hide?|`WM_SHOWWINDOW` OR `WM_SIZE` reported hide?|
|
||||
|---|---|---|---|
|
||||
|0|`SW_HIDE`|YES|YES|
|
||||
|1|`SW_NORMAL`|NO|NO|
|
||||
|2|`SW_SHOWMINIMIZED`|YES|YES|
|
||||
|3|`SW_SHOWMAXIMIZED`|NO|NO|
|
||||
|4|`SW_SHOWNOACTIVATE`|NO|NO|
|
||||
|5|`SW_SHOW`|NO|NO|
|
||||
|6|`SW_MINIMIZE`|YES|YES|
|
||||
|7|`SW_SHOWMINNOACTIVE`|YES|YES|
|
||||
|8|`SW_SHOWNA`|NO|NO|
|
||||
|9|`SW_RESTORE`|NO|NO|
|
||||
|10|`SW_SHOWDEFAULT`|NO|NO|
|
||||
|11|`SW_FORCEMINIMIZE`|YES|YES|
|
||||
|
||||
Since this now matched up perfectly with what I was suspecting should happen *and* it was easier to implement than picking apart the `WM_WINDOWPOSCHANGING` message, it is what I believe the design should be.
|
||||
|
||||
Finally, with the *fake window* changing state to and from `WS_VISIBLE`... it was appearing on the screen and showing up in the taskbar and alt-tab. To resolve this, I utilized [**DWMWA_CLOAK**](https://docs.microsoft.com//windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute) which makes the window completely invisible even when in a normally `WS_VISIBLE` state. I then added the [**WS_EX_TOOLWINDOW**](https://docs.microsoft.com/windows/win32/winmsg/extended-window-styles) extended window style to hide it from alt-tab and taskbar.
|
||||
|
||||
With this setup, the PTY now has a completely invisible window with a synchronized `WS_VISIBLE` state with the real terminal window, a bidirectional signal channel to adjust the state between the terminal and PTY, and the ability to catch `user32` calls being made against the *fake window* that the PTY stands up for the client command-line application.
|
||||
|
||||
## UI/UX Design
|
||||
|
||||
The visible change in behavior is that a call to `::ShowWindow()` against the `::GetConsoleWindow()`
|
||||
handle that is returned by the ConPTY will be propagated to the attached Terminal. As such, a
|
||||
user will see the entire window be shown or hidden if one of the underlying attached
|
||||
command-line applications requests a show or hide.
|
||||
|
||||
At the initial moment, the fact that the Terminal contains tabbed and/or paned sessions and
|
||||
therefore multiple command-line clients on "different sessions" are attached to the same window
|
||||
is partially ignored. If one attached client calls "show", the entire window will be shown with
|
||||
all tabs. If another calls "hide", the entire window will be hidden including the other tab
|
||||
that just requested a show. In the opposite direction, when the window is shown, all attached
|
||||
PTYs for all tabs/panes will be alerted that they're now shown at once.
|
||||
|
||||
## Capabilities
|
||||
|
||||
### Accessibility
|
||||
|
||||
Users of assistive devices will have the same experience that they did with the legacy Windows
|
||||
Console after this change. If a command-line application decides to show or hide the window
|
||||
through the API without their consent, they will receive notification of the showing/hiding
|
||||
window through our UIA framework.
|
||||
|
||||
Prior to this change, the window would have always remained visible and there would be no
|
||||
action.
|
||||
|
||||
Overall, the experience will be consistent between what is happening on-screen and what is
|
||||
presented through the UIA framework to assistive tools.
|
||||
|
||||
For third party terminals, it will be up to them to decide what their reaction and experience is.
|
||||
|
||||
### Security
|
||||
|
||||
We will maintain the security and integrity of the Terminal application chosen for presentation
|
||||
by not revealing its true window handle information to the client process through the existing
|
||||
`::GetConsoleWindow()` API. Through our design for default terminal applications, the final
|
||||
presentation terminal could be Windows Terminal or it could be any third-party terminal that
|
||||
meets the same specifications for communication. Giving raw access to its `HWND` to a client
|
||||
application could disrupt its security.
|
||||
|
||||
By maintaining a level of separation with this feature by generating a "fake window" in the
|
||||
ConPTY layer and only forwarding events, the attached terminal (whether ours or a 3rd party)
|
||||
maintains the final level of control on whether or not it processes the message. This is
|
||||
improved security over the legacy console host where the tool had full backdoor style access
|
||||
to all `user32` based window APIs.
|
||||
|
||||
### Reliability
|
||||
|
||||
This test doesn't improve overall reliability in the system because utilities that are relying
|
||||
on the behavior that this compatibility shim will restore are already introducing additional
|
||||
layers of complexity and additional processes into their operation than were strictly necessary
|
||||
simply by not stating their desires upfront at creation time.
|
||||
|
||||
In some capacity, you could argue it increases reliability of the existing tests that were
|
||||
using this complex behavior in that they didn't work before and they will work now, but
|
||||
the entire process is fragile. We're just restoring the fragile process instead of having
|
||||
it not work at all.
|
||||
|
||||
### Compatibility
|
||||
|
||||
This change restores compatibility with existing applications that were relying on the behavior
|
||||
we had excluded from our initial designs.
|
||||
|
||||
### Performance, Power, and Efficiency
|
||||
|
||||
The performance of tooling that is leveraging this process to create a console and then hide
|
||||
or manipulate the session after the fact will be significantly worse when we enable the
|
||||
default Windows Terminal than it was with the old Windows Console. This is because the
|
||||
Terminal is significantly heavier weight (with its modern technologies like WinUI) and
|
||||
will take more time to start and more committed memory. Additionally, more processes
|
||||
will be in use because there will be the `conhost.exe` doing the ConPTY translation
|
||||
and then the `windowsterminal.exe` doing the presentation.
|
||||
|
||||
However, this particular feature doesn't do anything to make that better or worse.
|
||||
|
||||
The appropriate solution for any tooling, test, or scenario that has a need for
|
||||
performance and efficiency is to use the flags to `::CreateProcess` in the first place
|
||||
to specify that they did not need a console window session at all, or to direct its
|
||||
placement and visibility as a part of the creation call. We are working with
|
||||
Microsoft's test automation tooling (TAEF) as well as the Windows performance
|
||||
fundamentals (FUN) team to ensure that the test automation supports creating sessions
|
||||
without a console window and that our internal performance test suite uses those
|
||||
specifications on creation so we have accurate performance testing of the operating
|
||||
system.
|
||||
|
||||
## Potential Issues
|
||||
|
||||
### Multiple clients sharing the same window host
|
||||
|
||||
With the initial design, multiple clients sharing the same window host will effectively
|
||||
share the window state. Two different tabs or panes with two different client applications
|
||||
could fight over the show/hide state of the window. In the initial revision, this is
|
||||
ignored because this feature is being driven by a narrow failure scenario in the test gates.
|
||||
In the reported scenario, a singular application is default-launched into a singular tab
|
||||
in a terminal window and then the application expects to be able to hide it after the creation.
|
||||
|
||||
In the future, we may have to implement a conflict resolution or a graphical variance to
|
||||
compensate for multiple tabs.
|
||||
|
||||
### Other verbs against the console window handle
|
||||
|
||||
This scenario initially focuses on just the `::ShowWindow()` call against the window handle
|
||||
from `::GetConsoleWindow()`. Other functions from `user32` against the `HWND` will not
|
||||
necessarily be captured and forwarded to the attached terminal application. And even more
|
||||
specifically, we're focusing only on the Show and Hide state. Other state modifications that
|
||||
are subtle related to z-ordering, activation, maximizing, snapping, and so on are not considered.
|
||||
|
||||
## Future considerations
|
||||
|
||||
### Multiple clients
|
||||
|
||||
If the multiple clients problem becomes more widespread, we may need to change the graphical
|
||||
behavior of the Windows Terminal window to only hide certain tabs or panes when a command
|
||||
comes in instead of hiding the entire window (unless of course there is only one tab/pane).
|
||||
|
||||
We may also need to adjust that once consensus is reached among tabs/panes that it can then
|
||||
and only then propagate up to the entire window.
|
||||
|
||||
We will decide on this after we receive feedback that it is a necessary scenario. Otherwise,
|
||||
we will hold for now.
|
||||
|
||||
### Other verbs
|
||||
|
||||
If it turns out that we discover tests/scenarios that need maximizing, activation, or other
|
||||
properties of the `::ShowWindow()` call to be propagated to maintain compatibility, we will
|
||||
be able to carry those through on the same channel and command. Most of them have an existing
|
||||
equivalent in `XTWINOPS`. Those that do not, we would want to probably avoid as they will not
|
||||
be implemented in any other terminal. We would extend the protocol as an absolute last resort
|
||||
and only after receiving feedback from the greater worldwide terminal community.
|
||||
|
||||
### Z-ordering
|
||||
|
||||
The channel we're establishing here to communicate information about the window and its
|
||||
placement may be useful for the z-ordering issues we have in #2988. In those scenarios,
|
||||
a console client application is attempting to launch and position a window on top of the
|
||||
terminal, wherever it is. Further synchronizing the state of the new fake-window in the
|
||||
ConPTY with the real window on the terminal side may enable those tools to function as
|
||||
they expect.
|
||||
|
||||
This is another circumstance we didn't expect: having command-line applications create windows
|
||||
with a need for complex layout and ordering. These sorts of behaviors cannot be translated
|
||||
to a universal language and will not be available off the singular machine, so encouraged
|
||||
alternative methods like command-line based UI. However, for single-box scenarios, this
|
||||
behavior is engrained in some Windows tooling due to its ease of use.
|
||||
|
||||
## Resources
|
||||
|
||||
- [Default Terminal spec](https://github.com/microsoft/terminal/pull/7414)
|
||||
- [Z-ordering issue](https://github.com/microsoft/terminal/issues/2988)
|
||||
- See all the embedded links in this document to Windows API resources
|
||||
@@ -1,2 +0,0 @@
|
||||
@echo off
|
||||
git branch | D:\dev\private\OpenConsole\bin\x64\Debug\Scratch.exe --prefix "git checkout "
|
||||
@@ -95,7 +95,7 @@ typename CharRow::const_iterator CharRow::cend() const noexcept
|
||||
// - The calculated left boundary of the internal string.
|
||||
size_t CharRow::MeasureLeft() const noexcept
|
||||
{
|
||||
const_iterator it = _data.cbegin();
|
||||
auto it = _data.cbegin();
|
||||
while (it != _data.cend() && it->IsSpace())
|
||||
{
|
||||
++it;
|
||||
@@ -111,7 +111,7 @@ size_t CharRow::MeasureLeft() const noexcept
|
||||
// - The calculated right boundary of the internal string.
|
||||
size_t CharRow::MeasureRight() const
|
||||
{
|
||||
const_reverse_iterator it = _data.crbegin();
|
||||
auto it = _data.crbegin();
|
||||
while (it != _data.crend() && it->IsSpace())
|
||||
{
|
||||
++it;
|
||||
@@ -132,7 +132,7 @@ void CharRow::ClearCell(const size_t column)
|
||||
// - True if there is valid text in this row. False otherwise.
|
||||
bool CharRow::ContainsText() const noexcept
|
||||
{
|
||||
for (const value_type& cell : _data)
|
||||
for (const auto& cell : _data)
|
||||
{
|
||||
if (!cell.IsSpace())
|
||||
{
|
||||
|
||||
@@ -110,7 +110,7 @@ CharRowCellReference::const_iterator CharRowCellReference::end() const
|
||||
|
||||
bool operator==(const CharRowCellReference& ref, const std::vector<wchar_t>& glyph)
|
||||
{
|
||||
const DbcsAttribute& dbcsAttr = ref._cellData().DbcsAttr();
|
||||
const auto& dbcsAttr = ref._cellData().DbcsAttr();
|
||||
if (glyph.size() == 1 && dbcsAttr.IsGlyphStored())
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -24,7 +24,7 @@ enum class LineRendition
|
||||
constexpr SMALL_RECT ScreenToBufferLine(const SMALL_RECT& line, const LineRendition lineRendition)
|
||||
{
|
||||
// Use shift right to quickly divide the Left and Right by 2 for double width lines.
|
||||
const auto scale = lineRendition == LineRendition::SingleWidth ? 0 : 1;
|
||||
const SHORT scale = lineRendition == LineRendition::SingleWidth ? 0 : 1;
|
||||
return { line.Left >> scale, line.Top, line.Right >> scale, line.Bottom };
|
||||
}
|
||||
|
||||
|
||||
@@ -302,7 +302,7 @@ OutputCellIterator& OutputCellIterator::operator++()
|
||||
// - Reference to self after advancement.
|
||||
OutputCellIterator OutputCellIterator::operator++(int)
|
||||
{
|
||||
auto temp(*this);
|
||||
auto temp = *this;
|
||||
operator++();
|
||||
return temp;
|
||||
}
|
||||
@@ -478,7 +478,7 @@ OutputCellView OutputCellIterator::s_GenerateView(const wchar_t& wch, const Text
|
||||
// - Object representing the view into this cell
|
||||
OutputCellView OutputCellIterator::s_GenerateViewLegacyAttr(const WORD& legacyAttr) noexcept
|
||||
{
|
||||
WORD cleanAttr = legacyAttr;
|
||||
auto cleanAttr = legacyAttr;
|
||||
WI_ClearAllFlags(cleanAttr, COMMON_LVB_SBCSDBCS); // don't use legacy lead/trailing byte flags for colors
|
||||
|
||||
const TextAttribute attr(cleanAttr);
|
||||
|
||||
@@ -113,8 +113,8 @@ OutputCellIterator ROW::WriteCells(OutputCellIterator it, const size_t index, co
|
||||
|
||||
auto currentColor = it->TextAttr();
|
||||
uint16_t colorUses = 0;
|
||||
uint16_t colorStarts = gsl::narrow_cast<uint16_t>(index);
|
||||
uint16_t currentIndex = colorStarts;
|
||||
auto colorStarts = gsl::narrow_cast<uint16_t>(index);
|
||||
auto currentIndex = colorStarts;
|
||||
|
||||
while (it && currentIndex <= finalColumnInRow)
|
||||
{
|
||||
@@ -141,7 +141,7 @@ OutputCellIterator ROW::WriteCells(OutputCellIterator it, const size_t index, co
|
||||
// Fill the text if the behavior isn't set to saying there's only a color stored in this iterator.
|
||||
if (it->TextAttrBehavior() != TextAttributeBehavior::StoredOnly)
|
||||
{
|
||||
const bool fillingLastColumn = currentIndex == finalColumnInRow;
|
||||
const auto fillingLastColumn = currentIndex == finalColumnInRow;
|
||||
|
||||
// TODO: MSFT: 19452170 - We need to ensure when writing any trailing byte that the one to the left
|
||||
// is a matching leading byte. Likewise, if we're writing a leading byte, we need to make sure we still have space in this loop
|
||||
|
||||
@@ -11,6 +11,8 @@ static_assert(sizeof(TextAttribute) == 14);
|
||||
static_assert(alignof(TextAttribute) == 2);
|
||||
// Ensure that we can memcpy() and memmove() the struct for performance.
|
||||
static_assert(std::is_trivially_copyable_v<TextAttribute>);
|
||||
// Assert that the use of memcmp() for comparisons is safe.
|
||||
static_assert(std::has_unique_object_representations_v<TextAttribute>);
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -112,10 +114,10 @@ TextAttribute TextAttribute::StripErroneousVT16VersionsOfLegacyDefaults(const Te
|
||||
// - a WORD with legacy-style attributes for this textattribute.
|
||||
WORD TextAttribute::GetLegacyAttributes() const noexcept
|
||||
{
|
||||
const BYTE fgIndex = _foreground.GetLegacyIndex(s_legacyDefaultForeground);
|
||||
const BYTE bgIndex = _background.GetLegacyIndex(s_legacyDefaultBackground);
|
||||
const auto fgIndex = _foreground.GetLegacyIndex(s_legacyDefaultForeground);
|
||||
const auto bgIndex = _background.GetLegacyIndex(s_legacyDefaultBackground);
|
||||
const WORD metaAttrs = _wAttrLegacy & META_ATTRS;
|
||||
const bool brighten = IsIntense() && _foreground.CanBeBrightened();
|
||||
const auto brighten = IsIntense() && _foreground.CanBeBrightened();
|
||||
return fgIndex | (bgIndex << 4) | metaAttrs | (brighten ? FOREGROUND_INTENSITY : 0);
|
||||
}
|
||||
|
||||
@@ -355,11 +357,6 @@ void TextAttribute::SetReverseVideo(bool isReversed) noexcept
|
||||
WI_UpdateFlag(_wAttrLegacy, COMMON_LVB_REVERSE_VIDEO, isReversed);
|
||||
}
|
||||
|
||||
ExtendedAttributes TextAttribute::GetExtendedAttributes() const noexcept
|
||||
{
|
||||
return _extendedAttrs;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - swaps foreground and background color
|
||||
void TextAttribute::Invert() noexcept
|
||||
|
||||
@@ -76,12 +76,15 @@ public:
|
||||
|
||||
void Invert() noexcept;
|
||||
|
||||
friend constexpr bool operator==(const TextAttribute& a, const TextAttribute& b) noexcept;
|
||||
friend constexpr bool operator!=(const TextAttribute& a, const TextAttribute& b) noexcept;
|
||||
friend constexpr bool operator==(const TextAttribute& attr, const WORD& legacyAttr) noexcept;
|
||||
friend constexpr bool operator!=(const TextAttribute& attr, const WORD& legacyAttr) noexcept;
|
||||
friend constexpr bool operator==(const WORD& legacyAttr, const TextAttribute& attr) noexcept;
|
||||
friend constexpr bool operator!=(const WORD& legacyAttr, const TextAttribute& attr) noexcept;
|
||||
inline bool operator==(const TextAttribute& other) const noexcept
|
||||
{
|
||||
return memcmp(this, &other, sizeof(TextAttribute)) == 0;
|
||||
}
|
||||
|
||||
inline bool operator!=(const TextAttribute& other) const noexcept
|
||||
{
|
||||
return memcmp(this, &other, sizeof(TextAttribute)) != 0;
|
||||
}
|
||||
|
||||
bool IsLegacy() const noexcept;
|
||||
bool IsIntense() const noexcept;
|
||||
@@ -106,7 +109,10 @@ public:
|
||||
void SetOverlined(bool isOverlined) noexcept;
|
||||
void SetReverseVideo(bool isReversed) noexcept;
|
||||
|
||||
ExtendedAttributes GetExtendedAttributes() const noexcept;
|
||||
constexpr ExtendedAttributes GetExtendedAttributes() const noexcept
|
||||
{
|
||||
return _extendedAttrs;
|
||||
}
|
||||
|
||||
bool IsHyperlink() const noexcept;
|
||||
|
||||
@@ -158,6 +164,13 @@ public:
|
||||
{
|
||||
return WI_IsAnyFlagSet(_wAttrLegacy, COMMON_LVB_GRID_HORIZONTAL | COMMON_LVB_GRID_LVERTICAL | COMMON_LVB_GRID_RVERTICAL | COMMON_LVB_UNDERSCORE);
|
||||
}
|
||||
constexpr bool HasAnyExtendedAttributes() const noexcept
|
||||
{
|
||||
return GetExtendedAttributes() != ExtendedAttributes::Normal ||
|
||||
IsAnyGridLineEnabled() ||
|
||||
GetHyperlinkId() != 0 ||
|
||||
IsReverseVideo();
|
||||
}
|
||||
|
||||
private:
|
||||
static std::array<TextColor, 16> s_legacyForegroundColorMap;
|
||||
@@ -167,7 +180,7 @@ private:
|
||||
uint16_t _hyperlinkId; // sizeof: 2, alignof: 2
|
||||
TextColor _foreground; // sizeof: 4, alignof: 1
|
||||
TextColor _background; // sizeof: 4, alignof: 1
|
||||
ExtendedAttributes _extendedAttrs; // sizeof: 1, alignof: 1
|
||||
ExtendedAttributes _extendedAttrs; // sizeof: 2, alignof: 2
|
||||
|
||||
#ifdef UNIT_TESTING
|
||||
friend class TextBufferTests;
|
||||
@@ -184,20 +197,6 @@ enum class TextAttributeBehavior
|
||||
StoredOnly, // only use the contained text attribute and skip the insertion of anything else
|
||||
};
|
||||
|
||||
constexpr bool operator==(const TextAttribute& a, const TextAttribute& b) noexcept
|
||||
{
|
||||
return a._wAttrLegacy == b._wAttrLegacy &&
|
||||
a._foreground == b._foreground &&
|
||||
a._background == b._background &&
|
||||
a._extendedAttrs == b._extendedAttrs &&
|
||||
a._hyperlinkId == b._hyperlinkId;
|
||||
}
|
||||
|
||||
constexpr bool operator!=(const TextAttribute& a, const TextAttribute& b) noexcept
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
#ifdef UNIT_TESTING
|
||||
|
||||
#define LOG_ATTR(attr) (Log::Comment(NoThrowString().Format( \
|
||||
|
||||
@@ -54,6 +54,8 @@ constexpr std::array<BYTE, 256> Index256ToIndex16 = {
|
||||
|
||||
// We should only need 4B for TextColor. Any more than that is just waste.
|
||||
static_assert(sizeof(TextColor) == 4);
|
||||
// Assert that the use of memcmp() for comparisons is safe.
|
||||
static_assert(std::has_unique_object_representations_v<TextColor>);
|
||||
|
||||
bool TextColor::CanBeBrightened() const noexcept
|
||||
{
|
||||
@@ -111,6 +113,8 @@ void TextColor::SetIndex(const BYTE index, const bool isIndex256) noexcept
|
||||
{
|
||||
_meta = isIndex256 ? ColorType::IsIndex256 : ColorType::IsIndex16;
|
||||
_index = index;
|
||||
_green = 0;
|
||||
_blue = 0;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -123,6 +127,9 @@ void TextColor::SetIndex(const BYTE index, const bool isIndex256) noexcept
|
||||
void TextColor::SetDefault() noexcept
|
||||
{
|
||||
_meta = ColorType::IsDefault;
|
||||
_red = 0;
|
||||
_green = 0;
|
||||
_blue = 0;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
||||
@@ -101,8 +101,15 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
friend constexpr bool operator==(const TextColor& a, const TextColor& b) noexcept;
|
||||
friend constexpr bool operator!=(const TextColor& a, const TextColor& b) noexcept;
|
||||
bool operator==(const TextColor& other) const noexcept
|
||||
{
|
||||
return memcmp(this, &other, sizeof(TextColor)) == 0;
|
||||
}
|
||||
|
||||
bool operator!=(const TextColor& other) const noexcept
|
||||
{
|
||||
return memcmp(this, &other, sizeof(TextColor)) != 0;
|
||||
}
|
||||
|
||||
bool CanBeBrightened() const noexcept;
|
||||
bool IsLegacy() const noexcept;
|
||||
@@ -151,19 +158,6 @@ private:
|
||||
#endif
|
||||
};
|
||||
|
||||
bool constexpr operator==(const TextColor& a, const TextColor& b) noexcept
|
||||
{
|
||||
return a._meta == b._meta &&
|
||||
a._red == b._red &&
|
||||
a._green == b._green &&
|
||||
a._blue == b._blue;
|
||||
}
|
||||
|
||||
bool constexpr operator!=(const TextColor& a, const TextColor& b) noexcept
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
#ifdef UNIT_TESTING
|
||||
|
||||
namespace WEX
|
||||
|
||||
@@ -140,10 +140,10 @@ std::pair<COORD, COORD> Search::GetFoundLocation() const noexcept
|
||||
// - direction - The intended direction of the search
|
||||
// Return Value:
|
||||
// - Coordinate to start the search from.
|
||||
COORD Search::s_GetInitialAnchor(IUiaData& uiaData, const Direction direction)
|
||||
COORD Search::s_GetInitialAnchor(const IUiaData& uiaData, const Direction direction)
|
||||
{
|
||||
const auto& textBuffer = uiaData.GetTextBuffer();
|
||||
const COORD textBufferEndPosition = uiaData.GetTextBufferEndPosition();
|
||||
const auto textBufferEndPosition = uiaData.GetTextBufferEndPosition();
|
||||
if (uiaData.IsSelectionActive())
|
||||
{
|
||||
// Convert the screen position of the selection anchor into an equivalent
|
||||
@@ -192,7 +192,7 @@ bool Search::_FindNeedleInHaystackAt(const COORD pos, COORD& start, COORD& end)
|
||||
start = { 0 };
|
||||
end = { 0 };
|
||||
|
||||
COORD bufferPos = pos;
|
||||
auto bufferPos = pos;
|
||||
|
||||
for (const auto& needleCell : _needle)
|
||||
{
|
||||
@@ -307,7 +307,7 @@ void Search::_UpdateNextPosition()
|
||||
// We put the next position to:
|
||||
// Forward: (0, 0)
|
||||
// Backward: the position of the end of the text buffer
|
||||
const COORD bufferEndPosition = _uiaData.GetTextBufferEndPosition();
|
||||
const auto bufferEndPosition = _uiaData.GetTextBufferEndPosition();
|
||||
|
||||
if (_coordNext.Y > bufferEndPosition.Y ||
|
||||
(_coordNext.Y == bufferEndPosition.Y && _coordNext.X > bufferEndPosition.X))
|
||||
|
||||
@@ -66,7 +66,7 @@ private:
|
||||
void _IncrementCoord(COORD& coord) const noexcept;
|
||||
void _DecrementCoord(COORD& coord) const noexcept;
|
||||
|
||||
static COORD s_GetInitialAnchor(Microsoft::Console::Types::IUiaData& uiaData, const Direction dir);
|
||||
static COORD s_GetInitialAnchor(const Microsoft::Console::Types::IUiaData& uiaData, const Direction dir);
|
||||
|
||||
static std::vector<std::vector<wchar_t>> s_CreateNeedleFromString(const std::wstring& wstr);
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ const ROW& TextBuffer::GetRowByOffset(const size_t index) const
|
||||
const size_t totalRows = TotalRowCount();
|
||||
|
||||
// Rows are stored circularly, so the index you ask for is offset by the start position and mod the total of rows.
|
||||
const size_t offsetIndex = (_firstRow + index) % totalRows;
|
||||
const auto offsetIndex = (_firstRow + index) % totalRows;
|
||||
return _storage.at(offsetIndex);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ ROW& TextBuffer::GetRowByOffset(const size_t index)
|
||||
const size_t totalRows = TotalRowCount();
|
||||
|
||||
// Rows are stored circularly, so the index you ask for is offset by the start position and mod the total of rows.
|
||||
const size_t offsetIndex = (_firstRow + index) % totalRows;
|
||||
const auto offsetIndex = (_firstRow + index) % totalRows;
|
||||
return _storage.at(offsetIndex);
|
||||
}
|
||||
|
||||
@@ -201,8 +201,8 @@ TextBufferCellIterator TextBuffer::GetCellDataAt(const COORD at, const Viewport
|
||||
bool TextBuffer::_AssertValidDoubleByteSequence(const DbcsAttribute dbcsAttribute)
|
||||
{
|
||||
// To figure out if the sequence is valid, we have to look at the character that comes before the current one
|
||||
const COORD coordPrevPosition = _GetPreviousFromCursor();
|
||||
ROW& prevRow = GetRowByOffset(coordPrevPosition.Y);
|
||||
const auto coordPrevPosition = _GetPreviousFromCursor();
|
||||
auto& prevRow = GetRowByOffset(coordPrevPosition.Y);
|
||||
DbcsAttribute prevDbcsAttr;
|
||||
try
|
||||
{
|
||||
@@ -214,8 +214,8 @@ bool TextBuffer::_AssertValidDoubleByteSequence(const DbcsAttribute dbcsAttribut
|
||||
return false;
|
||||
}
|
||||
|
||||
bool fValidSequence = true; // Valid until proven otherwise
|
||||
bool fCorrectableByErase = false; // Can't be corrected until proven otherwise
|
||||
auto fValidSequence = true; // Valid until proven otherwise
|
||||
auto fCorrectableByErase = false; // Can't be corrected until proven otherwise
|
||||
|
||||
// Here's the matrix of valid items:
|
||||
// N = None (single byte)
|
||||
@@ -290,7 +290,7 @@ bool TextBuffer::_PrepareForDoubleByteSequence(const DbcsAttribute dbcsAttribute
|
||||
// older versions of conhost simply let pass by unflinching.
|
||||
LOG_HR_IF(E_NOT_VALID_STATE, !(_AssertValidDoubleByteSequence(dbcsAttribute))); // Shouldn't be uncorrectable sequences unless something is very wrong.
|
||||
|
||||
bool fSuccess = true;
|
||||
auto fSuccess = true;
|
||||
// Now compensate if we don't have enough space for the upcoming double byte sequence
|
||||
// We only need to compensate for leading bytes
|
||||
if (dbcsAttribute.IsLeading())
|
||||
@@ -385,12 +385,12 @@ OutputCellIterator TextBuffer::WriteLine(const OutputCellIterator givenIt,
|
||||
}
|
||||
|
||||
// Get the row and write the cells
|
||||
ROW& row = GetRowByOffset(target.Y);
|
||||
auto& row = GetRowByOffset(target.Y);
|
||||
const auto newIt = row.WriteCells(givenIt, target.X, wrap, limitRight);
|
||||
|
||||
// Take the cell distance written and notify that it needs to be repainted.
|
||||
const auto written = newIt.GetCellDistance(givenIt);
|
||||
const Viewport paint = Viewport::FromDimensions(target, { gsl::narrow<SHORT>(written), 1 });
|
||||
const auto paint = Viewport::FromDimensions(target, { gsl::narrow<SHORT>(written), 1 });
|
||||
TriggerRedraw(paint);
|
||||
|
||||
return newIt;
|
||||
@@ -410,19 +410,19 @@ bool TextBuffer::InsertCharacter(const std::wstring_view chars,
|
||||
const TextAttribute attr)
|
||||
{
|
||||
// Ensure consistent buffer state for double byte characters based on the character type we're about to insert
|
||||
bool fSuccess = _PrepareForDoubleByteSequence(dbcsAttribute);
|
||||
auto fSuccess = _PrepareForDoubleByteSequence(dbcsAttribute);
|
||||
|
||||
if (fSuccess)
|
||||
{
|
||||
// Get the current cursor position
|
||||
short const iRow = GetCursor().GetPosition().Y; // row stored as logical position, not array position
|
||||
short const iCol = GetCursor().GetPosition().X; // column logical and array positions are equal.
|
||||
const auto iRow = GetCursor().GetPosition().Y; // row stored as logical position, not array position
|
||||
const auto iCol = GetCursor().GetPosition().X; // column logical and array positions are equal.
|
||||
|
||||
// Get the row associated with the given logical position
|
||||
ROW& Row = GetRowByOffset(iRow);
|
||||
auto& Row = GetRowByOffset(iRow);
|
||||
|
||||
// Store character and double byte data
|
||||
CharRow& charRow = Row.GetCharRow();
|
||||
auto& charRow = Row.GetCharRow();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -506,7 +506,7 @@ bool TextBuffer::IncrementCursor()
|
||||
// Move the cursor one position to the right
|
||||
GetCursor().IncrementXPosition(1);
|
||||
|
||||
bool fSuccess = true;
|
||||
auto fSuccess = true;
|
||||
// If we've passed the final valid column...
|
||||
if (GetCursor().GetPosition().X > iFinalColumnIndex)
|
||||
{
|
||||
@@ -527,8 +527,8 @@ bool TextBuffer::IncrementCursor()
|
||||
// - true if we successfully moved the cursor.
|
||||
bool TextBuffer::NewlineCursor()
|
||||
{
|
||||
bool fSuccess = false;
|
||||
short const iFinalRowIndex = GetSize().BottomInclusive();
|
||||
auto fSuccess = false;
|
||||
const auto iFinalRowIndex = GetSize().BottomInclusive();
|
||||
|
||||
// Reset the cursor position to 0 and move down one line
|
||||
GetCursor().SetXPosition(0);
|
||||
@@ -576,7 +576,7 @@ bool TextBuffer::IncrementCircularBuffer(const bool inVtMode)
|
||||
// the current background color, but with no meta attributes set.
|
||||
fillAttributes.SetStandardErase();
|
||||
}
|
||||
const bool fSuccess = _storage.at(_firstRow).Reset(fillAttributes);
|
||||
const auto fSuccess = _storage.at(_firstRow).Reset(fillAttributes);
|
||||
if (fSuccess)
|
||||
{
|
||||
// Now proceed to increment.
|
||||
@@ -618,7 +618,7 @@ COORD TextBuffer::GetLastNonSpaceCharacter(std::optional<const Microsoft::Consol
|
||||
|
||||
// If the X coordinate turns out to be -1, the row was empty, we need to search backwards for the real end of text.
|
||||
const auto viewportTop = viewport.Top();
|
||||
bool fDoBackUp = (coordEndOfText.X < 0 && coordEndOfText.Y > viewportTop); // this row is empty, and we're not at the top
|
||||
auto fDoBackUp = (coordEndOfText.X < 0 && coordEndOfText.Y > viewportTop); // this row is empty, and we're not at the top
|
||||
while (fDoBackUp)
|
||||
{
|
||||
coordEndOfText.Y--;
|
||||
@@ -645,7 +645,7 @@ COORD TextBuffer::GetLastNonSpaceCharacter(std::optional<const Microsoft::Consol
|
||||
// - NOTE: Will return 0,0 if already in the top left corner
|
||||
COORD TextBuffer::_GetPreviousFromCursor() const
|
||||
{
|
||||
COORD coordPosition = GetCursor().GetPosition();
|
||||
auto coordPosition = GetCursor().GetPosition();
|
||||
|
||||
// If we're not at the left edge, simply move the cursor to the left by one
|
||||
if (coordPosition.X > 0)
|
||||
@@ -826,7 +826,7 @@ void TextBuffer::SetCurrentLineRendition(const LineRendition lineRendition)
|
||||
auto fillAttrs = GetCurrentAttributes();
|
||||
fillAttrs.SetStandardErase();
|
||||
const size_t fillOffset = GetLineWidth(rowIndex);
|
||||
const size_t fillLength = GetSize().Width() - fillOffset;
|
||||
const auto fillLength = GetSize().Width() - fillOffset;
|
||||
const auto fillData = OutputCellIterator{ fillChar, fillAttrs, fillLength };
|
||||
row.WriteCells(fillData, fillOffset, false);
|
||||
// We also need to make sure the cursor is clamped within the new width.
|
||||
@@ -917,7 +917,7 @@ void TextBuffer::Reset()
|
||||
const SHORT TopRowIndex = (GetFirstRowIndex() + TopRow) % currentSize.Y;
|
||||
|
||||
// rotate rows until the top row is at index 0
|
||||
for (int i = 0; i < TopRowIndex; i++)
|
||||
for (auto i = 0; i < TopRowIndex; i++)
|
||||
{
|
||||
_storage.emplace_back(std::move(_storage.front()));
|
||||
_storage.erase(_storage.begin());
|
||||
@@ -1081,7 +1081,7 @@ ROW& TextBuffer::_GetFirstRow()
|
||||
// - will throw exception if called with the first row of the text buffer
|
||||
ROW& TextBuffer::_GetPrevRowNoWrap(const ROW& Row)
|
||||
{
|
||||
int prevRowIndex = Row.GetId() - 1;
|
||||
auto prevRowIndex = Row.GetId() - 1;
|
||||
if (prevRowIndex < 0)
|
||||
{
|
||||
prevRowIndex = TotalRowCount() - 1;
|
||||
@@ -1167,9 +1167,9 @@ const COORD TextBuffer::GetWordStart(const COORD target, const std::wstring_view
|
||||
// - The COORD for the first character on the current/previous READABLE "word" (inclusive)
|
||||
const COORD TextBuffer::_GetWordStartForAccessibility(const COORD target, const std::wstring_view wordDelimiters) const
|
||||
{
|
||||
COORD result = target;
|
||||
auto result = target;
|
||||
const auto bufferSize = GetSize();
|
||||
bool stayAtOrigin = false;
|
||||
auto stayAtOrigin = false;
|
||||
|
||||
// ignore left boundary. Continue until readable text found
|
||||
while (_GetDelimiterClassAt(result, wordDelimiters) != DelimiterClass::RegularChar)
|
||||
@@ -1212,7 +1212,7 @@ const COORD TextBuffer::_GetWordStartForAccessibility(const COORD target, const
|
||||
// - The COORD for the first character on the current word or delimiter run (stopped by the left margin)
|
||||
const COORD TextBuffer::_GetWordStartForSelection(const COORD target, const std::wstring_view wordDelimiters) const
|
||||
{
|
||||
COORD result = target;
|
||||
auto result = target;
|
||||
const auto bufferSize = GetSize();
|
||||
|
||||
const auto initialDelimiter = _GetDelimiterClassAt(result, wordDelimiters);
|
||||
@@ -1284,7 +1284,7 @@ const COORD TextBuffer::GetWordEnd(const COORD target, const std::wstring_view w
|
||||
const COORD TextBuffer::_GetWordEndForAccessibility(const COORD target, const std::wstring_view wordDelimiters, const COORD limit) const
|
||||
{
|
||||
const auto bufferSize{ GetSize() };
|
||||
COORD result{ target };
|
||||
auto result{ target };
|
||||
|
||||
if (bufferSize.CompareInBounds(target, limit, true) >= 0)
|
||||
{
|
||||
@@ -1341,7 +1341,7 @@ const COORD TextBuffer::_GetWordEndForSelection(const COORD target, const std::w
|
||||
return target;
|
||||
}
|
||||
|
||||
COORD result = target;
|
||||
auto result = target;
|
||||
const auto initialDelimiter = _GetDelimiterClassAt(result, wordDelimiters);
|
||||
|
||||
// expand right until we hit the right boundary or a different delimiter class
|
||||
@@ -1465,7 +1465,7 @@ bool TextBuffer::MoveToPreviousWord(COORD& pos, std::wstring_view wordDelimiters
|
||||
// - pos - The COORD for the first cell of the current glyph (inclusive)
|
||||
const til::point TextBuffer::GetGlyphStart(const til::point pos, std::optional<til::point> limitOptional) const
|
||||
{
|
||||
COORD resultPos = pos.to_win32_coord();
|
||||
auto resultPos = pos.to_win32_coord();
|
||||
const auto bufferSize = GetSize();
|
||||
const auto limit{ limitOptional.value_or(til::point{ bufferSize.EndExclusive() }) };
|
||||
|
||||
@@ -1493,7 +1493,7 @@ const til::point TextBuffer::GetGlyphStart(const til::point pos, std::optional<t
|
||||
// - pos - The COORD for the last cell of the current glyph (exclusive)
|
||||
const til::point TextBuffer::GetGlyphEnd(const til::point pos, bool accessibilityMode, std::optional<til::point> limitOptional) const
|
||||
{
|
||||
COORD resultPos = pos.to_win32_coord();
|
||||
auto resultPos = pos.to_win32_coord();
|
||||
const auto bufferSize = GetSize();
|
||||
const auto limit{ limitOptional.value_or(til::point{ bufferSize.EndExclusive() }) };
|
||||
|
||||
@@ -1569,7 +1569,7 @@ bool TextBuffer::MoveToNextGlyph(til::point& pos, bool allowExclusiveEnd, std::o
|
||||
// - pos - The COORD for the first cell of the previous glyph (inclusive)
|
||||
bool TextBuffer::MoveToPreviousGlyph(til::point& pos, std::optional<til::point> limitOptional) const
|
||||
{
|
||||
COORD resultPos = pos.to_win32_coord();
|
||||
auto resultPos = pos.to_win32_coord();
|
||||
const auto bufferSize = GetSize();
|
||||
const auto limit{ limitOptional.value_or(til::point{ bufferSize.EndExclusive() }) };
|
||||
|
||||
@@ -1582,7 +1582,7 @@ bool TextBuffer::MoveToPreviousGlyph(til::point& pos, std::optional<til::point>
|
||||
}
|
||||
|
||||
// try to move. If we can't, we're done.
|
||||
const bool success = bufferSize.DecrementInBounds(resultPos, true);
|
||||
const auto success = bufferSize.DecrementInBounds(resultPos, true);
|
||||
if (resultPos != bufferSize.EndExclusive() && GetCellDataAt(resultPos)->DbcsAttr().IsLeading())
|
||||
{
|
||||
bufferSize.DecrementInBounds(resultPos, true);
|
||||
@@ -1713,10 +1713,10 @@ const TextBuffer::TextAndColor TextBuffer::GetText(const bool includeCRLF,
|
||||
const bool formatWrappedRows) const
|
||||
{
|
||||
TextAndColor data;
|
||||
const bool copyTextColor = GetAttributeColors != nullptr;
|
||||
const auto copyTextColor = GetAttributeColors != nullptr;
|
||||
|
||||
// preallocate our vectors to reduce reallocs
|
||||
size_t const rows = selectionRects.size();
|
||||
const auto rows = selectionRects.size();
|
||||
data.text.reserve(rows);
|
||||
if (copyTextColor)
|
||||
{
|
||||
@@ -1729,7 +1729,7 @@ const TextBuffer::TextAndColor TextBuffer::GetText(const bool includeCRLF,
|
||||
{
|
||||
const UINT iRow = selectionRects.at(i).Top;
|
||||
|
||||
const Viewport highlight = Viewport::FromInclusive(selectionRects.at(i));
|
||||
const auto highlight = Viewport::FromInclusive(selectionRects.at(i));
|
||||
|
||||
// retrieve the data from the screen buffer
|
||||
auto it = GetCellDataAt(highlight.Origin(), highlight);
|
||||
@@ -1774,7 +1774,7 @@ const TextBuffer::TextAndColor TextBuffer::GetText(const bool includeCRLF,
|
||||
}
|
||||
|
||||
// We apply formatting to rows if the row was NOT wrapped or formatting of wrapped rows is allowed
|
||||
const bool shouldFormatRow = formatWrappedRows || !GetRowByOffset(iRow).WasWrapForced();
|
||||
const auto shouldFormatRow = formatWrappedRows || !GetRowByOffset(iRow).WasWrapForced();
|
||||
|
||||
if (trimTrailingWhitespace)
|
||||
{
|
||||
@@ -1806,7 +1806,7 @@ const TextBuffer::TextAndColor TextBuffer::GetText(const bool includeCRLF,
|
||||
if (copyTextColor)
|
||||
{
|
||||
// can't see CR/LF so just use black FG & BK
|
||||
COLORREF const Blackness = RGB(0x00, 0x00, 0x00);
|
||||
const auto Blackness = RGB(0x00, 0x00, 0x00);
|
||||
selectionFgAttr.push_back(Blackness);
|
||||
selectionFgAttr.push_back(Blackness);
|
||||
selectionBkAttr.push_back(Blackness);
|
||||
@@ -1883,7 +1883,7 @@ std::string TextBuffer::GenHTML(const TextAndColor& rows,
|
||||
}
|
||||
|
||||
// copy text and info color from buffer
|
||||
bool hasWrittenAnyText = false;
|
||||
auto hasWrittenAnyText = false;
|
||||
std::optional<COLORREF> fgColor = std::nullopt;
|
||||
std::optional<COLORREF> bkColor = std::nullopt;
|
||||
for (size_t row = 0; row < rows.text.size(); row++)
|
||||
@@ -1931,7 +1931,7 @@ std::string TextBuffer::GenHTML(const TextAndColor& rows,
|
||||
break;
|
||||
}
|
||||
|
||||
bool colorChanged = false;
|
||||
auto colorChanged = false;
|
||||
if (!fgColor.has_value() || rows.FgAttr.at(row).at(col) != fgColor.value())
|
||||
{
|
||||
fgColor = rows.FgAttr.at(row).at(col);
|
||||
@@ -1990,10 +1990,10 @@ std::string TextBuffer::GenHTML(const TextAndColor& rows,
|
||||
constexpr size_t ClipboardHeaderSize = 157;
|
||||
|
||||
// these values are byte offsets from start of clipboard
|
||||
const size_t htmlStartPos = ClipboardHeaderSize;
|
||||
const size_t htmlEndPos = ClipboardHeaderSize + gsl::narrow<size_t>(htmlBuilder.tellp());
|
||||
const size_t fragStartPos = ClipboardHeaderSize + gsl::narrow<size_t>(htmlHeader.length());
|
||||
const size_t fragEndPos = htmlEndPos - HtmlFooter.length();
|
||||
const auto htmlStartPos = ClipboardHeaderSize;
|
||||
const auto htmlEndPos = ClipboardHeaderSize + gsl::narrow<size_t>(htmlBuilder.tellp());
|
||||
const auto fragStartPos = ClipboardHeaderSize + gsl::narrow<size_t>(htmlHeader.length());
|
||||
const auto fragEndPos = htmlEndPos - HtmlFooter.length();
|
||||
|
||||
// header required by HTML 0.9 format
|
||||
std::ostringstream clipHeaderBuilder;
|
||||
@@ -2050,7 +2050,7 @@ std::string TextBuffer::GenRTF(const TextAndColor& rows, const int fontHeightPoi
|
||||
// keys are colors represented by COLORREF
|
||||
// values are indices of the corresponding colors in the color table
|
||||
std::unordered_map<COLORREF, int> colorMap;
|
||||
int nextColorIndex = 1; // leave 0 for the default color and start from 1.
|
||||
auto nextColorIndex = 1; // leave 0 for the default color and start from 1.
|
||||
|
||||
// RTF color table
|
||||
std::ostringstream colorTableBuilder;
|
||||
@@ -2103,7 +2103,7 @@ std::string TextBuffer::GenRTF(const TextAndColor& rows, const int fontHeightPoi
|
||||
break;
|
||||
}
|
||||
|
||||
bool colorChanged = false;
|
||||
auto colorChanged = false;
|
||||
if (!fgColor.has_value() || rows.FgAttr.at(row).at(col) != fgColor.value())
|
||||
{
|
||||
fgColor = rows.FgAttr.at(row).at(col);
|
||||
@@ -2120,7 +2120,7 @@ std::string TextBuffer::GenRTF(const TextAndColor& rows, const int fontHeightPoi
|
||||
{
|
||||
writeAccumulatedChars(false);
|
||||
|
||||
int bkColorIndex = 0;
|
||||
auto bkColorIndex = 0;
|
||||
if (colorMap.find(bkColor.value()) != colorMap.end())
|
||||
{
|
||||
// color already exists in the map, just retrieve the index
|
||||
@@ -2137,7 +2137,7 @@ std::string TextBuffer::GenRTF(const TextAndColor& rows, const int fontHeightPoi
|
||||
bkColorIndex = nextColorIndex++;
|
||||
}
|
||||
|
||||
int fgColorIndex = 0;
|
||||
auto fgColorIndex = 0;
|
||||
if (colorMap.find(fgColor.value()) != colorMap.end())
|
||||
{
|
||||
// color already exists in the map, just retrieve the index
|
||||
@@ -2234,31 +2234,31 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
const std::optional<Viewport> lastCharacterViewport,
|
||||
std::optional<std::reference_wrapper<PositionInformation>> positionInfo)
|
||||
{
|
||||
const Cursor& oldCursor = oldBuffer.GetCursor();
|
||||
Cursor& newCursor = newBuffer.GetCursor();
|
||||
const auto& oldCursor = oldBuffer.GetCursor();
|
||||
auto& newCursor = newBuffer.GetCursor();
|
||||
|
||||
// We need to save the old cursor position so that we can
|
||||
// place the new cursor back on the equivalent character in
|
||||
// the new buffer.
|
||||
const COORD cOldCursorPos = oldCursor.GetPosition();
|
||||
const COORD cOldLastChar = oldBuffer.GetLastNonSpaceCharacter(lastCharacterViewport);
|
||||
const auto cOldCursorPos = oldCursor.GetPosition();
|
||||
const auto cOldLastChar = oldBuffer.GetLastNonSpaceCharacter(lastCharacterViewport);
|
||||
|
||||
const short cOldRowsTotal = cOldLastChar.Y + 1;
|
||||
|
||||
COORD cNewCursorPos = { 0 };
|
||||
bool fFoundCursorPos = false;
|
||||
bool foundOldMutable = false;
|
||||
bool foundOldVisible = false;
|
||||
HRESULT hr = S_OK;
|
||||
auto fFoundCursorPos = false;
|
||||
auto foundOldMutable = false;
|
||||
auto foundOldVisible = false;
|
||||
auto hr = S_OK;
|
||||
// Loop through all the rows of the old buffer and reprint them into the new buffer
|
||||
short iOldRow = 0;
|
||||
for (; iOldRow < cOldRowsTotal; iOldRow++)
|
||||
{
|
||||
// Fetch the row and its "right" which is the last printable character.
|
||||
const ROW& row = oldBuffer.GetRowByOffset(iOldRow);
|
||||
const short cOldColsTotal = oldBuffer.GetLineWidth(iOldRow);
|
||||
const CharRow& charRow = row.GetCharRow();
|
||||
short iRight = gsl::narrow_cast<short>(charRow.MeasureRight());
|
||||
const auto& row = oldBuffer.GetRowByOffset(iOldRow);
|
||||
const auto cOldColsTotal = oldBuffer.GetLineWidth(iOldRow);
|
||||
const auto& charRow = row.GetCharRow();
|
||||
auto iRight = gsl::narrow_cast<short>(charRow.MeasureRight());
|
||||
|
||||
// If we're starting a new row, try and preserve the line rendition
|
||||
// from the row in the original buffer.
|
||||
@@ -2348,7 +2348,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
const auto newWidth = newBuffer.GetLineWidth(newRowY);
|
||||
// Stop when we get to the end of the buffer width, or the new position
|
||||
// for inserting an attr would be past the right of the new buffer.
|
||||
for (short copyAttrCol = iOldCol;
|
||||
for (auto copyAttrCol = iOldCol;
|
||||
copyAttrCol < cOldColsTotal && newAttrColumn < newWidth;
|
||||
copyAttrCol++, newAttrColumn++)
|
||||
{
|
||||
@@ -2436,7 +2436,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
// |aaaaaaaaaaaaaaaaaaa| no wrap at the end (preserved hard newline)
|
||||
// | |
|
||||
// ^ and the cursor is now here.
|
||||
const COORD coordNewCursor = newCursor.GetPosition();
|
||||
const auto coordNewCursor = newCursor.GetPosition();
|
||||
if (coordNewCursor.X == 0 && coordNewCursor.Y > 0)
|
||||
{
|
||||
if (newBuffer.GetRowByOffset(gsl::narrow_cast<size_t>(coordNewCursor.Y) - 1).WasWrapForced())
|
||||
@@ -2460,7 +2460,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
iOldRow < oldHeight && newRowY < newHeight;
|
||||
iOldRow++)
|
||||
{
|
||||
const ROW& row = oldBuffer.GetRowByOffset(iOldRow);
|
||||
const auto& row = oldBuffer.GetRowByOffset(iOldRow);
|
||||
|
||||
// Optimization: Since all these rows are below the last printable char,
|
||||
// we can reasonably assume that they are filled with just spaces.
|
||||
@@ -2494,9 +2494,9 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
// Advance the cursor to the same offset as before
|
||||
// get the number of newlines and spaces between the old end of text and the old cursor,
|
||||
// then advance that many newlines and chars
|
||||
int iNewlines = cOldCursorPos.Y - cOldLastChar.Y;
|
||||
const int iIncrements = cOldCursorPos.X - cOldLastChar.X;
|
||||
const COORD cNewLastChar = newBuffer.GetLastNonSpaceCharacter();
|
||||
auto iNewlines = cOldCursorPos.Y - cOldLastChar.Y;
|
||||
const auto iIncrements = cOldCursorPos.X - cOldLastChar.X;
|
||||
const auto cNewLastChar = newBuffer.GetLastNonSpaceCharacter();
|
||||
|
||||
// If the last row of the new buffer wrapped, there's going to be one less newline needed,
|
||||
// because the cursor is already on the next line
|
||||
@@ -2514,7 +2514,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
}
|
||||
}
|
||||
|
||||
for (int r = 0; r < iNewlines; r++)
|
||||
for (auto r = 0; r < iNewlines; r++)
|
||||
{
|
||||
if (!newBuffer.NewlineCursor())
|
||||
{
|
||||
@@ -2524,7 +2524,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
}
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
for (int c = 0; c < iIncrements - 1; c++)
|
||||
for (auto c = 0; c < iIncrements - 1; c++)
|
||||
{
|
||||
if (!newBuffer.IncrementCursor())
|
||||
{
|
||||
@@ -2539,7 +2539,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// Save old cursor size before we delete it
|
||||
ULONG const ulSize = oldCursor.GetSize();
|
||||
const auto ulSize = oldCursor.GetSize();
|
||||
|
||||
// Set size back to real size as it will be taking over the rendering duties.
|
||||
newCursor.SetSize(ulSize);
|
||||
@@ -2726,14 +2726,14 @@ PointTree TextBuffer::GetPatterns(const size_t firstRow, const size_t lastRow) c
|
||||
// match and the previous match, so we use the size of the prefix
|
||||
// along with the size of the match to determine the locations
|
||||
size_t prefixSize = 0;
|
||||
for (const std::vector<wchar_t> parsedGlyph : Utf16Parser::Parse(i->prefix().str()))
|
||||
for (const auto parsedGlyph : Utf16Parser::Parse(i->prefix().str()))
|
||||
{
|
||||
const std::wstring_view glyph{ parsedGlyph.data(), parsedGlyph.size() };
|
||||
prefixSize += IsGlyphFullWidth(glyph) ? 2 : 1;
|
||||
}
|
||||
const auto start = lenUpToThis + prefixSize;
|
||||
size_t matchSize = 0;
|
||||
for (const std::vector<wchar_t> parsedGlyph : Utf16Parser::Parse(i->str()))
|
||||
for (const auto parsedGlyph : Utf16Parser::Parse(i->str()))
|
||||
{
|
||||
const std::wstring_view glyph{ parsedGlyph.data(), parsedGlyph.size() };
|
||||
matchSize += IsGlyphFullWidth(glyph) ? 2 : 1;
|
||||
|
||||
@@ -96,7 +96,7 @@ TextBufferCellIterator& TextBufferCellIterator::operator+=(const ptrdiff_t& move
|
||||
{
|
||||
// Note that this method is called intensively when the terminal is under heavy load.
|
||||
// We need to aggressively optimize it, comparing to the -= operator.
|
||||
ptrdiff_t move = movement;
|
||||
auto move = movement;
|
||||
if (move < 0)
|
||||
{
|
||||
// Early branching to leave the rare case to -= operator.
|
||||
@@ -165,7 +165,7 @@ TextBufferCellIterator& TextBufferCellIterator::operator+=(const ptrdiff_t& move
|
||||
_attrIter += diff;
|
||||
_view.UpdateTextAttribute(*_attrIter);
|
||||
|
||||
const CharRow& charRow = _pRow->GetCharRow();
|
||||
const auto& charRow = _pRow->GetCharRow();
|
||||
_view.UpdateText(charRow.GlyphAt(newX));
|
||||
_view.UpdateDbcsAttribute(charRow.DbcsAttrAt(newX));
|
||||
_pos.X = newX;
|
||||
@@ -191,7 +191,7 @@ TextBufferCellIterator& TextBufferCellIterator::operator+=(const ptrdiff_t& move
|
||||
// - Reference to self after movement.
|
||||
TextBufferCellIterator& TextBufferCellIterator::operator-=(const ptrdiff_t& movement)
|
||||
{
|
||||
ptrdiff_t move = movement;
|
||||
auto move = movement;
|
||||
if (move < 0)
|
||||
{
|
||||
return (*this) += (-move);
|
||||
@@ -233,7 +233,7 @@ TextBufferCellIterator& TextBufferCellIterator::operator--()
|
||||
// - Value with previous position prior to movement.
|
||||
TextBufferCellIterator TextBufferCellIterator::operator++(int)
|
||||
{
|
||||
auto temp(*this);
|
||||
auto temp = *this;
|
||||
operator++();
|
||||
return temp;
|
||||
}
|
||||
@@ -244,7 +244,7 @@ TextBufferCellIterator TextBufferCellIterator::operator++(int)
|
||||
// - Value with previous position prior to movement.
|
||||
TextBufferCellIterator TextBufferCellIterator::operator--(int)
|
||||
{
|
||||
auto temp(*this);
|
||||
auto temp = *this;
|
||||
operator--();
|
||||
return temp;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ TextBufferCellIterator TextBufferCellIterator::operator--(int)
|
||||
// - Value with previous position prior to movement.
|
||||
TextBufferCellIterator TextBufferCellIterator::operator+(const ptrdiff_t& movement)
|
||||
{
|
||||
auto temp(*this);
|
||||
auto temp = *this;
|
||||
temp += movement;
|
||||
return temp;
|
||||
}
|
||||
@@ -270,7 +270,7 @@ TextBufferCellIterator TextBufferCellIterator::operator+(const ptrdiff_t& moveme
|
||||
// - Value with previous position prior to movement.
|
||||
TextBufferCellIterator TextBufferCellIterator::operator-(const ptrdiff_t& movement)
|
||||
{
|
||||
auto temp(*this);
|
||||
auto temp = *this;
|
||||
temp -= movement;
|
||||
return temp;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ void TextAttributeTests::TestRoundtripLegacy()
|
||||
WORD expectedLegacy = FOREGROUND_BLUE | BACKGROUND_RED;
|
||||
WORD bgOnly = expectedLegacy & BG_ATTRS;
|
||||
WORD bgShifted = bgOnly >> 4;
|
||||
BYTE bgByte = (BYTE)(bgShifted);
|
||||
auto bgByte = (BYTE)(bgShifted);
|
||||
|
||||
VERIFY_ARE_EQUAL(FOREGROUND_RED, bgByte);
|
||||
|
||||
@@ -65,9 +65,9 @@ void TextAttributeTests::TestRoundtripMetaBits()
|
||||
COMMON_LVB_UNDERSCORE
|
||||
};
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(metaFlags); ++i)
|
||||
for (auto i = 0; i < ARRAYSIZE(metaFlags); ++i)
|
||||
{
|
||||
WORD flag = metaFlags[i];
|
||||
auto flag = metaFlags[i];
|
||||
WORD expectedLegacy = FOREGROUND_BLUE | BACKGROUND_RED | flag;
|
||||
WORD metaOnly = expectedLegacy & META_ATTRS;
|
||||
VERIFY_ARE_EQUAL(flag, metaOnly);
|
||||
@@ -114,9 +114,9 @@ void TextAttributeTests::TestRoundtripExhaustive()
|
||||
void TextAttributeTests::TestTextAttributeColorGetters()
|
||||
{
|
||||
const auto& colorTable = _renderSettings.GetColorTable();
|
||||
const COLORREF red = RGB(255, 0, 0);
|
||||
const COLORREF faintRed = RGB(127, 0, 0);
|
||||
const COLORREF green = RGB(0, 255, 0);
|
||||
const auto red = RGB(255, 0, 0);
|
||||
const auto faintRed = RGB(127, 0, 0);
|
||||
const auto green = RGB(0, 255, 0);
|
||||
TextAttribute attr(red, green);
|
||||
|
||||
// verify that calculated foreground/background are the same as the direct
|
||||
@@ -178,8 +178,8 @@ void TextAttributeTests::TestTextAttributeColorGetters()
|
||||
void TextAttributeTests::TestReverseDefaultColors()
|
||||
{
|
||||
const auto& colorTable = _renderSettings.GetColorTable();
|
||||
const COLORREF red = RGB(255, 0, 0);
|
||||
const COLORREF green = RGB(0, 255, 0);
|
||||
const auto red = RGB(255, 0, 0);
|
||||
const auto green = RGB(0, 255, 0);
|
||||
TextAttribute attr{};
|
||||
|
||||
// verify that calculated foreground/background are the same as the direct
|
||||
@@ -260,9 +260,9 @@ void TextAttributeTests::TestRoundtripDefaultColors()
|
||||
void TextAttributeTests::TestIntenseAsBright()
|
||||
{
|
||||
const auto& colorTable = _renderSettings.GetColorTable();
|
||||
const COLORREF darkBlack = til::at(colorTable, 0);
|
||||
const COLORREF brightBlack = til::at(colorTable, 8);
|
||||
const COLORREF darkGreen = til::at(colorTable, 2);
|
||||
const auto darkBlack = til::at(colorTable, 0);
|
||||
const auto brightBlack = til::at(colorTable, 8);
|
||||
const auto darkGreen = til::at(colorTable, 2);
|
||||
|
||||
TextAttribute attr{};
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ void TextColorTests::TestBrightIndexColor()
|
||||
|
||||
void TextColorTests::TestRgbColor()
|
||||
{
|
||||
COLORREF myColor = RGB(7, 8, 9);
|
||||
auto myColor = RGB(7, 8, 9);
|
||||
TextColor rgbColor(myColor);
|
||||
|
||||
VERIFY_IS_FALSE(rgbColor.IsDefault());
|
||||
@@ -140,7 +140,7 @@ void TextColorTests::TestRgbColor()
|
||||
|
||||
void TextColorTests::TestChangeColor()
|
||||
{
|
||||
COLORREF myColor = RGB(7, 8, 9);
|
||||
auto myColor = RGB(7, 8, 9);
|
||||
TextColor rgbColor(myColor);
|
||||
|
||||
VERIFY_IS_FALSE(rgbColor.IsDefault());
|
||||
|
||||
@@ -28,7 +28,7 @@ class UnicodeStorageTests
|
||||
// verify it was stored
|
||||
auto findIt = storage._map.find(coord);
|
||||
VERIFY_ARE_NOT_EQUAL(findIt, storage._map.end());
|
||||
const std::vector<wchar_t>& newMoonGlyph = findIt->second;
|
||||
const auto& newMoonGlyph = findIt->second;
|
||||
VERIFY_ARE_EQUAL(newMoonGlyph.size(), newMoon.size());
|
||||
for (size_t i = 0; i < newMoon.size(); ++i)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ class UnicodeStorageTests
|
||||
// verify the glyph was overwritten
|
||||
findIt = storage._map.find(coord);
|
||||
VERIFY_ARE_NOT_EQUAL(findIt, storage._map.end());
|
||||
const std::vector<wchar_t>& fullMoonGlyph = findIt->second;
|
||||
const auto& fullMoonGlyph = findIt->second;
|
||||
VERIFY_ARE_EQUAL(fullMoonGlyph.size(), fullMoon.size());
|
||||
for (size_t i = 0; i < fullMoon.size(); ++i)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
|
||||
|
||||
<PropertyGroup Label="NuGet Dependencies">
|
||||
<TerminalMUX>true</TerminalMUX>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(OpenConsoleDir)src\wap-common.build.pre.props" />
|
||||
<Import Project="$(OpenConsoleDir)src\common.nugetversions.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<!--
|
||||
These two properties are very important!
|
||||
@@ -135,6 +140,10 @@
|
||||
<!-- 16.3.0 - remove non-resources.pri PRI files since we just forced them back in. -->
|
||||
<AppxPackagePayload Remove="@(AppxPackagePayload)" Condition="'%(Extension)' == '.pri' and '%(Filename)' != 'resources'" />
|
||||
<AppxUploadPackagePayload Remove="@(AppxUploadPackagePayload)" Condition="'%(Extension)' == '.pri' and '%(Filename)' != 'resources'" />
|
||||
|
||||
<!-- Remove all of the xaml files, because we are using embedded xbf payloads (saves about 500kb on disk!) -->
|
||||
<AppxPackagePayload Remove="@(AppxPackagePayload)" Condition="'%(Extension)' == '.xaml'" />
|
||||
<AppxUploadPackagePayload Remove="@(AppxUploadPackagePayload)" Condition="'%(Extension)' == '.xaml'" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
@@ -160,13 +169,7 @@
|
||||
</Target>
|
||||
|
||||
<!-- This is required to get the package dependency in the AppXManifest. -->
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.$(TerminalMUXVersion)\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.$(TerminalMUXVersion)\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.UI.Xaml.$(TerminalMUXVersion)\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.UI.Xaml.$(TerminalMUXVersion)\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
</Target>
|
||||
<Import Project="$(OpenConsoleDir)src\common.nugetversions.targets" />
|
||||
|
||||
<Import Project="$(SolutionDir)build\rules\CollectWildcardResources.targets" />
|
||||
</Project>
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace SettingsModelLocalTests
|
||||
}
|
||||
|
||||
Log::Comment(L"Roundtrip Test for Color Scheme");
|
||||
Json::Value outJson{ scheme->ToJson() };
|
||||
auto outJson{ scheme->ToJson() };
|
||||
VERIFY_ARE_EQUAL(schemeObject, outJson);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace SettingsModelLocalTests
|
||||
const auto commands1Json = VerifyParseSucceeded(commands1String);
|
||||
const auto commands2Json = VerifyParseSucceeded(commands2String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
{
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
@@ -92,7 +92,7 @@ namespace SettingsModelLocalTests
|
||||
const auto commands2Json = VerifyParseSucceeded(commands2String);
|
||||
const auto commands3Json = VerifyParseSucceeded(commands3String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
{
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
@@ -154,7 +154,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
const auto commands0Json = VerifyParseSucceeded(commands0String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
VERIFY_ARE_EQUAL(0u, warnings.size());
|
||||
@@ -272,7 +272,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
const auto commands0Json = VerifyParseSucceeded(commands0String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
VERIFY_ARE_EQUAL(3u, warnings.size());
|
||||
@@ -298,7 +298,7 @@ namespace SettingsModelLocalTests
|
||||
const std::string commands0String{ R"([ { "name": { "key": "DuplicateTabCommandKey"}, "command": "copy" } ])" };
|
||||
const auto commands0Json = VerifyParseSucceeded(commands0String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
{
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
@@ -340,7 +340,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
const auto commands0Json = VerifyParseSucceeded(commands0String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
VERIFY_ARE_EQUAL(0u, warnings.size());
|
||||
@@ -410,7 +410,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
const auto commands0Json = VerifyParseSucceeded(commands0String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
VERIFY_ARE_EQUAL(0u, warnings.size());
|
||||
@@ -473,7 +473,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
const auto commands0Json = VerifyParseSucceeded(commands0String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
auto commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
VERIFY_ARE_EQUAL(0u, warnings.size());
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace SettingsModelLocalTests
|
||||
}
|
||||
{
|
||||
// Case 2: Bad settings
|
||||
bool caughtExpectedException = false;
|
||||
auto caughtExpectedException = false;
|
||||
try
|
||||
{
|
||||
auto settings = winrt::make_self<implementation::CascadiaSettings>(settingsWithoutProfiles);
|
||||
@@ -173,7 +173,7 @@ namespace SettingsModelLocalTests
|
||||
}
|
||||
{
|
||||
// Case 3: Bad settings
|
||||
bool caughtExpectedException = false;
|
||||
auto caughtExpectedException = false;
|
||||
try
|
||||
{
|
||||
auto settings = winrt::make_self<implementation::CascadiaSettings>(settingsWithEmptyProfiles);
|
||||
@@ -886,7 +886,7 @@ namespace SettingsModelLocalTests
|
||||
const winrt::guid guid1{ Utils::GuidFromString(L"{6239a42c-6666-49a3-80bd-e8fdd045185c}") };
|
||||
const winrt::guid guid2{ Utils::GuidFromString(L"{2C4DE342-38B7-51CF-B940-2309A097F518}") };
|
||||
const winrt::guid fakeGuid{ Utils::GuidFromString(L"{FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF}") };
|
||||
const winrt::guid autogeneratedGuid{ implementation::Profile::_GenerateGuidForProfile(name3, L"") };
|
||||
const auto autogeneratedGuid{ implementation::Profile::_GenerateGuidForProfile(name3, L"") };
|
||||
|
||||
const auto settings = createSettings(settings0String);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
Json::Value root;
|
||||
std::string errs;
|
||||
const bool parseResult = reader->parse(content.data(), content.data() + content.size(), &root, &errs);
|
||||
const auto parseResult = reader->parse(content.data(), content.data() + content.size(), &root, &errs);
|
||||
VERIFY_IS_TRUE(parseResult, winrt::to_hstring(errs).c_str());
|
||||
return root;
|
||||
};
|
||||
|
||||
@@ -82,9 +82,9 @@ namespace SettingsModelLocalTests
|
||||
expectedArgv.reserve(expectedArgc * 65);
|
||||
input.reserve(expectedArgc * 67);
|
||||
|
||||
for (int i = 0; i < expectedArgc; ++i)
|
||||
for (auto i = 0; i < expectedArgc; ++i)
|
||||
{
|
||||
const bool useQuotes = static_cast<bool>(rng(2));
|
||||
const auto useQuotes = static_cast<bool>(rng(2));
|
||||
// We need to ensure there is at least one character
|
||||
const auto count = static_cast<size_t>(rng(64) + 1);
|
||||
const auto ch = static_cast<wchar_t>(rng('z' - 'a' + 1) + 'a');
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_SUCCEEDED(TestData::TryGetValue(L"testPass", testPass), L"Get a commandline to test");
|
||||
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*>& rawCommands{ commandsToTest.at(testPass) };
|
||||
auto& rawCommands{ commandsToTest.at(testPass) };
|
||||
_logCommandline(rawCommands);
|
||||
|
||||
auto commandlines = AppCommandlineArgs::BuildCommands(rawCommands);
|
||||
@@ -232,7 +232,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_SUCCEEDED(TestData::TryGetValue(L"testPass", testPass), L"Get a commandline to test");
|
||||
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*>& rawCommands{ commandsToTest.at(testPass) };
|
||||
auto& rawCommands{ commandsToTest.at(testPass) };
|
||||
_logCommandline(rawCommands);
|
||||
|
||||
auto commandlines = AppCommandlineArgs::BuildCommands(rawCommands);
|
||||
@@ -266,7 +266,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_SUCCEEDED(TestData::TryGetValue(L"testPass", testPass), L"Get a commandline to test");
|
||||
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*>& rawCommands{ commandsToTest.at(testPass) };
|
||||
auto& rawCommands{ commandsToTest.at(testPass) };
|
||||
_logCommandline(rawCommands);
|
||||
|
||||
auto commandlines = AppCommandlineArgs::BuildCommands(rawCommands);
|
||||
@@ -439,7 +439,7 @@ namespace TerminalAppLocalTests
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortForm, L"If true, use `nt` instead of `new-tab`");
|
||||
const wchar_t* subcommand = useShortForm ? L"nt" : L"new-tab";
|
||||
auto subcommand = useShortForm ? L"nt" : L"new-tab";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
@@ -697,7 +697,7 @@ namespace TerminalAppLocalTests
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortForm, L"If true, use `sp` instead of `split-pane`");
|
||||
const wchar_t* subcommand = useShortForm ? L"sp" : L"split-pane";
|
||||
auto subcommand = useShortForm ? L"sp" : L"split-pane";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
@@ -880,8 +880,8 @@ namespace TerminalAppLocalTests
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortFormNewTab, L"If true, use `nt` instead of `new-tab`");
|
||||
INIT_TEST_PROPERTY(bool, useShortFormSplitPane, L"If true, use `sp` instead of `split-pane`");
|
||||
const wchar_t* ntSubcommand = useShortFormNewTab ? L"nt" : L"new-tab";
|
||||
const wchar_t* spSubcommand = useShortFormSplitPane ? L"sp" : L"split-pane";
|
||||
auto ntSubcommand = useShortFormNewTab ? L"nt" : L"new-tab";
|
||||
auto spSubcommand = useShortFormSplitPane ? L"sp" : L"split-pane";
|
||||
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", ntSubcommand, L";", spSubcommand };
|
||||
@@ -1009,7 +1009,7 @@ namespace TerminalAppLocalTests
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortForm, L"If true, use `ft` instead of `focus-tab`");
|
||||
const wchar_t* subcommand = useShortForm ? L"ft" : L"focus-tab";
|
||||
auto subcommand = useShortForm ? L"ft" : L"focus-tab";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
@@ -1101,7 +1101,7 @@ namespace TerminalAppLocalTests
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortForm, L"If true, use `mf` instead of `move-focus`");
|
||||
const wchar_t* subcommand = useShortForm ? L"mf" : L"move-focus";
|
||||
auto subcommand = useShortForm ? L"mf" : L"move-focus";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
@@ -1214,7 +1214,7 @@ namespace TerminalAppLocalTests
|
||||
|
||||
void CommandlineTest::ParseSwapPaneArgs()
|
||||
{
|
||||
const wchar_t* subcommand = L"swap-pane";
|
||||
auto subcommand = L"swap-pane";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
@@ -1332,7 +1332,7 @@ namespace TerminalAppLocalTests
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortForm, L"If true, use `fp` instead of `focus-pane`");
|
||||
const wchar_t* subcommand = useShortForm ? L"fp" : L"focus-pane";
|
||||
auto subcommand = useShortForm ? L"fp" : L"focus-pane";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
@@ -1765,7 +1765,7 @@ namespace TerminalAppLocalTests
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortForm, L"If true, use `sp` instead of `split-pane`");
|
||||
const wchar_t* subcommand = useShortForm ? L"sp" : L"split-pane";
|
||||
auto subcommand = useShortForm ? L"sp" : L"split-pane";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
|
||||
@@ -81,7 +81,7 @@ HRESULT RunOnUIThread(const TFunction& function)
|
||||
return HRESULT_FROM_WIN32(::GetLastError());
|
||||
}
|
||||
|
||||
HRESULT invokeResult = E_FAIL;
|
||||
auto invokeResult = E_FAIL;
|
||||
|
||||
auto asyncAction = d.RunAsync(winrt::Windows::UI::Core::CoreDispatcherPriority::Normal,
|
||||
[&invokeResult, &function]() {
|
||||
@@ -94,7 +94,7 @@ HRESULT RunOnUIThread(const TFunction& function)
|
||||
});
|
||||
|
||||
// Wait for the callback to complete
|
||||
HRESULT hr = completedEvent.Wait();
|
||||
auto hr = completedEvent.Wait();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return hr;
|
||||
|
||||
@@ -681,6 +681,10 @@ namespace TerminalAppLocalTests
|
||||
|
||||
void TabTests::TryZoomPane()
|
||||
{
|
||||
BEGIN_TEST_METHOD_PROPERTIES()
|
||||
TEST_METHOD_PROPERTY(L"IsolationLevel", L"Method")
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
auto page = _commonSetup();
|
||||
|
||||
Log::Comment(L"Create a second pane");
|
||||
@@ -1052,7 +1056,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(4u, page->_tabs.Size());
|
||||
|
||||
TestOnUIThread([&page]() {
|
||||
uint32_t focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
auto focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
VERIFY_ARE_EQUAL(3u, focusedIndex, L"Verify the fourth tab is the focused one");
|
||||
});
|
||||
|
||||
@@ -1062,7 +1066,7 @@ namespace TerminalAppLocalTests
|
||||
});
|
||||
|
||||
TestOnUIThread([&page]() {
|
||||
uint32_t focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
auto focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
VERIFY_ARE_EQUAL(1u, focusedIndex, L"Verify the second tab is the focused one");
|
||||
});
|
||||
|
||||
@@ -1088,7 +1092,7 @@ namespace TerminalAppLocalTests
|
||||
});
|
||||
|
||||
TestOnUIThread([&page]() {
|
||||
uint32_t focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
auto focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
VERIFY_ARE_EQUAL(3u, focusedIndex, L"Verify the fourth tab is the focused one");
|
||||
});
|
||||
|
||||
@@ -1109,7 +1113,7 @@ namespace TerminalAppLocalTests
|
||||
});
|
||||
|
||||
TestOnUIThread([&page]() {
|
||||
uint32_t focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
auto focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
VERIFY_ARE_EQUAL(1u, focusedIndex, L"Verify the second tab is the focused one");
|
||||
});
|
||||
|
||||
@@ -1121,7 +1125,7 @@ namespace TerminalAppLocalTests
|
||||
page->_SelectNextTab(true, nullptr);
|
||||
});
|
||||
TestOnUIThread([&page]() {
|
||||
uint32_t focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
auto focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
VERIFY_ARE_EQUAL(2u, focusedIndex, L"Verify the third tab is the focused one");
|
||||
});
|
||||
|
||||
@@ -1133,7 +1137,7 @@ namespace TerminalAppLocalTests
|
||||
page->_SelectNextTab(true, nullptr);
|
||||
});
|
||||
TestOnUIThread([&page]() {
|
||||
uint32_t focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
auto focusedIndex = page->_GetFocusedTabIndex().value_or(-1);
|
||||
VERIFY_ARE_EQUAL(3u, focusedIndex, L"Verify the fourth tab is the focused one");
|
||||
});
|
||||
}
|
||||
@@ -1244,7 +1248,7 @@ namespace TerminalAppLocalTests
|
||||
page->WindowName(args.ProposedName());
|
||||
});
|
||||
|
||||
bool windowNameChanged = false;
|
||||
auto windowNameChanged = false;
|
||||
page->PropertyChanged([&page, &windowNameChanged](auto&&, const winrt::WUX::Data::PropertyChangedEventArgs& args) mutable {
|
||||
if (args.PropertyName() == L"WindowNameForDisplay")
|
||||
{
|
||||
@@ -1274,7 +1278,7 @@ namespace TerminalAppLocalTests
|
||||
page->RenameFailed();
|
||||
});
|
||||
|
||||
bool windowNameChanged = false;
|
||||
auto windowNameChanged = false;
|
||||
|
||||
page->PropertyChanged([&page, &windowNameChanged](auto&&, const winrt::WUX::Data::PropertyChangedEventArgs& args) mutable {
|
||||
if (args.PropertyName() == L"WindowNameForDisplay")
|
||||
@@ -1312,7 +1316,8 @@ namespace TerminalAppLocalTests
|
||||
TestOnUIThread([&page]() {
|
||||
Log::Comment(L"Emulate previewing the SetColorScheme action");
|
||||
SetColorSchemeArgs args{ L"Vintage" };
|
||||
page->_PreviewColorScheme(args);
|
||||
ActionAndArgs actionAndArgs{ ShortcutAction::SetColorScheme, args };
|
||||
page->_PreviewAction(actionAndArgs);
|
||||
});
|
||||
|
||||
TestOnUIThread([&page]() {
|
||||
@@ -1379,7 +1384,8 @@ namespace TerminalAppLocalTests
|
||||
TestOnUIThread([&page]() {
|
||||
Log::Comment(L"Emulate previewing the SetColorScheme action");
|
||||
SetColorSchemeArgs args{ L"Vintage" };
|
||||
page->_PreviewColorScheme(args);
|
||||
ActionAndArgs actionAndArgs{ ShortcutAction::SetColorScheme, args };
|
||||
page->_PreviewAction(actionAndArgs);
|
||||
});
|
||||
|
||||
TestOnUIThread([&page]() {
|
||||
|
||||
@@ -38,7 +38,7 @@ static bool _IsGlyphWideForceNarrowFallback(const std::wstring_view /* glyph */)
|
||||
static bool _EnsureStaticInitialization()
|
||||
{
|
||||
// use C++11 magic statics to make sure we only do this once.
|
||||
static bool initialized = []() {
|
||||
static auto initialized = []() {
|
||||
// *** THIS IS A SINGLETON ***
|
||||
SetGlyphWidthFallback(_IsGlyphWideForceNarrowFallback);
|
||||
|
||||
@@ -55,7 +55,7 @@ LRESULT CALLBACK HwndTerminal::HwndTerminalWndProc(
|
||||
try
|
||||
{
|
||||
#pragma warning(suppress : 26490) // Win32 APIs can only store void*, have to use reinterpret_cast
|
||||
HwndTerminal* terminal = reinterpret_cast<HwndTerminal*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
|
||||
auto terminal = reinterpret_cast<HwndTerminal*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
|
||||
|
||||
if (terminal)
|
||||
{
|
||||
@@ -178,7 +178,7 @@ HwndTerminal::HwndTerminal(HWND parentHwnd) :
|
||||
{
|
||||
_EnsureStaticInitialization();
|
||||
|
||||
HINSTANCE hInstance = wil::GetModuleInstanceHandle();
|
||||
auto hInstance = wil::GetModuleInstanceHandle();
|
||||
|
||||
if (RegisterTermClass(hInstance))
|
||||
{
|
||||
@@ -214,7 +214,9 @@ HRESULT HwndTerminal::Initialize()
|
||||
_terminal = std::make_unique<::Microsoft::Terminal::Core::Terminal>();
|
||||
auto renderThread = std::make_unique<::Microsoft::Console::Render::RenderThread>();
|
||||
auto* const localPointerToThread = renderThread.get();
|
||||
const auto& renderSettings = _terminal->GetRenderSettings();
|
||||
auto& renderSettings = _terminal->GetRenderSettings();
|
||||
renderSettings.SetColorTableEntry(TextColor::DEFAULT_BACKGROUND, RGB(12, 12, 12));
|
||||
renderSettings.SetColorTableEntry(TextColor::DEFAULT_FOREGROUND, RGB(204, 204, 204));
|
||||
_renderer = std::make_unique<::Microsoft::Console::Render::Renderer>(renderSettings, _terminal.get(), nullptr, 0, std::move(renderThread));
|
||||
RETURN_HR_IF_NULL(E_POINTER, localPointerToThread);
|
||||
RETURN_IF_FAILED(localPointerToThread->Initialize(_renderer.get()));
|
||||
@@ -237,11 +239,7 @@ HRESULT HwndTerminal::Initialize()
|
||||
|
||||
_renderEngine = std::move(dxEngine);
|
||||
|
||||
_terminal->SetBackgroundCallback([](auto) {});
|
||||
|
||||
_terminal->Create(COORD{ 80, 25 }, 1000, *_renderer);
|
||||
_terminal->SetColorTableEntry(TextColor::DEFAULT_BACKGROUND, RGB(12, 12, 12));
|
||||
_terminal->SetColorTableEntry(TextColor::DEFAULT_FOREGROUND, RGB(204, 204, 204));
|
||||
_terminal->SetWriteInputCallback([=](std::wstring_view input) noexcept { _WriteTextToConnection(input); });
|
||||
localPointerToThread->EnablePainting();
|
||||
|
||||
@@ -536,7 +534,7 @@ try
|
||||
};
|
||||
|
||||
auto lock = _terminal->LockForWriting();
|
||||
const bool altPressed = GetKeyState(VK_MENU) < 0;
|
||||
const auto altPressed = GetKeyState(VK_MENU) < 0;
|
||||
const til::size fontSize{ this->_actualFont.GetSize() };
|
||||
|
||||
this->_terminal->SetBlockSelection(altPressed);
|
||||
@@ -626,7 +624,7 @@ void _stdcall TerminalClearSelection(void* terminal)
|
||||
bool _stdcall TerminalIsSelectionActive(void* terminal)
|
||||
{
|
||||
const auto publicTerminal = static_cast<const HwndTerminal*>(terminal);
|
||||
const bool selectionActive = publicTerminal->_terminal->IsSelectionActive();
|
||||
const auto selectionActive = publicTerminal->_terminal->IsSelectionActive();
|
||||
return selectionActive;
|
||||
}
|
||||
|
||||
@@ -684,7 +682,7 @@ static ControlKeyStates getControlKeyState() noexcept
|
||||
bool HwndTerminal::_CanSendVTMouseInput() const noexcept
|
||||
{
|
||||
// Only allow the transit of mouse events if shift isn't pressed.
|
||||
const bool shiftPressed = GetKeyState(VK_SHIFT) < 0;
|
||||
const auto shiftPressed = GetKeyState(VK_SHIFT) < 0;
|
||||
return !shiftPressed && _focused && _terminal->IsTrackingMouseInput();
|
||||
}
|
||||
|
||||
@@ -703,7 +701,7 @@ try
|
||||
wheelDelta = HIWORD(wParam);
|
||||
|
||||
// If it's a *WHEEL event, it's in screen coordinates, not window (?!)
|
||||
POINT coordsToTransform = cursorPosition.to_win32_point();
|
||||
auto coordsToTransform = cursorPosition.to_win32_point();
|
||||
ScreenToClient(_hwnd.get(), &coordsToTransform);
|
||||
cursorPosition = til::point{ coordsToTransform };
|
||||
}
|
||||
@@ -788,15 +786,17 @@ void _stdcall TerminalSetTheme(void* terminal, TerminalTheme theme, LPCWSTR font
|
||||
{
|
||||
auto lock = publicTerminal->_terminal->LockForWriting();
|
||||
|
||||
publicTerminal->_terminal->SetColorTableEntry(TextColor::DEFAULT_FOREGROUND, theme.DefaultForeground);
|
||||
publicTerminal->_terminal->SetColorTableEntry(TextColor::DEFAULT_BACKGROUND, theme.DefaultBackground);
|
||||
auto& renderSettings = publicTerminal->_terminal->GetRenderSettings();
|
||||
renderSettings.SetColorTableEntry(TextColor::DEFAULT_FOREGROUND, theme.DefaultForeground);
|
||||
renderSettings.SetColorTableEntry(TextColor::DEFAULT_BACKGROUND, theme.DefaultBackground);
|
||||
|
||||
publicTerminal->_renderEngine->SetSelectionBackground(theme.DefaultSelectionBackground, theme.SelectionBackgroundAlpha);
|
||||
|
||||
// Set the font colors
|
||||
for (size_t tableIndex = 0; tableIndex < 16; tableIndex++)
|
||||
{
|
||||
// It's using gsl::at to check the index is in bounds, but the analyzer still calls this array-to-pointer-decay
|
||||
[[gsl::suppress(bounds .3)]] publicTerminal->_terminal->SetColorTableEntry(tableIndex, gsl::at(theme.ColorTable, tableIndex));
|
||||
[[gsl::suppress(bounds .3)]] renderSettings.SetColorTableEntry(tableIndex, gsl::at(theme.ColorTable, tableIndex));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -849,7 +849,7 @@ void __stdcall TerminalKillFocus(void* terminal)
|
||||
// Arguments:
|
||||
// - rows - Rows of text data to copy
|
||||
// - fAlsoCopyFormatting - true if the color and formatting should also be copied, false otherwise
|
||||
HRESULT HwndTerminal::_CopyTextToSystemClipboard(const TextBuffer::TextAndColor& rows, bool const fAlsoCopyFormatting)
|
||||
HRESULT HwndTerminal::_CopyTextToSystemClipboard(const TextBuffer::TextAndColor& rows, const bool fAlsoCopyFormatting)
|
||||
try
|
||||
{
|
||||
std::wstring finalString;
|
||||
@@ -861,17 +861,17 @@ try
|
||||
}
|
||||
|
||||
// allocate the final clipboard data
|
||||
const size_t cchNeeded = finalString.size() + 1;
|
||||
const size_t cbNeeded = sizeof(wchar_t) * cchNeeded;
|
||||
const auto cchNeeded = finalString.size() + 1;
|
||||
const auto cbNeeded = sizeof(wchar_t) * cchNeeded;
|
||||
wil::unique_hglobal globalHandle(GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, cbNeeded));
|
||||
RETURN_LAST_ERROR_IF_NULL(globalHandle.get());
|
||||
|
||||
PWSTR pwszClipboard = static_cast<PWSTR>(GlobalLock(globalHandle.get()));
|
||||
auto pwszClipboard = static_cast<PWSTR>(GlobalLock(globalHandle.get()));
|
||||
RETURN_LAST_ERROR_IF_NULL(pwszClipboard);
|
||||
|
||||
// The pattern gets a bit strange here because there's no good wil built-in for global lock of this type.
|
||||
// Try to copy then immediately unlock. Don't throw until after (so the hglobal won't be freed until we unlock).
|
||||
const HRESULT hr = StringCchCopyW(pwszClipboard, cchNeeded, finalString.data());
|
||||
const auto hr = StringCchCopyW(pwszClipboard, cchNeeded, finalString.data());
|
||||
GlobalUnlock(globalHandle.get());
|
||||
RETURN_IF_FAILED(hr);
|
||||
|
||||
@@ -889,13 +889,13 @@ try
|
||||
if (fAlsoCopyFormatting)
|
||||
{
|
||||
const auto& fontData = _actualFont;
|
||||
int const iFontHeightPoints = fontData.GetUnscaledSize().Y; // this renderer uses points already
|
||||
const COLORREF bgColor = _terminal->GetAttributeColors({}).second;
|
||||
const int iFontHeightPoints = fontData.GetUnscaledSize().Y; // this renderer uses points already
|
||||
const auto bgColor = _terminal->GetAttributeColors({}).second;
|
||||
|
||||
std::string HTMLToPlaceOnClip = TextBuffer::GenHTML(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor);
|
||||
auto HTMLToPlaceOnClip = TextBuffer::GenHTML(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor);
|
||||
_CopyToSystemClipboard(HTMLToPlaceOnClip, L"HTML Format");
|
||||
|
||||
std::string RTFToPlaceOnClip = TextBuffer::GenRTF(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor);
|
||||
auto RTFToPlaceOnClip = TextBuffer::GenRTF(rows, iFontHeightPoints, fontData.GetFaceName(), bgColor);
|
||||
_CopyToSystemClipboard(RTFToPlaceOnClip, L"Rich Text Format");
|
||||
}
|
||||
}
|
||||
@@ -916,22 +916,22 @@ CATCH_RETURN()
|
||||
// - lpszFormat - the name of the format
|
||||
HRESULT HwndTerminal::_CopyToSystemClipboard(std::string stringToCopy, LPCWSTR lpszFormat)
|
||||
{
|
||||
const size_t cbData = stringToCopy.size() + 1; // +1 for '\0'
|
||||
const auto cbData = stringToCopy.size() + 1; // +1 for '\0'
|
||||
if (cbData)
|
||||
{
|
||||
wil::unique_hglobal globalHandleData(GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, cbData));
|
||||
RETURN_LAST_ERROR_IF_NULL(globalHandleData.get());
|
||||
|
||||
PSTR pszClipboardHTML = static_cast<PSTR>(GlobalLock(globalHandleData.get()));
|
||||
auto pszClipboardHTML = static_cast<PSTR>(GlobalLock(globalHandleData.get()));
|
||||
RETURN_LAST_ERROR_IF_NULL(pszClipboardHTML);
|
||||
|
||||
// The pattern gets a bit strange here because there's no good wil built-in for global lock of this type.
|
||||
// Try to copy then immediately unlock. Don't throw until after (so the hglobal won't be freed until we unlock).
|
||||
const HRESULT hr2 = StringCchCopyA(pszClipboardHTML, cbData, stringToCopy.data());
|
||||
const auto hr2 = StringCchCopyA(pszClipboardHTML, cbData, stringToCopy.data());
|
||||
GlobalUnlock(globalHandleData.get());
|
||||
RETURN_IF_FAILED(hr2);
|
||||
|
||||
UINT const CF_FORMAT = RegisterClipboardFormatW(lpszFormat);
|
||||
const auto CF_FORMAT = RegisterClipboardFormatW(lpszFormat);
|
||||
RETURN_LAST_ERROR_IF(0 == CF_FORMAT);
|
||||
|
||||
RETURN_LAST_ERROR_IF_NULL(SetClipboardData(CF_FORMAT, globalHandleData.get()));
|
||||
@@ -953,14 +953,14 @@ void HwndTerminal::_PasteTextFromClipboard() noexcept
|
||||
return;
|
||||
}
|
||||
|
||||
HANDLE ClipboardDataHandle = GetClipboardData(CF_UNICODETEXT);
|
||||
auto ClipboardDataHandle = GetClipboardData(CF_UNICODETEXT);
|
||||
if (ClipboardDataHandle == nullptr)
|
||||
{
|
||||
CloseClipboard();
|
||||
return;
|
||||
}
|
||||
|
||||
PCWCH pwstr = static_cast<PCWCH>(GlobalLock(ClipboardDataHandle));
|
||||
auto pwstr = static_cast<PCWCH>(GlobalLock(ClipboardDataHandle));
|
||||
|
||||
_StringPaste(pwstr);
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ private:
|
||||
|
||||
void _UpdateFont(int newDpi);
|
||||
void _WriteTextToConnection(const std::wstring_view text) noexcept;
|
||||
HRESULT _CopyTextToSystemClipboard(const TextBuffer::TextAndColor& rows, bool const fAlsoCopyFormatting);
|
||||
HRESULT _CopyTextToSystemClipboard(const TextBuffer::TextAndColor& rows, const bool fAlsoCopyFormatting);
|
||||
HRESULT _CopyToSystemClipboard(std::string stringToCopy, LPCWSTR lpszFormat);
|
||||
void _PasteTextFromClipboard() noexcept;
|
||||
void _StringPaste(const wchar_t* const pData) noexcept;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// It must be defined after CommandlineArgs.g.cpp, otherwise the compiler
|
||||
// will give you just the most impossible template errors to try and
|
||||
// decipher.
|
||||
void CommandlineArgs::Commandline(winrt::array_view<const winrt::hstring> const& value)
|
||||
void CommandlineArgs::Commandline(const winrt::array_view<const winrt::hstring>& value)
|
||||
{
|
||||
_args = { value.begin(), value.end() };
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
|
||||
winrt::hstring CurrentDirectory() { return _cwd; };
|
||||
|
||||
void Commandline(winrt::array_view<const winrt::hstring> const& value);
|
||||
void Commandline(const winrt::array_view<const winrt::hstring>& value);
|
||||
winrt::com_array<winrt::hstring> Commandline();
|
||||
|
||||
private:
|
||||
|
||||
@@ -821,7 +821,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
void Monarch::_renameRequested(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const winrt::Microsoft::Terminal::Remoting::RenameRequestArgs& args)
|
||||
{
|
||||
bool successfullyRenamed = false;
|
||||
auto successfullyRenamed = false;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -972,7 +972,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
|
||||
bool Monarch::DoesQuakeWindowExist()
|
||||
{
|
||||
bool result = false;
|
||||
auto result = false;
|
||||
const auto func = [&](const auto& /*id*/, const auto& p) {
|
||||
if (p.WindowName() == QuakeWindowName)
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// activated.
|
||||
_lastActivatedArgs = args;
|
||||
|
||||
bool successfullyNotified = false;
|
||||
auto successfullyNotified = false;
|
||||
// Raise our WindowActivated event, to let the monarch know we've been
|
||||
// activated.
|
||||
try
|
||||
@@ -172,7 +172,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// - <none>
|
||||
void Peasant::RequestIdentifyWindows()
|
||||
{
|
||||
bool successfullyNotified = false;
|
||||
auto successfullyNotified = false;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -197,7 +197,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
|
||||
void Peasant::RequestRename(const winrt::Microsoft::Terminal::Remoting::RenameRequestArgs& args)
|
||||
{
|
||||
bool successfullyNotified = false;
|
||||
auto successfullyNotified = false;
|
||||
const auto oldName{ _WindowName };
|
||||
try
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// Register with COM as a server for the Monarch class
|
||||
_registerAsMonarch();
|
||||
// Instantiate an instance of the Monarch. This may or may not be in-proc!
|
||||
bool foundMonarch = false;
|
||||
auto foundMonarch = false;
|
||||
while (!foundMonarch)
|
||||
{
|
||||
try
|
||||
@@ -83,8 +83,8 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
winrt::hstring& givenName)
|
||||
{
|
||||
// these two errors are Win32 errors, convert them to HRESULTS so we can actually compare below.
|
||||
static constexpr HRESULT RPC_SERVER_UNAVAILABLE_HR = HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE);
|
||||
static constexpr HRESULT RPC_CALL_FAILED_HR = HRESULT_FROM_WIN32(RPC_S_CALL_FAILED);
|
||||
static constexpr auto RPC_SERVER_UNAVAILABLE_HR = HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE);
|
||||
static constexpr auto RPC_CALL_FAILED_HR = HRESULT_FROM_WIN32(RPC_S_CALL_FAILED);
|
||||
|
||||
// The monarch may respond back "you should be a new
|
||||
// window, with ID,name of (id, name)". Really the responses are:
|
||||
@@ -101,7 +101,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// starting a defterm, and when that BP gets hit, kill the original
|
||||
// monarch, and see what happens here.
|
||||
|
||||
bool proposedCommandline = false;
|
||||
auto proposedCommandline = false;
|
||||
Remoting::ProposeCommandlineResult result{ nullptr };
|
||||
while (!proposedCommandline)
|
||||
{
|
||||
@@ -113,7 +113,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
// dies between now and the inspection of
|
||||
// `result.ShouldCreateWindow` below, we don't want to explode
|
||||
// (since _proposeToMonarch is not try/caught).
|
||||
Remoting::ProposeCommandlineResult outOfProcResult = _monarch.ProposeCommandline(args);
|
||||
auto outOfProcResult = _monarch.ProposeCommandline(args);
|
||||
result = winrt::make<implementation::ProposeCommandlineResult>(outOfProcResult);
|
||||
|
||||
proposedCommandline = true;
|
||||
@@ -550,7 +550,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
waits[1] = _monarchWaitInterrupt.get();
|
||||
const auto peasantID = _peasant.GetID(); // safe: _peasant is in-proc.
|
||||
|
||||
bool exitThreadRequested = false;
|
||||
auto exitThreadRequested = false;
|
||||
while (!exitThreadRequested)
|
||||
{
|
||||
// At any point in all this, the current monarch might die. If it
|
||||
@@ -652,7 +652,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
TraceLoggingUInt64(peasantID, "peasantID", "Our peasant ID"),
|
||||
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
|
||||
TraceLoggingKeyword(TIL_KEYWORD_TRACE));
|
||||
bool foundNewMonarch = false;
|
||||
auto foundNewMonarch = false;
|
||||
while (!foundNewMonarch)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -18,7 +18,7 @@ using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
ActionPaletteItem::ActionPaletteItem(Microsoft::Terminal::Settings::Model::Command const& command) :
|
||||
ActionPaletteItem::ActionPaletteItem(const Microsoft::Terminal::Settings::Model::Command& command) :
|
||||
_Command(command)
|
||||
{
|
||||
Name(command.Name());
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace winrt::TerminalApp::implementation
|
||||
struct ActionPaletteItem : ActionPaletteItemT<ActionPaletteItem, PaletteItem>
|
||||
{
|
||||
ActionPaletteItem() = default;
|
||||
ActionPaletteItem(Microsoft::Terminal::Settings::Model::Command const& command);
|
||||
ActionPaletteItem(const Microsoft::Terminal::Settings::Model::Command& command);
|
||||
|
||||
WINRT_PROPERTY(Microsoft::Terminal::Settings::Model::Command, Command, nullptr);
|
||||
|
||||
|
||||
@@ -35,28 +35,27 @@ namespace winrt::TerminalApp::implementation
|
||||
// Method Description:
|
||||
// - Stop previewing the currently previewed action. We can use this to
|
||||
// clean up any state from that action's preview.
|
||||
// - We use _lastPreviewedCommand to determine what type of action to clean up.
|
||||
// - We use _lastPreviewedAction to determine what type of action to clean up.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_EndPreview()
|
||||
{
|
||||
if (_lastPreviewedCommand == nullptr || _lastPreviewedCommand.ActionAndArgs() == nullptr)
|
||||
if (_lastPreviewedAction == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (_lastPreviewedCommand.ActionAndArgs().Action())
|
||||
switch (_lastPreviewedAction.Action())
|
||||
{
|
||||
case ShortcutAction::SetColorScheme:
|
||||
case ShortcutAction::AdjustOpacity:
|
||||
case ShortcutAction::SendInput:
|
||||
{
|
||||
_RunRestorePreviews();
|
||||
break;
|
||||
}
|
||||
}
|
||||
_lastPreviewedCommand = nullptr;
|
||||
_lastPreviewedAction = nullptr;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -141,25 +140,27 @@ namespace winrt::TerminalApp::implementation
|
||||
});
|
||||
}
|
||||
|
||||
void TerminalPage::_PreviewSendInput(const Settings::Model::SendInputArgs& args)
|
||||
void TerminalPage::_PreviewAction(const Settings::Model::ActionAndArgs& args)
|
||||
{
|
||||
const auto backup = _restorePreviewFuncs.empty();
|
||||
switch (args.Action())
|
||||
{
|
||||
case ShortcutAction::SetColorScheme:
|
||||
_PreviewColorScheme(args.Args().try_as<SetColorSchemeArgs>());
|
||||
break;
|
||||
case ShortcutAction::AdjustOpacity:
|
||||
_PreviewAdjustOpacity(args.Args().try_as<AdjustOpacityArgs>());
|
||||
break;
|
||||
}
|
||||
|
||||
_ApplyToActiveControls([&](const auto& control) {
|
||||
// // Stash a copy of the original opacity.
|
||||
// auto originalOpacity{ control.BackgroundOpacity() };
|
||||
// GH#9818 Other ideas for actions that could be preview-able:
|
||||
// * Set Font size
|
||||
// * Set acrylic true/false/opacity?
|
||||
// * SetPixelShaderPath?
|
||||
// * SetWindowTheme (light/dark/system/<some theme from #3327>)?
|
||||
|
||||
// Apply the new opacity
|
||||
control.PreviewInput(args.Input());
|
||||
|
||||
if (backup)
|
||||
{
|
||||
_restorePreviewFuncs.emplace_back([=]() {
|
||||
// On dismiss:
|
||||
control.PreviewInput(L"");
|
||||
});
|
||||
}
|
||||
});
|
||||
// Stash this action, so we know what to do when we're done
|
||||
// previewing.
|
||||
_lastPreviewedAction = args;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -186,34 +187,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (args.ActionAndArgs().Action())
|
||||
{
|
||||
case ShortcutAction::SetColorScheme:
|
||||
{
|
||||
_PreviewColorScheme(args.ActionAndArgs().Args().try_as<SetColorSchemeArgs>());
|
||||
break;
|
||||
}
|
||||
case ShortcutAction::AdjustOpacity:
|
||||
{
|
||||
_PreviewAdjustOpacity(args.ActionAndArgs().Args().try_as<AdjustOpacityArgs>());
|
||||
break;
|
||||
}
|
||||
case ShortcutAction::SendInput:
|
||||
{
|
||||
_PreviewSendInput(args.ActionAndArgs().Args().try_as<SendInputArgs>());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// GH#9818 Other ideas for actions that could be preview-able:
|
||||
// * Set Font size
|
||||
// * Set acrylic true/false/opacity?
|
||||
// * SetPixelShaderPath?
|
||||
// * SetWindowTheme (light/dark/system/<some theme from #3327>)?
|
||||
|
||||
// Stash this action, so we know what to do when we're done
|
||||
// previewing.
|
||||
_lastPreviewedCommand = args;
|
||||
_PreviewAction(args.ActionAndArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
using IXamlType = ::winrt::Windows::UI::Xaml::Markup::IXamlType;
|
||||
|
||||
IXamlType GetXamlType(::winrt::Windows::UI::Xaml::Interop::TypeName const& type)
|
||||
IXamlType GetXamlType(const ::winrt::Windows::UI::Xaml::Interop::TypeName& type)
|
||||
{
|
||||
return _appProvider.GetXamlType(type);
|
||||
}
|
||||
|
||||
IXamlType GetXamlType(::winrt::hstring const& fullName)
|
||||
IXamlType GetXamlType(const ::winrt::hstring& fullName)
|
||||
{
|
||||
return _appProvider.GetXamlType(fullName);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace winrt::TerminalApp::implementation
|
||||
/// will be used such as when the application is launched to open a specific file.
|
||||
/// </summary>
|
||||
/// <param name="e">Details about the launch request and process.</param>
|
||||
void App::OnLaunched(LaunchActivatedEventArgs const& /*e*/)
|
||||
void App::OnLaunched(const LaunchActivatedEventArgs& /*e*/)
|
||||
{
|
||||
// if this is a UWP... it means its our problem to hook up the content to the window here.
|
||||
if (_isUwp)
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
public:
|
||||
App();
|
||||
void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const&);
|
||||
void OnLaunched(const Windows::ApplicationModel::Activation::LaunchActivatedEventArgs&);
|
||||
|
||||
TerminalApp::AppLogic Logic();
|
||||
|
||||
|
||||
@@ -46,10 +46,87 @@
|
||||
Color="{ThemeResource SystemErrorTextColor}" />
|
||||
|
||||
<!-- Suppress top padding -->
|
||||
<Thickness x:Key="TabViewHeaderPadding">9,0,8,0</Thickness>
|
||||
<Thickness x:Key="TabViewHeaderPadding">9,0,5,0</Thickness>
|
||||
|
||||
<!-- Remove when implementing WinUI 2.6 -->
|
||||
<Thickness x:Key="FlyoutContentPadding">12</Thickness>
|
||||
<!-- Shadow that can be used by any control. -->
|
||||
<ThemeShadow x:Name="SharedShadow" />
|
||||
|
||||
<!-- Colored button which changes on hover/press -->
|
||||
<Style x:Key="ColorButtonStyle"
|
||||
TargetType="Button">
|
||||
<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}" />
|
||||
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
|
||||
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
|
||||
<Setter Property="FocusVisualMargin" Value="-3" />
|
||||
<Setter Property="Width" Value="32" />
|
||||
<Setter Property="Height" Value="32" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Grid>
|
||||
<Border x:Name="ColorButtonBackground"
|
||||
Background="{TemplateBinding Background}"
|
||||
BackgroundSizing="{TemplateBinding BackgroundSizing}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}" />
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
|
||||
<VisualState x:Name="PointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColorButtonBackground"
|
||||
Storyboard.TargetProperty="Opacity">
|
||||
<DiscreteObjectKeyFrame KeyTime="0"
|
||||
Value="0.9" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColorButtonBackground"
|
||||
Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0"
|
||||
Value="{ThemeResource ButtonBorderBrushPointerOver}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColorButtonBackground"
|
||||
Storyboard.TargetProperty="Opacity">
|
||||
<DiscreteObjectKeyFrame KeyTime="0"
|
||||
Value="0.8" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColorButtonBackground"
|
||||
Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0"
|
||||
Value="{ThemeResource ButtonBorderBrushPressed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColorButtonBackground"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0"
|
||||
Value="{ThemeResource ButtonBackgroundDisabled}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ColorButtonBackground"
|
||||
Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0"
|
||||
Value="{ThemeResource ButtonBorderBrushDisabled}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Dark">
|
||||
@@ -76,8 +153,6 @@
|
||||
|
||||
<StaticResource x:Key="UnfocusedBorderBrush"
|
||||
ResourceKey="ApplicationPageBackgroundThemeBrush" />
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
|
||||
<ResourceDictionary x:Key="Light">
|
||||
|
||||
@@ -189,6 +189,18 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
else if (const auto& realArgs = args.ActionArgs().try_as<SplitPaneArgs>())
|
||||
{
|
||||
if (const auto& newTerminalArgs{ realArgs.TerminalArgs() })
|
||||
{
|
||||
if (const auto index = realArgs.TerminalArgs().ProfileIndex())
|
||||
{
|
||||
if (gsl::narrow<uint32_t>(index.Value()) >= _settings.ActiveProfiles().Size())
|
||||
{
|
||||
args.Handled(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_SplitPane(realArgs.SplitDirection(),
|
||||
// This is safe, we're already filtering so the value is (0, 1)
|
||||
::base::saturated_cast<float>(realArgs.SplitSize()),
|
||||
@@ -266,116 +278,6 @@ namespace winrt::TerminalApp::implementation
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleScrollToMark(const IInspectable& /*sender*/,
|
||||
const ActionEventArgs& args)
|
||||
{
|
||||
if (const auto& realArgs = args.ActionArgs().try_as<ScrollToMarkArgs>())
|
||||
{
|
||||
_ApplyToActiveControls([realArgs](auto& control) {
|
||||
const auto currentOffset = control.ScrollOffset();
|
||||
const auto marks{ control.ScrollMarks() };
|
||||
|
||||
std::optional<Control::ScrollMark> tgt{ std::nullopt };
|
||||
|
||||
switch (realArgs.Direction())
|
||||
{
|
||||
case ScrollToMarkDirection::Last:
|
||||
{
|
||||
int highest = 0;
|
||||
for (const auto& mark : marks)
|
||||
{
|
||||
const auto newY = mark.Start.Y;
|
||||
if (newY > highest)
|
||||
{
|
||||
tgt = mark;
|
||||
highest = newY;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ScrollToMarkDirection::First:
|
||||
{
|
||||
int lowest = currentOffset;
|
||||
for (const auto& mark : marks)
|
||||
{
|
||||
const auto newY = mark.Start.Y;
|
||||
if (newY < lowest)
|
||||
{
|
||||
tgt = mark;
|
||||
lowest = newY;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ScrollToMarkDirection::Next:
|
||||
{
|
||||
int minDistance = INT_MAX;
|
||||
for (const auto& mark : marks)
|
||||
{
|
||||
const auto delta = mark.Start.Y - currentOffset;
|
||||
if (delta > 0 && delta < minDistance)
|
||||
{
|
||||
tgt = mark;
|
||||
minDistance = delta;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ScrollToMarkDirection::Previous:
|
||||
default:
|
||||
{
|
||||
int minDistance = INT_MAX;
|
||||
for (const auto& mark : marks)
|
||||
{
|
||||
const auto delta = currentOffset - mark.Start.Y;
|
||||
if (delta > 0 && delta < minDistance)
|
||||
{
|
||||
tgt = mark;
|
||||
minDistance = delta;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tgt.has_value())
|
||||
{
|
||||
control.ScrollViewport(tgt->Start.Y);
|
||||
}
|
||||
});
|
||||
}
|
||||
args.Handled(true);
|
||||
}
|
||||
void TerminalPage::_HandleAddMark(const IInspectable& /*sender*/,
|
||||
const ActionEventArgs& args)
|
||||
{
|
||||
if (const auto& realArgs = args.ActionArgs().try_as<AddMarkArgs>())
|
||||
{
|
||||
_ApplyToActiveControls([realArgs](auto& control) {
|
||||
Control::ScrollMark mark;
|
||||
mark.Color = realArgs.Color();
|
||||
control.AddMark(mark);
|
||||
});
|
||||
}
|
||||
args.Handled(true);
|
||||
}
|
||||
void TerminalPage::_HandleClearMark(const IInspectable& /*sender*/,
|
||||
const ActionEventArgs& args)
|
||||
{
|
||||
_ApplyToActiveControls([](auto& control) {
|
||||
control.ClearMark();
|
||||
});
|
||||
args.Handled(true);
|
||||
}
|
||||
void TerminalPage::_HandleClearAllMarks(const IInspectable& /*sender*/,
|
||||
const ActionEventArgs& args)
|
||||
{
|
||||
_ApplyToActiveControls([](auto& control) {
|
||||
control.ClearAllMarks();
|
||||
});
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleFindMatch(const IInspectable& /*sender*/,
|
||||
const ActionEventArgs& args)
|
||||
{
|
||||
@@ -415,6 +317,18 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
else if (const auto& realArgs = args.ActionArgs().try_as<NewTabArgs>())
|
||||
{
|
||||
if (const auto& newTerminalArgs{ realArgs.TerminalArgs() })
|
||||
{
|
||||
if (const auto index = newTerminalArgs.ProfileIndex())
|
||||
{
|
||||
if (gsl::narrow<uint32_t>(index.Value()) >= _settings.ActiveProfiles().Size())
|
||||
{
|
||||
args.Handled(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG_IF_FAILED(_OpenNewTab(realArgs.TerminalArgs()));
|
||||
args.Handled(true);
|
||||
}
|
||||
@@ -947,7 +861,7 @@ namespace winrt::TerminalApp::implementation
|
||||
if (WindowRenamer() == nullptr)
|
||||
{
|
||||
// We need to use FindName to lazy-load this object
|
||||
if (MUX::Controls::TeachingTip tip{ FindName(L"WindowRenamer").try_as<MUX::Controls::TeachingTip>() })
|
||||
if (auto tip{ FindName(L"WindowRenamer").try_as<MUX::Controls::TeachingTip>() })
|
||||
{
|
||||
tip.Closed({ get_weak(), &TerminalPage::_FocusActiveControl });
|
||||
}
|
||||
@@ -1119,4 +1033,14 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleSelectAll(const IInspectable& /*sender*/,
|
||||
const ActionEventArgs& args)
|
||||
{
|
||||
if (const auto& control{ _GetActiveControl() })
|
||||
{
|
||||
control.SelectAll();
|
||||
args.Handled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ AppCommandlineArgs::AppCommandlineArgs()
|
||||
// - nonzero return values are defined in CLI::ExitCodes
|
||||
int AppCommandlineArgs::ParseCommand(const Commandline& command)
|
||||
{
|
||||
const int argc = static_cast<int>(command.Argc());
|
||||
const auto argc = static_cast<int>(command.Argc());
|
||||
|
||||
// Stash a pointer to the current Commandline instance we're parsing.
|
||||
// When we're trying to parse the commandline for a new-tab/split-pane
|
||||
@@ -809,7 +809,7 @@ void AppCommandlineArgs::_addCommandsForArg(std::vector<Commandline>& commands,
|
||||
else
|
||||
{
|
||||
// Harder case: There was a match.
|
||||
const bool matchedFirstChar = match.position(0) == 0;
|
||||
const auto matchedFirstChar = match.position(0) == 0;
|
||||
// If the match was at the beginning of the string, then the
|
||||
// next arg should be "", since there was no content before the
|
||||
// delimiter. Otherwise, add one, since the regex will include
|
||||
@@ -1013,7 +1013,7 @@ int AppCommandlineArgs::ParseArgs(const winrt::Microsoft::Terminal::Settings::Mo
|
||||
// Convert the commandline into an array of args with
|
||||
// CommandLineToArgvW, similar to how the app typically does when
|
||||
// called from the commandline.
|
||||
int argc = 0;
|
||||
auto argc = 0;
|
||||
wil::unique_any<LPWSTR*, decltype(&::LocalFree), ::LocalFree> argv{ CommandLineToArgvW(args.Commandline().c_str(), &argc) };
|
||||
if (argv)
|
||||
{
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
AppKeyBindings() = default;
|
||||
|
||||
bool TryKeyChord(winrt::Microsoft::Terminal::Control::KeyChord const& kc);
|
||||
bool IsKeyChordExplicitlyUnbound(winrt::Microsoft::Terminal::Control::KeyChord const& kc);
|
||||
bool TryKeyChord(const winrt::Microsoft::Terminal::Control::KeyChord& kc);
|
||||
bool IsKeyChordExplicitlyUnbound(const winrt::Microsoft::Terminal::Control::KeyChord& kc);
|
||||
|
||||
void SetDispatch(const winrt::TerminalApp::ShortcutActionDispatch& dispatch);
|
||||
void SetActionMap(const Microsoft::Terminal::Settings::Model::IActionMapView& actionMap);
|
||||
|
||||
@@ -122,10 +122,10 @@ static Documents::Run _BuildErrorRun(const winrt::hstring& text, const ResourceD
|
||||
textRun.Text(text);
|
||||
|
||||
// Color the text red (light theme) or yellow (dark theme) based on the system theme
|
||||
winrt::IInspectable key = winrt::box_value(L"ErrorTextBrush");
|
||||
auto key = winrt::box_value(L"ErrorTextBrush");
|
||||
if (resources.HasKey(key))
|
||||
{
|
||||
winrt::IInspectable g = resources.Lookup(key);
|
||||
auto g = resources.Lookup(key);
|
||||
auto brush = g.try_as<winrt::Windows::UI::Xaml::Media::Brush>();
|
||||
textRun.Foreground(brush);
|
||||
}
|
||||
@@ -292,7 +292,7 @@ namespace winrt::TerminalApp::implementation
|
||||
_root->Maximized(true);
|
||||
}
|
||||
|
||||
if (WI_IsFlagSet(launchMode, LaunchMode::FullscreenMode))
|
||||
if (WI_IsFlagSet(launchMode, LaunchMode::FullscreenMode) && !IsQuakeWindow())
|
||||
{
|
||||
_root->SetFullscreen(true);
|
||||
}
|
||||
@@ -601,7 +601,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
winrt::Windows::Foundation::Size proposedSize{};
|
||||
|
||||
const float scale = static_cast<float>(dpi) / static_cast<float>(USER_DEFAULT_SCREEN_DPI);
|
||||
const auto scale = static_cast<float>(dpi) / static_cast<float>(USER_DEFAULT_SCREEN_DPI);
|
||||
if (const auto layout = _root->LoadPersistedLayout(_settings))
|
||||
{
|
||||
if (layout.InitialSize())
|
||||
@@ -781,7 +781,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - S_OK if we successfully parsed the settings, otherwise an appropriate HRESULT.
|
||||
[[nodiscard]] HRESULT AppLogic::_TryLoadSettings() noexcept
|
||||
{
|
||||
HRESULT hr = E_FAIL;
|
||||
auto hr = E_FAIL;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1123,6 +1123,22 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Used to tell the PTY connection that the window visibility has changed.
|
||||
// The underlying PTY might need to expose window visibility status to the
|
||||
// client application for the `::GetConsoleWindow()` API.
|
||||
// Arguments:
|
||||
// - showOrHide - True is show; false is hide.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void AppLogic::WindowVisibilityChanged(const bool showOrHide)
|
||||
{
|
||||
if (_root)
|
||||
{
|
||||
_root->WindowVisibilityChanged(showOrHide);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Implements the F7 handler (per GH#638)
|
||||
// - Implements the Alt handler (per GH#6421)
|
||||
@@ -1354,7 +1370,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// now.
|
||||
if (parsedTarget.empty())
|
||||
{
|
||||
int32_t windowId = WindowingBehaviorUseNew;
|
||||
auto windowId = WindowingBehaviorUseNew;
|
||||
switch (windowingBehavior)
|
||||
{
|
||||
case WindowingMode::UseNew:
|
||||
@@ -1375,7 +1391,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// window's ID:
|
||||
try
|
||||
{
|
||||
int32_t windowId = ::base::saturated_cast<int32_t>(std::stoi(parsedTarget));
|
||||
auto windowId = ::base::saturated_cast<int32_t>(std::stoi(parsedTarget));
|
||||
|
||||
// If the user provides _any_ negative number, then treat it as
|
||||
// -1, for "use a new window".
|
||||
|
||||
@@ -114,6 +114,7 @@ namespace winrt::TerminalApp::implementation
|
||||
bool OnDirectKeyEvent(const uint32_t vkey, const uint8_t scanCode, const bool down);
|
||||
|
||||
void CloseWindow(Microsoft::Terminal::Settings::Model::LaunchPosition position);
|
||||
void WindowVisibilityChanged(const bool showOrHide);
|
||||
|
||||
winrt::TerminalApp::TaskbarState TaskbarState();
|
||||
|
||||
@@ -207,6 +208,7 @@ namespace winrt::TerminalApp::implementation
|
||||
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);
|
||||
|
||||
#ifdef UNIT_TESTING
|
||||
friend class TerminalAppLocalTests::CommandlineTest;
|
||||
|
||||
@@ -91,6 +91,7 @@ namespace TerminalApp
|
||||
Single CalcSnappedDimension(Boolean widthOrHeight, Single dimension);
|
||||
void TitlebarClicked();
|
||||
void CloseWindow(Microsoft.Terminal.Settings.Model.LaunchPosition position);
|
||||
void WindowVisibilityChanged(Boolean showOrHide);
|
||||
|
||||
TaskbarState TaskbarState{ get; };
|
||||
|
||||
@@ -132,5 +133,6 @@ namespace TerminalApp
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> OpenSystemMenu;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> QuitRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, TerminalApp.SystemMenuChangeArgs> SystemMenuChangeRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Control.ShowWindowArgs> ShowWindowChanged;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,9 +67,9 @@ HSL ColorHelper::RgbToHsl(const winrt::Windows::UI::Color& color)
|
||||
|
||||
// three decimal places after the comma ought
|
||||
// to be enough for everybody - Bill Gates, 1981
|
||||
float finalH = std::roundf(h * 60);
|
||||
float finalS = std::roundf(s * 1000) / 1000;
|
||||
float finalL = std::roundf(l * 1000) / 1000;
|
||||
auto finalH = std::roundf(h * 60);
|
||||
auto finalS = std::roundf(s * 1000) / 1000;
|
||||
auto finalL = std::roundf(l * 1000) / 1000;
|
||||
|
||||
return HSL{ finalH, finalS, finalL };
|
||||
}
|
||||
@@ -264,6 +264,6 @@ float ColorHelper::GetLuminance(const winrt::Windows::UI::Color& color)
|
||||
{
|
||||
B = std::pow(((BsRGB + 0.055f) / 1.055f), 2.4f);
|
||||
}
|
||||
float luminance = (0.2126f * R) + (0.7152f * G) + (0.0722f * B);
|
||||
auto luminance = (0.2126f * R) + (0.7152f * G) + (0.0722f * B);
|
||||
return std::roundf(luminance * 10000) / 10000.f;
|
||||
}
|
||||
|
||||
@@ -31,11 +31,10 @@ namespace winrt::TerminalApp::implementation
|
||||
// - sender: the rectangle that got clicked
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void ColorPickupFlyout::ColorButton_Click(IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const&)
|
||||
void ColorPickupFlyout::ColorButton_Click(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
{
|
||||
auto button{ sender.as<Windows::UI::Xaml::Controls::Button>() };
|
||||
auto rectangle{ button.Content().as<Windows::UI::Xaml::Shapes::Rectangle>() };
|
||||
auto rectClr{ rectangle.Fill().as<Windows::UI::Xaml::Media::SolidColorBrush>() };
|
||||
auto rectClr{ button.Background().as<Windows::UI::Xaml::Media::SolidColorBrush>() };
|
||||
_ColorSelectedHandlers(rectClr.Color());
|
||||
Hide();
|
||||
}
|
||||
@@ -47,7 +46,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void ColorPickupFlyout::ClearColorButton_Click(IInspectable const&, Windows::UI::Xaml::RoutedEventArgs const&)
|
||||
void ColorPickupFlyout::ClearColorButton_Click(const IInspectable&, const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
{
|
||||
_ColorClearedHandlers();
|
||||
Hide();
|
||||
@@ -61,7 +60,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void ColorPickupFlyout::ShowColorPickerButton_Click(Windows::Foundation::IInspectable const&, Windows::UI::Xaml::RoutedEventArgs const&)
|
||||
void ColorPickupFlyout::ShowColorPickerButton_Click(const Windows::Foundation::IInspectable&, const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
{
|
||||
auto visibility = customColorPanel().Visibility();
|
||||
if (visibility == winrt::Windows::UI::Xaml::Visibility::Collapsed)
|
||||
@@ -81,7 +80,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void ColorPickupFlyout::CustomColorButton_Click(Windows::Foundation::IInspectable const&, Windows::UI::Xaml::RoutedEventArgs const&)
|
||||
void ColorPickupFlyout::CustomColorButton_Click(const Windows::Foundation::IInspectable&, const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
{
|
||||
auto color = customColorPicker().Color();
|
||||
_ColorSelectedHandlers(color);
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
ColorPickupFlyout();
|
||||
|
||||
void ColorButton_Click(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void ShowColorPickerButton_Click(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void CustomColorButton_Click(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void ClearColorButton_Click(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void ColorButton_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void ShowColorPickerButton_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void CustomColorButton_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void ClearColorButton_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void ColorPicker_ColorChanged(const Microsoft::UI::Xaml::Controls::ColorPicker&, const Microsoft::UI::Xaml::Controls::ColorChangedEventArgs& args);
|
||||
|
||||
WINRT_CALLBACK(ColorCleared, TerminalApp::ColorClearedArgs);
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
xmlns:local="using:TerminalApp"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
Placement="Bottom"
|
||||
ShouldConstrainToRootBounds="False"
|
||||
mc:Ignorable="d">
|
||||
<Flyout.FlyoutPresenterStyle>
|
||||
<Style TargetType="FlyoutPresenter">
|
||||
@@ -23,164 +25,105 @@
|
||||
MaximumRowsOrColumns="4"
|
||||
Orientation="Horizontal">
|
||||
<VariableSizedWrapGrid.Resources>
|
||||
<Style TargetType="Rectangle">
|
||||
<Setter Property="Width" Value="30" />
|
||||
<Setter Property="Height" Value="30" />
|
||||
</Style>
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Padding" Value="-1" />
|
||||
<Style x:Name="ColorPickerColorButtonStyle"
|
||||
BasedOn="{StaticResource ColorButtonStyle}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Margin" Value="2" />
|
||||
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource SystemBaseLowColor}" />
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource ColorPickerColorButtonStyle}"
|
||||
TargetType="Button" />
|
||||
</VariableSizedWrapGrid.Resources>
|
||||
|
||||
<Button x:Uid="CrimsonColorButton"
|
||||
AutomationProperties.Name="Crimson"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="Crimson" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="Crimson"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="SteelBlueColorButton"
|
||||
AutomationProperties.Name="SteelBlue"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="SteelBlue" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="SteelBlue"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="MediumSeaGreenColorButton"
|
||||
AutomationProperties.Name="MediumSeaGreen"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="MediumSeaGreen" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="MediumSeaGreen"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="DarkOrangeColorButton"
|
||||
AutomationProperties.Name="DarkOrange"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="DarkOrange" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="DarkOrange"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="MediumVioletRedColorButton"
|
||||
AutomationProperties.Name="MediumVioletRed"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="MediumVioletRed" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="MediumVioletRed"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="DodgerBlueColorButton"
|
||||
AutomationProperties.Name="DodgerBlue"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="DodgerBlue" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="DodgerBlue"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="LimeGreenColorButton"
|
||||
AutomationProperties.Name="LimeGreen"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="LimeGreen" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="LimeGreen"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="YellowColorButton"
|
||||
AutomationProperties.Name="Yellow"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="Yellow" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="Yellow"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="BlueVioletColorButton"
|
||||
AutomationProperties.Name="BlueViolet"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="BlueViolet" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="BlueViolet"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="SlateBlueColorButton"
|
||||
AutomationProperties.Name="SlateBlue"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="SlateBlue" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="SlateBlue"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="LimeColorButton"
|
||||
AutomationProperties.Name="Lime"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="Lime" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="Lime"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="TanColorButton"
|
||||
AutomationProperties.Name="Tan"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="Tan" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="Tan"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="MagentaColorButton"
|
||||
AutomationProperties.Name="Magenta"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="Magenta" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="Magenta"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="CyanColorButton"
|
||||
AutomationProperties.Name="Cyan"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="Cyan" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="Cyan"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="SkyBlueColorButton"
|
||||
AutomationProperties.Name="SkyBlue"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="SkyBlue" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="SkyBlue"
|
||||
Click="ColorButton_Click" />
|
||||
<Button x:Uid="DarkGrayColorButton"
|
||||
AutomationProperties.Name="DarkGray"
|
||||
Click="ColorButton_Click">
|
||||
<Button.Content>
|
||||
<Rectangle Fill="DarkGray" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
Background="DarkGray"
|
||||
Click="ColorButton_Click" />
|
||||
</VariableSizedWrapGrid>
|
||||
</Grid>
|
||||
<Grid Margin="0,12,0,0"
|
||||
Padding="-2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="0,12,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Button x:Name="ClearColorButton"
|
||||
x:Uid="TabColorClearButton"
|
||||
Grid.Column="0"
|
||||
Margin="2"
|
||||
HorizontalAlignment="Stretch"
|
||||
Click="ClearColorButton_Click"
|
||||
Content="Reset" />
|
||||
<ToggleButton x:Name="CustomColorButton"
|
||||
x:Uid="TabColorCustomButton"
|
||||
Grid.Column="1"
|
||||
Margin="2"
|
||||
HorizontalAlignment="Stretch"
|
||||
Click="ShowColorPickerButton_Click"
|
||||
Content="Custom"
|
||||
IsChecked="False" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<Grid x:Name="customColorPanel"
|
||||
Margin="16,0,0,0"
|
||||
Visibility="Collapsed">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel x:Name="customColorPanel"
|
||||
Margin="16,0,0,0"
|
||||
Spacing="12"
|
||||
Visibility="Collapsed">
|
||||
<muxc:ColorPicker x:Name="customColorPicker"
|
||||
Grid.Row="0"
|
||||
Margin="0,0,0,12"
|
||||
ColorChanged="ColorPicker_ColorChanged"
|
||||
FontSize="10"
|
||||
IsAlphaEnabled="False"
|
||||
@@ -198,6 +141,6 @@
|
||||
Click="CustomColorButton_Click"
|
||||
Content="OK"
|
||||
Style="{ThemeResource AccentButtonStyle}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
|
||||
@@ -18,7 +18,7 @@ using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
CommandLinePaletteItem::CommandLinePaletteItem(winrt::hstring const& commandLine) :
|
||||
CommandLinePaletteItem::CommandLinePaletteItem(const winrt::hstring& commandLine) :
|
||||
_CommandLine(commandLine)
|
||||
{
|
||||
Name(commandLine);
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace winrt::TerminalApp::implementation
|
||||
struct CommandLinePaletteItem : CommandLinePaletteItemT<CommandLinePaletteItem, PaletteItem>
|
||||
{
|
||||
CommandLinePaletteItem() = default;
|
||||
CommandLinePaletteItem(winrt::hstring const& commandLine);
|
||||
CommandLinePaletteItem(const winrt::hstring& commandLine);
|
||||
|
||||
WINRT_PROPERTY(winrt::hstring, CommandLine);
|
||||
};
|
||||
|
||||
@@ -39,17 +39,6 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
_switchToMode(CommandPaletteMode::ActionMode);
|
||||
|
||||
if (CommandPaletteShadow())
|
||||
{
|
||||
// Hook up the shadow on the command palette to the backdrop that
|
||||
// will actually show it. This needs to be done at runtime, and only
|
||||
// if the shadow actually exists. ThemeShadow isn't supported below
|
||||
// version 18362.
|
||||
CommandPaletteShadow().Receivers().Append(_shadowBackdrop());
|
||||
// "raise" the command palette up by 16 units, so it will cast a shadow.
|
||||
_backdrop().Translation({ 0, 0, 16 });
|
||||
}
|
||||
|
||||
// Whatever is hosting us will enable us by setting our visibility to
|
||||
// "Visible". When that happens, set focus to our search box.
|
||||
RegisterPropertyChangedCallback(UIElement::VisibilityProperty(), [this](auto&&, auto&&) {
|
||||
@@ -119,7 +108,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void CommandPalette::SelectNextItem(const bool moveDown)
|
||||
{
|
||||
auto selected = _filteredActionsView().SelectedIndex();
|
||||
const int numItems = ::base::saturated_cast<int>(_filteredActionsView().Items().Size());
|
||||
const auto numItems = ::base::saturated_cast<int>(_filteredActionsView().Items().Size());
|
||||
|
||||
// Do not try to select an item if
|
||||
// - the list is empty
|
||||
@@ -262,8 +251,8 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void CommandPalette::_previewKeyDownHandler(IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e)
|
||||
void CommandPalette::_previewKeyDownHandler(const IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
const auto key = e.OriginalKey();
|
||||
const auto scanCode = e.KeyStatus().ScanCode;
|
||||
@@ -411,8 +400,8 @@ namespace winrt::TerminalApp::implementation
|
||||
return handled;
|
||||
}
|
||||
|
||||
void CommandPalette::_keyUpHandler(IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e)
|
||||
void CommandPalette::_keyUpHandler(const IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e)
|
||||
{
|
||||
if (_currentMode == CommandPaletteMode::TabSwitchMode)
|
||||
{
|
||||
@@ -453,8 +442,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <unused>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_rootPointerPressed(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::Input::PointerRoutedEventArgs const& /*e*/)
|
||||
void CommandPalette::_rootPointerPressed(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Input::PointerRoutedEventArgs& /*e*/)
|
||||
{
|
||||
if (Visibility() != Visibility::Collapsed)
|
||||
{
|
||||
@@ -476,8 +465,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <unused>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_lostFocusHandler(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::RoutedEventArgs const& /*args*/)
|
||||
void CommandPalette::_lostFocusHandler(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& /*args*/)
|
||||
{
|
||||
const auto flyout = _searchBox().ContextFlyout();
|
||||
if (flyout && flyout.IsOpen())
|
||||
@@ -511,8 +500,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - e: the PointerRoutedEventArgs that we want to mark as handled
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_backdropPointerPressed(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e)
|
||||
void CommandPalette::_backdropPointerPressed(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e)
|
||||
{
|
||||
e.Handled(true);
|
||||
}
|
||||
@@ -525,8 +514,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - e: an ItemClickEventArgs who's ClickedItem() will be the command that was clicked on.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_listItemClicked(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::Controls::ItemClickEventArgs const& e)
|
||||
void CommandPalette::_listItemClicked(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::Controls::ItemClickEventArgs& e)
|
||||
{
|
||||
const auto selectedCommand = e.ClickedItem();
|
||||
if (const auto filteredCommand = selectedCommand.try_as<winrt::TerminalApp::FilteredCommand>())
|
||||
@@ -543,8 +532,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - sender: the button that got clicked
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_moveBackButtonClicked(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::RoutedEventArgs const&)
|
||||
void CommandPalette::_moveBackButtonClicked(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::RoutedEventArgs&)
|
||||
{
|
||||
_PreviewActionHandlers(*this, nullptr);
|
||||
_nestedActionStack.Clear();
|
||||
@@ -628,7 +617,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - command: the Command to dispatch. This might be null.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_dispatchCommand(winrt::TerminalApp::FilteredCommand const& filteredCommand)
|
||||
void CommandPalette::_dispatchCommand(const winrt::TerminalApp::FilteredCommand& filteredCommand)
|
||||
{
|
||||
if (_currentMode == CommandPaletteMode::CommandlineMode)
|
||||
{
|
||||
@@ -724,7 +713,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - filteredCommand - Selected filtered command - might be null
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_switchToTab(winrt::TerminalApp::FilteredCommand const& filteredCommand)
|
||||
void CommandPalette::_switchToTab(const winrt::TerminalApp::FilteredCommand& filteredCommand)
|
||||
{
|
||||
if (filteredCommand)
|
||||
{
|
||||
@@ -744,7 +733,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - filteredCommand - Selected filtered command - might be null
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_dispatchCommandline(winrt::TerminalApp::FilteredCommand const& command)
|
||||
void CommandPalette::_dispatchCommandline(const winrt::TerminalApp::FilteredCommand& command)
|
||||
{
|
||||
const auto filteredCommand = command ? command : _buildCommandLineCommand(winrt::hstring(_getTrimmedInput()));
|
||||
if (filteredCommand.has_value())
|
||||
@@ -804,8 +793,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <unused>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_filterTextChanged(IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::RoutedEventArgs const& /*args*/)
|
||||
void CommandPalette::_filterTextChanged(const IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& /*args*/)
|
||||
{
|
||||
if (_currentMode == CommandPaletteMode::CommandlineMode)
|
||||
{
|
||||
@@ -906,7 +895,7 @@ namespace winrt::TerminalApp::implementation
|
||||
_actionMap = actionMap;
|
||||
}
|
||||
|
||||
void CommandPalette::SetCommands(Collections::IVector<Command> const& actions)
|
||||
void CommandPalette::SetCommands(const Collections::IVector<Command>& actions)
|
||||
{
|
||||
_allCommands.Clear();
|
||||
for (const auto& action : actions)
|
||||
@@ -934,8 +923,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_bindTabs(
|
||||
Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase> const& source,
|
||||
Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand> const& target)
|
||||
const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase>& source,
|
||||
const Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand>& target)
|
||||
{
|
||||
target.Clear();
|
||||
for (const auto& tab : source)
|
||||
@@ -946,13 +935,13 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void CommandPalette::SetTabs(Collections::IObservableVector<TabBase> const& tabs, Collections::IObservableVector<TabBase> const& mruTabs)
|
||||
void CommandPalette::SetTabs(const Collections::IObservableVector<TabBase>& tabs, const Collections::IObservableVector<TabBase>& mruTabs)
|
||||
{
|
||||
_bindTabs(tabs, _tabActions);
|
||||
_bindTabs(mruTabs, _mruTabActions);
|
||||
}
|
||||
|
||||
void CommandPalette::EnableCommandPaletteMode(CommandPaletteLaunchMode const launchMode)
|
||||
void CommandPalette::EnableCommandPaletteMode(const CommandPaletteLaunchMode launchMode)
|
||||
{
|
||||
const auto mode = (launchMode == CommandPaletteLaunchMode::CommandLine) ?
|
||||
CommandPaletteMode::CommandlineMode :
|
||||
@@ -1088,11 +1077,11 @@ namespace winrt::TerminalApp::implementation
|
||||
// This allows WinUI to nicely animate the ListView as it changes.
|
||||
for (uint32_t i = 0; i < _filteredActions.Size() && i < actions.size(); i++)
|
||||
{
|
||||
for (uint32_t j = i; j < _filteredActions.Size(); j++)
|
||||
for (auto j = i; j < _filteredActions.Size(); j++)
|
||||
{
|
||||
if (_filteredActions.GetAt(j).Item() == actions[i].Item())
|
||||
{
|
||||
for (uint32_t k = i; k < j; k++)
|
||||
for (auto k = i; k < j; k++)
|
||||
{
|
||||
_filteredActions.RemoveAt(i);
|
||||
}
|
||||
@@ -1174,8 +1163,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_choosingItemContainer(
|
||||
Windows::UI::Xaml::Controls::ListViewBase const& /*sender*/,
|
||||
Windows::UI::Xaml::Controls::ChoosingItemContainerEventArgs const& args)
|
||||
const Windows::UI::Xaml::Controls::ListViewBase& /*sender*/,
|
||||
const Windows::UI::Xaml::Controls::ChoosingItemContainerEventArgs& args)
|
||||
{
|
||||
const auto dataTemplate = _itemTemplateSelector.SelectTemplate(args.Item());
|
||||
const auto itemContainer = args.ItemContainer();
|
||||
@@ -1223,8 +1212,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CommandPalette::_containerContentChanging(
|
||||
Windows::UI::Xaml::Controls::ListViewBase const& /*sender*/,
|
||||
Windows::UI::Xaml::Controls::ContainerContentChangingEventArgs const& args)
|
||||
const Windows::UI::Xaml::Controls::ListViewBase& /*sender*/,
|
||||
const Windows::UI::Xaml::Controls::ContainerContentChangingEventArgs& args)
|
||||
{
|
||||
const auto itemContainer = args.ItemContainer();
|
||||
if (args.InRecycleQueue() && itemContainer && itemContainer.ContentTemplate())
|
||||
@@ -1314,23 +1303,4 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
ApplicationState::SharedInstance().RecentCommands(single_threaded_vector(std::move(newRecentCommands)));
|
||||
}
|
||||
|
||||
void CommandPalette::PositionManually(Windows::Foundation::Point origin, Windows::Foundation::Size size)
|
||||
{
|
||||
Controls::Grid::SetRow(_backdrop(), 0);
|
||||
Controls::Grid::SetColumn(_backdrop(), 0);
|
||||
Controls::Grid::SetRowSpan(_backdrop(), 2);
|
||||
Controls::Grid::SetColumnSpan(_backdrop(), 3);
|
||||
|
||||
_backdrop().Width(size.Width);
|
||||
_backdrop().Height(size.Height);
|
||||
|
||||
_backdrop().HorizontalAlignment(HorizontalAlignment::Left);
|
||||
_backdrop().VerticalAlignment(VerticalAlignment::Top);
|
||||
|
||||
Windows::UI::Xaml::Thickness margins{};
|
||||
margins.Left = origin.X;
|
||||
margins.Top = origin.Y;
|
||||
_backdrop().Margin(margins);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::FilteredCommand> FilteredActions();
|
||||
|
||||
void SetCommands(Windows::Foundation::Collections::IVector<Microsoft::Terminal::Settings::Model::Command> const& actions);
|
||||
void SetTabs(Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase> const& tabs, Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase> const& mruTabs);
|
||||
void SetCommands(const Windows::Foundation::Collections::IVector<Microsoft::Terminal::Settings::Model::Command>& actions);
|
||||
void SetTabs(const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase>& tabs, const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase>& mruTabs);
|
||||
void SetActionMap(const Microsoft::Terminal::Settings::Model::IActionMapView& actionMap);
|
||||
|
||||
bool OnDirectKeyEvent(const uint32_t vkey, const uint8_t scanCode, const bool down);
|
||||
@@ -46,8 +46,6 @@ namespace winrt::TerminalApp::implementation
|
||||
void EnableTabSwitcherMode(const uint32_t startIdx, Microsoft::Terminal::Settings::Model::TabSwitcherMode tabSwitcherMode);
|
||||
void EnableTabSearchMode();
|
||||
|
||||
void PositionManually(Windows::Foundation::Point origin, Windows::Foundation::Size size);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, NoMatchesText, _PropertyChangedHandlers);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, SearchBoxPlaceholderText, _PropertyChangedHandlers);
|
||||
@@ -73,28 +71,28 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
bool _lastFilterTextWasEmpty{ true };
|
||||
|
||||
void _filterTextChanged(Windows::Foundation::IInspectable const& sender,
|
||||
Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void _previewKeyDownHandler(Windows::Foundation::IInspectable const& sender,
|
||||
Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e);
|
||||
void _filterTextChanged(const Windows::Foundation::IInspectable& sender,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
void _previewKeyDownHandler(const Windows::Foundation::IInspectable& sender,
|
||||
const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
|
||||
void _keyUpHandler(Windows::Foundation::IInspectable const& sender,
|
||||
Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e);
|
||||
void _keyUpHandler(const Windows::Foundation::IInspectable& sender,
|
||||
const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e);
|
||||
|
||||
void _selectedCommandChanged(Windows::Foundation::IInspectable const& sender,
|
||||
Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void _selectedCommandChanged(const Windows::Foundation::IInspectable& sender,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
|
||||
void _updateUIForStackChange();
|
||||
|
||||
void _rootPointerPressed(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);
|
||||
void _rootPointerPressed(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e);
|
||||
|
||||
void _lostFocusHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
|
||||
void _lostFocusHandler(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
|
||||
void _backdropPointerPressed(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);
|
||||
void _backdropPointerPressed(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e);
|
||||
|
||||
void _listItemClicked(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Controls::ItemClickEventArgs const& e);
|
||||
void _listItemClicked(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::Controls::ItemClickEventArgs& e);
|
||||
|
||||
void _moveBackButtonClicked(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const&);
|
||||
void _moveBackButtonClicked(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs&);
|
||||
|
||||
void _updateFilteredActions();
|
||||
|
||||
@@ -116,14 +114,14 @@ namespace winrt::TerminalApp::implementation
|
||||
Microsoft::Terminal::Settings::Model::TabSwitcherMode _tabSwitcherMode;
|
||||
uint32_t _switcherStartIdx;
|
||||
|
||||
void _bindTabs(Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase> const& source, Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand> const& target);
|
||||
void _bindTabs(const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::TabBase>& source, const Windows::Foundation::Collections::IVector<winrt::TerminalApp::FilteredCommand>& target);
|
||||
void _anchorKeyUpHandler();
|
||||
|
||||
winrt::Windows::UI::Xaml::Controls::ListView::SizeChanged_revoker _sizeChangedRevoker;
|
||||
|
||||
void _dispatchCommand(winrt::TerminalApp::FilteredCommand const& command);
|
||||
void _dispatchCommandline(winrt::TerminalApp::FilteredCommand const& command);
|
||||
void _switchToTab(winrt::TerminalApp::FilteredCommand const& command);
|
||||
void _dispatchCommand(const winrt::TerminalApp::FilteredCommand& command);
|
||||
void _dispatchCommandline(const winrt::TerminalApp::FilteredCommand& command);
|
||||
void _switchToTab(const winrt::TerminalApp::FilteredCommand& command);
|
||||
static std::optional<winrt::TerminalApp::FilteredCommand> _buildCommandLineCommand(const winrt::hstring& commandLine);
|
||||
|
||||
void _dismissPalette();
|
||||
@@ -136,8 +134,8 @@ namespace winrt::TerminalApp::implementation
|
||||
static void _updateRecentCommands(const winrt::hstring& command);
|
||||
::TerminalApp::AppCommandlineArgs _appArgs;
|
||||
|
||||
void _choosingItemContainer(Windows::UI::Xaml::Controls::ListViewBase const& sender, Windows::UI::Xaml::Controls::ChoosingItemContainerEventArgs const& args);
|
||||
void _containerContentChanging(Windows::UI::Xaml::Controls::ListViewBase const& sender, Windows::UI::Xaml::Controls::ContainerContentChangingEventArgs const& args);
|
||||
void _choosingItemContainer(const Windows::UI::Xaml::Controls::ListViewBase& sender, const Windows::UI::Xaml::Controls::ChoosingItemContainerEventArgs& args);
|
||||
void _containerContentChanging(const Windows::UI::Xaml::Controls::ListViewBase& sender, const Windows::UI::Xaml::Controls::ContainerContentChangingEventArgs& args);
|
||||
winrt::TerminalApp::PaletteItemTemplateSelector _itemTemplateSelector{ nullptr };
|
||||
std::unordered_map<Windows::UI::Xaml::DataTemplate, std::unordered_set<Windows::UI::Xaml::Controls::Primitives::SelectorItem>> _listViewItemsCache;
|
||||
Windows::UI::Xaml::DataTemplate _listItemTemplate;
|
||||
|
||||
@@ -33,8 +33,6 @@ namespace TerminalApp
|
||||
void EnableTabSwitcherMode(UInt32 startIdx, Microsoft.Terminal.Settings.Model.TabSwitcherMode tabSwitcherMode);
|
||||
void EnableTabSearchMode();
|
||||
|
||||
void PositionManually(Windows.Foundation.Point origin, Windows.Foundation.Size size);
|
||||
|
||||
event Windows.Foundation.TypedEventHandler<CommandPalette, TabBase> SwitchToTabRequested;
|
||||
event Windows.Foundation.TypedEventHandler<CommandPalette, Microsoft.Terminal.Settings.Model.Command> DispatchCommandRequested;
|
||||
event Windows.Foundation.TypedEventHandler<CommandPalette, String> CommandLineExecutionRequested;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:SettingsModel="using:Microsoft.Terminal.Settings.Model"
|
||||
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:TerminalApp"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -24,13 +23,6 @@
|
||||
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
<!--
|
||||
ThemeShadow is only on 18362. This "Windows10version1903" bit
|
||||
adds it conditionally
|
||||
-->
|
||||
<Windows10version1903:ThemeShadow x:Name="CommandPaletteShadow" />
|
||||
|
||||
<!-- This creates an instance of our CommandKeyChordVisibilityConverter we can reference below -->
|
||||
<local:EmptyStringVisibilityConverter x:Key="CommandKeyChordVisibilityConverter" />
|
||||
<local:EmptyStringVisibilityConverter x:Key="ParsedCommandLineTextVisibilityConverter" />
|
||||
@@ -142,16 +134,11 @@
|
||||
Text="{x:Bind Item.KeyChordText, Mode=OneWay}" />
|
||||
</Border>
|
||||
|
||||
<!-- xE70E is ChevronUp. Rotated 90 degrees, it's _ChevronRight_ -->
|
||||
<FontIcon Grid.Column="2"
|
||||
HorizontalAlignment="Right"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
Glyph="">
|
||||
|
||||
<FontIcon.RenderTransform>
|
||||
<RotateTransform Angle="90" CenterX="0.5" CenterY="0.5" />
|
||||
</FontIcon.RenderTransform>
|
||||
</FontIcon>
|
||||
FontSize="12"
|
||||
Glyph="" />
|
||||
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
@@ -228,48 +215,13 @@
|
||||
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Dark">
|
||||
<Style x:Key="CommandPaletteBackground"
|
||||
TargetType="Grid">
|
||||
<Setter Property="Background" Value="#333333" />
|
||||
</Style>
|
||||
<!-- TextBox colors ! -->
|
||||
<SolidColorBrush x:Key="TextControlBackground"
|
||||
Color="#333333" />
|
||||
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
|
||||
Color="#B5B5B5" />
|
||||
<SolidColorBrush x:Key="TextControlForeground"
|
||||
Color="#B5B5B5" />
|
||||
<SolidColorBrush x:Key="TextControlBorderBrush"
|
||||
Color="#404040" />
|
||||
<SolidColorBrush x:Key="TextControlButtonForeground"
|
||||
Color="#B5B5B5" />
|
||||
|
||||
<SolidColorBrush x:Key="TextControlBackgroundPointerOver"
|
||||
Color="#404040" />
|
||||
<SolidColorBrush x:Key="TextControlForegroundPointerOver"
|
||||
Color="#FFFFFF" />
|
||||
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
|
||||
Color="#404040" />
|
||||
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
|
||||
Color="#FF4343" />
|
||||
|
||||
<SolidColorBrush x:Key="TextControlBackgroundFocused"
|
||||
Color="#333333" />
|
||||
<SolidColorBrush x:Key="TextControlForegroundFocused"
|
||||
Color="#FFFFFF" />
|
||||
<SolidColorBrush x:Key="TextControlBorderBrushFocused"
|
||||
Color="#404040" />
|
||||
<SolidColorBrush x:Key="TextControlButtonForegroundPressed"
|
||||
Color="#FFFFFF" />
|
||||
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
|
||||
Color="#FF4343" />
|
||||
|
||||
<!-- KeyChordText styles -->
|
||||
<Style x:Key="KeyChordBorderStyle"
|
||||
TargetType="Border">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="1" />
|
||||
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
|
||||
<Setter Property="CornerRadius" Value="2" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
</Style>
|
||||
<Style x:Key="KeyChordTextBlockStyle"
|
||||
@@ -281,9 +233,9 @@
|
||||
<Style x:Key="ParsedCommandLineBorderStyle"
|
||||
TargetType="Border">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="1" />
|
||||
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
|
||||
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}" />
|
||||
</Style>
|
||||
<Style x:Key="ParsedCommandLineTextBlockStyle"
|
||||
TargetType="TextBlock">
|
||||
@@ -291,42 +243,13 @@
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<Style x:Key="CommandPaletteBackground"
|
||||
TargetType="Grid">
|
||||
<Setter Property="Background" Value="#CCCCCC" />
|
||||
</Style>
|
||||
<!-- TextBox colors ! -->
|
||||
<SolidColorBrush x:Key="TextControlBackground"
|
||||
Color="#CCCCCC" />
|
||||
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
|
||||
Color="#636363" />
|
||||
<SolidColorBrush x:Key="TextControlBorderBrush"
|
||||
Color="#636363" />
|
||||
<SolidColorBrush x:Key="TextControlButtonForeground"
|
||||
Color="#636363" />
|
||||
|
||||
<SolidColorBrush x:Key="TextControlBackgroundPointerOver"
|
||||
Color="#DADADA" />
|
||||
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
|
||||
Color="#636363" />
|
||||
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
|
||||
Color="#FF4343" />
|
||||
|
||||
<SolidColorBrush x:Key="TextControlBackgroundFocused"
|
||||
Color="#CCCCCC" />
|
||||
<SolidColorBrush x:Key="TextControlBorderBrushFocused"
|
||||
Color="#636363" />
|
||||
<SolidColorBrush x:Key="TextControlButtonForegroundPressed"
|
||||
Color="#FFFFFF" />
|
||||
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
|
||||
Color="#FF4343" />
|
||||
|
||||
<!-- KeyChordText styles -->
|
||||
<Style x:Key="KeyChordBorderStyle"
|
||||
TargetType="Border">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="1" />
|
||||
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
|
||||
<Setter Property="CornerRadius" Value="2" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
</Style>
|
||||
<Style x:Key="KeyChordTextBlockStyle"
|
||||
@@ -338,9 +261,9 @@
|
||||
<Style x:Key="ParsedCommandLineBorderStyle"
|
||||
TargetType="Border">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="1" />
|
||||
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
|
||||
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}" />
|
||||
</Style>
|
||||
<Style x:Key="ParsedCommandLineTextBlockStyle"
|
||||
TargetType="TextBlock">
|
||||
@@ -348,10 +271,6 @@
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<Style x:Key="CommandPaletteBackground"
|
||||
TargetType="Grid">
|
||||
<Setter Property="Background" Value="{ThemeResource SystemColorWindowColor}" />
|
||||
</Style>
|
||||
|
||||
<!-- KeyChordText styles (use XAML defaults for High Contrast theme) -->
|
||||
<Style x:Key="KeyChordBorderStyle"
|
||||
@@ -381,37 +300,23 @@
|
||||
<RowDefinition Height="2*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--
|
||||
Setting the row/col span of this shadow backdrop is a bit of a hack. In
|
||||
order to receive pointer events, an element needs to be _not_ transparent.
|
||||
However, we want to be able to eat all the clicks outside the immediate
|
||||
bounds of the command palette, and we don't want a semi-transparent overlay
|
||||
over all of the UI. Fortunately, if we make this _shadowBackdrop the size of
|
||||
the entire page, then it can be mostly transparent, and cause the root grid
|
||||
to receive clicks _anywhere_ in its bounds.
|
||||
-->
|
||||
|
||||
<Grid x:Name="_shadowBackdrop"
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="Transparent" />
|
||||
|
||||
<Grid x:Name="_backdrop"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="8"
|
||||
Padding="0,8,0,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top"
|
||||
Windows10version1903:Shadow="{StaticResource CommandPaletteShadow}"
|
||||
Background="{ThemeResource FlyoutPresenterBackground}"
|
||||
BorderBrush="{ThemeResource FlyoutBorderThemeBrush}"
|
||||
BorderThickness="{ThemeResource FlyoutBorderThemeThickness}"
|
||||
CornerRadius="{ThemeResource OverlayCornerRadius}"
|
||||
PointerPressed="_backdropPointerPressed"
|
||||
Style="{ThemeResource CommandPaletteBackground}">
|
||||
Shadow="{StaticResource SharedShadow}"
|
||||
Translation="0,0,32">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
@@ -419,7 +324,7 @@
|
||||
|
||||
<TextBox x:Name="_searchBox"
|
||||
Grid.Row="0"
|
||||
Margin="8"
|
||||
Margin="8,0,8,8"
|
||||
Padding="18,8,8,8"
|
||||
IsSpellCheckEnabled="False"
|
||||
PlaceholderText="{x:Bind SearchBoxPlaceholderText, Mode=OneWay}"
|
||||
@@ -428,45 +333,39 @@
|
||||
|
||||
<TextBlock x:Name="_prefixCharacter"
|
||||
Grid.Row="0"
|
||||
Margin="16,16,0,-8"
|
||||
Margin="8,0,8,8"
|
||||
Padding="8,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="{x:Bind PrefixCharacter, Mode=OneWay}"
|
||||
Visibility="{x:Bind PrefixCharacter, Mode=OneWay, Converter={StaticResource ParentCommandVisibilityConverter}}" />
|
||||
|
||||
<StackPanel Grid.Row="1"
|
||||
Padding="16,0,16,4"
|
||||
Margin="8,0,8,8"
|
||||
Orientation="Horizontal"
|
||||
Visibility="{x:Bind ParentCommandName, Mode=OneWay, Converter={StaticResource ParentCommandVisibilityConverter}}">
|
||||
|
||||
<Button x:Name="_parentCommandBackButton"
|
||||
x:Uid="ParentCommandBackButton"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
Click="_moveBackButtonClicked"
|
||||
ClickMode="Press">
|
||||
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="12"
|
||||
FontSize="11"
|
||||
Glyph="" />
|
||||
</Button>
|
||||
|
||||
<TextBlock x:Name="_parentCommandText"
|
||||
Grid.Row="1"
|
||||
Padding="16,0,16,4"
|
||||
Padding="16,4"
|
||||
VerticalAlignment="Center"
|
||||
FontStyle="Italic"
|
||||
Text="{x:Bind ParentCommandName, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock x:Name="_noMatchesText"
|
||||
Grid.Row="1"
|
||||
Padding="16"
|
||||
FontStyle="Italic"
|
||||
Text="{x:Bind NoMatchesText, Mode=OneWay}"
|
||||
Visibility="Collapsed" />
|
||||
|
||||
<Border Grid.Row="1"
|
||||
Padding="16"
|
||||
Margin="8,0,8,8"
|
||||
Padding="16,12"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Style="{ThemeResource ParsedCommandLineBorderStyle}"
|
||||
@@ -480,8 +379,20 @@
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
|
||||
<Border x:Name="_noMatchesText"
|
||||
Grid.Row="3"
|
||||
Height="36"
|
||||
Margin="8,0,8,8"
|
||||
Visibility="Collapsed">
|
||||
<TextBlock Padding="12,0"
|
||||
VerticalAlignment="Center"
|
||||
FontStyle="Italic"
|
||||
Text="{x:Bind NoMatchesText, Mode=OneWay}" />
|
||||
</Border>
|
||||
|
||||
<ListView x:Name="_filteredActionsView"
|
||||
Grid.Row="2"
|
||||
Grid.Row="3"
|
||||
Padding="4,-2,4,6"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
AllowDrop="False"
|
||||
|
||||
@@ -27,8 +27,8 @@ const std::vector<std::string>& Commandline::Args() const
|
||||
void Commandline::AddArg(const std::wstring& nextArg)
|
||||
{
|
||||
// Attempt to convert '\;' in the arg to just '\', removing the escaping
|
||||
std::wstring modifiedArg{ nextArg };
|
||||
size_t pos = modifiedArg.find(EscapedDelimiter, 0);
|
||||
auto modifiedArg{ nextArg };
|
||||
auto pos = modifiedArg.find(EscapedDelimiter, 0);
|
||||
while (pos != std::string::npos)
|
||||
{
|
||||
modifiedArg.replace(pos, EscapedDelimiter.length(), Delimiter);
|
||||
|
||||
@@ -39,17 +39,17 @@ namespace winrt::Microsoft::TerminalApp::implementation
|
||||
|
||||
_wrappedConnection.Start();
|
||||
}
|
||||
void WriteInput(hstring const& data)
|
||||
void WriteInput(const hstring& data)
|
||||
{
|
||||
_pairedTap->_PrintInput(data);
|
||||
_wrappedConnection.WriteInput(data);
|
||||
}
|
||||
void Resize(uint32_t rows, uint32_t columns) { _wrappedConnection.Resize(rows, columns); }
|
||||
void Close() { _wrappedConnection.Close(); }
|
||||
winrt::event_token TerminalOutput(TerminalOutputHandler const& args) { return _wrappedConnection.TerminalOutput(args); };
|
||||
void TerminalOutput(winrt::event_token const& token) noexcept { _wrappedConnection.TerminalOutput(token); };
|
||||
winrt::event_token StateChanged(TypedEventHandler<ITerminalConnection, IInspectable> const& handler) { return _wrappedConnection.StateChanged(handler); };
|
||||
void StateChanged(winrt::event_token const& token) noexcept { _wrappedConnection.StateChanged(token); };
|
||||
winrt::event_token TerminalOutput(const TerminalOutputHandler& args) { return _wrappedConnection.TerminalOutput(args); };
|
||||
void TerminalOutput(const winrt::event_token& token) noexcept { _wrappedConnection.TerminalOutput(token); };
|
||||
winrt::event_token StateChanged(const TypedEventHandler<ITerminalConnection, IInspectable>& handler) { return _wrappedConnection.StateChanged(handler); };
|
||||
void StateChanged(const winrt::event_token& token) noexcept { _wrappedConnection.StateChanged(token); };
|
||||
ConnectionState State() const noexcept { return _wrappedConnection.State(); }
|
||||
|
||||
private:
|
||||
@@ -78,7 +78,7 @@ namespace winrt::Microsoft::TerminalApp::implementation
|
||||
_start.count_down();
|
||||
}
|
||||
|
||||
void DebugTapConnection::WriteInput(hstring const& data)
|
||||
void DebugTapConnection::WriteInput(const hstring& data)
|
||||
{
|
||||
// If the user types into the tap side, forward it to the input side
|
||||
if (auto strongInput{ _inputSide.get() })
|
||||
@@ -111,7 +111,15 @@ namespace winrt::Microsoft::TerminalApp::implementation
|
||||
|
||||
void DebugTapConnection::_OutputHandler(const hstring str)
|
||||
{
|
||||
_TerminalOutputHandlers(til::visualize_control_codes(str));
|
||||
auto output = til::visualize_control_codes(str);
|
||||
// To make the output easier to read, we introduce a line break whenever
|
||||
// an LF control is encountered. But at this point, the LF would have
|
||||
// been converted to U+240A (␊), so that's what we need to search for.
|
||||
for (size_t lfPos = 0; (lfPos = output.find(L'\u240A', lfPos)) != std::wstring::npos;)
|
||||
{
|
||||
output.insert(++lfPos, L"\r\n");
|
||||
}
|
||||
_TerminalOutputHandlers(output);
|
||||
}
|
||||
|
||||
// Called by the DebugInputTapConnection to print user input
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace winrt::Microsoft::TerminalApp::implementation
|
||||
void Initialize(const Windows::Foundation::Collections::ValueSet& /*settings*/){};
|
||||
~DebugTapConnection();
|
||||
void Start();
|
||||
void WriteInput(hstring const& data);
|
||||
void WriteInput(const hstring& data);
|
||||
void Resize(uint32_t rows, uint32_t columns);
|
||||
void Close();
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ConnectionState State() const noexcept;
|
||||
|
||||
@@ -18,20 +18,20 @@ namespace winrt::TerminalApp::implementation
|
||||
// - value: the input object to attempt to convert into a Visibility.
|
||||
// Return Value:
|
||||
// - Visible if the object was a string and wasn't the empty string.
|
||||
Foundation::IInspectable EmptyStringVisibilityConverter::Convert(Foundation::IInspectable const& value,
|
||||
Windows::UI::Xaml::Interop::TypeName const& /* targetType */,
|
||||
Foundation::IInspectable const& /* parameter */,
|
||||
hstring const& /* language */)
|
||||
Foundation::IInspectable EmptyStringVisibilityConverter::Convert(const Foundation::IInspectable& value,
|
||||
const Windows::UI::Xaml::Interop::TypeName& /* targetType */,
|
||||
const Foundation::IInspectable& /* parameter */,
|
||||
const hstring& /* language */)
|
||||
{
|
||||
const auto& name = winrt::unbox_value_or<hstring>(value, L"");
|
||||
return winrt::box_value(name.empty() ? Visibility::Collapsed : Visibility::Visible);
|
||||
}
|
||||
|
||||
// unused for one-way bindings
|
||||
Foundation::IInspectable EmptyStringVisibilityConverter::ConvertBack(Foundation::IInspectable const& /* value */,
|
||||
Windows::UI::Xaml::Interop::TypeName const& /* targetType */,
|
||||
Foundation::IInspectable const& /* parameter */,
|
||||
hstring const& /* language */)
|
||||
Foundation::IInspectable EmptyStringVisibilityConverter::ConvertBack(const Foundation::IInspectable& /* value */,
|
||||
const Windows::UI::Xaml::Interop::TypeName& /* targetType */,
|
||||
const Foundation::IInspectable& /* parameter */,
|
||||
const hstring& /* language */)
|
||||
{
|
||||
throw hresult_not_implemented();
|
||||
}
|
||||
|
||||
@@ -8,15 +8,15 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
EmptyStringVisibilityConverter() = default;
|
||||
|
||||
Windows::Foundation::IInspectable Convert(Windows::Foundation::IInspectable const& value,
|
||||
Windows::UI::Xaml::Interop::TypeName const& targetType,
|
||||
Windows::Foundation::IInspectable const& parameter,
|
||||
hstring const& language);
|
||||
Windows::Foundation::IInspectable Convert(const Windows::Foundation::IInspectable& value,
|
||||
const Windows::UI::Xaml::Interop::TypeName& targetType,
|
||||
const Windows::Foundation::IInspectable& parameter,
|
||||
const hstring& language);
|
||||
|
||||
Windows::Foundation::IInspectable ConvertBack(Windows::Foundation::IInspectable const& value,
|
||||
Windows::UI::Xaml::Interop::TypeName const& targetType,
|
||||
Windows::Foundation::IInspectable const& parameter,
|
||||
hstring const& language);
|
||||
Windows::Foundation::IInspectable ConvertBack(const Windows::Foundation::IInspectable& value,
|
||||
const Windows::UI::Xaml::Interop::TypeName& targetType,
|
||||
const Windows::Foundation::IInspectable& parameter,
|
||||
const hstring& language);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
// This class is a wrapper of PaletteItem, that is used as an item of a filterable list in CommandPalette.
|
||||
// It manages a highlighted text that is computed by matching search filter characters to item name
|
||||
FilteredCommand::FilteredCommand(winrt::TerminalApp::PaletteItem const& item) :
|
||||
FilteredCommand::FilteredCommand(const winrt::TerminalApp::PaletteItem& item) :
|
||||
_Item(item),
|
||||
_Filter(L""),
|
||||
_Weight(0)
|
||||
@@ -39,7 +39,7 @@ namespace winrt::TerminalApp::implementation
|
||||
});
|
||||
}
|
||||
|
||||
void FilteredCommand::UpdateFilter(winrt::hstring const& filter)
|
||||
void FilteredCommand::UpdateFilter(const winrt::hstring& filter)
|
||||
{
|
||||
// If the filter was not changed we want to prevent the re-computation of matching
|
||||
// that might result in triggering a notification event
|
||||
@@ -74,7 +74,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
const auto segments = winrt::single_threaded_observable_vector<winrt::TerminalApp::HighlightedTextSegment>();
|
||||
auto commandName = _Item.Name();
|
||||
bool isProcessingMatchedSegment = false;
|
||||
auto isProcessingMatchedSegment = false;
|
||||
uint32_t nextOffsetToReport = 0;
|
||||
uint32_t currentOffset = 0;
|
||||
|
||||
@@ -191,8 +191,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - the relative weight of this match
|
||||
int FilteredCommand::_computeWeight()
|
||||
{
|
||||
int result = 0;
|
||||
bool isNextSegmentWordBeginning = true;
|
||||
auto result = 0;
|
||||
auto isNextSegmentWordBeginning = true;
|
||||
|
||||
for (const auto& segment : _HighlightedName.Segments())
|
||||
{
|
||||
@@ -225,7 +225,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - other: another instance of FilteredCommand interface
|
||||
// Return Value:
|
||||
// - Returns true if the first is "bigger" (aka should appear first)
|
||||
int FilteredCommand::Compare(winrt::TerminalApp::FilteredCommand const& first, winrt::TerminalApp::FilteredCommand const& second)
|
||||
int FilteredCommand::Compare(const winrt::TerminalApp::FilteredCommand& first, const winrt::TerminalApp::FilteredCommand& second)
|
||||
{
|
||||
auto firstWeight{ first.Weight() };
|
||||
auto secondWeight{ second.Weight() };
|
||||
|
||||
@@ -17,11 +17,11 @@ namespace winrt::TerminalApp::implementation
|
||||
struct FilteredCommand : FilteredCommandT<FilteredCommand>
|
||||
{
|
||||
FilteredCommand() = default;
|
||||
FilteredCommand(winrt::TerminalApp::PaletteItem const& item);
|
||||
FilteredCommand(const winrt::TerminalApp::PaletteItem& item);
|
||||
|
||||
void UpdateFilter(winrt::hstring const& filter);
|
||||
void UpdateFilter(const winrt::hstring& filter);
|
||||
|
||||
static int Compare(winrt::TerminalApp::FilteredCommand const& first, winrt::TerminalApp::FilteredCommand const& second);
|
||||
static int Compare(const winrt::TerminalApp::FilteredCommand& first, const winrt::TerminalApp::FilteredCommand& second);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::TerminalApp::PaletteItem, Item, _PropertyChangedHandlers, nullptr);
|
||||
|
||||
@@ -18,13 +18,13 @@ using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
HighlightedTextSegment::HighlightedTextSegment(winrt::hstring const& textSegment, bool isHighlighted) :
|
||||
HighlightedTextSegment::HighlightedTextSegment(const winrt::hstring& textSegment, bool isHighlighted) :
|
||||
_TextSegment(textSegment),
|
||||
_IsHighlighted(isHighlighted)
|
||||
{
|
||||
}
|
||||
|
||||
HighlightedText::HighlightedText(Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment> const& segments) :
|
||||
HighlightedText::HighlightedText(const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment>& segments) :
|
||||
_Segments(segments)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace winrt::TerminalApp::implementation
|
||||
struct HighlightedTextSegment : HighlightedTextSegmentT<HighlightedTextSegment>
|
||||
{
|
||||
HighlightedTextSegment() = default;
|
||||
HighlightedTextSegment(winrt::hstring const& text, bool isHighlighted);
|
||||
HighlightedTextSegment(const winrt::hstring& text, bool isHighlighted);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, TextSegment, _PropertyChangedHandlers);
|
||||
@@ -23,7 +23,7 @@ namespace winrt::TerminalApp::implementation
|
||||
struct HighlightedText : HighlightedTextT<HighlightedText>
|
||||
{
|
||||
HighlightedText() = default;
|
||||
HighlightedText(Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment> const& segments);
|
||||
HighlightedText(const Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment>& segments);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(Windows::Foundation::Collections::IObservableVector<winrt::TerminalApp::HighlightedTextSegment>, Segments, _PropertyChangedHandlers);
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace winrt::TerminalApp::implementation
|
||||
return winrt::unbox_value<winrt::TerminalApp::HighlightedText>(GetValue(_textProperty));
|
||||
}
|
||||
|
||||
void HighlightedTextControl::Text(winrt::TerminalApp::HighlightedText const& value)
|
||||
void HighlightedTextControl::Text(const winrt::TerminalApp::HighlightedText& value)
|
||||
{
|
||||
SetValue(_textProperty, winrt::box_value(value));
|
||||
}
|
||||
@@ -65,7 +65,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - o - dependency object that was modified, expected to be an instance of this control
|
||||
// - e - event arguments of the property changed event fired by the event system upon Text property change.
|
||||
// The new value is expected to be an instance of HighlightedText
|
||||
void HighlightedTextControl::_onTextChanged(DependencyObject const& o, DependencyPropertyChangedEventArgs const& e)
|
||||
void HighlightedTextControl::_onTextChanged(const DependencyObject& o, const DependencyPropertyChangedEventArgs& e)
|
||||
{
|
||||
const auto control = o.try_as<winrt::TerminalApp::HighlightedTextControl>();
|
||||
const auto highlightedText = e.NewValue().try_as<winrt::TerminalApp::HighlightedText>();
|
||||
|
||||
@@ -16,13 +16,13 @@ namespace winrt::TerminalApp::implementation
|
||||
static Windows::UI::Xaml::DependencyProperty TextProperty();
|
||||
|
||||
winrt::TerminalApp::HighlightedText Text();
|
||||
void Text(winrt::TerminalApp::HighlightedText const& value);
|
||||
void Text(const winrt::TerminalApp::HighlightedText& value);
|
||||
|
||||
Windows::UI::Xaml::Controls::TextBlock TextView();
|
||||
|
||||
private:
|
||||
static Windows::UI::Xaml::DependencyProperty _textProperty;
|
||||
static void _onTextChanged(Windows::UI::Xaml::DependencyObject const& o, Windows::UI::Xaml::DependencyPropertyChangedEventArgs const& e);
|
||||
static void _onTextChanged(const Windows::UI::Xaml::DependencyObject& o, const Windows::UI::Xaml::DependencyPropertyChangedEventArgs& e);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -66,19 +66,19 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
// These event handlers simply forward each buttons click events up to the
|
||||
// events we've exposed.
|
||||
void MinMaxCloseControl::_MinimizeClick(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
||||
RoutedEventArgs const& e)
|
||||
void MinMaxCloseControl::_MinimizeClick(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const RoutedEventArgs& e)
|
||||
{
|
||||
_MinimizeClickHandlers(*this, e);
|
||||
}
|
||||
|
||||
void MinMaxCloseControl::_MaximizeClick(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
||||
RoutedEventArgs const& e)
|
||||
void MinMaxCloseControl::_MaximizeClick(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const RoutedEventArgs& e)
|
||||
{
|
||||
_MaximizeClickHandlers(*this, e);
|
||||
}
|
||||
void MinMaxCloseControl::_CloseClick(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
||||
RoutedEventArgs const& e)
|
||||
void MinMaxCloseControl::_CloseClick(const winrt::Windows::Foundation::IInspectable& /*sender*/,
|
||||
const RoutedEventArgs& e)
|
||||
{
|
||||
_CloseClickHandlers(*this, e);
|
||||
}
|
||||
|
||||
@@ -21,12 +21,12 @@ namespace winrt::TerminalApp::implementation
|
||||
void PressButton(CaptionButton button);
|
||||
void ReleaseButtons();
|
||||
|
||||
void _MinimizeClick(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void _MaximizeClick(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void _CloseClick(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void _MinimizeClick(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _MaximizeClick(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _CloseClick(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
|
||||
TYPED_EVENT(MinimizeClick, TerminalApp::MinMaxCloseControl, winrt::Windows::UI::Xaml::RoutedEventArgs);
|
||||
TYPED_EVENT(MaximizeClick, TerminalApp::MinMaxCloseControl, winrt::Windows::UI::Xaml::RoutedEventArgs);
|
||||
|
||||
@@ -19,11 +19,12 @@
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<Color x:Key="CloseButtonColor">#C42B1C</Color>
|
||||
<x:Double x:Key="CaptionButtonStrokeWidth">1.0</x:Double>
|
||||
<StaticResource x:Key="CaptionButtonBackgroundPointerOver"
|
||||
ResourceKey="SystemControlBackgroundBaseLowBrush" />
|
||||
ResourceKey="SubtleFillColorSecondary" />
|
||||
<StaticResource x:Key="CaptionButtonBackgroundPressed"
|
||||
ResourceKey="SystemControlBackgroundBaseMediumLowBrush" />
|
||||
ResourceKey="SubtleFillColorTertiary" />
|
||||
<StaticResource x:Key="CaptionButtonStroke"
|
||||
ResourceKey="SystemControlForegroundBaseHighBrush" />
|
||||
<StaticResource x:Key="CaptionButtonStrokeColor"
|
||||
@@ -36,23 +37,26 @@
|
||||
Color="Transparent" />
|
||||
<Color x:Key="CaptionButtonBackgroundColor">Transparent</Color>
|
||||
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver"
|
||||
Color="#e81123" />
|
||||
Color="{ThemeResource CloseButtonColor}" />
|
||||
<SolidColorBrush x:Key="CloseButtonStrokePointerOver"
|
||||
Color="White" />
|
||||
<SolidColorBrush x:Key="CloseButtonBackgroundPressed"
|
||||
Color="#f1707a" />
|
||||
Opacity="0.9"
|
||||
Color="{ThemeResource CloseButtonColor}" />
|
||||
<SolidColorBrush x:Key="CloseButtonStrokePressed"
|
||||
Color="Black" />
|
||||
Opacity="0.7"
|
||||
Color="White" />
|
||||
<SolidColorBrush x:Key="CloseButtonBackground"
|
||||
Color="#00e81123" />
|
||||
<Color x:Key="CloseButtonBackgroundColor">#00e81123</Color>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="Dark">
|
||||
<Color x:Key="CloseButtonColor">#C42B1C</Color>
|
||||
<x:Double x:Key="CaptionButtonStrokeWidth">1.0</x:Double>
|
||||
<StaticResource x:Key="CaptionButtonBackgroundPointerOver"
|
||||
ResourceKey="SystemControlBackgroundBaseLowBrush" />
|
||||
ResourceKey="SubtleFillColorSecondary" />
|
||||
<StaticResource x:Key="CaptionButtonBackgroundPressed"
|
||||
ResourceKey="SystemControlBackgroundBaseMediumLowBrush" />
|
||||
ResourceKey="SubtleFillColorTertiary" />
|
||||
<StaticResource x:Key="CaptionButtonStroke"
|
||||
ResourceKey="SystemControlForegroundBaseHighBrush" />
|
||||
<StaticResource x:Key="CaptionButtonStrokeColor"
|
||||
@@ -65,19 +69,21 @@
|
||||
Color="Transparent" />
|
||||
<Color x:Key="CaptionButtonBackgroundColor">Transparent</Color>
|
||||
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver"
|
||||
Color="#e81123" />
|
||||
Color="{ThemeResource CloseButtonColor}" />
|
||||
<SolidColorBrush x:Key="CloseButtonStrokePointerOver"
|
||||
Color="White" />
|
||||
<SolidColorBrush x:Key="CloseButtonBackgroundPressed"
|
||||
Color="#f1707a" />
|
||||
Opacity="0.9"
|
||||
Color="{ThemeResource CloseButtonColor}" />
|
||||
<SolidColorBrush x:Key="CloseButtonStrokePressed"
|
||||
Color="Black" />
|
||||
Opacity="0.7"
|
||||
Color="White" />
|
||||
<SolidColorBrush x:Key="CloseButtonBackground"
|
||||
Color="#00e81123" />
|
||||
<Color x:Key="CloseButtonBackgroundColor">#00e81123</Color>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<x:Double x:Key="CaptionButtonStrokeWidth">3.0</x:Double>
|
||||
<x:Double x:Key="CaptionButtonStrokeWidth">2.0</x:Double>
|
||||
<SolidColorBrush x:Key="CaptionButtonBackground"
|
||||
Color="{ThemeResource SystemColorButtonFaceColor}" />
|
||||
<StaticResource x:Key="CaptionButtonBackgroundColor"
|
||||
@@ -165,7 +171,7 @@
|
||||
<ColorAnimation Storyboard.TargetName="ButtonBaseElement"
|
||||
Storyboard.TargetProperty="(UIElement.Background).(SolidColorBrush.Color)"
|
||||
To="{ThemeResource CaptionButtonBackgroundColor}"
|
||||
Duration="0:0:0.2" />
|
||||
Duration="0:0:0.15" />
|
||||
<ColorAnimation Storyboard.TargetName="Path"
|
||||
Storyboard.TargetProperty="(UIElement.Stroke).(SolidColorBrush.Color)"
|
||||
To="{ThemeResource CaptionButtonStrokeColor}"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
Windows::UI::Xaml::DataTemplate PaletteItemTemplateSelector::SelectTemplateCore(winrt::Windows::Foundation::IInspectable const& item, winrt::Windows::UI::Xaml::DependencyObject const& /*container*/)
|
||||
Windows::UI::Xaml::DataTemplate PaletteItemTemplateSelector::SelectTemplateCore(const winrt::Windows::Foundation::IInspectable& item, const winrt::Windows::UI::Xaml::DependencyObject& /*container*/)
|
||||
{
|
||||
return SelectTemplateCore(item);
|
||||
}
|
||||
@@ -22,7 +22,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - item - an instance of filtered command to render
|
||||
// Return Value:
|
||||
// - data template to use for rendering
|
||||
Windows::UI::Xaml::DataTemplate PaletteItemTemplateSelector::SelectTemplateCore(winrt::Windows::Foundation::IInspectable const& item)
|
||||
Windows::UI::Xaml::DataTemplate PaletteItemTemplateSelector::SelectTemplateCore(const winrt::Windows::Foundation::IInspectable& item)
|
||||
{
|
||||
if (const auto filteredCommand{ item.try_as<winrt::TerminalApp::FilteredCommand>() })
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
PaletteItemTemplateSelector() = default;
|
||||
|
||||
Windows::UI::Xaml::DataTemplate SelectTemplateCore(winrt::Windows::Foundation::IInspectable const&, winrt::Windows::UI::Xaml::DependencyObject const&);
|
||||
Windows::UI::Xaml::DataTemplate SelectTemplateCore(winrt::Windows::Foundation::IInspectable const&);
|
||||
Windows::UI::Xaml::DataTemplate SelectTemplateCore(const winrt::Windows::Foundation::IInspectable&, const winrt::Windows::UI::Xaml::DependencyObject&);
|
||||
Windows::UI::Xaml::DataTemplate SelectTemplateCore(const winrt::Windows::Foundation::IInspectable&);
|
||||
|
||||
WINRT_PROPERTY(winrt::Windows::UI::Xaml::DataTemplate, TabItemTemplate);
|
||||
WINRT_PROPERTY(winrt::Windows::UI::Xaml::DataTemplate, NestedItemTemplate);
|
||||
|
||||
@@ -289,14 +289,14 @@ bool Pane::_Resize(const ResizeDirection& direction)
|
||||
return false;
|
||||
}
|
||||
|
||||
float amount = .05f;
|
||||
auto amount = .05f;
|
||||
if (direction == ResizeDirection::Right || direction == ResizeDirection::Down)
|
||||
{
|
||||
amount = -amount;
|
||||
}
|
||||
|
||||
// Make sure we're not making a pane explode here by resizing it to 0 characters.
|
||||
const bool changeWidth = _splitState == SplitState::Vertical;
|
||||
const auto changeWidth = _splitState == SplitState::Vertical;
|
||||
|
||||
const Size actualSize{ gsl::narrow_cast<float>(_root.ActualWidth()),
|
||||
gsl::narrow_cast<float>(_root.ActualHeight()) };
|
||||
@@ -336,8 +336,8 @@ bool Pane::ResizePane(const ResizeDirection& direction)
|
||||
// If it is, and the requested resize direction matches our separator, then
|
||||
// we're the pane that needs to adjust its separator.
|
||||
// If our separator is the wrong direction, then we can't handle it.
|
||||
const bool firstIsFocused = _firstChild->_lastActive;
|
||||
const bool secondIsFocused = _secondChild->_lastActive;
|
||||
const auto firstIsFocused = _firstChild->_lastActive;
|
||||
const auto secondIsFocused = _secondChild->_lastActive;
|
||||
if (firstIsFocused || secondIsFocused)
|
||||
{
|
||||
return _Resize(direction);
|
||||
@@ -504,7 +504,7 @@ std::shared_ptr<Pane> Pane::NextPane(const std::shared_ptr<Pane> targetPane)
|
||||
|
||||
std::shared_ptr<Pane> firstLeaf = nullptr;
|
||||
std::shared_ptr<Pane> nextPane = nullptr;
|
||||
bool foundTarget = false;
|
||||
auto foundTarget = false;
|
||||
|
||||
auto foundNext = WalkTree([&](auto pane) {
|
||||
// If we are a parent pane we don't want to move to one of our children
|
||||
@@ -566,7 +566,7 @@ std::shared_ptr<Pane> Pane::PreviousPane(const std::shared_ptr<Pane> targetPane)
|
||||
}
|
||||
|
||||
std::shared_ptr<Pane> lastLeaf = nullptr;
|
||||
bool foundTarget = false;
|
||||
auto foundTarget = false;
|
||||
|
||||
WalkTree([&](auto pane) {
|
||||
if (pane == targetPane)
|
||||
@@ -639,8 +639,8 @@ bool Pane::SwapPanes(std::shared_ptr<Pane> first, std::shared_ptr<Pane> second)
|
||||
|
||||
// Recurse through the tree to find the parent panes of each pane that is
|
||||
// being swapped.
|
||||
std::shared_ptr<Pane> firstParent = _FindParentOfPane(first);
|
||||
std::shared_ptr<Pane> secondParent = _FindParentOfPane(second);
|
||||
auto firstParent = _FindParentOfPane(first);
|
||||
auto secondParent = _FindParentOfPane(second);
|
||||
|
||||
// We should have found either no elements, or both elements.
|
||||
// If we only found one parent then the pane SwapPane was called on did not
|
||||
@@ -1138,10 +1138,10 @@ void Pane::_ControlWarningBellHandler(const winrt::Windows::Foundation::IInspect
|
||||
// - <unused>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void Pane::_ControlGotFocusHandler(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
RoutedEventArgs const& /* args */)
|
||||
void Pane::_ControlGotFocusHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const RoutedEventArgs& /* args */)
|
||||
{
|
||||
FocusState f = FocusState::Programmatic;
|
||||
auto f = FocusState::Programmatic;
|
||||
if (const auto o = sender.try_as<winrt::Windows::UI::Xaml::Controls::Control>())
|
||||
{
|
||||
f = o.FocusState();
|
||||
@@ -1153,8 +1153,8 @@ void Pane::_ControlGotFocusHandler(winrt::Windows::Foundation::IInspectable cons
|
||||
// - Called when our control loses focus. We'll use this to trigger our LostFocus
|
||||
// callback. The tab that's hosting us should have registered a callback which
|
||||
// can be used to update its own internal focus state
|
||||
void Pane::_ControlLostFocusHandler(winrt::Windows::Foundation::IInspectable const& /* sender */,
|
||||
RoutedEventArgs const& /* args */)
|
||||
void Pane::_ControlLostFocusHandler(const winrt::Windows::Foundation::IInspectable& /* sender */,
|
||||
const RoutedEventArgs& /* args */)
|
||||
{
|
||||
_LostFocusHandlers(shared_from_this());
|
||||
}
|
||||
@@ -1244,7 +1244,7 @@ TermControl Pane::GetLastFocusedTerminalControl()
|
||||
{
|
||||
if (_lastActive)
|
||||
{
|
||||
std::shared_ptr<Pane> pane = shared_from_this();
|
||||
auto pane = shared_from_this();
|
||||
while (const auto p = pane->_parentChildPath.lock())
|
||||
{
|
||||
if (p->_IsLeaf())
|
||||
@@ -1552,7 +1552,7 @@ void Pane::_CloseChild(const bool closeFirst, const bool isDetaching)
|
||||
|
||||
// If we were a parent pane, and we pointed into the now closed child
|
||||
// clear it. We will set it to something else later if
|
||||
bool usedToFocusClosedChildsTerminal = false;
|
||||
auto usedToFocusClosedChildsTerminal = false;
|
||||
if (const auto prev = _parentChildPath.lock())
|
||||
{
|
||||
if (closedChild == prev)
|
||||
@@ -1772,7 +1772,7 @@ winrt::fire_and_forget Pane::_CloseChildRoutine(const bool closeFirst)
|
||||
const auto animationsEnabledInApp = Media::Animation::Timeline::AllowDependentAnimations();
|
||||
|
||||
// GH#7252: If either child is zoomed, just skip the animation. It won't work.
|
||||
const bool eitherChildZoomed = pane->_firstChild->_zoomed || pane->_secondChild->_zoomed;
|
||||
const auto eitherChildZoomed = pane->_firstChild->_zoomed || pane->_secondChild->_zoomed;
|
||||
// If animations are disabled, just skip this and go straight to
|
||||
// _CloseChild. Curiously, the pane opening animation doesn't need this,
|
||||
// and will skip straight to Completed when animations are disabled, but
|
||||
@@ -1787,7 +1787,7 @@ winrt::fire_and_forget Pane::_CloseChildRoutine(const bool closeFirst)
|
||||
|
||||
auto removedChild = closeFirst ? _firstChild : _secondChild;
|
||||
auto remainingChild = closeFirst ? _secondChild : _firstChild;
|
||||
const bool splitWidth = _splitState == SplitState::Vertical;
|
||||
const auto splitWidth = _splitState == SplitState::Vertical;
|
||||
|
||||
Size removedOriginalSize{
|
||||
::base::saturated_cast<float>(removedChild->_root.ActualWidth()),
|
||||
@@ -2075,7 +2075,7 @@ void Pane::_SetupEntranceAnimation()
|
||||
const auto animationsEnabledInOS = uiSettings.AnimationsEnabled();
|
||||
const auto animationsEnabledInApp = Media::Animation::Timeline::AllowDependentAnimations();
|
||||
|
||||
const bool splitWidth = _splitState == SplitState::Vertical;
|
||||
const auto splitWidth = _splitState == SplitState::Vertical;
|
||||
const auto totalSize = splitWidth ? _root.ActualWidth() : _root.ActualHeight();
|
||||
// If we don't have a size yet, it's likely that we're in startup, or we're
|
||||
// being executed as a sequence of actions. In that case, just skip the
|
||||
@@ -2254,7 +2254,7 @@ std::optional<std::optional<SplitDirection>> Pane::PreCalculateCanSplit(const st
|
||||
const auto secondPercent = splitSize;
|
||||
// If this pane is the pane we're looking for, use
|
||||
// the available space to calculate which direction to split in.
|
||||
const Size minSize = _GetMinSize();
|
||||
const auto minSize = _GetMinSize();
|
||||
|
||||
if (splitType == SplitDirection::Automatic)
|
||||
{
|
||||
@@ -2290,19 +2290,19 @@ std::optional<std::optional<SplitDirection>> Pane::PreCalculateCanSplit(const st
|
||||
// If this pane is a parent, calculate how much space our children will
|
||||
// be able to use, and recurse into them.
|
||||
|
||||
const bool isVerticalSplit = _splitState == SplitState::Vertical;
|
||||
const float firstWidth = isVerticalSplit ?
|
||||
(availableSpace.Width * _desiredSplitPosition) - PaneBorderSize :
|
||||
const auto isVerticalSplit = _splitState == SplitState::Vertical;
|
||||
const auto firstWidth = isVerticalSplit ?
|
||||
(availableSpace.Width * _desiredSplitPosition) - PaneBorderSize :
|
||||
availableSpace.Width;
|
||||
const auto secondWidth = isVerticalSplit ?
|
||||
(availableSpace.Width - firstWidth) - PaneBorderSize :
|
||||
availableSpace.Width;
|
||||
const float secondWidth = isVerticalSplit ?
|
||||
(availableSpace.Width - firstWidth) - PaneBorderSize :
|
||||
availableSpace.Width;
|
||||
const float firstHeight = !isVerticalSplit ?
|
||||
(availableSpace.Height * _desiredSplitPosition) - PaneBorderSize :
|
||||
const auto firstHeight = !isVerticalSplit ?
|
||||
(availableSpace.Height * _desiredSplitPosition) - PaneBorderSize :
|
||||
availableSpace.Height;
|
||||
const auto secondHeight = !isVerticalSplit ?
|
||||
(availableSpace.Height - firstHeight) - PaneBorderSize :
|
||||
availableSpace.Height;
|
||||
const float secondHeight = !isVerticalSplit ?
|
||||
(availableSpace.Height - firstHeight) - PaneBorderSize :
|
||||
availableSpace.Height;
|
||||
|
||||
const auto firstResult = _firstChild->PreCalculateCanSplit(target, splitType, splitSize, { firstWidth, firstHeight });
|
||||
return firstResult.has_value() ? firstResult : _secondChild->PreCalculateCanSplit(target, splitType, splitSize, { secondWidth, secondHeight });
|
||||
@@ -2359,8 +2359,8 @@ bool Pane::ToggleSplitOrientation()
|
||||
|
||||
// If a parent pane is focused, or if one of its children are a leaf and is
|
||||
// focused then switch the split orientation on the current pane.
|
||||
const bool firstIsFocused = _firstChild->_IsLeaf() && _firstChild->_lastActive;
|
||||
const bool secondIsFocused = _secondChild->_IsLeaf() && _secondChild->_lastActive;
|
||||
const auto firstIsFocused = _firstChild->_IsLeaf() && _firstChild->_lastActive;
|
||||
const auto secondIsFocused = _secondChild->_IsLeaf() && _secondChild->_lastActive;
|
||||
if (_lastActive || firstIsFocused || secondIsFocused)
|
||||
{
|
||||
// Switch the split orientation
|
||||
@@ -2739,7 +2739,7 @@ Pane::SnapChildrenSizeResult Pane::_CalcSnappedChildrenSizes(const bool widthOrH
|
||||
// size, but it doesn't seem to be beneficial.
|
||||
|
||||
auto sizeTree = _CreateMinSizeTree(widthOrHeight);
|
||||
LayoutSizeNode lastSizeTree{ sizeTree };
|
||||
auto lastSizeTree{ sizeTree };
|
||||
|
||||
while (sizeTree.size < fullSize)
|
||||
{
|
||||
@@ -2802,7 +2802,7 @@ Pane::SnapSizeResult Pane::_CalcSnappedDimension(const bool widthOrHeight, const
|
||||
return { minDimension, minDimension };
|
||||
}
|
||||
|
||||
float lower = _control.SnapDimensionToGrid(widthOrHeight, dimension);
|
||||
auto lower = _control.SnapDimensionToGrid(widthOrHeight, dimension);
|
||||
if (widthOrHeight)
|
||||
{
|
||||
lower += WI_IsFlagSet(_borders, Borders::Left) ? PaneBorderSize : 0;
|
||||
@@ -3091,7 +3091,7 @@ void Pane::_SetupResources()
|
||||
const auto unfocusedBorderBrushKey = winrt::box_value(L"UnfocusedBorderBrush");
|
||||
if (res.HasKey(unfocusedBorderBrushKey))
|
||||
{
|
||||
winrt::Windows::Foundation::IInspectable obj = res.Lookup(unfocusedBorderBrushKey);
|
||||
auto obj = res.Lookup(unfocusedBorderBrushKey);
|
||||
s_unfocusedBorderBrush = obj.try_as<winrt::Windows::UI::Xaml::Media::SolidColorBrush>();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -278,12 +278,12 @@ private:
|
||||
void _Focus();
|
||||
void _FocusFirstChild();
|
||||
void _ControlConnectionStateChangedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& /*args*/);
|
||||
void _ControlWarningBellHandler(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::Foundation::IInspectable const& e);
|
||||
void _ControlGotFocusHandler(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void _ControlLostFocusHandler(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void _ControlWarningBellHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::Foundation::IInspectable& e);
|
||||
void _ControlGotFocusHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _ControlLostFocusHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
|
||||
std::pair<float, float> _CalcChildrenSizes(const float fullSize) const;
|
||||
SnapChildrenSizeResult _CalcSnappedChildrenSizes(const bool widthOrHeight, const float fullSize) const;
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
</resheader>
|
||||
<data name="AppName" xml:space="preserve">
|
||||
<value>Terminal</value>
|
||||
<comment>{Locked=qps-ploc,qps-ploca,qps-plocm}</comment>
|
||||
</data>
|
||||
<data name="AppNameDev" xml:space="preserve">
|
||||
<value>Terminal Dev</value>
|
||||
@@ -126,9 +127,11 @@
|
||||
</data>
|
||||
<data name="AppNamePre" xml:space="preserve">
|
||||
<value>Terminal Preview</value>
|
||||
<comment>{Locked=qps-ploc,qps-ploca,qps-plocm}</comment>
|
||||
</data>
|
||||
<data name="AppStoreName" xml:space="preserve">
|
||||
<value>Windows Terminal</value>
|
||||
<comment>{Locked=qps-ploc,qps-ploca,qps-plocm}</comment>
|
||||
</data>
|
||||
<data name="AppStoreNameDev" xml:space="preserve">
|
||||
<value>Windows Terminal Dev</value>
|
||||
@@ -136,9 +139,11 @@
|
||||
</data>
|
||||
<data name="AppStoreNamePre" xml:space="preserve">
|
||||
<value>Windows Terminal Preview</value>
|
||||
<comment>{Locked=qps-ploc,qps-ploca,qps-plocm}</comment>
|
||||
</data>
|
||||
<data name="AppShortName" xml:space="preserve">
|
||||
<value>Terminal</value>
|
||||
<comment>{Locked=qps-ploc,qps-ploca,qps-plocm}</comment>
|
||||
</data>
|
||||
<data name="AppShortNameDev" xml:space="preserve">
|
||||
<value>Terminal Dev</value>
|
||||
@@ -146,6 +151,7 @@
|
||||
</data>
|
||||
<data name="AppShortNamePre" xml:space="preserve">
|
||||
<value>Terminal Preview</value>
|
||||
<comment>{Locked=qps-ploc,qps-ploca,qps-plocm}</comment>
|
||||
</data>
|
||||
<data name="AppDescription" xml:space="preserve">
|
||||
<value>The New Windows Terminal</value>
|
||||
@@ -158,15 +164,15 @@
|
||||
<value>Windows Terminal with a preview of upcoming features</value>
|
||||
</data>
|
||||
<data name="ShellExtension_OpenInTerminalMenuItem_Dev" xml:space="preserve">
|
||||
<value>Open in Terminal (Dev)</value>
|
||||
<value>Open in Terminal (&Dev)</value>
|
||||
<comment>{Locked} The dev build will never be seen in multiple languages</comment>
|
||||
</data>
|
||||
<data name="ShellExtension_OpenInTerminalMenuItem_Preview" xml:space="preserve">
|
||||
<value>Open in Terminal Preview</value>
|
||||
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the Preview version of Windows Terminal</comment>
|
||||
<value>Open in Terminal &Preview</value>
|
||||
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the Preview version of Windows Terminal. Please mark one of the characters to be an accelerator key.</comment>
|
||||
</data>
|
||||
<data name="ShellExtension_OpenInTerminalMenuItem" xml:space="preserve">
|
||||
<value>Open in Terminal</value>
|
||||
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the non-preview version of Windows Terminal</comment>
|
||||
<value>Open in &Terminal</value>
|
||||
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the non-preview version of Windows Terminal. Please mark one of the characters to be an accelerator key.</comment>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
@@ -709,6 +709,9 @@
|
||||
<data name="ExportSuccess" xml:space="preserve">
|
||||
<value>Successfully exported terminal content</value>
|
||||
</data>
|
||||
<data name="FindText" xml:space="preserve">
|
||||
<value>Find</value>
|
||||
</data>
|
||||
<data name="PlainText" xml:space="preserve">
|
||||
<value>Plain Text</value>
|
||||
</data>
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// remove the TextBox from the UI tree, then the following KeyUp
|
||||
// will bubble to the NewTabButton, which we don't want to have
|
||||
// happen.
|
||||
HeaderRenamerTextBox().KeyUp([&](auto&&, Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e) {
|
||||
HeaderRenamerTextBox().KeyUp([&](auto&&, const Windows::UI::Xaml::Input::KeyRoutedEventArgs& e) {
|
||||
if (_receivedKeyDown)
|
||||
{
|
||||
if (e.OriginalKey() == Windows::System::VirtualKey::Enter)
|
||||
@@ -94,8 +94,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Event handler for when the rename box loses focus
|
||||
// - When the rename box loses focus, we send a request for the title change depending
|
||||
// on whether the rename was cancelled
|
||||
void TabHeaderControl::RenameBoxLostFocusHandler(Windows::Foundation::IInspectable const& /*sender*/,
|
||||
Windows::UI::Xaml::RoutedEventArgs const& /*e*/)
|
||||
void TabHeaderControl::RenameBoxLostFocusHandler(const Windows::Foundation::IInspectable& /*sender*/,
|
||||
const Windows::UI::Xaml::RoutedEventArgs& /*e*/)
|
||||
{
|
||||
// If the context menu associated with the renamer text box is open we know it gained the focus.
|
||||
// In this case we ignore this event (we will regain the focus once the menu will be closed).
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace winrt::TerminalApp::implementation
|
||||
TabHeaderControl();
|
||||
void BeginRename();
|
||||
|
||||
void RenameBoxLostFocusHandler(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
void RenameBoxLostFocusHandler(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
|
||||
bool InRename();
|
||||
|
||||
|
||||
@@ -13,22 +13,6 @@
|
||||
MinHeight="16"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="Dark">
|
||||
<Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<Thickness x:Key="TextControlBorderThemeThicknessFocused">0,0,0,1</Thickness>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
<StackPanel x:Name="HeaderStackPanel"
|
||||
Orientation="Horizontal">
|
||||
<mux:ProgressRing x:Name="HeaderProgressRing"
|
||||
@@ -68,10 +52,10 @@
|
||||
Text="{x:Bind Title, Mode=OneWay}"
|
||||
Visibility="Visible" />
|
||||
<TextBox x:Name="HeaderRenamerTextBox"
|
||||
Height="16"
|
||||
Height="24"
|
||||
MinHeight="0"
|
||||
MaxWidth="{x:Bind RenamerMaxWidth, Mode=OneWay}"
|
||||
Padding="4,0,4,0"
|
||||
Padding="4,4,4,3"
|
||||
FontSize="12"
|
||||
IsSpellCheckEnabled="False"
|
||||
LostFocus="RenameBoxLostFocusHandler"
|
||||
|
||||
@@ -66,6 +66,12 @@ namespace winrt::TerminalApp::implementation
|
||||
try
|
||||
{
|
||||
const auto profile{ _settings.GetProfileForArgs(newTerminalArgs) };
|
||||
// GH#11114: GetProfileForArgs can return null if the index is higher
|
||||
// than the number of available profiles.
|
||||
if (!profile)
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
const auto settings{ TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs, *_bindings) };
|
||||
|
||||
// Try to handle auto-elevation
|
||||
@@ -81,8 +87,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// case above with the _maybeElevate call.
|
||||
_CreateNewTabFromPane(_MakePane(newTerminalArgs, false, existingConnection));
|
||||
|
||||
const uint32_t tabCount = _tabs.Size();
|
||||
const bool usedManualProfile = (newTerminalArgs != nullptr) &&
|
||||
const auto tabCount = _tabs.Size();
|
||||
const auto usedManualProfile = (newTerminalArgs != nullptr) &&
|
||||
(newTerminalArgs.ProfileIndex() != nullptr ||
|
||||
newTerminalArgs.Profile().empty());
|
||||
|
||||
@@ -152,6 +158,9 @@ namespace winrt::TerminalApp::implementation
|
||||
// SetTaskbarProgress event here, to get tell the hosting
|
||||
// application to re-query this value from us.
|
||||
page->_SetTaskbarProgressHandlers(*page, nullptr);
|
||||
|
||||
auto profile = tab->GetFocusedProfile();
|
||||
page->_UpdateBackground(profile);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -200,6 +209,16 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
});
|
||||
|
||||
newTabImpl->FindRequested([weakTab, weakThis{ get_weak() }]() {
|
||||
auto page{ weakThis.get() };
|
||||
auto tab{ weakTab.get() };
|
||||
|
||||
if (page && tab)
|
||||
{
|
||||
page->_Find();
|
||||
}
|
||||
});
|
||||
|
||||
auto tabViewItem = newTabImpl->TabViewItem();
|
||||
_tabView.TabItems().Append(tabViewItem);
|
||||
|
||||
@@ -287,7 +306,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// 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 bool isVisible = (!_isFullscreen && !_isInFocusMode) &&
|
||||
const auto isVisible = (!_isFullscreen && !_isInFocusMode) &&
|
||||
(_settings.GlobalSettings().ShowTabsInTitlebar() ||
|
||||
(_tabs.Size() > 1) ||
|
||||
_settings.GlobalSettings().AlwaysShowTabs());
|
||||
@@ -449,7 +468,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
if (tab.ReadOnly())
|
||||
{
|
||||
ContentDialogResult warningResult = co_await _ShowCloseReadOnlyDialog();
|
||||
auto warningResult = co_await _ShowCloseReadOnlyDialog();
|
||||
|
||||
// If the user didn't explicitly click on close tab - leave
|
||||
if (warningResult != ContentDialogResult::Primary)
|
||||
@@ -574,7 +593,7 @@ namespace winrt::TerminalApp::implementation
|
||||
const auto tabSwitchMode = customTabSwitcherMode ? customTabSwitcherMode.Value() : _settings.GlobalSettings().TabSwitcherMode();
|
||||
if (tabSwitchMode == TabSwitcherMode::Disabled)
|
||||
{
|
||||
uint32_t tabCount = _tabs.Size();
|
||||
auto tabCount = _tabs.Size();
|
||||
// Wraparound math. By adding tabCount and then calculating
|
||||
// modulo tabCount, we clamp the values to the range [0,
|
||||
// tabCount) while still supporting moving leftward from 0 to
|
||||
@@ -743,7 +762,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
if (pane->ContainsReadOnly())
|
||||
{
|
||||
ContentDialogResult warningResult = co_await _ShowCloseReadOnlyDialog();
|
||||
auto warningResult = co_await _ShowCloseReadOnlyDialog();
|
||||
|
||||
// If the user didn't explicitly click on close tab - leave
|
||||
if (warningResult != ContentDialogResult::Primary)
|
||||
@@ -905,10 +924,25 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
_TitleChangedHandlers(*this, tab.Title());
|
||||
}
|
||||
|
||||
auto tab_impl = _GetTerminalTabImpl(tab);
|
||||
if (tab_impl)
|
||||
{
|
||||
auto profile = tab_impl->GetFocusedProfile();
|
||||
_UpdateBackground(profile);
|
||||
}
|
||||
}
|
||||
CATCH_LOG();
|
||||
}
|
||||
|
||||
void TerminalPage::_UpdateBackground(const winrt::Microsoft::Terminal::Settings::Model::Profile& profile)
|
||||
{
|
||||
if (profile && _settings.GlobalSettings().UseBackgroundImageForWindow())
|
||||
{
|
||||
_SetBackgroundImage(profile.DefaultAppearance());
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Responds to the TabView control's Selection Changed event (to move a
|
||||
// new terminal control into focus) when not in in the middle of a tab rearrangement.
|
||||
@@ -937,7 +971,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
void TerminalPage::_UpdateTabIndices()
|
||||
{
|
||||
const uint32_t size = _tabs.Size();
|
||||
const auto size = _tabs.Size();
|
||||
for (uint32_t i = 0; i < size; ++i)
|
||||
{
|
||||
auto tab{ _tabs.GetAt(i) };
|
||||
|
||||
@@ -19,7 +19,7 @@ using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
TabPaletteItem::TabPaletteItem(winrt::TerminalApp::TabBase const& tab) :
|
||||
TabPaletteItem::TabPaletteItem(const winrt::TerminalApp::TabBase& tab) :
|
||||
_tab(tab)
|
||||
{
|
||||
Name(tab.Title());
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace winrt::TerminalApp::implementation
|
||||
struct TabPaletteItem : TabPaletteItemT<TabPaletteItem, PaletteItem>
|
||||
{
|
||||
TabPaletteItem() = default;
|
||||
TabPaletteItem(winrt::TerminalApp::TabBase const& tab);
|
||||
TabPaletteItem(const winrt::TerminalApp::TabBase& tab);
|
||||
|
||||
winrt::TerminalApp::TabBase Tab() const noexcept
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Bound in the Xaml editor to the [+] button.
|
||||
// Arguments:
|
||||
// <unused>
|
||||
void TabRowControl::OnNewTabButtonClick(IInspectable const&, Controls::SplitButtonClickEventArgs const&)
|
||||
void TabRowControl::OnNewTabButtonClick(const IInspectable&, const Controls::SplitButtonClickEventArgs&)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Bound in Drag&Drop of the Xaml editor to the [+] button.
|
||||
// Arguments:
|
||||
// <unused>
|
||||
void TabRowControl::OnNewTabButtonDrop(IInspectable const&, winrt::Windows::UI::Xaml::DragEventArgs const&)
|
||||
void TabRowControl::OnNewTabButtonDrop(const IInspectable&, const winrt::Windows::UI::Xaml::DragEventArgs&)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Arguments:
|
||||
// - <unused>
|
||||
// - e: DragEventArgs which hold the items
|
||||
void TabRowControl::OnNewTabButtonDragOver(IInspectable const&, winrt::Windows::UI::Xaml::DragEventArgs const& e)
|
||||
void TabRowControl::OnNewTabButtonDragOver(const IInspectable&, const winrt::Windows::UI::Xaml::DragEventArgs& e)
|
||||
{
|
||||
// We can only handle drag/dropping StorageItems (files).
|
||||
// If the format on the clipboard is anything else, returning
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user