mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-07 23:01:09 +00:00
Compare commits
204 Commits
dev/miniks
...
dev/migrie
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdf62de189 | ||
|
|
95580b5f11 | ||
|
|
7edbbd1ccb | ||
|
|
4217bed9c8 | ||
|
|
7b47f4601d | ||
|
|
c30ef6d30b | ||
|
|
fe6fa04f15 | ||
|
|
5806cdab52 | ||
|
|
2d0608d8c0 | ||
|
|
0df02343f1 | ||
|
|
8ba8f35dc5 | ||
|
|
ed87689c04 | ||
|
|
3d35e396b2 | ||
|
|
b693fd484a | ||
|
|
1fccbc5304 | ||
|
|
537258a60f | ||
|
|
b5fe4ffd54 | ||
|
|
12d2e170dd | ||
|
|
2da3b49c9e | ||
|
|
2063197605 | ||
|
|
2ac24979da | ||
|
|
429af0e6fa | ||
|
|
18bacfe973 | ||
|
|
bac69f7cab | ||
|
|
ce34c7320c | ||
|
|
badbbc43a4 | ||
|
|
fecddafad5 | ||
|
|
d8ff47a0d3 | ||
|
|
125e1771ae | ||
|
|
c58033cda2 | ||
|
|
fc81adf32f | ||
|
|
689c21e802 | ||
|
|
96cc7727bc | ||
|
|
886d018bb4 | ||
|
|
d0c207bc9c | ||
|
|
ce3028e12f | ||
|
|
b7c1e05060 | ||
|
|
3bff2a3eb0 | ||
|
|
7c66e66ca1 | ||
|
|
e0762f6bb3 | ||
|
|
51f53535d1 | ||
|
|
21067a7629 | ||
|
|
7d9534bfa8 | ||
|
|
6735311fc9 | ||
|
|
4204733c34 | ||
|
|
23b4a466f5 | ||
|
|
01bd77003c | ||
|
|
ae25a32913 | ||
|
|
93aa9455e2 | ||
|
|
41f209f6d3 | ||
|
|
244fb72fee | ||
|
|
3a0da64276 | ||
|
|
b2c093fa2f | ||
|
|
87f5852a72 | ||
|
|
e14a59a1b6 | ||
|
|
cd144e98c6 | ||
|
|
c7f0a3439d | ||
|
|
5d60d69e86 | ||
|
|
072bbfd09d | ||
|
|
b87f8f9070 | ||
|
|
b78d9176ae | ||
|
|
3bbd8f4c97 | ||
|
|
2d3f285894 | ||
|
|
49ff36bfc3 | ||
|
|
d8bc94f13c | ||
|
|
dd49c3ed51 | ||
|
|
9678dd894c | ||
|
|
45e599368f | ||
|
|
594dca993b | ||
|
|
c956913a28 | ||
|
|
b180406b07 | ||
|
|
bbdfdf91eb | ||
|
|
d5d7cf420d | ||
|
|
81ab5803aa | ||
|
|
7d4096bbbf | ||
|
|
230e7f43e0 | ||
|
|
cdfbf8f106 | ||
|
|
30e8e7f3a3 | ||
|
|
feb5b18296 | ||
|
|
7ec6bfc01c | ||
|
|
4f1157c044 | ||
|
|
8c3a629b52 | ||
|
|
8579d8905a | ||
|
|
50e2d0c433 | ||
|
|
8ea7401dc9 | ||
|
|
a381f6a042 | ||
|
|
c63289b114 | ||
|
|
b33a59816e | ||
|
|
bd2d5ddb4b | ||
|
|
23897b1bd4 | ||
|
|
65dec36cb1 | ||
|
|
1989eb9d00 | ||
|
|
cb02ca7534 | ||
|
|
5de63096ac | ||
|
|
f93adb9540 | ||
|
|
0d12a25b2d | ||
|
|
5e38bcd754 | ||
|
|
f4294b17d7 | ||
|
|
974e95ebf7 | ||
|
|
cffa033116 | ||
|
|
ebcf8126dc | ||
|
|
02d8df8431 | ||
|
|
949839fdd8 | ||
|
|
e7c78c8d28 | ||
|
|
1006e98780 | ||
|
|
9ff90ba174 | ||
|
|
5694606aea | ||
|
|
84d19f5348 | ||
|
|
6d50fb4d31 | ||
|
|
d1a3e6d2b8 | ||
|
|
be52880620 | ||
|
|
e92efa5bc0 | ||
|
|
667c0286c1 | ||
|
|
28b767d00b | ||
|
|
8096d7cf2f | ||
|
|
f9752148d0 | ||
|
|
09d79cb422 | ||
|
|
0c454f53e9 | ||
|
|
ff87190823 | ||
|
|
98f77818ff | ||
|
|
71eaf621bc | ||
|
|
38156311e8 | ||
|
|
bd47dcc898 | ||
|
|
734fc1dcc6 | ||
|
|
c70fb49ab5 | ||
|
|
d55ecae199 | ||
|
|
d7d96f723a | ||
|
|
24ea0866d3 | ||
|
|
fca0cd9879 | ||
|
|
16e1e29a12 | ||
|
|
becdd16008 | ||
|
|
1f41fd35cf | ||
|
|
82de43bce9 | ||
|
|
8999c661b2 | ||
|
|
13d66c9948 | ||
|
|
ac97e5d082 | ||
|
|
138d3b81c8 | ||
|
|
0843f3cced | ||
|
|
646d8f91b9 | ||
|
|
eac29d2c67 | ||
|
|
1e4e12507d | ||
|
|
6c747c565b | ||
|
|
89925ebe44 | ||
|
|
8fa42e09df | ||
|
|
94e5d545aa | ||
|
|
dfb853644a | ||
|
|
ff7fdbeab4 | ||
|
|
a7877558f2 | ||
|
|
aae938fc33 | ||
|
|
b495ad255f | ||
|
|
4529e46d3e | ||
|
|
3086671bc7 | ||
|
|
1b33d186f3 | ||
|
|
0d8f2998d6 | ||
|
|
42c1e58966 | ||
|
|
0da13cdf2d | ||
|
|
f8f0798826 | ||
|
|
6749ab03b8 | ||
|
|
66044ca605 | ||
|
|
a08666b58e | ||
|
|
1afab788ab | ||
|
|
63df881f31 | ||
|
|
2d3e271a4f | ||
|
|
7abcc35fdf | ||
|
|
c6c51fbb0e | ||
|
|
56589c0aac | ||
|
|
3f62c8b470 | ||
|
|
96496d8154 | ||
|
|
ed18c1e8c1 | ||
|
|
10c599eb17 | ||
|
|
bd5cae1328 | ||
|
|
dd1f8a8245 | ||
|
|
644ac56fdb | ||
|
|
83a4c22919 | ||
|
|
09e828fa49 | ||
|
|
c97cccb55c | ||
|
|
63347f47fb | ||
|
|
a5746850f9 | ||
|
|
a2744529e6 | ||
|
|
577da7441e | ||
|
|
66d46ed8ed | ||
|
|
8ae4f2fc1b | ||
|
|
2febe1fa2b | ||
|
|
89190c6e6c | ||
|
|
2c3e175f62 | ||
|
|
9d36b08b82 | ||
|
|
5da2ab1a86 | ||
|
|
e662277cb0 | ||
|
|
2407828d03 | ||
|
|
69c67f8a8e | ||
|
|
260d095f94 | ||
|
|
a6ab075a62 | ||
|
|
3b96a84261 | ||
|
|
dca0ffe6dd | ||
|
|
5074335392 | ||
|
|
8ffff8ea37 | ||
|
|
57ad2d57fd | ||
|
|
f1441a589c | ||
|
|
988fe0ba60 | ||
|
|
de1de4425e | ||
|
|
8d52ba0990 | ||
|
|
a0782bfd6c | ||
|
|
fa5b9b06bd | ||
|
|
7067910862 |
4
.github/ISSUE_TEMPLATE/Bug_Report.md
vendored
4
.github/ISSUE_TEMPLATE/Bug_Report.md
vendored
@@ -26,6 +26,8 @@ This bug tracker is monitored by Windows Terminal development team and other tec
|
||||
**Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**.
|
||||
Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue.
|
||||
|
||||
If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link.
|
||||
|
||||
Please use this form and describe your issue, concisely but precisely, with as much detail as possible.
|
||||
|
||||
-->
|
||||
@@ -33,7 +35,7 @@ Please use this form and describe your issue, concisely but precisely, with as m
|
||||
# Environment
|
||||
|
||||
```none
|
||||
Windows build number: [run "ver" at a command prompt]
|
||||
Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd]
|
||||
Windows Terminal version (if applicable):
|
||||
|
||||
Any other software?
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/Feature_Request.md
vendored
2
.github/ISSUE_TEMPLATE/Feature_Request.md
vendored
@@ -20,7 +20,7 @@ I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING:
|
||||
All good? Then proceed!
|
||||
-->
|
||||
|
||||
# Summary of the new feature/enhancement
|
||||
# Description of the new feature/enhancement
|
||||
|
||||
<!--
|
||||
A clear and concise description of what the problem is that the new feature would solve.
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
|
||||
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
||||
"Microsoft.VisualStudio.Component.VC.Tools.ARM64",
|
||||
"Microsoft.VisualStudio.Component.VC.v141.x86.x64",
|
||||
"Microsoft.VisualStudio.Component.VC.v141.ARM64",
|
||||
"Microsoft.VisualStudio.Component.VC.v142.x86.x64",
|
||||
"Microsoft.VisualStudio.Component.VC.v142.ARM64",
|
||||
"Microsoft.VisualStudio.ComponentGroup.UWP.VC",
|
||||
"Microsoft.VisualStudio.ComponentGroup.UWP.VC.v141",
|
||||
"Microsoft.VisualStudio.ComponentGroup.UWP.VC.v142",
|
||||
"Microsoft.VisualStudio.Component.UWP.VC.ARM64"
|
||||
]
|
||||
}
|
||||
|
||||
180
OpenConsole.sln
180
OpenConsole.sln
@@ -243,6 +243,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TerminalAppLib", "src\casca
|
||||
{CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907} = {CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LocalTests_TerminalApp", "src\cascadia\LocalTests_TerminalApp\TerminalApp.LocalTests.vcxproj", "{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{CA5CAD1A-9A12-429C-B551-8562EC954746} = {CA5CAD1A-9A12-429C-B551-8562EC954746}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winconpty", "src\winconpty\winconpty.vcxproj", "{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
AuditMode|ARM64 = AuditMode|ARM64
|
||||
@@ -257,14 +264,8 @@ Global
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{CA5CAD1A-224A-4171-B13A-F16E576FDD12}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{CA5CAD1A-224A-4171-B13A-F16E576FDD12}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{CA5CAD1A-224A-4171-B13A-F16E576FDD12}.AuditMode|ARM64.Deploy.0 = Release|ARM64
|
||||
{CA5CAD1A-224A-4171-B13A-F16E576FDD12}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{CA5CAD1A-224A-4171-B13A-F16E576FDD12}.AuditMode|x64.Build.0 = Release|x64
|
||||
{CA5CAD1A-224A-4171-B13A-F16E576FDD12}.AuditMode|x64.Deploy.0 = Release|x64
|
||||
{CA5CAD1A-224A-4171-B13A-F16E576FDD12}.AuditMode|x86.ActiveCfg = Release|x86
|
||||
{CA5CAD1A-224A-4171-B13A-F16E576FDD12}.AuditMode|x86.Build.0 = Release|x86
|
||||
{CA5CAD1A-224A-4171-B13A-F16E576FDD12}.AuditMode|x86.Deploy.0 = Release|x86
|
||||
{CA5CAD1A-224A-4171-B13A-F16E576FDD12}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{CA5CAD1A-224A-4171-B13A-F16E576FDD12}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{CA5CAD1A-224A-4171-B13A-F16E576FDD12}.Debug|ARM64.Deploy.0 = Debug|ARM64
|
||||
@@ -284,11 +285,8 @@ Global
|
||||
{CA5CAD1A-224A-4171-B13A-F16E576FDD12}.Release|x86.Build.0 = Release|x86
|
||||
{CA5CAD1A-224A-4171-B13A-F16E576FDD12}.Release|x86.Deploy.0 = Release|x86
|
||||
{9CBD7DFA-1754-4A9D-93D7-857A9D17CB1B}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{9CBD7DFA-1754-4A9D-93D7-857A9D17CB1B}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{9CBD7DFA-1754-4A9D-93D7-857A9D17CB1B}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{9CBD7DFA-1754-4A9D-93D7-857A9D17CB1B}.AuditMode|x64.Build.0 = Release|x64
|
||||
{9CBD7DFA-1754-4A9D-93D7-857A9D17CB1B}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{9CBD7DFA-1754-4A9D-93D7-857A9D17CB1B}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{9CBD7DFA-1754-4A9D-93D7-857A9D17CB1B}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{9CBD7DFA-1754-4A9D-93D7-857A9D17CB1B}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{9CBD7DFA-1754-4A9D-93D7-857A9D17CB1B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -302,11 +300,8 @@ Global
|
||||
{9CBD7DFA-1754-4A9D-93D7-857A9D17CB1B}.Release|x86.ActiveCfg = Release|Win32
|
||||
{9CBD7DFA-1754-4A9D-93D7-857A9D17CB1B}.Release|x86.Build.0 = Release|Win32
|
||||
{345FD5A4-B32B-4F29-BD1C-B033BD2C35CC}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{345FD5A4-B32B-4F29-BD1C-B033BD2C35CC}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{345FD5A4-B32B-4F29-BD1C-B033BD2C35CC}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{345FD5A4-B32B-4F29-BD1C-B033BD2C35CC}.AuditMode|x64.Build.0 = Release|x64
|
||||
{345FD5A4-B32B-4F29-BD1C-B033BD2C35CC}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{345FD5A4-B32B-4F29-BD1C-B033BD2C35CC}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{345FD5A4-B32B-4F29-BD1C-B033BD2C35CC}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{345FD5A4-B32B-4F29-BD1C-B033BD2C35CC}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{345FD5A4-B32B-4F29-BD1C-B033BD2C35CC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -320,11 +315,8 @@ Global
|
||||
{345FD5A4-B32B-4F29-BD1C-B033BD2C35CC}.Release|x86.ActiveCfg = Release|Win32
|
||||
{345FD5A4-B32B-4F29-BD1C-B033BD2C35CC}.Release|x86.Build.0 = Release|Win32
|
||||
{2FD12FBB-1DDB-46D8-B818-1023C624CACA}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{2FD12FBB-1DDB-46D8-B818-1023C624CACA}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{2FD12FBB-1DDB-46D8-B818-1023C624CACA}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{2FD12FBB-1DDB-46D8-B818-1023C624CACA}.AuditMode|x64.Build.0 = Release|x64
|
||||
{2FD12FBB-1DDB-46D8-B818-1023C624CACA}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{2FD12FBB-1DDB-46D8-B818-1023C624CACA}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{2FD12FBB-1DDB-46D8-B818-1023C624CACA}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{2FD12FBB-1DDB-46D8-B818-1023C624CACA}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{2FD12FBB-1DDB-46D8-B818-1023C624CACA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -338,11 +330,8 @@ Global
|
||||
{2FD12FBB-1DDB-46D8-B818-1023C624CACA}.Release|x86.ActiveCfg = Release|Win32
|
||||
{2FD12FBB-1DDB-46D8-B818-1023C624CACA}.Release|x86.Build.0 = Release|Win32
|
||||
{3AE13314-1939-4DFA-9C14-38CA0834050C}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{3AE13314-1939-4DFA-9C14-38CA0834050C}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{3AE13314-1939-4DFA-9C14-38CA0834050C}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{3AE13314-1939-4DFA-9C14-38CA0834050C}.AuditMode|x64.Build.0 = Release|x64
|
||||
{3AE13314-1939-4DFA-9C14-38CA0834050C}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{3AE13314-1939-4DFA-9C14-38CA0834050C}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{3AE13314-1939-4DFA-9C14-38CA0834050C}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{3AE13314-1939-4DFA-9C14-38CA0834050C}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{3AE13314-1939-4DFA-9C14-38CA0834050C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -356,11 +345,8 @@ Global
|
||||
{3AE13314-1939-4DFA-9C14-38CA0834050C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{3AE13314-1939-4DFA-9C14-38CA0834050C}.Release|x86.Build.0 = Release|Win32
|
||||
{DCF55140-EF6A-4736-A403-957E4F7430BB}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{DCF55140-EF6A-4736-A403-957E4F7430BB}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{DCF55140-EF6A-4736-A403-957E4F7430BB}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{DCF55140-EF6A-4736-A403-957E4F7430BB}.AuditMode|x64.Build.0 = Release|x64
|
||||
{DCF55140-EF6A-4736-A403-957E4F7430BB}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{DCF55140-EF6A-4736-A403-957E4F7430BB}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{DCF55140-EF6A-4736-A403-957E4F7430BB}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{DCF55140-EF6A-4736-A403-957E4F7430BB}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{DCF55140-EF6A-4736-A403-957E4F7430BB}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -374,11 +360,8 @@ Global
|
||||
{DCF55140-EF6A-4736-A403-957E4F7430BB}.Release|x86.ActiveCfg = Release|Win32
|
||||
{DCF55140-EF6A-4736-A403-957E4F7430BB}.Release|x86.Build.0 = Release|Win32
|
||||
{1CF55140-EF6A-4736-A403-957E4F7430BB}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{1CF55140-EF6A-4736-A403-957E4F7430BB}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{1CF55140-EF6A-4736-A403-957E4F7430BB}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{1CF55140-EF6A-4736-A403-957E4F7430BB}.AuditMode|x64.Build.0 = Release|x64
|
||||
{1CF55140-EF6A-4736-A403-957E4F7430BB}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{1CF55140-EF6A-4736-A403-957E4F7430BB}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{1CF55140-EF6A-4736-A403-957E4F7430BB}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{1CF55140-EF6A-4736-A403-957E4F7430BB}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{1CF55140-EF6A-4736-A403-957E4F7430BB}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -392,11 +375,8 @@ Global
|
||||
{1CF55140-EF6A-4736-A403-957E4F7430BB}.Release|x86.ActiveCfg = Release|Win32
|
||||
{1CF55140-EF6A-4736-A403-957E4F7430BB}.Release|x86.Build.0 = Release|Win32
|
||||
{AF0A096A-8B3A-4949-81EF-7DF8F0FEE91F}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{AF0A096A-8B3A-4949-81EF-7DF8F0FEE91F}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{AF0A096A-8B3A-4949-81EF-7DF8F0FEE91F}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{AF0A096A-8B3A-4949-81EF-7DF8F0FEE91F}.AuditMode|x64.Build.0 = Release|x64
|
||||
{AF0A096A-8B3A-4949-81EF-7DF8F0FEE91F}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{AF0A096A-8B3A-4949-81EF-7DF8F0FEE91F}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{AF0A096A-8B3A-4949-81EF-7DF8F0FEE91F}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{AF0A096A-8B3A-4949-81EF-7DF8F0FEE91F}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{AF0A096A-8B3A-4949-81EF-7DF8F0FEE91F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -410,11 +390,8 @@ Global
|
||||
{AF0A096A-8B3A-4949-81EF-7DF8F0FEE91F}.Release|x86.ActiveCfg = Release|Win32
|
||||
{AF0A096A-8B3A-4949-81EF-7DF8F0FEE91F}.Release|x86.Build.0 = Release|Win32
|
||||
{1C959542-BAC2-4E55-9A6D-13251914CBB9}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{1C959542-BAC2-4E55-9A6D-13251914CBB9}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{1C959542-BAC2-4E55-9A6D-13251914CBB9}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{1C959542-BAC2-4E55-9A6D-13251914CBB9}.AuditMode|x64.Build.0 = Release|x64
|
||||
{1C959542-BAC2-4E55-9A6D-13251914CBB9}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{1C959542-BAC2-4E55-9A6D-13251914CBB9}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{1C959542-BAC2-4E55-9A6D-13251914CBB9}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{1C959542-BAC2-4E55-9A6D-13251914CBB9}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{1C959542-BAC2-4E55-9A6D-13251914CBB9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -428,11 +405,8 @@ Global
|
||||
{1C959542-BAC2-4E55-9A6D-13251914CBB9}.Release|x86.ActiveCfg = Release|Win32
|
||||
{1C959542-BAC2-4E55-9A6D-13251914CBB9}.Release|x86.Build.0 = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8562EC954746}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8562EC954746}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8562EC954746}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{06EC74CB-9A12-429C-B551-8562EC954746}.AuditMode|x64.Build.0 = Release|x64
|
||||
{06EC74CB-9A12-429C-B551-8562EC954746}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8562EC954746}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8562EC954746}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8562EC954746}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8562EC954746}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -446,11 +420,8 @@ Global
|
||||
{06EC74CB-9A12-429C-B551-8562EC954746}.Release|x86.ActiveCfg = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8562EC954746}.Release|x86.Build.0 = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8562EC954747}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8562EC954747}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8562EC954747}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{06EC74CB-9A12-429C-B551-8562EC954747}.AuditMode|x64.Build.0 = Release|x64
|
||||
{06EC74CB-9A12-429C-B551-8562EC954747}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8562EC954747}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8562EC954747}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8562EC954747}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8562EC954747}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -464,11 +435,8 @@ Global
|
||||
{06EC74CB-9A12-429C-B551-8562EC954747}.Release|x86.ActiveCfg = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8562EC954747}.Release|x86.Build.0 = Release|Win32
|
||||
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.AuditMode|x64.Build.0 = Release|x64
|
||||
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -482,11 +450,8 @@ Global
|
||||
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.Release|x86.ActiveCfg = Release|Win32
|
||||
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.Release|x86.Build.0 = Release|Win32
|
||||
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.AuditMode|x64.Build.0 = Release|x64
|
||||
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -500,11 +465,8 @@ Global
|
||||
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.Release|x86.ActiveCfg = Release|Win32
|
||||
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.Release|x86.Build.0 = Release|Win32
|
||||
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.AuditMode|x64.Build.0 = Release|x64
|
||||
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -516,11 +478,8 @@ Global
|
||||
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.Release|x64.Build.0 = Release|x64
|
||||
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.Release|x86.ActiveCfg = Release|Win32
|
||||
{12144E07-FE63-4D33-9231-748B8D8C3792}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{12144E07-FE63-4D33-9231-748B8D8C3792}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{12144E07-FE63-4D33-9231-748B8D8C3792}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{12144E07-FE63-4D33-9231-748B8D8C3792}.AuditMode|x64.Build.0 = Release|x64
|
||||
{12144E07-FE63-4D33-9231-748B8D8C3792}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{12144E07-FE63-4D33-9231-748B8D8C3792}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{12144E07-FE63-4D33-9231-748B8D8C3792}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{12144E07-FE63-4D33-9231-748B8D8C3792}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{12144E07-FE63-4D33-9231-748B8D8C3792}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -534,11 +493,8 @@ Global
|
||||
{12144E07-FE63-4D33-9231-748B8D8C3792}.Release|x86.ActiveCfg = Release|Win32
|
||||
{12144E07-FE63-4D33-9231-748B8D8C3792}.Release|x86.Build.0 = Release|Win32
|
||||
{6AF01638-84CF-4B65-9870-484DFFCAC772}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{6AF01638-84CF-4B65-9870-484DFFCAC772}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{6AF01638-84CF-4B65-9870-484DFFCAC772}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{6AF01638-84CF-4B65-9870-484DFFCAC772}.AuditMode|x64.Build.0 = Release|x64
|
||||
{6AF01638-84CF-4B65-9870-484DFFCAC772}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{6AF01638-84CF-4B65-9870-484DFFCAC772}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{6AF01638-84CF-4B65-9870-484DFFCAC772}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{6AF01638-84CF-4B65-9870-484DFFCAC772}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{6AF01638-84CF-4B65-9870-484DFFCAC772}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -552,11 +508,8 @@ Global
|
||||
{6AF01638-84CF-4B65-9870-484DFFCAC772}.Release|x86.ActiveCfg = Release|Win32
|
||||
{6AF01638-84CF-4B65-9870-484DFFCAC772}.Release|x86.Build.0 = Release|Win32
|
||||
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.AuditMode|x64.Build.0 = Release|x64
|
||||
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -570,11 +523,8 @@ Global
|
||||
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.Release|x86.ActiveCfg = Release|Win32
|
||||
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.Release|x86.Build.0 = Release|Win32
|
||||
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.AuditMode|x64.Build.0 = Release|x64
|
||||
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -588,11 +538,8 @@ Global
|
||||
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.Release|x86.ActiveCfg = Release|Win32
|
||||
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.Release|x86.Build.0 = Release|Win32
|
||||
{5D23E8E1-3C64-4CC1-A8F7-6861677F7239}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{5D23E8E1-3C64-4CC1-A8F7-6861677F7239}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{5D23E8E1-3C64-4CC1-A8F7-6861677F7239}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{5D23E8E1-3C64-4CC1-A8F7-6861677F7239}.AuditMode|x64.Build.0 = Release|x64
|
||||
{5D23E8E1-3C64-4CC1-A8F7-6861677F7239}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{5D23E8E1-3C64-4CC1-A8F7-6861677F7239}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{5D23E8E1-3C64-4CC1-A8F7-6861677F7239}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{5D23E8E1-3C64-4CC1-A8F7-6861677F7239}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{5D23E8E1-3C64-4CC1-A8F7-6861677F7239}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -606,11 +553,8 @@ Global
|
||||
{5D23E8E1-3C64-4CC1-A8F7-6861677F7239}.Release|x86.ActiveCfg = Release|Win32
|
||||
{5D23E8E1-3C64-4CC1-A8F7-6861677F7239}.Release|x86.Build.0 = Release|Win32
|
||||
{18D09A24-8240-42D6-8CB6-236EEE820262}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{18D09A24-8240-42D6-8CB6-236EEE820262}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{18D09A24-8240-42D6-8CB6-236EEE820262}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{18D09A24-8240-42D6-8CB6-236EEE820262}.AuditMode|x64.Build.0 = Release|x64
|
||||
{18D09A24-8240-42D6-8CB6-236EEE820262}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{18D09A24-8240-42D6-8CB6-236EEE820262}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{18D09A24-8240-42D6-8CB6-236EEE820262}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{18D09A24-8240-42D6-8CB6-236EEE820262}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{18D09A24-8240-42D6-8CB6-236EEE820262}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -624,11 +568,8 @@ Global
|
||||
{18D09A24-8240-42D6-8CB6-236EEE820262}.Release|x86.ActiveCfg = Release|Win32
|
||||
{18D09A24-8240-42D6-8CB6-236EEE820262}.Release|x86.Build.0 = Release|Win32
|
||||
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.AuditMode|ARM64.ActiveCfg = Debug|Win32
|
||||
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.AuditMode|ARM64.Build.0 = Debug|Win32
|
||||
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.AuditMode|x64.Build.0 = Release|x64
|
||||
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.Debug|ARM64.ActiveCfg = Debug|Win32
|
||||
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.Debug|x64.Build.0 = Debug|x64
|
||||
@@ -640,11 +581,8 @@ Global
|
||||
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.Release|x86.ActiveCfg = Release|Win32
|
||||
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.Release|x86.Build.0 = Release|Win32
|
||||
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.AuditMode|ARM64.ActiveCfg = Debug|Win32
|
||||
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.AuditMode|ARM64.Build.0 = Debug|Win32
|
||||
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.AuditMode|x64.Build.0 = Release|x64
|
||||
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.Debug|ARM64.ActiveCfg = Debug|Win32
|
||||
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.Debug|x64.Build.0 = Debug|x64
|
||||
@@ -656,11 +594,8 @@ Global
|
||||
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.Release|x86.ActiveCfg = Release|Win32
|
||||
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.Release|x86.Build.0 = Release|Win32
|
||||
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.AuditMode|x64.Build.0 = Release|x64
|
||||
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -674,11 +609,8 @@ Global
|
||||
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.Release|x86.ActiveCfg = Release|Win32
|
||||
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.Release|x86.Build.0 = Release|Win32
|
||||
{919544AC-D39B-463F-8414-3C3C67CF727C}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{919544AC-D39B-463F-8414-3C3C67CF727C}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{919544AC-D39B-463F-8414-3C3C67CF727C}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{919544AC-D39B-463F-8414-3C3C67CF727C}.AuditMode|x64.Build.0 = Release|x64
|
||||
{919544AC-D39B-463F-8414-3C3C67CF727C}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{919544AC-D39B-463F-8414-3C3C67CF727C}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{919544AC-D39B-463F-8414-3C3C67CF727C}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{919544AC-D39B-463F-8414-3C3C67CF727C}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{919544AC-D39B-463F-8414-3C3C67CF727C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -692,11 +624,8 @@ Global
|
||||
{919544AC-D39B-463F-8414-3C3C67CF727C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{919544AC-D39B-463F-8414-3C3C67CF727C}.Release|x86.Build.0 = Release|Win32
|
||||
{ED82003F-FC5D-4E94-8B36-F480018ED064}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{ED82003F-FC5D-4E94-8B36-F480018ED064}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{ED82003F-FC5D-4E94-8B36-F480018ED064}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{ED82003F-FC5D-4E94-8B36-F480018ED064}.AuditMode|x64.Build.0 = Release|x64
|
||||
{ED82003F-FC5D-4E94-8B36-F480018ED064}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{ED82003F-FC5D-4E94-8B36-F480018ED064}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{ED82003F-FC5D-4E94-8B36-F480018ED064}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{ED82003F-FC5D-4E94-8B36-F480018ED064}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{ED82003F-FC5D-4E94-8B36-F480018ED064}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -710,11 +639,8 @@ Global
|
||||
{ED82003F-FC5D-4E94-8B36-F480018ED064}.Release|x86.ActiveCfg = Release|Win32
|
||||
{ED82003F-FC5D-4E94-8B36-F480018ED064}.Release|x86.Build.0 = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8532EC964726}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8532EC964726}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8532EC964726}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{06EC74CB-9A12-429C-B551-8532EC964726}.AuditMode|x64.Build.0 = Release|x64
|
||||
{06EC74CB-9A12-429C-B551-8532EC964726}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8532EC964726}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8532EC964726}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8532EC964726}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8532EC964726}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -728,11 +654,8 @@ Global
|
||||
{06EC74CB-9A12-429C-B551-8532EC964726}.Release|x86.ActiveCfg = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8532EC964726}.Release|x86.Build.0 = Release|Win32
|
||||
{ED82003F-FC5D-4E94-8B47-F480018ED064}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{ED82003F-FC5D-4E94-8B47-F480018ED064}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{ED82003F-FC5D-4E94-8B47-F480018ED064}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{ED82003F-FC5D-4E94-8B47-F480018ED064}.AuditMode|x64.Build.0 = Release|x64
|
||||
{ED82003F-FC5D-4E94-8B47-F480018ED064}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{ED82003F-FC5D-4E94-8B47-F480018ED064}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{ED82003F-FC5D-4E94-8B47-F480018ED064}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{ED82003F-FC5D-4E94-8B47-F480018ED064}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{ED82003F-FC5D-4E94-8B47-F480018ED064}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -746,11 +669,8 @@ Global
|
||||
{ED82003F-FC5D-4E94-8B47-F480018ED064}.Release|x86.ActiveCfg = Release|Win32
|
||||
{ED82003F-FC5D-4E94-8B47-F480018ED064}.Release|x86.Build.0 = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8562EC964846}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8562EC964846}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8562EC964846}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{06EC74CB-9A12-429C-B551-8562EC964846}.AuditMode|x64.Build.0 = Release|x64
|
||||
{06EC74CB-9A12-429C-B551-8562EC964846}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8562EC964846}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8562EC964846}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8562EC964846}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{06EC74CB-9A12-429C-B551-8562EC964846}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -764,11 +684,8 @@ Global
|
||||
{06EC74CB-9A12-429C-B551-8562EC964846}.Release|x86.ActiveCfg = Release|Win32
|
||||
{06EC74CB-9A12-429C-B551-8562EC964846}.Release|x86.Build.0 = Release|Win32
|
||||
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.AuditMode|x64.Build.0 = Release|x64
|
||||
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -782,11 +699,8 @@ Global
|
||||
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.Release|x86.ActiveCfg = Release|Win32
|
||||
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.Release|x86.Build.0 = Release|Win32
|
||||
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.AuditMode|x64.Build.0 = Release|x64
|
||||
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -800,11 +714,8 @@ Global
|
||||
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.Release|x86.ActiveCfg = Release|Win32
|
||||
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.Release|x86.Build.0 = Release|Win32
|
||||
{990F2657-8580-4828-943F-5DD657D11842}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{990F2657-8580-4828-943F-5DD657D11842}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{990F2657-8580-4828-943F-5DD657D11842}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{990F2657-8580-4828-943F-5DD657D11842}.AuditMode|x64.Build.0 = Release|x64
|
||||
{990F2657-8580-4828-943F-5DD657D11842}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{990F2657-8580-4828-943F-5DD657D11842}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{990F2657-8580-4828-943F-5DD657D11842}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{990F2657-8580-4828-943F-5DD657D11842}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{990F2657-8580-4828-943F-5DD657D11842}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -818,11 +729,8 @@ Global
|
||||
{990F2657-8580-4828-943F-5DD657D11842}.Release|x86.ActiveCfg = Release|Win32
|
||||
{990F2657-8580-4828-943F-5DD657D11842}.Release|x86.Build.0 = Release|Win32
|
||||
{814DBDDE-894E-4327-A6E1-740504850098}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{814DBDDE-894E-4327-A6E1-740504850098}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{814DBDDE-894E-4327-A6E1-740504850098}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{814DBDDE-894E-4327-A6E1-740504850098}.AuditMode|x64.Build.0 = Release|x64
|
||||
{814DBDDE-894E-4327-A6E1-740504850098}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{814DBDDE-894E-4327-A6E1-740504850098}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{814DBDDE-894E-4327-A6E1-740504850098}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{814DBDDE-894E-4327-A6E1-740504850098}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{814DBDDE-894E-4327-A6E1-740504850098}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -836,11 +744,8 @@ Global
|
||||
{814DBDDE-894E-4327-A6E1-740504850098}.Release|x86.ActiveCfg = Release|Win32
|
||||
{814DBDDE-894E-4327-A6E1-740504850098}.Release|x86.Build.0 = Release|Win32
|
||||
{814CBEEE-894E-4327-A6E1-740504850098}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{814CBEEE-894E-4327-A6E1-740504850098}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{814CBEEE-894E-4327-A6E1-740504850098}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{814CBEEE-894E-4327-A6E1-740504850098}.AuditMode|x64.Build.0 = Release|x64
|
||||
{814CBEEE-894E-4327-A6E1-740504850098}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{814CBEEE-894E-4327-A6E1-740504850098}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{814CBEEE-894E-4327-A6E1-740504850098}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{814CBEEE-894E-4327-A6E1-740504850098}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{814CBEEE-894E-4327-A6E1-740504850098}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -872,11 +777,8 @@ Global
|
||||
{18D09A24-8240-42D6-8CB6-236EEE820263}.Release|x86.ActiveCfg = Release|Win32
|
||||
{18D09A24-8240-42D6-8CB6-236EEE820263}.Release|x86.Build.0 = Release|Win32
|
||||
{990F2657-8580-4828-943F-5DD657D11843}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{990F2657-8580-4828-943F-5DD657D11843}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{990F2657-8580-4828-943F-5DD657D11843}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{990F2657-8580-4828-943F-5DD657D11843}.AuditMode|x64.Build.0 = Release|x64
|
||||
{990F2657-8580-4828-943F-5DD657D11843}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{990F2657-8580-4828-943F-5DD657D11843}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{990F2657-8580-4828-943F-5DD657D11843}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{990F2657-8580-4828-943F-5DD657D11843}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{990F2657-8580-4828-943F-5DD657D11843}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -926,11 +828,8 @@ Global
|
||||
{48D21369-3D7B-4431-9967-24E81292CF62}.Release|x86.ActiveCfg = Release|Win32
|
||||
{48D21369-3D7B-4431-9967-24E81292CF62}.Release|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-C46D-4588-B1C0-40F31AE9100B}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{CA5CAD1A-C46D-4588-B1C0-40F31AE9100B}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{CA5CAD1A-C46D-4588-B1C0-40F31AE9100B}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{CA5CAD1A-C46D-4588-B1C0-40F31AE9100B}.AuditMode|x64.Build.0 = Release|x64
|
||||
{CA5CAD1A-C46D-4588-B1C0-40F31AE9100B}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-C46D-4588-B1C0-40F31AE9100B}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-C46D-4588-B1C0-40F31AE9100B}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{CA5CAD1A-C46D-4588-B1C0-40F31AE9100B}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{CA5CAD1A-C46D-4588-B1C0-40F31AE9100B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -944,11 +843,8 @@ Global
|
||||
{CA5CAD1A-C46D-4588-B1C0-40F31AE9100B}.Release|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-C46D-4588-B1C0-40F31AE9100B}.Release|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-ABCD-429C-B551-8562EC954746}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{CA5CAD1A-ABCD-429C-B551-8562EC954746}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{CA5CAD1A-ABCD-429C-B551-8562EC954746}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{CA5CAD1A-ABCD-429C-B551-8562EC954746}.AuditMode|x64.Build.0 = Release|x64
|
||||
{CA5CAD1A-ABCD-429C-B551-8562EC954746}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-ABCD-429C-B551-8562EC954746}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-ABCD-429C-B551-8562EC954746}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{CA5CAD1A-ABCD-429C-B551-8562EC954746}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{CA5CAD1A-ABCD-429C-B551-8562EC954746}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -962,11 +858,8 @@ Global
|
||||
{CA5CAD1A-ABCD-429C-B551-8562EC954746}.Release|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-ABCD-429C-B551-8562EC954746}.Release|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-44BD-4AC7-AC72-6CA5B3AB89ED}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{CA5CAD1A-44BD-4AC7-AC72-6CA5B3AB89ED}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{CA5CAD1A-44BD-4AC7-AC72-6CA5B3AB89ED}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{CA5CAD1A-44BD-4AC7-AC72-6CA5B3AB89ED}.AuditMode|x64.Build.0 = Release|x64
|
||||
{CA5CAD1A-44BD-4AC7-AC72-6CA5B3AB89ED}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-44BD-4AC7-AC72-6CA5B3AB89ED}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-44BD-4AC7-AC72-6CA5B3AB89ED}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{CA5CAD1A-44BD-4AC7-AC72-6CA5B3AB89ED}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{CA5CAD1A-44BD-4AC7-AC72-6CA5B3AB89ED}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -980,11 +873,8 @@ Global
|
||||
{CA5CAD1A-44BD-4AC7-AC72-6CA5B3AB89ED}.Release|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-44BD-4AC7-AC72-6CA5B3AB89ED}.Release|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-1754-4A9D-93D7-857A9D17CB1B}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{CA5CAD1A-1754-4A9D-93D7-857A9D17CB1B}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{CA5CAD1A-1754-4A9D-93D7-857A9D17CB1B}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{CA5CAD1A-1754-4A9D-93D7-857A9D17CB1B}.AuditMode|x64.Build.0 = Release|x64
|
||||
{CA5CAD1A-1754-4A9D-93D7-857A9D17CB1B}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-1754-4A9D-93D7-857A9D17CB1B}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-1754-4A9D-93D7-857A9D17CB1B}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{CA5CAD1A-1754-4A9D-93D7-857A9D17CB1B}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{CA5CAD1A-1754-4A9D-93D7-857A9D17CB1B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -998,11 +888,8 @@ Global
|
||||
{CA5CAD1A-1754-4A9D-93D7-857A9D17CB1B}.Release|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-1754-4A9D-93D7-857A9D17CB1B}.Release|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-44BD-4AC7-AC72-F16E576FDD12}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{CA5CAD1A-44BD-4AC7-AC72-F16E576FDD12}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{CA5CAD1A-44BD-4AC7-AC72-F16E576FDD12}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{CA5CAD1A-44BD-4AC7-AC72-F16E576FDD12}.AuditMode|x64.Build.0 = Release|x64
|
||||
{CA5CAD1A-44BD-4AC7-AC72-F16E576FDD12}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-44BD-4AC7-AC72-F16E576FDD12}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-44BD-4AC7-AC72-F16E576FDD12}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{CA5CAD1A-44BD-4AC7-AC72-F16E576FDD12}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{CA5CAD1A-44BD-4AC7-AC72-F16E576FDD12}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -1016,11 +903,8 @@ Global
|
||||
{CA5CAD1A-44BD-4AC7-AC72-F16E576FDD12}.Release|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-44BD-4AC7-AC72-F16E576FDD12}.Release|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907}.AuditMode|x64.Build.0 = Release|x64
|
||||
{CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -1034,14 +918,8 @@ Global
|
||||
{CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907}.Release|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907}.Release|x86.Build.0 = Release|Win32
|
||||
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.AuditMode|ARM64.Deploy.0 = Release|ARM64
|
||||
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.AuditMode|x64.Build.0 = Release|x64
|
||||
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.AuditMode|x64.Deploy.0 = Release|x64
|
||||
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.AuditMode|x86.ActiveCfg = Release|x86
|
||||
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.AuditMode|x86.Build.0 = Release|x86
|
||||
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.AuditMode|x86.Deploy.0 = Release|x86
|
||||
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.Debug|ARM64.Deploy.0 = Debug|ARM64
|
||||
@@ -1061,11 +939,8 @@ Global
|
||||
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.Release|x86.Build.0 = Release|x86
|
||||
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.Release|x86.Deploy.0 = Release|x86
|
||||
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
|
||||
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.AuditMode|ARM64.Build.0 = AuditMode|ARM64
|
||||
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.AuditMode|x64.ActiveCfg = AuditMode|x64
|
||||
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.AuditMode|x64.Build.0 = AuditMode|x64
|
||||
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.AuditMode|x86.ActiveCfg = AuditMode|Win32
|
||||
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.AuditMode|x86.Build.0 = AuditMode|Win32
|
||||
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -1097,11 +972,8 @@ Global
|
||||
{EF3E32A7-5FF6-42B4-B6E2-96CD7D033F00}.Release|x86.ActiveCfg = Release|Win32
|
||||
{EF3E32A7-5FF6-42B4-B6E2-96CD7D033F00}.Release|x86.Build.0 = Release|Win32
|
||||
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
|
||||
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.AuditMode|ARM64.Build.0 = AuditMode|ARM64
|
||||
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.AuditMode|x64.ActiveCfg = AuditMode|x64
|
||||
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.AuditMode|x64.Build.0 = AuditMode|x64
|
||||
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.AuditMode|x86.ActiveCfg = AuditMode|Win32
|
||||
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.AuditMode|x86.Build.0 = AuditMode|Win32
|
||||
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -1115,11 +987,8 @@ Global
|
||||
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.Release|x86.ActiveCfg = Release|Win32
|
||||
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.Release|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
|
||||
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.AuditMode|ARM64.Build.0 = AuditMode|ARM64
|
||||
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.AuditMode|x64.ActiveCfg = AuditMode|x64
|
||||
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.AuditMode|x64.Build.0 = AuditMode|x64
|
||||
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.AuditMode|x86.ActiveCfg = AuditMode|Win32
|
||||
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.AuditMode|x86.Build.0 = AuditMode|Win32
|
||||
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -1133,11 +1002,8 @@ Global
|
||||
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.Release|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.Release|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-9A12-429C-B551-8562EC954746}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{CA5CAD1A-9A12-429C-B551-8562EC954746}.AuditMode|ARM64.Build.0 = Release|ARM64
|
||||
{CA5CAD1A-9A12-429C-B551-8562EC954746}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{CA5CAD1A-9A12-429C-B551-8562EC954746}.AuditMode|x64.Build.0 = Release|x64
|
||||
{CA5CAD1A-9A12-429C-B551-8562EC954746}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-9A12-429C-B551-8562EC954746}.AuditMode|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-9A12-429C-B551-8562EC954746}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{CA5CAD1A-9A12-429C-B551-8562EC954746}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{CA5CAD1A-9A12-429C-B551-8562EC954746}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -1150,6 +1016,36 @@ Global
|
||||
{CA5CAD1A-9A12-429C-B551-8562EC954746}.Release|x64.Build.0 = Release|x64
|
||||
{CA5CAD1A-9A12-429C-B551-8562EC954746}.Release|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-9A12-429C-B551-8562EC954746}.Release|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.AuditMode|x64.ActiveCfg = AuditMode|x64
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.AuditMode|x86.ActiveCfg = AuditMode|Win32
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Debug|x64.Build.0 = Debug|x64
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Debug|x86.Build.0 = Debug|Win32
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Release|x64.ActiveCfg = Release|x64
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Release|x64.Build.0 = Release|x64
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Release|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Release|x86.Build.0 = Release|Win32
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.Debug|x64.Build.0 = Debug|x64
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.Debug|x86.Build.0 = Debug|Win32
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.Release|x64.ActiveCfg = Release|x64
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.Release|x64.Build.0 = Release|x64
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.Release|x86.ActiveCfg = Release|Win32
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -1210,6 +1106,8 @@ Global
|
||||
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73} = {89CDCC5C-9F53-4054-97A4-639D99F169CD}
|
||||
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9} = {59840756-302F-44DF-AA47-441A9D673202}
|
||||
{CA5CAD1A-9A12-429C-B551-8562EC954746} = {59840756-302F-44DF-AA47-441A9D673202}
|
||||
{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506} = {59840756-302F-44DF-AA47-441A9D673202}
|
||||
{58A03BB2-DF5A-4B66-91A0-7EF3BA01269A} = {E8F24881-5E37-4362-B191-A3BA0ED7F4EB}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3140B1B7-C8EE-43D1-A772-D82A7061A271}
|
||||
|
||||
28
README.md
28
README.md
@@ -1,7 +1,7 @@
|
||||
# Welcome\!
|
||||
#### This repository contains the source code for:
|
||||
|
||||
* Windows Terminal
|
||||
* [Windows Terminal](https://www.microsoft.com/en-us/p/windows-terminal-preview/9n0dx20hk701)
|
||||
* The Windows console host (`conhost.exe`)
|
||||
* Components shared between the two projects
|
||||
* [ColorTool](https://github.com/Microsoft/Terminal/tree/master/src/tools/ColorTool)
|
||||
@@ -10,6 +10,32 @@
|
||||
#### Other related repositories include:
|
||||
* [Console API Documentation](https://github.com/MicrosoftDocs/Console-Docs)
|
||||
|
||||
## Installation
|
||||
|
||||
_(Note: in order to run the Windows Terminal, you'll need to be running at least Windows build 18362 or higher.)_
|
||||
|
||||
### Microsoft Store
|
||||
|
||||
Download the Microsoft Terminal free from the Microsoft Store and it'll be continuously updated. Or, feel free to side-load [releases](https://github.com/microsoft/terminal/releases) from GitHub, but note they won't auto-update.
|
||||
|
||||
<a href='//www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge'><img src='https://assets.windowsphone.com/85864462-9c82-451e-9355-a3d5f874397a/English_get-it-from-MS_InvariantCulture_Default.png' alt='English badge' width="284" height="104" style='width: 284px; height: 104px;'/></a>
|
||||
|
||||
### Chocolatey (Unofficial)
|
||||
|
||||
Download and upgrade the Windows Terminal from [Chocolatey](https://chocolatey.org).
|
||||
|
||||
To install Windows Terminal, run the following command from the command line or from PowerShell:
|
||||
```powershell
|
||||
choco install microsoft-windows-terminal
|
||||
```
|
||||
|
||||
To upgrade Windows Terminal, run the following command from the command line or from PowerShell:
|
||||
```powershell
|
||||
choco upgrade microsoft-windows-terminal
|
||||
```
|
||||
|
||||
If you have any issues when installing/upgrading the package please go to the [package page](https://chocolatey.org/packages/microsoft-windows-terminal) and follow the [Chocolatey triage process](https://chocolatey.org/docs/package-triage-process)
|
||||
|
||||
### Build Status
|
||||
|
||||
Project|Build Status
|
||||
|
||||
41
SECURITY.md
Normal file
41
SECURITY.md
Normal file
@@ -0,0 +1,41 @@
|
||||
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.2 BLOCK -->
|
||||
|
||||
## Security
|
||||
|
||||
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [many more](https://opensource.microsoft.com/).
|
||||
|
||||
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [definition](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)) of a security vulnerability, please report it to us as described below.
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
**Please do not report security vulnerabilities through public GitHub issues.**
|
||||
|
||||
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
|
||||
|
||||
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
|
||||
|
||||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
|
||||
|
||||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||
|
||||
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||
* Full paths of source file(s) related to the manifestation of the issue
|
||||
* The location of the affected source code (tag/branch/commit or direct URL)
|
||||
* Any special configuration required to reproduce the issue
|
||||
* Step-by-step instructions to reproduce the issue
|
||||
* Proof-of-concept or exploit code (if possible)
|
||||
* Impact of the issue, including how an attacker might exploit the issue
|
||||
|
||||
This information will help us triage your report more quickly.
|
||||
|
||||
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
|
||||
|
||||
## Preferred Languages
|
||||
|
||||
We prefer all communications to be in English.
|
||||
|
||||
## Policy
|
||||
|
||||
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
|
||||
|
||||
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
||||
@@ -13,6 +13,11 @@ pr:
|
||||
branches:
|
||||
include:
|
||||
- master
|
||||
paths:
|
||||
exclude:
|
||||
- doc/*
|
||||
- samples/*
|
||||
- tools/*
|
||||
|
||||
# 0.0.yyMM.dd##
|
||||
# 0.0.1904.0900
|
||||
|
||||
@@ -46,6 +46,14 @@ steps:
|
||||
clean: true
|
||||
maximumCpuCount: true
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Check MSIX for common regressions'
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
$Package = Get-ChildItem -Recurse -Filter "CascadiaPackage_*.msix"
|
||||
.\build\scripts\Test-WindowsTerminalPackage.ps1 -Verbose -Path $Package.FullName
|
||||
|
||||
- task: VSTest@2
|
||||
displayName: 'Run Unit Tests'
|
||||
inputs:
|
||||
|
||||
41
build/rules/GenerateSxsManifestsFromWinmds.targets
Normal file
41
build/rules/GenerateSxsManifestsFromWinmds.targets
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BeforeLinkTargets Condition="'$(WindowsTargetPlatformVersion)' >= '10.0.18362.0'">
|
||||
$(BeforeLinkTargets);
|
||||
_ConsoleGenerateAdditionalWinmdManifests;
|
||||
</BeforeLinkTargets>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="_ConsoleMapWinmdsToManifestFiles" DependsOnTargets="ResolveAssemblyReferences">
|
||||
<ItemGroup>
|
||||
<!-- For each non-system .winmd file in References, generate a .manifest in IntDir for it. -->
|
||||
<_ConsoleWinmdManifest Include="@(ReferencePath->'$(IntDir)\%(FileName).manifest')" Condition="'%(ReferencePath.IsSystemReference)' != 'true' and '%(ReferencePath.WinMDFile)' == 'true' and '%(ReferencePath.ReferenceSourceTarget)' == 'ResolveAssemblyReference'">
|
||||
<WinMDPath>%(ReferencePath.FullPath)</WinMDPath>
|
||||
<Implementation>%(ReferencePath.Implementation)</Implementation>
|
||||
</_ConsoleWinmdManifest>
|
||||
<!-- For each referenced project that _produces_ a winmd, generate a temporary item that maps to
|
||||
the winmd, and use that temporary item to generate a .manifest in IntDir for it.
|
||||
We don't set Implementation here because it's inherited from the _ResolvedNativeProjectReferencePaths. -->
|
||||
<_ConsoleWinmdProjectReference Condition="'%(_ResolvedNativeProjectReferencePaths.ProjectType)' != 'StaticLibrary'" Include="@(_ResolvedNativeProjectReferencePaths->WithMetadataValue('FileType','winmd')->'%(RootDir)%(Directory)%(TargetPath)')" />
|
||||
<_ConsoleWinmdManifest Include="@(_ConsoleWinmdProjectReference->'$(IntDir)\%(FileName).manifest')">
|
||||
<WinMDPath>%(Identity)</WinMDPath>
|
||||
</_ConsoleWinmdManifest>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="_ConsoleGenerateAdditionalWinmdManifests"
|
||||
Inputs="@(_ConsoleWinmdManifest.WinMDPath)"
|
||||
Outputs="@(_ConsoleWinmdManifest)"
|
||||
DependsOnTargets="_ConsoleMapWinmdsToManifestFiles">
|
||||
|
||||
<!-- This target is batched and a new Exec is spawned for each entry in _ConsoleWinmdManifest. -->
|
||||
<Exec Command="mt.exe -winmd:%(_ConsoleWinmdManifest.WinMDPath) -dll:%(_ConsoleWinmdManifest.Implementation) -out:%(_ConsoleWinmdManifest.Identity)" />
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Emit the generated manifest into the Link inputs. -->
|
||||
<Manifest Include="@(_ConsoleWinmdManifest)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Target>
|
||||
</Project>
|
||||
87
build/scripts/Test-WindowsTerminalPackage.ps1
Normal file
87
build/scripts/Test-WindowsTerminalPackage.ps1
Normal file
@@ -0,0 +1,87 @@
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[Parameter(Mandatory=$true, ValueFromPipeline=$true,
|
||||
HelpMessage="Path to the .appx/.msix to validate")]
|
||||
[string]
|
||||
$Path,
|
||||
|
||||
[Parameter(HelpMessage="Path to Windows Kit")]
|
||||
[ValidateScript({Test-Path $_ -Type Leaf})]
|
||||
[string]
|
||||
$WindowsKitPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
If ($null -Eq (Get-Item $WindowsKitPath -EA:SilentlyContinue)) {
|
||||
Write-Error "Could not find a windows SDK at at `"$WindowsKitPath`".`nMake sure that WindowsKitPath points to a valid SDK."
|
||||
Exit 1
|
||||
}
|
||||
|
||||
$makeAppx = "$WindowsKitPath\x86\MakeAppx.exe"
|
||||
$makePri = "$WindowsKitPath\x86\MakePri.exe"
|
||||
|
||||
Function Expand-ApplicationPackage {
|
||||
Param(
|
||||
[Parameter(Mandatory, ValueFromPipeline)]
|
||||
[string]
|
||||
$Path
|
||||
)
|
||||
|
||||
$sentinelFile = New-TemporaryFile
|
||||
$directory = New-Item -Type Directory "$($sentinelFile.FullName)_Package"
|
||||
Remove-Item $sentinelFile -Force -EA:Ignore
|
||||
|
||||
& $makeAppx unpack /p $Path /d $directory /nv /o
|
||||
|
||||
If ($LastExitCode -Ne 0) {
|
||||
Throw "Failed to expand AppX"
|
||||
}
|
||||
|
||||
$directory
|
||||
}
|
||||
|
||||
Write-Verbose "Expanding $Path"
|
||||
$AppxPackageRoot = Expand-ApplicationPackage $Path
|
||||
$AppxPackageRootPath = $AppxPackageRoot.FullName
|
||||
|
||||
Write-Verbose "Expanded to $AppxPackageRootPath"
|
||||
|
||||
Try {
|
||||
& $makePri dump /if "$AppxPackageRootPath\resources.pri" /of "$AppxPackageRootPath\resources.pri.xml" /o
|
||||
If ($LastExitCode -Ne 0) {
|
||||
Throw "Failed to dump PRI"
|
||||
}
|
||||
|
||||
$Manifest = [xml](Get-Content "$AppxPackageRootPath\AppxManifest.xml")
|
||||
$PRIFile = [xml](Get-Content "$AppxPackageRootPath\resources.pri.xml")
|
||||
|
||||
### Check the activatable class entries for a few DLLs we need.
|
||||
$inProcServers = $Manifest.Package.Extensions.Extension.InProcessServer.Path
|
||||
$RequiredInProcServers = ("TerminalApp.dll", "TerminalControl.dll", "TerminalConnection.dll")
|
||||
|
||||
Write-Verbose "InProc Servers: $inProcServers"
|
||||
|
||||
ForEach ($req in $RequiredInProcServers) {
|
||||
If ($req -NotIn $inProcServers) {
|
||||
Throw "Failed to find $req in InProcServer list $inProcServers"
|
||||
}
|
||||
}
|
||||
|
||||
### Check that we have an App.xbf (which is a proxy for our resources having been merged)
|
||||
$resourceXpath = '/PriInfo/ResourceMap/ResourceMapSubtree[@name="Files"]/NamedResource[@name="App.xbf"]'
|
||||
$AppXbf = $PRIFile.SelectSingleNode($resourceXpath)
|
||||
If ($null -eq $AppXbf) {
|
||||
Throw "Failed to find App.xbf (TerminalApp project) in resources.pri"
|
||||
}
|
||||
|
||||
If ($Manifest.Package.Identity.ProcessorArchitecture -Ne "arm64") {
|
||||
### ARM64 doesn't package cpprest_2_10.
|
||||
If (($null -eq (Get-Item "$AppxPackageRootPath\cpprest_2_10.dll" -EA:Ignore)) -And
|
||||
($null -eq (Get-Item "$AppxPackageRootPath\cpprest_2_10d.dll" -EA:Ignore))) {
|
||||
Throw "Failed to find cpprest_2_10.dll -- check the WAP packaging project"
|
||||
}
|
||||
}
|
||||
} Finally {
|
||||
Remove-Item -Recurse -Force $AppxPackageRootPath
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
"/.vs/",
|
||||
"/build/",
|
||||
"/src/cascadia/",
|
||||
"/src/winconpty/",
|
||||
"/.nuget/",
|
||||
"/.github/",
|
||||
"/samples/"
|
||||
|
||||
2
dep/gsl
2
dep/gsl
Submodule dep/gsl updated: b74b286d5e...1212beae77
2
dep/wil
2
dep/wil
Submodule dep/wil updated: fbcd1d2abb...e8c599bca6
@@ -8,9 +8,9 @@ Settings in the Windows Console Host can be a bit tricky to understand. This is
|
||||
|---------------------------|-----------------------|--------------------------------------|
|
||||
|`FontSize` |Coordinate (REG_DWORD) |Size of font in pixels |
|
||||
|`FontFamily` |REG_DWORD |GDI Font family |
|
||||
|`ScreenBufferSize` |Coordinate (REG_DWORD) |Size of the screen buffer in WxH characters |
|
||||
|`ScreenBufferSize` |Coordinate (REG_DWORD) |Size of the screen buffer in WxH characters\*\* |
|
||||
|`CursorSize` |REG_DWORD |Cursor height as percentage of a single character |
|
||||
|`WindowSize` |Coordinate (REG_DWORD) |Initial size of the window in WxH characters |
|
||||
|`WindowSize` |Coordinate (REG_DWORD) |Initial size of the window in WxH characters\*\* |
|
||||
|`WindowPosition` |Coordinate (REG_DWORD) |Initial position of the window in WxH pixels (if not set, use auto-positioning) |
|
||||
|`WindowAlpha` |REG_DWORD |Opacity of the window (valid range: 0x4D-0xFF) |
|
||||
|`ScreenColors` |REG_DWORD |Default foreground and background colors |
|
||||
@@ -39,6 +39,10 @@ Settings in the Windows Console Host can be a bit tricky to understand. This is
|
||||
|
||||
*: Only applies to the improved version of the Windows Console Host
|
||||
|
||||
**: WxH stands for Width by Height, it's the fact that things like a Window size
|
||||
store the Width and Height values in the high and low word in the registry's
|
||||
double word values.
|
||||
|
||||
## The Settings Hierarchy
|
||||
|
||||
Settings are persisted to a variety of locations depending on how they are modified and how the Windows Console Host was invoked:
|
||||
|
||||
181
doc/Niksa.md
Normal file
181
doc/Niksa.md
Normal file
@@ -0,0 +1,181 @@
|
||||
# Niksa's explanations
|
||||
|
||||
Sometimes @miniksa will write a big, long explanatory comment in an issue thread that turns out to be a decent bit of reference material.
|
||||
This document serves as a storage point for those posts.
|
||||
|
||||
- [Why do we avoid changing CMD.exe?](#cmd)
|
||||
- [Why is typing-to-screen performance better than every other app?](#screenPerf)
|
||||
- [How are the Windows graphics/messaging stack assembled?](#gfxMsgStack)
|
||||
- [Output Processing between "Far East" and "Western"](#fesb)
|
||||
- [Why do we not backport things?](#backport)
|
||||
- [Why can't we have mixed elevated and non-elevated tabs in the Terminal?](#elevation)
|
||||
|
||||
## <a name="cmd"></a>Why do we avoid changing CMD.exe?
|
||||
`setlocal` doesn't behave the same way as an environment variable. It's a thing that would have to be put in at the top of the batch script that is `somefile.cmd` as one of its first commands to adjust the way that one specific batch file is processed by the `cmd.exe` engine. That's probably not suitable for your needs, but that's the way we have to go.
|
||||
|
||||
I don't think anyone is disagreeing with you, @mikemaccana, that this would be a five minute development change to read that environment variable and change the behavior of `cmd.exe`. It absolutely would be a tiny development time.
|
||||
|
||||
It's just that from our experience, we know there's going to be a 3-24 month bug tail here where we get massive investigation callbacks by some billion dollar enterprise customer who for whatever reason was already using the environment variable we pick for another purpose. Their script that they give their rank-and-file folks will tell them to press Ctrl+C at some point in the batch script to do whatever happens, it will do something different, those people will notice the script doesn't match the computer anymore. They will then halt the production line and tell their supervisor. The supervisor tells some director. Their director comes screaming at their Microsoft enterprise support contract person that we've introduced a change to the OS that is costing them millions if not billions of dollars in shipments per month. Our directors at Microsoft then come bashing down our doors angry with us and make us fix it ASAP or revert it, we don't get to go home at 5pm to our families or friends because we're fixing it, we get stressed the heck out, we have to spin up servicing potentially for already shipped operating systems which is expensive and headache-causing...etc.
|
||||
|
||||
We can see this story coming a million miles away because it has happened before with other 'tiny' change we've been asked to make to `cmd.exe` in the past few years.
|
||||
|
||||
I would just ask you to understand that `cmd.exe` is very, very much in a maintenance mode and I just want to set expectations here. We maintain it, yes. We have a renewed interest in command-line development, yes. But our focuses are revolving around improving the terminal and platform itself and bringing modern, supported shells to be the best they can be on Windows. Paul will put this on the backlog of things that people want in `cmd.exe`, yes. But it will sink to the bottom of the backlog because changing `cmd.exe` is our worst nightmare as its compatibility story is among the heaviest of any piece of the operating system.
|
||||
|
||||
I would highly recommend that Gulp convert to using PowerShell scripts and that if such an issue exists with PowerShell, that we get their modern, supported, and better-engineered platform to support the scenario. I don't want you to sit around waiting for `cmd.exe` to change this because it's really not going to happen faster than that script could be converted to `ps1` and it fixed in PowerShell Core (if that's even a problem in that world.)
|
||||
|
||||
Original Source: https://github.com/microsoft/terminal/issues/217#issuecomment-404240443
|
||||
|
||||
## <a name="screenPerf"></a>Why is typing-to-screen performance better than every other app?
|
||||
|
||||
I really do not mind when someone comes by and decides to tell us that we're doing a good job at something. We hear so many complaints every day that a post like this is a breath of fresh air. Thanks for your thanks!
|
||||
|
||||
Also, I'm happy to discuss this with you until you're utterly sick of reading it. Please ask any follow-ons you want. I thrive on blathering about my work. :P
|
||||
|
||||
If I had to take an educated guess as to what is making us faster than pretty much any other application on Windows at putting your text on the screen... I would say it is because that is literally our only job! Also probably because we are using darn near the oldest and lowest level APIs that Windows has to accomplish this work.
|
||||
|
||||
Pretty much everything else you've listed has some sort of layer or framework involved, or many, many layers and frameworks, when you start talking about Electron and Javascript. We don't.
|
||||
|
||||
We have one bare, super un-special window with no additional controls attached to it. We get our keys fed into us from just barely above the kernel given that we're processing them from window messages and not from some sort of eventing framework common to pretty much any other more complicated UI framework than ours (WPF, WinForms, UWP, Electron). And we dump our text straight onto the window surface using GDI's [PolyTextOut](https://docs.microsoft.com/en-us/windows/desktop/api/wingdi/nf-wingdi-polytextoutw) with no frills.
|
||||
|
||||
Even `notepad.exe` has multiple controls on its window at the very least and is probably (I haven't looked) using some sort of library framework in the edit control to figure out its text layout (which probably is using another library framework for internationalization support...)
|
||||
|
||||
Of course this also means that we have trade offs. We don't support fully international text like pretty much every other application will. RTL? No go zone right now. Surrogate pairs and emoji? We're getting there but not there yet. Indic scripts? Nope.
|
||||
|
||||
Why are we like this? For one, `conhost.exe` is old as dirt. It has to use the bare metal bottom layer of everything because it was created before most of those other frameworks were created. And also it maintains as low/bottom level as possible because it is pretty much the first thing that one needs to bring up when bringing up a new operating system edition or device before you have all the nice things like frameworks or what those frameworks require to operate. Also it's written in C/C++ which is about as low and bare metal as we can get.
|
||||
|
||||
Will this UI enhancement come to other apps on Windows? Almost certainly not. They have too much going on which is both a good and a bad thing. I'm jealous of their ability to just call one method and layout text in an uncomplicated manner in any language without manually calculating pixels or caring about what styles apply to their font. But my manual pixel calculations, dirty region math, scroll region madness, and more makes it so we go faster than them. I'm also jealous that when someone says "hey can you add a status bar to the bottom of your window" that they can pretty much click and drag that into place with their UI Framework and it will just work where as for us, it's been a backlog item forever and gives me heartburn to think about implementing.
|
||||
|
||||
Will we try to keep it from regressing? Yes! Right now it's sort of a manual process. We identify that something is getting slow and then we go haul out [WPR](https://docs.microsoft.com/en-us/windows-hardware/test/wpt/windows-performance-recorder) and start taking traces. We stare down the hot paths and try to reason out what is going on and then improve them. For instance, in the last cycle or two, we focused on heap allocations as a major area where we could improve our end-to-end performance, changing a ton of our code to use stack-constructed iterator-like facades over the underlying request buffer instead of translating and allocating it into a new heap space for each level of processing.
|
||||
|
||||
As an aside, @bitcrazed wants us to automate performance tests in some conhost specific way, but I haven't quite figured out a controlled environment to do this in yet. The Windows Engineering System runs performance tests each night that give us a coarse grained way of knowing if we messed something up for the whole operating system, and they technically offer a fine grained way for us to insert our own performance tests... but I just haven't got around to that yet. If you have an idea for a way for us to do this in an automated fashion, I'm all ears.
|
||||
|
||||
If there's anything else you'd like to know, let me know. I could go on all day. I deleted like 15 tangents from this reply before posting it....
|
||||
|
||||
Original Source: https://github.com/microsoft/terminal/issues/327#issuecomment-447391705
|
||||
|
||||
## <a name="gfxMsgStack"></a>How are the Windows graphics/messaging stack assembled?
|
||||
|
||||
@stakx, I am referring to USER32 and GDI32.
|
||||
|
||||
I'll give you a cursory overview of what I know off the top of my head without spending hours confirming the details. As such, some of this is subject to handwaving and could be mildly incorrect but is probably in the right direction. Consider every statement to be my personal knowledge on how the world works and subject to opinion or error.
|
||||
|
||||
For the graphics part of the pipeline (GDI32), the user-mode portions of GDI are pretty far down. The app calls GDI32, some work is done in that DLL on the user-mode side, then a kernel call jumps over to the kernel and drawing occurs.
|
||||
|
||||
The portion that you're thinking of regarding "silently converted to sit on top of other stuff" is probably that once we hit the kernel calls, a bunch of the kernel GDI stuff tends to be re-platformed on top of the same stuff as DirectX when it is actually handled by the NVIDIA/AMD/Intel/etc. graphics driver and the GPU at the bottom of the stack. I think this happened with the graphics driver re-architecture that came as a part of WDDM for Windows Vista. There's a document out there somewhere about what calls are still really fast in GDI and which are slower as a result of the re-platforming. Last time I found that document and checked, we were using the fast ones.
|
||||
|
||||
On top of GDI, I believe there are things like Common Controls or comctl32.dll which provided folks reusable sets of buttons and elements to make their UIs before we had nicer declarative frameworks. We don't use those in the console really (except in the property sheet off the right click menu).
|
||||
|
||||
As for DirectWrite and D2D and D3D and DXGI themselves, they're a separate set of commands and paths that are completely off to the side from GDI at all both in user and kernel mode. They're not really related other than that there's some interoperability provisions between the two. Most of our other UI frameworks tend to be built on top of the DirectX stack though. XAML is for sure. I think WPF is. Not sure about WinForms. And I believe the composition stack and the window manager are using DirectX as well.
|
||||
|
||||
As for the input/interaction part of the pipeline (USER32), I tend to find most other newer things (at least for desktop PCs) are built on top of what is already there. USER32's major concept is windows and window handles and everything is sent to a window handle. As long as you're on a desktop machine (or a laptop or whatever... I mean a classic-style Windows-powered machine), there's a window handle involved and messages floating around and that means we're talking USER32.
|
||||
|
||||
The window message queue is just a straight up FIFO (more or less) of whatever input has occurred relevant to that window while it's in the foreground + whatever has been sent to the window by other components in the system.
|
||||
|
||||
The newer technologies and the frameworks like XAML and WPF and WinForms tend to receive the messages from the window message queue one way or another and process them and turn them into event callbacks to various objects that they've provisioned within their world.
|
||||
|
||||
However, the newer technologies that also work on other non-desktop platforms like XAML tend to have the ability to process stuff off of a completely different non-USER32 stack as well. There's a separate parallel stack to USER32 with all of our new innovations and realizations on how input and interaction should occur that doesn't exactly deal with classic messaging queues and window handles the same way. This is the whole Core* family of things like CoreWindow and CoreMessaging. They also have a different concept of "what is a user" that isn't so centric around your butt in rolling chair in front of a screen with a keyboard and mouse on the desk.
|
||||
|
||||
Now, if you're on XAML or one of the other Frameworks... all this intricacy is handled for you. XAML figures out how to draw on DirectX for you and negotiates with the compositor and window manager for cool effects on your behalf. It figures out whether to get your input events from USER32 or Core* or whatever transparently depending on your platform and the input stacks can handle pen, touch, keyboard, mouse, and so on in a unified manner. It has provisions inside it embedded to do all the sorts of globalization, accessibility, input interaction, etc. stuff that make your life easy. But you could choose to go directly to the low-level and handle it yourself or skip handling what you don't care about.
|
||||
|
||||
The trick is that GDI32 and USER32 were designed for a limited world with a limited set of commands. Desktop PCs were the only thing that existed, single user at the keyboard and mouse, simple graphics output to a VGA monitor. So using them directly at the "low level" like conhost does is pretty easy. The new platforms could be used at the "low level" but they're orders of magnitude more complicated because they now account for everything that has happened with personal computing in 20+ years like different form factors, multiple active users, multiple graphics adapters, and on and on and on and on. So you tend to use a framework when using the new stuff so your head doesn't explode. They handle it for you, but they handle more than they ever did before so they're slower to some degree.
|
||||
|
||||
So are GDI32 and USER32 "lower" than the new stuff? Sort of.
|
||||
Can you get that low with the newer stuff? Mostly yes, but you probably shouldn't and don't want to.
|
||||
Does new live on top of old or is old replatformed on the new? Sometimes and/or partially.
|
||||
Basically... it's like the answer to anything software... "it's an unmitigated disaster and if we all stepped back a moment, we should be astounded that it works at all." :P
|
||||
|
||||
Anyway, that's enough ramble for one morning. Hopefully that somewhat answered your questions and gave you a bit more insight.
|
||||
|
||||
Original Source: https://github.com/microsoft/terminal/issues/327#issuecomment-447926388
|
||||
|
||||
## <a name="fesb"></a>Output Processing between "Far East" and "Western"
|
||||
|
||||
>
|
||||
> ```
|
||||
> if (WI_IsFlagSet(CharType, C1_CNTRL))
|
||||
> ```
|
||||
|
||||
In short, this is probably fine to fix.
|
||||
|
||||
However, I would personally feed a few characters through `WriteCharsLegacy` under the debugger and assert that your theory is correct first (that multiple flags coming back are what the problem is) before making the change.
|
||||
|
||||
I am mildly terrified, less than Dustin, because it is freaking `WriteCharsLegacy` which is the spawn of hell and I fear some sort of regression in it.
|
||||
|
||||
In long, why is it fine to fix?
|
||||
|
||||
For reference, this particular segment of code https://github.com/microsoft/terminal/blob/9b92986b49bed8cc41fde4d6ef080921c41e6d9e/src/host/_stream.cpp#L514-L539 appears to only be used when the codepoint is < 0x20 or == 0x7F https://github.com/microsoft/terminal/blob/9b92986b49bed8cc41fde4d6ef080921c41e6d9e/src/host/_stream.cpp#L408 and ENABLE_PROCESSED_OUTPUT is off. https://github.com/microsoft/terminal/blob/9b92986b49bed8cc41fde4d6ef080921c41e6d9e/src/host/_stream.cpp#L320
|
||||
|
||||
I looked back at the console v1 code and this particular section had a divergence for "Western" countries and "Far East" countries (a geopolitically-charged term, but what it was, nonetheless.)
|
||||
|
||||
For "Western" countries, we would unconditionally run all the characters through `MultiByteToWideChar` with `MB_USEGLYPHCHARS` without the `C1_CNTRL` test and move the result into the buffer.
|
||||
|
||||
For "Eastern" countries, we did the `C1_CNTRL` test and then if true, we would run through `MultiByteToWideChar` with `MB_USEGLYPHCHARS`. Otherwise, we would just move the original character into the buffer and call it a day.
|
||||
|
||||
Note in both of these, there is a little bit of indirection before `MultiByteToWideChar` is called through some other helper methods like `ConvertOutputToUnicode`, but that's the effective conversion point, as far as I can tell. And that's where the control characters would turn into acceptable low ASCII symbols.
|
||||
|
||||
When we took over the console codebase, this variation between "Western" and "Eastern" countries was especially painful because `conhost.exe` would choose which one it was in based on the `Codepage for Non-Unicode Applications` set in the Control Panel's Regional > Administrative panel and it could only be changed with a reboot. It wouldn't even change properly when you `chcp` to a different codepage. Heck, `chcp` would deny you from switching into many codepages. There was a block in place to prevent going to an "Eastern" codepage if you booted up in a "Western" codepage. There was also a block preventing you from going between "Eastern" codepages, if I recall correctly.
|
||||
|
||||
In modernizing, I decided a few things:
|
||||
1. What's good for the "Far East" should be good for the rest of the world. CJK languages that encompassed the "Far East" code have to be able to handle "Western" text as well even if the reverse wasn't true.
|
||||
2. We need to scrub all usages of "Far East" from the code. Someone already started that and replaced them with "East Asia" except then they left behind the shorthand of "FE" prefixing dozens of functions which made it hard to follow the code. It took us months to realize "FE" and "East Asia" were the same thing.
|
||||
3. It's obnoxious that the way this was handled was to literally double-define every output function in the code base to have two definitions, compile them both into the conhost, then choose to run down the SB_ versions or the FE_ versions depending on the startup Non-Unicode codepage. It was a massive pile of complex pre-compilation `#ifdef` and `#else`s that would sometimes surround individual lines in the function bodies. Gross.
|
||||
4. The fact that the FE_ versions of the functions were way slower than the SB_ ones was unacceptable even for the same output of Latin-character text.
|
||||
5. Anyone should be free to switch between any codepage they want at any time and restricting it based on a value from OS startup or region/locale is not acceptable in the modern world.
|
||||
6. I concluded by all of the above that I was going to tank/delete/remove the SB_ versions of everything and force the entire world to use the FE_ versions as truth. I would fix the FE_ versions to handle everything correctly, I would fix the performance characteristics of the FE_ versions so they were only slower when things were legitimately more complicated and never otherwise, I would banish all usage of "Far East", "East Asia", "FE_", and "SB_" from the codebase, and codepages would be freely switchable.
|
||||
7. Oh. Also, the conhost used to rewrite its entire backing buffer into whatever your current codepage was whenever you switched codepages. I changed that to always hold it as UTF-16.
|
||||
|
||||
Now, after that backstory. This is where the problem comes in. It looks like the code you're pointing to that didn't check flags and instead checked direct equality... is the way that it was ALWAYS done for the "Eastern" copy of the code. So it was ALWAYS broken for the "Eastern" codepages and country variants of the OS.
|
||||
|
||||
I don't know why the "Eastern" copy was checking `C1_CNTRL` at all in the first place. There is no documentation. I presume it has to do with Shift-JIS or GB-2312 or Unified Hangul or something having a conflict < 0x20 || == 0x7F. Or alternatively, it's because someone wrote the code naively thinking it was a good idea in a hurry and never tested it. Very possible and even probable.
|
||||
|
||||
Presuming CJK codepages have no conflict in this range for their DBCS codepages... we could probably remove the check with `GetStringTypeW` entirely and always run everything through `ConvertOutputToUnicode`. More risky than just the flag test change... but theoretically an option as well.
|
||||
|
||||
|
||||
Original Source: https://github.com/microsoft/terminal/issues/166#issuecomment-510953359
|
||||
|
||||
## <a name="backport"></a>Why do we not backport things?
|
||||
|
||||
Someone has to prove that this is costing millions to billions of dollars of lost productivity or revenue to outweigh the risks of shipping the fix to hundreds of millions of Windows machines and potentially breaking something.
|
||||
|
||||
Our team generally finds it pretty hard to prove that against the developer audience given that they're only a small portion of the total installed market of Windows machines.
|
||||
|
||||
Our only backport successes really come from corporations with massive addressable market (like OEMs shipping PCs) who complain that this is fouling up their manufacturing line (or something of that ilk). Otherwise, our management typically says that the risks don't outweigh the benefits.
|
||||
|
||||
It's also costly in terms of time, effort, and testing for us to validate a modification to a released OS. We have a mindbogglingly massive amount of automated machinery dedicated to processing and validating the things that we check in while developing the current OS builds. But it's a special costly ask to spin up some to all of those activities to validate backported fixes. We do it all the time for Patch Tuesday, but in those patches, they only pass through the minimum number of fixes required to maximize the restoration of productivity/security/revenue/etc. because every additional fix adds additional complexity and additional risk.
|
||||
|
||||
So from our little team working hard to make developers happy, we virtually never make the cut for servicing. We're sorry, but we hope you can understand. It's just the reality of the situation to say "nope" when people ask for a backport. In our team's ideal world, you would all be running the latest console bits everywhere everytime we make a change. But that's just not how it is today.
|
||||
|
||||
Original Source: https://github.com/microsoft/terminal/issues/279#issuecomment-439179675
|
||||
|
||||
## <a name="elevation"></a>Why can't we have mixed elevated and non-elevated tabs in the Terminal?
|
||||
|
||||
_guest speaker @DHowett-MSFT_
|
||||
|
||||
[1] It is trivial when you are _hosting traditional windows_ with traditional window handles. That works very well in the conemu case, or in the tabbed shell case, where you can take over a window in an elevated session and re-parent it under a window in a non-elevated session.
|
||||
|
||||
When you do that, there's a few security features that I'll touch on in [2]. Because of those, you can parent it but you can't really force it to do anything.
|
||||
|
||||
There's a problem, though. The Terminal isn't architected as a collection of re-parentable windows. For example, it's not running a console host and moving its window into a tab. It was designed to support a "connection" -- something that can read and write text. It's a lower-level primitive than a window. We realized the error of our ways and decided that the UNIX model was right the entire time, and pipes and text and streams are _where it's at._
|
||||
|
||||
Given that we're using Xaml islands to host a modern UI and stitching a DirectX surface into it, we're far beyond the world of standard window handles anyway. Xaml islands are fully composed into a single HWND, much like Chrome and Firefox and the gamut of DirectX/OpenGL/SDL games. We don't **have** components that can be run in one process (elevated) and hosted in another (non-elevated) that aren't the aforementioned "connections".
|
||||
|
||||
Now, the obvious followup question is _"why can't you have one elevated connection in a tab next to a non-elevated connection?"_ This is where @sba923 should pick up reading (:smile:). I'm probably going to cover some things that you (@robomac) know already.
|
||||
|
||||
[2] When you have two windows on the same desktop in the same window station, they can communicate with eachother. I can use `SendKeys` easily through `WScript.Shell` to send keyboard input to any window that the shell can see.
|
||||
|
||||
Running a process elevated _severs_ that connection. The shell can't see the elevated window. No other program at the same integrity level as the shell can see the elevated window. Even if it has its window handle, it can't really interact with it. This is also why you can't drag/drop from explorer into notepad if notepad is running elevated. Only another elevated process can interact with another elevated window.
|
||||
|
||||
That "security" feature (call it what you like, it was probably intended to be a security feature at one point) only exists for a few session-global object types. Windows are one of them. Pipes aren't really one of them.
|
||||
|
||||
Because of that, it's trivial to break that security. Take the terminal as an example of that. If we start an elevated connection and host it in a _non-elevated_ window, we've suddenly created a conduit through that security boundary. The elevated thing on the other end isn't a window, it's just a text-mode application. It immediately does the bidding of the non-elevated host.
|
||||
|
||||
Anybody that can _control_ the non-elevated host (like `WScript.Shell::SendKeys`) _also_ gets an instant conduit through the elevation boundary. Suddenly, any medium integrity application on your system can control a high-integrity process. This could be your browser, or the bitcoin miner that got installed with the `left-pad` package from NPM, or really any number of things.
|
||||
|
||||
It's a small risk, but it _is_ a risk.
|
||||
|
||||
---
|
||||
|
||||
Other platforms have accepted that risk in preference for user convenience. They aren't wrong to do so, but I think Microsoft gets less of a "pass" on things like "accepting risk for user convenience". Windows 9x was an unmitigated security disaster, and limited user accounts and elevation prompts and kernel-level security for window management were the answer to those things. They're not locks to be loosened lightly.
|
||||
|
||||
Original Source: https://github.com/microsoft/terminal/issues/632#issuecomment-519375707
|
||||
|
||||
42
doc/bot.md
42
doc/bot.md
@@ -8,12 +8,12 @@ We'll be using tags, primarily, to help us understand what needs attention, what
|
||||
### Quick-Guidance to Core Contributors
|
||||
1. Look at `Needs-Attention` as top priority
|
||||
1. Look at `Needs-Triage` during triage meetings to get a handle on what's new and sort it out
|
||||
1. Look at `Needs-Tag-Fix` when you have a few minutes to fix up things tagged impoperly
|
||||
1. Look at `Needs-Tag-Fix` when you have a few minutes to fix up things tagged improperly
|
||||
1. Manually add `Needs-Author-Feedback` when there's something we need the author to follow up on and want attention if they return it or an auto-close for inactivity if it goes stale.
|
||||
|
||||
### Tagging/Process Details
|
||||
1. When new issues arrive, or when issues are not properly tagged... we'll mark them as `Needs-Triage` automatically.
|
||||
- The core contributor team will then come through and mark them up as appropriate. The goal is to have a tag that fits the `Product`, `Area`, and `Issue` category.
|
||||
- The core contributor team will then come through and mark them up as appropriate. The goal is to have a tag that fits the `Product`, `Area`, and `Issue` category.
|
||||
- The `Needs-Triage` tag will be removed manually by the core contributor team during a triage meeting. (Exception, triage may also be done offline by senior team members during high-volume times.)
|
||||
- An issue may or may not be assigned to a contributor during triage. It is not necessary to assign someone to complete it.
|
||||
- We're not focusing on Projects yet.
|
||||
@@ -22,7 +22,7 @@ We'll be using tags, primarily, to help us understand what needs attention, what
|
||||
- When this tag drops off, the bot will apply the `Needs-Attention` tag to get the core contribution team's attention again. If an author cares enough to be active, we will attempt to prioritize engaging with that author.
|
||||
- If the author doesn't come back around in a while, this will become a `No-Recent-Activity` tag.
|
||||
- If there's activity on an issue, the `No-Recent-Activity` tag will automatically drop.
|
||||
- If the `No-Recent-Activity` stays, the issue will be closed as stale.
|
||||
- If the `No-Recent-Activity` stays, the issue will be closed as stale.
|
||||
1. PRs will automatically get a `Needs-Author-Feedback` tag when reviewers wait on the author
|
||||
- This follows a similar decay strategy to issues.
|
||||
- If the author responds, the `Needs-Author-Feedback` tag will drop.
|
||||
@@ -33,11 +33,22 @@ We'll be using tags, primarily, to help us understand what needs attention, what
|
||||
|
||||
## Rules
|
||||
|
||||
### Triage Shorthand
|
||||
- All rules in this category apply to triaging issues. They're shorthand comments that the triage team can use in order to complete the triage process faster.
|
||||
- Only individuals with `Write` or `Admin` privileges on the repository can use these responses.
|
||||
|
||||
#### Duplicate Issues
|
||||
- When a comment on the thread says `/dup #<issue ID>`...
|
||||
1. Reply with a comment explaining that the issue is a duplicate and recommend that the opener and interested parties follow the issue on the listed ID number.
|
||||
1. Close the issue
|
||||
1. Remove all `Needs-*` tags
|
||||
1. Add `Resolution-Duplicate`
|
||||
|
||||
### Issue Management
|
||||
|
||||
#### Mark as Triage Needed
|
||||
- When an issue doesn't meet triage criteria, applies `Needs-Triage` tag. Right now, this is just when it's opened.
|
||||
|
||||
|
||||
#### Author Has Responded
|
||||
- When an issue with `Needs-Author-Feedback` gets an author response, drops that tag in favor of `Needs-Attention` to flag core contributors to drop by.
|
||||
|
||||
@@ -64,6 +75,14 @@ We'll be using tags, primarily, to help us understand what needs attention, what
|
||||
- If an issue is filed matching a pattern that happens all the time (common duplicate phrase, obvious multiple-issues-in-one pattern)...
|
||||
- Then close the issue automatically informing the opener that they can resolve the problem and reopen the issue. (See Bug/Feature templates for example situations.)
|
||||
|
||||
#### Help ask for Feedback Hub
|
||||
- When a comment on the thread says `/feedback`...
|
||||
1. Then reply to the issue with a bit of text on asking the author to send us data with Feedback Hub and give us the link.
|
||||
1. And add the `Needs-Author-Feedback` tag
|
||||
|
||||
#### Remove Help Wanted from In PR issues
|
||||
- If an issue gets the `In-PR` tag when a new PR is created, we will remove the `Help-Wanted` tag to avoid someone trying to work on an issue where another person has already submitted a proposed fix.
|
||||
|
||||
### PR Management
|
||||
|
||||
#### Codeflow Link *(Disabled)*
|
||||
@@ -87,16 +106,25 @@ We'll be using tags, primarily, to help us understand what needs attention, what
|
||||
#### Auto-Merge pull requests
|
||||
- When a pull request has the `AutoMerge` label...
|
||||
- If it has been at least 480 minutes and all the statuses pass, merge it in.
|
||||
- Will use Squash merge stratgy
|
||||
- Will use Squash merge strategy
|
||||
- Will attempt to delete branch after merge, if possible
|
||||
- Will automatically remove the `AutoMerge` label if changes are pushed by someone *without* Write Access.
|
||||
- More information on bot-logic that can be controlled with comments is [here](https://github.com/OfficeDev/office-ui-fabric-react/wiki/Advanced-auto-merge)
|
||||
|
||||
|
||||
#### Mark issues with an active PR
|
||||
- If there is an active PR for an issue, label that issue with the `In-PR` label
|
||||
|
||||
#### Add committed fix tag for completed PRs
|
||||
- When a PR is finished and there's no outstanding work left on a linked issue, add the `Resolution-Fix-Committed` label
|
||||
|
||||
|
||||
#### Remove Needs-Second from completed PRs
|
||||
- If a PR is closed and it has the `Needs-Second` tag, the bot will remove the tag.
|
||||
|
||||
### Release Management
|
||||
|
||||
When a release is created, if the PR ID number is linked inside the release description, the bot will walk through the related PR and all of its related issues and leave a message.
|
||||
- PR message: "🎉{release name} {release version} has been released which incorporates this pull request.🎉
|
||||
- Issue message: 🎉This issue was addressed in #{pull request ID}, which has now been successfully released as {release name} {release version}.🎉"
|
||||
|
||||
## Admin Panel
|
||||
[Here](https://fabric-cp.azurewebsites.net/bot/)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
# How to build Openconsole
|
||||
|
||||
Openconsole can be built with Visual Studio or from the command line. There are build scripts for both cmd and powershell in /tools.
|
||||
Openconsole can be built with Visual Studio or from the command line. There are build scripts for both cmd and PowerShell in /tools.
|
||||
|
||||
When using Visual Studio, be sure to set up the path for code formatting. This can be done in Visual Studio by going to Tools > Options > Text Editor > C++ > Formatting and checking "Use custom clang-format.exe file" and choosing the clang-format.exe in the repository at /dep/llvm/clang-format.exe by clicking "browse" right under the check box.
|
||||
|
||||
@@ -33,4 +33,4 @@ Openconsole has three configuration types:
|
||||
- Release
|
||||
- AuditMode
|
||||
|
||||
AuditMode is an experimental mode that enables some additional static analyis from CppCoreCheck.
|
||||
AuditMode is an experimental mode that enables some additional static analysis from CppCoreCheck.
|
||||
|
||||
@@ -6,13 +6,14 @@ Properties listed below affect the entire window, regardless of the profile sett
|
||||
| Property | Necessity | Type | Default | Description |
|
||||
| -------- | --------- | ---- | ------- | ----------- |
|
||||
| `alwaysShowTabs` | _Required_ | Boolean | `true` | When set to `true`, tabs are always displayed. When set to `false` and `showTabsInTitlebar` is set to `false`, tabs only appear after typing <kbd>Ctrl</kbd> + <kbd>T</kbd>. |
|
||||
| `copyOnSelect` | Optional | Boolean | `false` | When set to `true`, a selection is immediately copied to your clipboard upon creation. When set to `false`, the selection persists and awaits further action. |
|
||||
| `defaultProfile` | _Required_ | String | PowerShell guid | Sets the default profile. Opens by typing <kbd>Ctrl</kbd> + <kbd>T</kbd> or by clicking the '+' icon. The guid of the desired default profile is used as the value. |
|
||||
| `initialCols` | _Required_ | Integer | `120` | The number of columns displayed in the window upon first load. |
|
||||
| `initialRows` | _Required_ | Integer | `30` | The number of rows displayed in the window upon first load. |
|
||||
| `requestedTheme` | _Required_ | String | `system` | Sets the theme of the application. Possible values: `"light"`, `"dark"`, `"system"` |
|
||||
| `showTerminalTitleInTitlebar` | _Required_ | Boolean | `true` | When set to `true`, titlebar displays the title of the selected tab. When set to `false`, titlebar displays "Windows Terminal". |
|
||||
| `showTabsInTitlebar` | Optional | Boolean | `true` | When set to `true`, the tabs are moved into the titlebar and the titlebar disappears. When set to `false`, the titlebar sits above the tabs. |
|
||||
| `wordDelimiters` | Optional | String | ` ./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}~?\u2502` | Determines the delimiters used in a double click selection. |
|
||||
| `wordDelimiters` | Optional | String | <code> /\()"'-:,.;<>~!@#$%^&*|+=[]{}~?│</code><br>_(`│` is `U+2502 BOX DRAWINGS LIGHT VERTICAL`)_ | Determines the delimiters used in a double click selection. |
|
||||
|
||||
## Profiles
|
||||
Properties listed below are specific to each unique profile.
|
||||
@@ -25,22 +26,26 @@ Properties listed below are specific to each unique profile.
|
||||
| `commandline` | _Required_ | String | `powershell.exe` | Executable used in the profile. |
|
||||
| `cursorColor` | _Required_ | String | `#FFFFFF` | Sets the cursor color for the profile. Uses hex color format: `"#rrggbb"`. |
|
||||
| `cursorShape` | _Required_ | String | `bar` | Sets the cursor shape for the profile. Possible values: `"vintage"` ( ▃ ), `"bar"` ( ┃ ), `"underscore"` ( ▁ ), `"filledBox"` ( █ ), `"emptyBox"` ( ▯ ) |
|
||||
| `fontFace` | _Required_ | String | `Consolas` | Name of the font face used in the profile. |
|
||||
| `fontSize` | _Required_ | Integer | `10` | Sets the font size. |
|
||||
| `fontFace` | _Required_ | String | `Consolas` | Name of the font face used in the profile. We will try to fallback to Consolas if this can't be found or is invalid. |
|
||||
| `fontSize` | _Required_ | Integer | `12` | Sets the font size. |
|
||||
| `guid` | _Required_ | String | | Unique identifier of the profile. Written in registry format: `"{00000000-0000-0000-0000-000000000000}"`. |
|
||||
| `historySize` | _Required_ | Integer | `9001` | The number of lines above the ones displayed in the window you can scroll back to. |
|
||||
| `name` | _Required_ | String | `PowerShell Core` | Name of the profile. Displays in the dropdown menu. |
|
||||
| `padding` | _Required_ | String | `0, 0, 0, 0` | Sets the padding around the text within the window. Can have three different formats: `"#"` sets the same padding for all sides, `"#, #"` sets the same padding for left-right and top-bottom, and `"#, #, #, #"` sets the padding individually for left, top, right, and bottom. |
|
||||
| `name` | _Required_ | String | `PowerShell Core` | Name of the profile. Displays in the dropdown menu. <br>Additionally, this value will be used as the "title" to pass to the shell on startup. Some shells (like `bash`) may choose to ignore this initial value, while others (`cmd`, `powershell`) may use this value over the lifetime of the application. This "title" behavior can be overriden by using `tabTitle`. |
|
||||
| `padding` | _Required_ | String | `8, 8, 8, 8` | Sets the padding around the text within the window. Can have three different formats: `"#"` sets the same padding for all sides, `"#, #"` sets the same padding for left-right and top-bottom, and `"#, #, #, #"` sets the padding individually for left, top, right, and bottom. |
|
||||
| `snapOnInput` | _Required_ | Boolean | `true` | When set to `true`, the window will scroll to the command input line when typing. When set to `false`, the window will not scroll when you start typing. |
|
||||
| `startingDirectory` | _Required_ | String | `%USERPROFILE%` | The directory the shell starts in when it is loaded. |
|
||||
| `useAcrylic` | _Required_ | Boolean | `false` | When set to `true`, the window will have an acrylic background. When set to `false`, the window will have a plain, untextured background. |
|
||||
| `background` | Optional | String | | Sets the background color of the profile. Overrides `background` set in color scheme if `colorscheme` is set. Uses hex color format: `"#rrggbb"`. |
|
||||
| `backgroundImage` | Optional | String | | Sets the file location of the Image to draw over the window background. |
|
||||
| `backgroundImageAlignment` | Optional | String | `center` | Sets how the background image aligns to the boundaries of the window. Possible values: `"center"`, `"left"`, `"top"`, `"right"`, `"bottom"`, `"topLeft"`, `"topRight"`, `"bottomLeft"`, `"bottomRight"` |
|
||||
| `backgroundImageOpacity` | Optional | Number | `1.0` | Sets the transparency of the background image. Accepts floating point values from 0-1. |
|
||||
| `backgroundImageStretchMode` | Optional | String | `uniformToFill` | Sets how the background image is resized to fill the window. Possible values: `"none"`, `"fill"`, `"uniform"`, `"uniformToFill"` |
|
||||
| `colorTable` | Optional | Array[String] | | Array of colors used in the profile if `colorscheme` is not set. Colors use hex color format: `"#rrggbb"`. Ordering is as follows: `[black, red, green, yellow, blue, magenta, cyan, white, bright black, bright red, bright green, bright yellow, bright blue, bright magenta, bright cyan, bright white]` |
|
||||
| `cursorHeight` | Optional | Integer | | Sets the percentage height of the cursor starting from the bottom. Only works when `cursorShape` is set to `"vintage"`. Accepts values from 25-100. |
|
||||
| `foreground` | Optional | String | | Sets the foreground color of the profile. Overrides `foreground` set in color scheme if `colorscheme` is set. Uses hex color format: `"#rrggbb"`. |
|
||||
| `icon` | Optional | String | | Image file location of the icon used in the profile. Displays within the tab and the dropdown menu. |
|
||||
| `icon` | Optional | String | | Image file location of the icon used in the profile. Displays within the tab and the dropdown menu. See [Background Images and Icons](./SettingsSchema.md#background-images-and-icons) below for help on specifying your own icons |
|
||||
| `scrollbarState` | Optional | String | | Defines the visibility of the scrollbar. Possible values: `"visible"`, `"hidden"` |
|
||||
| `tabTitle` | Optional | String | | Overrides default title of the tab. |
|
||||
| `tabTitle` | Optional | String | | If set, will replace the `name` as the title to pass to the shell on startup. Some shells (like `bash`) may choose to ignore this initial value, while others (`cmd`, `powershell`) may use this value over the lifetime of the application. |
|
||||
|
||||
## Schemes
|
||||
Properties listed below are specific to each color scheme. [ColorTool](https://github.com/microsoft/terminal/tree/master/src/tools/ColorTool) is a great tool you can use to create and explore new color schemes. All colors use hex color format.
|
||||
@@ -74,3 +79,102 @@ Properties listed below are specific to each custom key binding.
|
||||
| -------- | ---- | ----------- | ----------- |
|
||||
| `command` | _Required_ | String | The command executed when the associated key bindings are pressed. |
|
||||
| `keys` | _Required_ | Array[String] | Defines the key combinations used to call the command. |
|
||||
|
||||
### Implemented Keybindings
|
||||
|
||||
Bindings listed below are per the implementation in `src/cascadia/TerminalApp/AppKeyBindingsSerialization.cpp`
|
||||
|
||||
- copy
|
||||
- copyTextWithoutNewlines
|
||||
- paste
|
||||
- newTab
|
||||
- openNewTabDropdown
|
||||
- duplicateTab
|
||||
- newTabProfile0
|
||||
- newTabProfile1
|
||||
- newTabProfile2
|
||||
- newTabProfile3
|
||||
- newTabProfile4
|
||||
- newTabProfile5
|
||||
- newTabProfile6
|
||||
- newTabProfile7
|
||||
- newTabProfile8
|
||||
- newWindow
|
||||
- closeWindow
|
||||
- closeTab
|
||||
- closePane
|
||||
- switchToTab
|
||||
- nextTab
|
||||
- prevTab
|
||||
- increaseFontSize
|
||||
- decreaseFontSize
|
||||
- scrollUp
|
||||
- scrollDown
|
||||
- scrollUpPage
|
||||
- scrollDownPage
|
||||
- switchToTab0
|
||||
- switchToTab1
|
||||
- switchToTab2
|
||||
- switchToTab3
|
||||
- switchToTab4
|
||||
- switchToTab5
|
||||
- switchToTab6
|
||||
- switchToTab7
|
||||
- switchToTab8
|
||||
- openSettings
|
||||
- splitHorizontal
|
||||
- splitVertical
|
||||
- resizePaneLeft
|
||||
- resizePaneRight
|
||||
- resizePaneUp
|
||||
- resizePaneDown
|
||||
- moveFocusLeft
|
||||
- moveFocusRight
|
||||
- moveFocusUp
|
||||
- moveFocusDown
|
||||
|
||||
## Background Images and Icons
|
||||
Some Terminal settings allow you to specify custom background images and icons. It is recommended that custom images and icons are stored in system-provided folders and are referred to using the correct [URI Schemes](https://docs.microsoft.com/en-us/windows/uwp/app-resources/uri-schemes). URI Schemes provide a way to reference files independent of their physical paths (which may change in the future).
|
||||
|
||||
The most useful URI schemes to remember when customizing background images and icons are:
|
||||
|
||||
| URI Scheme | Corresponding Physical Path | Use / description |
|
||||
| --- | --- | ---|
|
||||
| `ms-appdata:///Local/` | `%localappdata%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\` | Per-machine files |
|
||||
| `ms-appdata:///Roaming/` | `%localappdata%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState\` | Common files |
|
||||
|
||||
> ⚠ Note: Do not rely on file references using the `ms-appx` URI Scheme (i.e. icons). These files are considered an internal implementation detail and may change name/location or may be omitted in the future.
|
||||
|
||||
### Icons
|
||||
Terminal displays icons for each of your profiles which Terminal generates for any built-in shells - PowerShell Core, PowerShell, and any installed Linux/WSL distros. Each profile refers to a stock icon via the `ms-appx` URI Scheme.
|
||||
|
||||
> ⚠ Note: Do not rely on the files referenced by the `ms-appx` URI Scheme - they are considered an internal implementation detail and may change name/location or may be omitted in the future.
|
||||
|
||||
You can refer to you own icons if you wish, e.g.:
|
||||
|
||||
```json
|
||||
"icon" : "C:\\Users\\richturn\\OneDrive\\WindowsTerminal\\icon-ubuntu-32.png",
|
||||
```
|
||||
|
||||
> 👉 Tip: Icons should be sized to 32x32px in an appropriate raster image format (e.g. .PNG, .GIF, or .ICO) to avoid having to scale your icons during runtime (causing a noticeable delay and loss of quality.)
|
||||
|
||||
### Custom Background Images
|
||||
You can apply a background image to each of your profiles, allowing you to configure/brand/style each of your profiles independently from one another if you wish.
|
||||
|
||||
To do so, specify your preferred `backgroundImage`, position it using `backgroundImageAlignment`, set its opacity with `backgroundImageOpacity`, and/or specify how your image fill the available space using `backgroundImageStretchMode`.
|
||||
|
||||
For example:
|
||||
```json
|
||||
"backgroundImage": "C:\\Users\\richturn\\OneDrive\\WindowsTerminal\\bg-ubuntu-256.png",
|
||||
"backgroundImageAlignment": "bottomRight",
|
||||
"backgroundImageOpacity": 0.1,
|
||||
"backgroundImageStretchMode": "none"
|
||||
```
|
||||
|
||||
> 👉 Tip: You can easily roam your collection of images and icons across all your machines by storing your icons and images in OneDrive (as shown above).
|
||||
|
||||
With these settings, your Terminal's Ubuntu profile would look similar to this:
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
BIN
doc/images/custom-icon-and-background-image.jpg
Normal file
BIN
doc/images/custom-icon-and-background-image.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 135 KiB |
362
doc/specs/#1142 - Keybinding Arguments.md
Normal file
362
doc/specs/#1142 - Keybinding Arguments.md
Normal file
@@ -0,0 +1,362 @@
|
||||
---
|
||||
author: Mike Griese @zadjii-msft
|
||||
created on: 2019-06-19
|
||||
last updated: 2019-07-14
|
||||
issue id: 1142
|
||||
---
|
||||
|
||||
# Arbitrary Keybindings Arguments
|
||||
|
||||
## Abstract
|
||||
|
||||
The goal of this change is to both simplify the keybindings, and also enable far
|
||||
more flexibility when editing a user's keybindings.
|
||||
|
||||
Currently, we have many actions that are very similar in implementation - for
|
||||
example, `newTabProfile0`, `newTabProfile1`, `newTabProfile2`, etc. All these
|
||||
actions are _fundamentally_ the same function. However, we've needed to define 9
|
||||
different actions to enable the user to provide different values to the `newTab`
|
||||
function.
|
||||
|
||||
With this change, we'll be able to remove these _essentially_ duplicated events,
|
||||
and allow the user to specify arbitrary arguments to these functions.
|
||||
|
||||
## Inspiration
|
||||
|
||||
Largely inspired by the keybindings in VsCode and Sublime Text. Additionally,
|
||||
much of the content regarding keybinding events being "handled" was designed as
|
||||
a solution for [#2285].
|
||||
|
||||
## Solution Design
|
||||
|
||||
We'll need to introduce args to some actions that we already have defined. These
|
||||
are the actions I'm thinking about when writing this spec:
|
||||
|
||||
```csharp
|
||||
// These events already exist like this:
|
||||
delegate void NewTabWithProfileEventArgs(Int32 profileIndex);
|
||||
delegate void SwitchToTabEventArgs(Int32 profileIndex);
|
||||
delegate void ResizePaneEventArgs(Direction direction);
|
||||
delegate void MoveFocusEventArgs(Direction direction);
|
||||
|
||||
// These events either exist in another form or don't exist.
|
||||
delegate void CopyTextEventArgs(Boolean copyWhitespace);
|
||||
delegate void ScrollEventArgs(Int32 numLines);
|
||||
delegate void SplitProfileEventArgs(Orientation splitOrientation, Int32 profileIndex);
|
||||
```
|
||||
|
||||
Ideally, after this change, the bindings for these actions would look something
|
||||
like the following:
|
||||
|
||||
```js
|
||||
{ "keys": ["ctrl+shift+1"], "command": "newTabProfile", "args": { "profileIndex":0 } },
|
||||
{ "keys": ["ctrl+shift+2"], "command": "newTabProfile", "args": { "profileIndex":1 } },
|
||||
// etc...
|
||||
|
||||
{ "keys": ["alt+1"], "command": "switchToTab", "args": { "index":0 } },
|
||||
{ "keys": ["alt+2"], "command": "switchToTab", "args": { "index":1 } },
|
||||
// etc...
|
||||
|
||||
{ "keys": ["alt+shift+down"], "command": "resizePane", "args": { "direction":"down" } },
|
||||
{ "keys": ["alt+shift+up"], "command": "resizePane", "args": { "direction":"up" } },
|
||||
// etc...
|
||||
|
||||
{ "keys": ["alt+down"], "command": "moveFocus", "args": { "direction":"down" } },
|
||||
{ "keys": ["alt+up"], "command": "moveFocus", "args": { "direction":"up" } },
|
||||
// etc...
|
||||
|
||||
{ "keys": ["ctrl+c"], "command": "copy", "args": { "copyWhitespace":true } },
|
||||
{ "keys": ["ctrl+shift+c"], "command": "copy", "args": { "copyWhitespace":false } },
|
||||
|
||||
{ "keys": ["ctrl+shift+down"], "command": "scroll", "args": { "numLines":1 } },
|
||||
{ "keys": ["ctrl+shift+up"], "command": "scroll", "args": { "numLines":-1 } },
|
||||
|
||||
{ "keys": ["ctrl+alt+1"], "command": "splitProfile", "args": { "orientation":"vertical", "profileIndex": 0 } },
|
||||
{ "keys": ["ctrl+alt+shift+1"], "command": "splitProfile", "args": { "orientation":"horizontal", "profileIndex": 0 } },
|
||||
{ "keys": ["ctrl+alt+2"], "command": "splitProfile", "args": { "orientation":"vertical", "profileIndex": 1 } },
|
||||
{ "keys": ["ctrl+alt+shift+2"], "command": "splitProfile", "args": { "orientation":"horizontal", "profileIndex": 1 } },
|
||||
// etc...
|
||||
```
|
||||
|
||||
Note that instead of having 9 different `newTabProfile<N>` actions, we have a
|
||||
singular `newTabProfile` action, and that action requires a `profileIndex` in
|
||||
the `args` object.
|
||||
|
||||
Also, pay attention to the last set of keybindings, the `splitProfile` ones.
|
||||
This is a function that requires two arguments, both an `orientation` and a
|
||||
`profileIndex`. Before this change we would have needed to create 20 separate
|
||||
actions (10 profile indices * 2 directions) to handle these cases. Now it can
|
||||
be done with a single action that can be much more flexible in its
|
||||
implementation.
|
||||
|
||||
### Parsing KeyBinding Arguments
|
||||
|
||||
We'll add two new interfaces: `IActionArgs` and `IActionEventArgs`. Classes that
|
||||
implement `IActionArgs` will contain all the per-action args, like
|
||||
`CopyWhitespace` or `ProfileIndex`. `IActionArgs` by itself will be an empty
|
||||
interface, but all other arguments will derive from it. `IActionEventArgs` will
|
||||
have a single property `Handled`, which will be used for indicating if a
|
||||
particular event was processed or not. When parsing args, we'll build
|
||||
`IActionArgs` to contain all the parameters. When dispatching events, we'll
|
||||
build `IActionEventArgs` using the `IActionArgs` to set all the parameter values.
|
||||
|
||||
All current keybinding events will be changed from their current types to
|
||||
`TypedEventHandler`s. These `TypedEventHandler`s second param will always be an
|
||||
instance of `IActionEventArgs`. So, for example:
|
||||
|
||||
```csharp
|
||||
|
||||
delegate void CopyTextEventArgs();
|
||||
delegate void NewTabEventArgs();
|
||||
delegate void NewTabWithProfileEventArgs(Int32 profileIndex);
|
||||
// ...
|
||||
|
||||
[default_interface]
|
||||
runtimeclass AppKeyBindings : Microsoft.Terminal.Settings.IKeyBindings
|
||||
{
|
||||
event CopyTextEventArgs CopyText;
|
||||
event NewTabEventArgs NewTab;
|
||||
event NewTabWithProfileEventArgs NewTabWithProfile;
|
||||
```
|
||||
|
||||
Becomes:
|
||||
|
||||
```csharp
|
||||
interface IActionArgs { /* Empty */ }
|
||||
|
||||
runtimeclass ActionEventArgs
|
||||
{
|
||||
Boolean Handled;
|
||||
ActionArgs Args;
|
||||
}
|
||||
|
||||
runtimeclass CopyTextArgs : IActionArgs
|
||||
{
|
||||
Boolean CopyWhitespace;
|
||||
}
|
||||
|
||||
runtimeclass NewTabWithProfileArgs : IActionArgs
|
||||
{
|
||||
Int32 ProfileIndex;
|
||||
}
|
||||
runtimeclass NewTabWithProfileEventArgs : NewTabWithProfileArgs, IActionArgs { }
|
||||
|
||||
[default_interface]
|
||||
runtimeclass AppKeyBindings : Microsoft.Terminal.Settings.IKeyBindings
|
||||
{
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> CopyText;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> NewTab;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> NewTabWithProfile;
|
||||
```
|
||||
|
||||
In this above example, the `CopyTextArgs` class actually contains all the
|
||||
potential arguments to the Copy action. `ActionEventArgs` is the class that
|
||||
holds any `ActionArgs`. When we parse the arguments, we'll build a
|
||||
`CopyTextArgs`, and when we're dispatching the event, we'll build a
|
||||
`ActionEventArgs` that holds a `CopyTextArgs` as its `Args` value, and dispatch
|
||||
the `ActionEventArgs` object.
|
||||
|
||||
|
||||
We'll also change our existing map in the `AppKeyBindings` implementation.
|
||||
Currently, it's a `std::unordered_map<KeyChord, ShortcutAction, ...>`, which
|
||||
uses the `KeyChord` to lookup the `ShortcutAction`. We'll need to introduce a
|
||||
new type `ActionAndArgs`:
|
||||
|
||||
```csharp
|
||||
runtimeclass ActionAndArgs
|
||||
{
|
||||
ShortcutAction Action;
|
||||
IActionArgs Args;
|
||||
}
|
||||
```
|
||||
|
||||
and we'll change the map in `AppKeyBindings` to a `std::unordered_map<KeyChord,
|
||||
ActionAndArgs, ...>`.
|
||||
|
||||
When we're parsing keybindings, we'll need to construct args for each of the
|
||||
events to go with each binding. When we find some key chord bound to a given
|
||||
Action, we'll construct the `IActionArgs` for that action. For many actions,
|
||||
these args will be an empty class. However, when we do find an action that needs
|
||||
additional parsing, `AppKeyBindingsSerialization` will do the extra work to
|
||||
parse the args for that action.
|
||||
|
||||
We'll keep a collection of functions that can be used for quickly determining
|
||||
how to parse the args for an action if necessary. This map will be a
|
||||
`std::unordered_map<ShortcutAction, function<IActionArgs(Json::Value)>>`. For
|
||||
most actions which don't require args, the function in this map will be set to
|
||||
nullptr, and we'll know that the action doesn't need to parse any more args.
|
||||
However, for actions that _do_ require args, we'll set up a global function that
|
||||
can be used to parse a json blob into an `IActionArgs`.
|
||||
|
||||
Once the `IActionArgs` is built for the keybinding, we'll set it in
|
||||
`AppKeyBindings` with a updated `AppKeyBindings::SetKeyBinding` call.
|
||||
`SetKeyBinding`'s signature will be updated to take a `ActionAndArgs` instead.
|
||||
Should an action not need arguments, the `Args` member can be left `null` in the
|
||||
`ActionAndArgs`.
|
||||
|
||||
### Executing KeyBinding Actions with Arguments
|
||||
|
||||
When we're handling a keybinding in `AppKeyBindings::_DoAction`, we'll trigger
|
||||
the event handlers with the `IActionArgs` we've stored in the map with the
|
||||
`ShortcutAction`.
|
||||
|
||||
Then, in `App`, we'll handle each of these events. We set up lambdas as event
|
||||
handlers for each event in `App::_HookupKeyBindings`. In each of those
|
||||
functions, we'll inspect the `IActionArgs` parameter, and use args from its
|
||||
implementation to call callbacks in the `App` class. We will update `App` to
|
||||
have methods defined with the actual keybinding function signatures.
|
||||
|
||||
Instead of:
|
||||
|
||||
```c++
|
||||
void App::_HookupKeyBindings(TerminalApp::AppKeyBindings bindings) noexcept
|
||||
{
|
||||
// ...
|
||||
bindings.NewTabWithProfile([this](const auto index) { _OpenNewTab({ index }); });
|
||||
}
|
||||
```
|
||||
|
||||
The code will look like:
|
||||
|
||||
```c++
|
||||
void App::_HookupKeyBindings(TerminalApp::AppKeyBindings bindings) noexcept
|
||||
{
|
||||
// ...
|
||||
bindings.NewTabWithProfile({ this, &App::_OpenNewTab });
|
||||
}
|
||||
// ...
|
||||
void App::_OpenNewTab(const TerminalApp::AppKeyBindings& sender, const NewTabEventArgs& args)
|
||||
{
|
||||
auto profileIndex = args.ProfileIndex();
|
||||
args.Handled(true);
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
### Handling Keybinding Events
|
||||
|
||||
Common to all implementations of `IActionArgs` is the `Handled` property. This
|
||||
will let the app indicate if it was able to actually process a keybinding event
|
||||
or not. While in the large majority of cases, the events will all be marked
|
||||
handled, there are some scenarios where the Terminal will need to know if the
|
||||
event could not be performed. For example, in the case of the `copy` event, the
|
||||
Terminal is only capable of copying text if there's actually a selection active.
|
||||
If there isn't a selection active, the `App` should make sure to not mark the
|
||||
event as not handled (it will leave `args.Handled(false)`). The App should only
|
||||
mark an event handled if it has actually dispatched the event.
|
||||
|
||||
When an event is handled, we'll make sure to return `true` from
|
||||
`AppKeyBindings::TryKeyChord`, so that the terminal does not actually process
|
||||
that keypress. For events that were not handled by the application, the terminal
|
||||
will get another chance to dispatch the keypress.
|
||||
|
||||
### Serializing KeyBinding Arguments
|
||||
|
||||
Similar to how we parse arguments from the json, we'll need to update the
|
||||
`AppKeyBindingsSerialization` code to be able to serialize the arguments from a
|
||||
particular `IActionArgs`.
|
||||
|
||||
## UI/UX Design
|
||||
|
||||
### Keybindings in the New Tab Dropdown
|
||||
|
||||
Small modifications will need to be made to the code responsible for the new tab
|
||||
dropdown. The new tab dropdown currently also displays the keybindings for each
|
||||
profile in the new tab dropdown. It does this by querying for the keybinding
|
||||
associated with each action. As we'll be removing the old `ShortcutAction`s that
|
||||
this dropdown uses, we'll need a new way to find which key chord corresponds to
|
||||
opening a given profile.
|
||||
|
||||
We'll need to be able to not only lookup a keybinding by `ShortcutAction`, but
|
||||
also by a `ShortcutAction` and `IActionArgs`. We'll need to update the
|
||||
`AppKeyBindings::GetKeyBinding` method to also accept a `IActionArgs`. We'll
|
||||
also probably want each `IActionArgs` implementation to define an
|
||||
`Equals(IActionArgs)` method, so that we can easily check if two different
|
||||
`IActionArgs` are the same in this method.
|
||||
|
||||
## Capabilities
|
||||
### Accessibility
|
||||
|
||||
N/A
|
||||
|
||||
### Security
|
||||
|
||||
This should not introduce any _new_ security concerns. We're relying on the
|
||||
security of jsoncpp for parsing json. Adding new keys to the settings file
|
||||
will rely on jsoncpp's ability to securely parse those json values.
|
||||
|
||||
### Reliability
|
||||
|
||||
We'll need to make sure that invalid keybindings are ignored. Currently, we
|
||||
already gracefully ignore keybindings that have invalid `keys` or invalid
|
||||
`commands`. We'll need to add additional validation on invalid sets of `args`.
|
||||
When we're parsing the args from a Json blob, we'll make sure to only ever look
|
||||
for keys we're expecting and ignore everything else.
|
||||
|
||||
If a keybinding requires certain args, but those args are not provided, we'll
|
||||
need to make sure those args each have reasonable default values to use. If for
|
||||
any reason a reasonable default can't be used for a keybinding argument, then
|
||||
we'll need to make sure to display an error dialog to the user for that
|
||||
scenario.
|
||||
|
||||
When we're re-serializing settings, we'll only know about the keybinding arg
|
||||
keys that were successfully parsed. Other keys will be lost on re-serialization.
|
||||
|
||||
### Compatibility
|
||||
|
||||
This change will need to carefully be crafted to enable upgrading the legacy
|
||||
keybindings seamlessly. For most actions, the upgrade should be seamless. Since
|
||||
they already don't have args, their serializations will remain exactly the same.
|
||||
|
||||
However, for the following actions that we'll be removing in favor of actions
|
||||
with arguments, we'll need to leave legacy deserialization in place to be able
|
||||
to find these old actions, and automatically build the correct `IActionArgs`
|
||||
for them:
|
||||
|
||||
* `newTabProfile<n>`
|
||||
- We'll need to make sure to build args with the right `profileIndex`
|
||||
corresponding to the old action.
|
||||
* `switchToTab<n>`
|
||||
- We'll need to make sure to build args with the right `index` corresponding
|
||||
to the old action.
|
||||
* `resizePane<direction>` and `moveFocus<direction>`
|
||||
- We'll need to make sure to build args with the right `direction`
|
||||
corresponding to the old action.
|
||||
* `scroll<direction>`
|
||||
- We'll need to make sure to build args with the right `amount` value
|
||||
corresponding to the old action. `Up` will be -1, and `Down` will be 1.
|
||||
|
||||
### Performance, Power, and Efficiency
|
||||
|
||||
N/A
|
||||
|
||||
## Potential Issues
|
||||
|
||||
N/A
|
||||
|
||||
## Future considerations
|
||||
|
||||
* Should we support some sort of conversion from num keys to an automatic arg?
|
||||
For example, by default, <kbd>Alt+<N></kbd> to focuses the
|
||||
Nth tab. Currently, those are 8 separate entries in the keybindings. Should we
|
||||
enable some way for them be combined into a single binding entry, where the
|
||||
binding automatically recieves the number pressed as an arg? I couldn't find
|
||||
any prior art of this, so it doesn't seem worth it to try and invent
|
||||
currently. This might be something that we want to loop back on, but for the
|
||||
time being, it remains out of scope of this PR.
|
||||
* When we inevitable support extensions, we'll need to allow extensions to also
|
||||
be able to support their own custom keybindings and args. We'll probably want
|
||||
to pass the settings to the extension to have the extension parse its own
|
||||
settings. We'll want to be able to ask the extension for its own set of
|
||||
`ActionAndArgs`<sup>[1]</sup> that it builds from the `keybindings`. Once we
|
||||
have that set of actions, we'll be able to store them locally, and dispatch
|
||||
them quickly.
|
||||
- [1] We probably won't be able to use the `ActionAndArgs` class directly,
|
||||
since that class is specific to the actions we define. We'll need another
|
||||
way for extensions to be able to uniquely identify their own actions.
|
||||
|
||||
## Resources
|
||||
|
||||
N/A
|
||||
|
||||
[#2285]: https://github.com/microsoft/terminal/issues/2285
|
||||
@@ -1,6 +1,8 @@
|
||||
---
|
||||
author: "Mike Griese @zadjii-msft"
|
||||
created on: 2019-May-16
|
||||
created on: 2019-05-16
|
||||
last updated: 2019-07-07
|
||||
issue id: 523
|
||||
---
|
||||
|
||||
# Panes in the Windows Terminal
|
||||
717
doc/specs/#754 - Cascading Default Settings.md
Normal file
717
doc/specs/#754 - Cascading Default Settings.md
Normal file
@@ -0,0 +1,717 @@
|
||||
---
|
||||
author: Mike Griese @zadjii-msft
|
||||
created on: 2019-05-31
|
||||
last updated: 2019-07-31
|
||||
issue id: 754
|
||||
---
|
||||
|
||||
# Cascading Default + User Settings
|
||||
|
||||
## Abstract
|
||||
|
||||
This spec outlines adding support for a cascading settings model. In this model,
|
||||
there are two settings files, instead of one.
|
||||
|
||||
1. The default settings file
|
||||
2. The user's settings file
|
||||
|
||||
The default settings file would be a static, read-only file shipped with the
|
||||
terminal. The user settings file would then contain all the user's chosen
|
||||
customizations to the settings. These two files would then be composed together
|
||||
when the app is launched, so that the runtime settings are the union of both the
|
||||
defaults and whatever modifications the user has chosen. This will enable the
|
||||
app to always use a default schema that it knows will be valid, and minimize the
|
||||
settings that the user needs to customize.
|
||||
|
||||
Should the settings schema ever change, the defaults file will change, without
|
||||
needing to re-write the user's settings file.
|
||||
|
||||
It also outlines a mechanism by which profiles could be dynamically added or
|
||||
hidden from the profiles list, based on some external source.
|
||||
|
||||
## Inspiration
|
||||
|
||||
Largely inspired by the settings model that both VS Code (and Sublime Text) use.
|
||||
|
||||
### Goal: Minimize Re-Serializing `profiles.json`
|
||||
|
||||
We want to re-serialize the user settings file, `profiles.json`, as little as
|
||||
possible. Each time we serialize the file, there's the possiblity that we've
|
||||
re-ordered the keys, as `jsoncpp` provides no ordering guarantee of the keys.
|
||||
This isn't great, as each write of the file will randomly re-order the file.
|
||||
|
||||
One of our overarching goals with this change should be to re-serialize the user
|
||||
settings file as little as possible.
|
||||
|
||||
### Goal: Minimize Content in `profiles.json`
|
||||
|
||||
We want the user to only have to make the minimal number of changes possible to
|
||||
the user settings file. Additionally, the user should only have to have the
|
||||
settings that they've changed in that file. If the user wants to change only the
|
||||
`cursorColor` of a profile, they should only need to set that property in the
|
||||
user settings file, and not need an entire copy of the `Profile` object in their
|
||||
user settings file. That would create additional noise that's not relevant to
|
||||
the user.
|
||||
|
||||
### Goal: Remove the Need to Reset Settings Entirely to get New Settings
|
||||
One problem with the current settings design is that we only generate "default"
|
||||
settings for the user when there's no settings file present at all. So, when we
|
||||
want to do things like update the default profiles to have an icon, or add
|
||||
support for generating WSL profiles, it will only apply to users for fresh
|
||||
installs. Otherwise, a user needs to completely delete the settings file to have
|
||||
the terminal re-generate the default settings.
|
||||
|
||||
This is fairly annoying to the end-user, so ideally we'll find a way to be able
|
||||
to prevent this scenario.
|
||||
|
||||
### Goal: Prevent Roaming Settings from Failing
|
||||
Another problem currently is that when settings roam to another machine, it's
|
||||
possible that the second machine doesn't have the same applications installed as
|
||||
the first, and some profiles might be totally invalid on the second machine.
|
||||
Take for example, profiles for WSL distros. If you have and Ubuntu profile on
|
||||
your first machine, and roam that profile to a second machine without Ubuntu
|
||||
installed, then the Ubuntu profile would be totally broken on the second
|
||||
machine.
|
||||
|
||||
While we won't be able to non-destructively prevent all failures of this case,
|
||||
we should be able to catch it in certain scenarios.
|
||||
|
||||
## Solution Design
|
||||
|
||||
The settings are now composed from two files: a "Default" settings file, and a
|
||||
"User" settings file.
|
||||
|
||||
When we load the settings, we'll perform the following steps, each mentioned in
|
||||
greater detail below:
|
||||
1. Load from disk the `defaults.json` (the default settings) -> DefaultsJson
|
||||
1. Load from disk the `profiles.json` (the user settings) -> UserJson
|
||||
1. Parse DefaultsJson to create all the default profiles, schemes, keybindings.
|
||||
1. [Not covered in this spec] Check the UserJson to find the list of dynamic
|
||||
profile sources that should run.
|
||||
1. Run all the _enabled_ dynamic profile generators. Those profiles will be
|
||||
added to the set of profiles.
|
||||
- During this step, check if any of the profiles added here don't exist in
|
||||
UserJson. If they _don't_, the generator created a profile that didn't
|
||||
exist before. Return a value indicating the user settings should be
|
||||
re-saved (with the new profiles added).
|
||||
1. [Not covered in this spec] Layer the UserJson.globals.defaults settings to
|
||||
every profile in the set, both the defaults, and generated profiles.
|
||||
1. Apply the user settings from UserJson. Layer the profiles on top of the
|
||||
existing profiles if possible (if both `guid` and `source` match). If a
|
||||
profile from the user settings does not already exist, make sure to apply the
|
||||
UserJson.globals.defaults settings first. Also layer Color schemes and
|
||||
keybindings.
|
||||
- If a profile has a `source` key, but there is not an existing profile with
|
||||
a matching `guid` and `source`, don't create a new Profile object for it.
|
||||
Either that generator didn't run, or the generator wanted to delete that
|
||||
profile, so we'll effectively hide the profile.
|
||||
1. Re-order the list of profiles, to match the ordering in the UserJson. If a
|
||||
profile doesn't exist in UserJson, it should follow all the profiles in the
|
||||
UserJson. If a profile listed in UserJson doesn't exist, we can skip it
|
||||
safely in this step (the profile will be a dynamic profile that didn't get
|
||||
populated.)
|
||||
1. Validate the settings.
|
||||
1. If requested in step 5, write the modified settings back to `profiles.json`.
|
||||
|
||||
### Default Settings
|
||||
|
||||
We'll have a static version of the "Default" file **hardcoded within the
|
||||
application package**. This `defaults.json` file will live within the
|
||||
application's package, which will prevent users from being able to edit it.
|
||||
|
||||
```json
|
||||
// This is an auto-generated file. Place any modifications to your settings in "profiles.json"
|
||||
```
|
||||
|
||||
This disclaimer will help identify that the file shouldn't be modified. The file
|
||||
won't actually be generated, but because it's shipped with our app, it'll be
|
||||
overridden each time the app is updated. "Auto-generated" should be good enough
|
||||
to indicate to users that it should not be modified.
|
||||
|
||||
Because the `defaults.json` file is hardcoded within our application, we can use
|
||||
its text directly, without loading the file from disk. This should help save
|
||||
some startup time, as we'll only need to load the user settings from disk.
|
||||
|
||||
When we make changes to the default settings, or we make changes to the settings
|
||||
schema, we should make sure that we update the hardcoded `defaults.json` with
|
||||
the new values. That way, the `defaults.json` file will always have the complete
|
||||
set of settings in it.
|
||||
|
||||
### Layering settings
|
||||
|
||||
When we load the settings, we'll do it in three stages. First, we'll deserialize
|
||||
the default settings that we've hardcoded. We'll then generate any profiles that
|
||||
might come from dynamic profile sources. Then, we'll intelligently layer the
|
||||
user's setting upon those we've already loaded. If a user wants to make changes
|
||||
to some objects, like the default profiles, we'll need to make sure to load from
|
||||
the user settings into the existing objects we created from the default
|
||||
settings.
|
||||
|
||||
* We'll need to make sure that any profile in the user settings that has a GUID
|
||||
matching a default profile loads the user settings into the object created
|
||||
from the defaults.
|
||||
* We'll need to make sure that there's only one action bound to each key chord
|
||||
for a keybinding. If there are any key chords in the user settings that match
|
||||
a default key chord, we should bind them to the action from the user settings
|
||||
instead.
|
||||
* For any color schemes whose name matches the name of a default color scheme,
|
||||
we'll need to apply the user settings to the existing color scheme. For
|
||||
example, a user could override the `red` entry of the "Campbell" scheme to be
|
||||
`#ff9900` if they want. This would then apply to all profiles using the
|
||||
"Campbell" scheme.
|
||||
* For profiles that were created from a dynamic profile source, they'll have
|
||||
both a `guid` and `source` guid that must _both_ match. If a user profile with
|
||||
a `source` set does not find a matching profile at load time, the profile will
|
||||
be ignored. See more details in the [Dynamic Profiles](#dynamic-profiles)
|
||||
section.
|
||||
|
||||
### Hiding Default Profiles
|
||||
|
||||
What if a user doesn't want to see one of the profiles that we've included in
|
||||
the default profiles?
|
||||
|
||||
We will add a `hidden` key to each profile, which defaults to false. When we
|
||||
want to mark a profile as hidden, we'd just set that value to `true`, instead of
|
||||
trying to look up the profile's guid.
|
||||
|
||||
So, if someone wanted to hide the default cmd.exe profile, all they'd have to do
|
||||
is add `"hidden": true` to the cmd.exe entry in their user settings, like so:
|
||||
|
||||
```js
|
||||
{
|
||||
"profiles": [
|
||||
{
|
||||
// Make changes here to the cmd.exe profile
|
||||
"guid": "{6239a42c-1de4-49a3-80bd-e8fdd045185c}",
|
||||
"hidden": true
|
||||
}
|
||||
],
|
||||
```
|
||||
|
||||
#### Hidden Profiles and the Open New Tab shortcuts
|
||||
|
||||
Currently, there are keyboard shortcuts for "Open New Tab With Profile
|
||||
<N>". These shortcuts will open up the Nth profile in the new tab
|
||||
dropdown. Considering we're adding the ability to remove profiles from that
|
||||
list, but keep them in the overall list of profiles, we'll need to make sure
|
||||
that the handler for that event still opens the Nth _visible_ profile.
|
||||
|
||||
### Serializing User Settings
|
||||
|
||||
How can we tell that a setting should be written back to the user settings file?
|
||||
|
||||
If the value of the setting isn't the same as the defaults, then it could easily
|
||||
be added to the user's `profiles.json`. We'll have to do a smart serialization
|
||||
of the various settings models. We'll pass in the default version **of that
|
||||
model** during the serialization. If that object finds that a particular setting
|
||||
is the same as a default setting, then we'll skip serializing it.
|
||||
|
||||
What happens if a user has chosen to set the value to _coincidentally_ the same
|
||||
value as the default value? We should keep that key in the user's settings file,
|
||||
even though it is the same.
|
||||
|
||||
In order to facilitate this, we'll need to keep the originally parsed user
|
||||
settings around in memory. When we go to serialize the settings, we'll check if
|
||||
either the setting exists already in the user settings file, or the setting has
|
||||
changed. If either is true, then we'll make sure to write that setting back out.
|
||||
|
||||
For serializing settings for the default profiles, we'll check if the setting is
|
||||
in the user settings file, or if the value of the setting is different from the
|
||||
version of that `Profile` from the default settings. For user-created profiles,
|
||||
we'll compare the value of the setting with the value of the _default
|
||||
constructed_ `Profile` object. This will help ensure that each profile in the
|
||||
user's settings file maintains the minimal amount of info necessary.
|
||||
|
||||
When we're adding profiles due to their generation in a dynamic profile
|
||||
generator, we'll need to serialize them, then insert them back into the
|
||||
originally parsed json object to be serialized. We don't want the automatic
|
||||
creation of a new profile to automatically trigger re-writing the entire user
|
||||
settings file, but we do want newly created dynamic profiles to have an entry
|
||||
the user can easily edit.
|
||||
|
||||
### Dynamic Profiles
|
||||
|
||||
Sometimes, we may want to auto-generate a profile on the user's behalf. Consider
|
||||
the case of WSL distros on their machine, or VMs running in Azure they may want
|
||||
to auto-connect to. These _dynamic_ profiles have a source that might be added
|
||||
or removed after the app is installed, and they will be different from user to
|
||||
user.
|
||||
|
||||
Currently, these profiles are only generated when a user first launches the
|
||||
Terminal. If they already have a `profiles.json` file, then we won't run the
|
||||
auto-generation behavior. This is obviously not great - if any new types of
|
||||
dynamic profiles are added, then users that already have the Terminal installed
|
||||
won't get any of these dynamic profiles. Furthemore, if any of the sources of
|
||||
these dynamic profiles are removed, then the app won't auto-remove the
|
||||
associated profile.
|
||||
|
||||
In the new model, with a combined defaults & user settings, how should these
|
||||
dynamic profiles work?
|
||||
|
||||
I propose we add functionality to automatically search for these profile sources
|
||||
and add/remove them on _every_ Terminal launch. To make this functionality work
|
||||
appropriately, we'll need to introduce a constraint on dynamic profiles.
|
||||
|
||||
**For any dynamic profiles, they must be able to be generated using a stable
|
||||
GUID**. For example, any time we try adding the "Ubuntu" profile, we must be
|
||||
able to generate the same GUID every time. This way, when a dynamic profile
|
||||
generator runs, it can check if that profile source already has a profile
|
||||
associated with it, and do nothing (as to not create many duplicate "Ubuntu"
|
||||
profiles, for example).
|
||||
|
||||
Additionally, each dynamic profile generator **must have a unique source guid**
|
||||
to associate with the profile. When a dynamic profile is generated, the source's
|
||||
guid will be added to the profile, to make sure the profile is correlated with
|
||||
the source it came from.
|
||||
|
||||
We'll generate these dynamic profiles immediately after parsing the default
|
||||
profiles and settings. When a generator runs, it'll be able to create unique
|
||||
profile GUIDs for each source it wants to generate a profile for. It'll hand
|
||||
back a list of Profile objects, with settings set up how the generator likes,
|
||||
with GUIDs set.
|
||||
|
||||
After a dynamic profile generator runs, we will determine what new profiles need
|
||||
to be added to the user settings, so we can append those to the list of
|
||||
profiles. The deserializer will look at the list of generated profiles and check
|
||||
if each and every one already has a entry in the user settings. The generator
|
||||
will just blind hand back a list of profiles, and the deserializer will figure
|
||||
out if any of them need to be added to the user settings. We'll store some sort
|
||||
of result indicating that we want a save operation to occur. After the rest of
|
||||
the deserializing is done, the app will then save the `profiles.json` file,
|
||||
including these new profiles.
|
||||
|
||||
When we're serializing the settings, instead of comparing a dynamic profile to
|
||||
the default-constructed `Profile`, we'll compare it to the state of the
|
||||
`Profile` after the dynamic profile generator created it. It'd then only
|
||||
serialize settings that are different from the auto-generated version. It will
|
||||
also always make sure that the `guid` of the dynamic profile is included in the
|
||||
user settings file, as a point for the user to add customizations to the dynamic
|
||||
profile to. Additionally, we'll also make sure the `source` is always serialized
|
||||
as well, to keep the profile correlated with the generator that created it.
|
||||
|
||||
We'll need to keep the state of these dynamically generated profiles around in
|
||||
memory during runtime to be able to ensure the only state we're serializing is
|
||||
that which is different from the initially generated dynamic profile.
|
||||
|
||||
When the generator is run, and determines that a new profile has been added,
|
||||
we'll need to make sure to add the profile to the user's settings file. This
|
||||
will create an easy point for users to customize the dynamic profiles. When
|
||||
added to the user settings, all that will be added is the `name`, `guid`, and
|
||||
`source`.
|
||||
|
||||
Additionally, a user might not want a dynamic profile generator to always run.
|
||||
They might want to keep their Azure connections visible in the list of profiles,
|
||||
even if its no longer a valid target. Or they might want to not automatically
|
||||
connect to Azure to find new instances every time they launch the terminal. To
|
||||
enable scenarios like this, we'll add an additional setting,
|
||||
`disabledProfileSources`. This is an array of guids. If any guids are in that
|
||||
list, then those dynamic profile generators _won't_ be run, suppressing those
|
||||
profiles from appearing in the profiles list.
|
||||
|
||||
If a dynamic profile generator needs to "delete" a profile, this will also work
|
||||
naturally with the above rules. Lets examine the case where the user has
|
||||
uninstalled the Ubuntu distro. When the WSL generator runs, it won't create the
|
||||
Ubuntu profile. When we get to the Ubuntu profile in the user's settings, it'll
|
||||
have a `source`, but we won't already have a profile with that `guid` and
|
||||
`source`. So we'll just ignore it, because whatever source for that profile
|
||||
doesn't want it anymore. Effectively, this will act like it was "deleted",
|
||||
though the artifacts still remain untouched in the user's json.
|
||||
|
||||
#### What if a dynamic profile is removed, but it's the default?
|
||||
|
||||
I'll direct our attention to [#1348] - Display a specific error for not finding
|
||||
the default profile. When we're done loading, and we determine that the default
|
||||
profile doesn't exist in the finalized list of profiles, we'll display a dialog
|
||||
to the user. This includes both hidden profiles and dynamic profiles that have
|
||||
been "deleted". We'll temporarily use the _first_ profile instead.
|
||||
|
||||
#### Dynamic profile GUID generation
|
||||
|
||||
In order to help facilitate the generation of stable, unique GUIDs for
|
||||
dynamically generated profiles, we'll enforce a few methods on each generator.
|
||||
The Generator should implement a method that returns its _unique_ namespace for
|
||||
profiles it generates:
|
||||
|
||||
```c++
|
||||
class IDynamicProfileGenerator
|
||||
{
|
||||
...
|
||||
virtual std::wstring GetNamespace() = 0;
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
For example, the WSL generator would return `Microsoft.Terminal.WSL`. The
|
||||
Powershell Core generator would return `Microsoft.Terminal.PowershellCore`.
|
||||
We'll use these names to be able to generate uuidv5 GUIDs that will be unique
|
||||
(so long as the names are unique).
|
||||
|
||||
The generator should also be able to ask the app for two other pieces of
|
||||
functionality:
|
||||
* The generator should be able to ask the app for the generator's own namespace
|
||||
GUID
|
||||
* The generator should be able to ask the app for a uuidv5 in the generator's
|
||||
namespace, given a specific name key.
|
||||
|
||||
These two functions will be exposed to the generator like so:
|
||||
|
||||
```c++
|
||||
GUID GetNamespaceGuid(IDynamicProfileGenerator& generator);
|
||||
GUID GetGuidForName(IDynamicProfileGenerator& generator, std::wstring& name);
|
||||
```
|
||||
|
||||
The generator does not _need_ to use `GetGuidForName` to generate guids for it's
|
||||
profiles. If the generator can determine another way to generate stable GUIDs
|
||||
for its profiles, it's free to use whatever method it wants. `GetGuidForName` is
|
||||
provided as a convenience.
|
||||
|
||||
It's not the responsibility of the dynamic profile generator to fill in the
|
||||
`source` of the profiles it generates. The deserializer will make sure to go
|
||||
through and fill in the guid for the generated profiles given the generator's
|
||||
namespace GUID.
|
||||
|
||||
### Powershell Core & the Defaults
|
||||
|
||||
How do we handle the potential existence of Powershell Core in this model?
|
||||
Powershell core is unique as far as the default profiles goes - it may or may
|
||||
not exist on the user's system. Not only that, but depending on the user's
|
||||
install of Powershell Core, it might have a path in either `Program Files` or
|
||||
`Program Files(x86)`.
|
||||
|
||||
Additionally, if it _is_ installed, we set it as the default profile instead of
|
||||
Windows Powershell.
|
||||
|
||||
Powershell core acts much like a dynamic profile. It has an installation source
|
||||
that may or not be there. So we'll add a dynamic profile generator for
|
||||
Powershell Core. This will automatically create a profile for Powershell Core if
|
||||
necessary.
|
||||
|
||||
Unlike the other dynamic profiles, if Powershell Core is present on
|
||||
_first_ launch of the terminal, we set that as the default profile. This can
|
||||
still be done - we'll need to do some special-case work when we're loading the
|
||||
user settings and we _don't_ find any existing settings. When that happens,
|
||||
we'll generate all the default user settings. Before we commit them, we'll check
|
||||
if the Powershell Core profile exists, and if it does, we'll set that as the
|
||||
default profile before writing the settings to disk.
|
||||
|
||||
### Unbinding a Keybinding
|
||||
|
||||
How can a user unbind a key that's part of the default keybindings? What if a
|
||||
user really wants <kbd>ctrl</kbd>+<kbd>t</kbd> to fall through to the
|
||||
commandline application attached to the shell, instead of opening a new tab?
|
||||
|
||||
We'll need to introduce a new keybinding command that should indicate that the
|
||||
key is unbound. We'll load the user keybindings and layer them on the defaults
|
||||
as described above. If during the deserializing we find an entry that's bound to
|
||||
the command `"unbound"` or any other string that we don't understand, instead of
|
||||
trying to _set_ the keybinding, we'll _clear_ the keybinding with a new method
|
||||
`AppKeyBindings::ClearKeyBinding(chord)`.
|
||||
|
||||
### Removing the Globals Object
|
||||
|
||||
As a part of #[1005](https://github.com/microsoft/terminal/pull/1005), all the
|
||||
global settings were moved to their own object within the serialized settings.
|
||||
This was to try and make the file easier to parse as a user, considering global
|
||||
settings would be intermingled with profiles, keybindings, color schemes, etc.
|
||||
Since this change will make the user settings dramatically easier to navigate,
|
||||
we should probably remove the `globals` object, and have globals at the root
|
||||
level again.
|
||||
|
||||
### Default `profiles.json`
|
||||
|
||||
Below is an example of what the default user settings file might look like when
|
||||
it's first generated, taking all the above points into consideration.
|
||||
|
||||
```js
|
||||
// To view the default settings, open <path-to-app-package>\defaults.json
|
||||
{
|
||||
"defaultProfile" : "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
|
||||
"profiles": [
|
||||
{
|
||||
// Make changes here to the cmd.exe profile
|
||||
"guid": "{6239a42c-1de4-49a3-80bd-e8fdd045185c}"
|
||||
},
|
||||
{
|
||||
// Make changes here to the Windows Powershell profile
|
||||
"guid": "{086a83cd-e4ef-418b-89b1-3f6523ff9195}",
|
||||
},
|
||||
{
|
||||
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
|
||||
"name" : "Powershell Core",
|
||||
"source": "{2bde4a90-d05f-401c-9492-e40884ead1d8}",
|
||||
}
|
||||
],
|
||||
|
||||
// Add custom color schemes to this array
|
||||
"schemes": [],
|
||||
|
||||
// Add any keybinding overrides to this array.
|
||||
// To unbind a default keybinding, set the command to "unbound"
|
||||
"keybindings": []
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Note the following:
|
||||
* cmd.exe and powershell.exe are both in the file, as to give users an easy
|
||||
point to extend the settings for those default profiles.
|
||||
* Powershell Core is included in the file, and the default profile has been set
|
||||
to its GUID. The `source` has been set, indicating that it came from a dynamic profile source.
|
||||
* There are a few helpful comments scattered throughout the file to help point
|
||||
the user in the right direction.
|
||||
|
||||
### Re-ordering profiles
|
||||
|
||||
Since there are shortcuts to open the Nth profile in the list of profiles, we
|
||||
need to expose a way for the user to change the order of the profiles. This was
|
||||
not a problem when there was only a single list of profiles, but if the defaults
|
||||
are applied _first_ to the list of profiles, then the user wouldn't be able to
|
||||
change the order of the default profiles. Additionally, any profiles they add
|
||||
would _always_ show up after the defaults.
|
||||
|
||||
To remedy this, we could scan the user profiles in the user settings first, and
|
||||
create `Profile` objects for each of those profiles first. These `Profile`s
|
||||
would only be initialized with their GUID temporarily, but they'd be placed into
|
||||
the list of profiles in the order they appear in the user's settings. Then, we'd
|
||||
load all the default settings, overlaying any default profiles on the `Profile`
|
||||
objects that might already exist in the list of profiles. If there are any
|
||||
default profiles that don't appear in the user's settings, they'll appear
|
||||
_after_ any profiles in the user's settings. Then, we'll overlay the full user
|
||||
settings on top of the defaults.
|
||||
|
||||
## UI/UX Design
|
||||
|
||||
### Opening `defaults.json`
|
||||
How do we open both these files to show to the user (for the interim period
|
||||
before a proper Settings UI is created)? Currently, the "Settings" button only
|
||||
opens a single json file, `profiles.json`. We could keep that button doing the
|
||||
same thing, though we want the user to be able to also view the default settings
|
||||
file, to be able to inspect what settings they wish to change.
|
||||
|
||||
We could have the "Settings" button open _both_ files at the same
|
||||
time. I'm not sure that `ShellExecute` (which is used to open these files)
|
||||
provides any ordering guarantees, so it's possible that the `defaults.json`
|
||||
would open in the foreground of the default json editor, while making in unclear
|
||||
that there's another file they should be opening instead. Additionally, if
|
||||
there's _no_ `.json` editor for the user, I believe the shell will attempt
|
||||
_twice_ to ask the user to select a program to open the file with, and it might
|
||||
not be clear that they need to select a program in both dialogs.
|
||||
|
||||
Alternatively, we could make the defaults file totally inaccessible from the
|
||||
Terminal UI, and instead leave a comment in the auto-generated `profiles.json`
|
||||
like so:
|
||||
|
||||
```json
|
||||
// To view the default settings, open the defaults.json file in this directory
|
||||
```
|
||||
|
||||
The "Settings" button would then only open the file the user needs to edit, and
|
||||
provide them instructions on how to open the defaults file.
|
||||
|
||||
There could alternatively be a hidden option for the "Open Settings" button,
|
||||
where holding <kbd>Alt</kbd> while clicking on the button would open the
|
||||
`defaults.json` instead.
|
||||
|
||||
We could additionally add a `ShortcutAction` (to be bound to a keybinding) that
|
||||
would `openDefaultSettings`, and we could bind that to
|
||||
<kbd>ctrl</kbd>+<kbd>alt</kbd>+<kbd>\`</kbd>, similar to `openSettings` on
|
||||
<kbd>ctrl</kbd>+<kbd>\`</kbd>.
|
||||
|
||||
### How does this work with the settings UI?
|
||||
|
||||
If we only have one version of the settings models (Globals, Profiles,
|
||||
ColorShemes, Keybindings) at runtime, and the user changes one of the settings
|
||||
with the settings UI, how can we tell that settings changed?
|
||||
|
||||
Fortunately, this should be handled cleanly by the algorithm proposed above, in
|
||||
the "Serializing User Settings" section. We'll only be serializing settings that
|
||||
have changed from the defaults, so only the actual changes they've made will be
|
||||
persisted back to the user settings file.
|
||||
|
||||
## Capabilities
|
||||
### Security
|
||||
|
||||
I don't think this will introduce any new security issues that weren't already
|
||||
present
|
||||
|
||||
### Reliability
|
||||
I don't think this will introduce any new reliability concerns that weren't
|
||||
already present. We will likely improve our reliability, as dynamic profiles
|
||||
that no longer exist will not cause the terminal to crash on startup anymore.
|
||||
|
||||
### Performance, Power, and Efficiency
|
||||
|
||||
By not writing the defaults to disk, we'll theoretically marginally improve the
|
||||
load and save times for the `profiles.json` file, by simply having a smaller
|
||||
file to load. However we'll also be doing more work to process the layering of
|
||||
defaults and user settings, which will likely slightly increase the load times.
|
||||
Overall, I expect the difference to be negligible due to these factors.
|
||||
|
||||
One potential concern is long-running dynamic profile generators. Because
|
||||
they'll need to run on startup, they could negatively impact startup time. You
|
||||
can read more below, in "Dynamic Profile Generators Need to be Enabled".
|
||||
|
||||
### Accessibility
|
||||
N/A
|
||||
|
||||
## Potential Issues
|
||||
|
||||
### Profiles with the same `guid` as a dynamic profile but not the same `source`
|
||||
|
||||
What happens if the User settings has a profile with a `guid` that matches a
|
||||
dynamic or default profile, but the user profile doesn't have a matching source?
|
||||
This could happen trivially easily if the user deletes the `source` key from a
|
||||
profile that has dynamically generated.
|
||||
|
||||
We could:
|
||||
1. Treat the profile as an entirely separate profile
|
||||
- There's lots of other code that assumes each profile has only a unique GUID,
|
||||
so we'd have to change the GUID of this profile. This would mean writing out
|
||||
the user settings, which we'd like to avoid.
|
||||
- We'll still end up generating the entry for the dynamic profile in the
|
||||
user's settings, so we'll need to write out the user settings anyways.
|
||||
- This other profile will likely not have a commandline set, so it might not
|
||||
work at all.
|
||||
1. Ignore the profile entirely.
|
||||
- When the dynamic profile generator runs, we're not going to find another
|
||||
entry in the user profiles with both a matching `guid` and a matching
|
||||
`source`. So we'll end up creating _another_ entry in the user profiles for
|
||||
the dynamic profile.
|
||||
- How could the user know that the profile is being ignored? There's nothing
|
||||
in the file itself that indicates obviously that this profile is now
|
||||
invalid.
|
||||
1. Treat the user settings as part of the dynamic profile
|
||||
- In this scenario, the user profile continues to exist as part of the dynamic profile.
|
||||
- When the dynamic profile generator runs, we're not going to find another
|
||||
entry in the user profiles with both a matching `guid` and a matching
|
||||
`source`. So we'll end up creating _another_ entry in the user profiles for
|
||||
the dynamic profile.
|
||||
- These two entries will each be layered upon the dynamically generated
|
||||
profile, so the settings in the second profile entry will override
|
||||
settings from the first.
|
||||
- If the user disables the generator, or the profile source is removed, the
|
||||
dynamic profile will cease to exist. However, the profile without the
|
||||
`source` entry will remain, though likely will not work.
|
||||
- How do we order these profiles for the user? When we're parsing the user
|
||||
profiles list to build an ordering of profiles, do we use the first entry as
|
||||
the index for that profile?
|
||||
1. (Variant of the above) Treat the profile as part of the dynamic profile, and
|
||||
re-insert the `source` key.
|
||||
- This will re-connect the user profile to the dynamic one.
|
||||
- We'll need to make sure to do this before determining the new dynamic
|
||||
profiles to add to the user settings.
|
||||
- Given all the scenarios are going to cause a user settings write anyways,
|
||||
this isn't terrible.
|
||||
- If the user _really_ wants to split the profile in their user settings from
|
||||
the dynamic one, they're free to always generate a new guid _and_ delete the
|
||||
`source` key.
|
||||
|
||||
Given the drawbacks associated with options 1-3, I propose we choose option 4 as
|
||||
our solution to this case.
|
||||
|
||||
### Migrating Existing Settings
|
||||
|
||||
I believe that existing `profiles.json` files will smoothly update to this
|
||||
model, without breaking. While in the new model, the `profiles.json` file can be
|
||||
much more sparse, users who have existing `profiles.json` files will have full
|
||||
settings in their user settings. We'll leave their files largely untouched, as
|
||||
we won't touch keys that have the same values as defaults that are currently in
|
||||
the `profiles.json` file. Fortunately though, users should be able to remove
|
||||
much of the boilerplate from their `profiles.json` files, and trim it down just
|
||||
to their modifications.
|
||||
|
||||
#### Migrating Powershell Core
|
||||
|
||||
Right now, default-generated Powershell Core profiles exist with a stable guid
|
||||
we've generated for them. However, when we move Powershell Core to being a
|
||||
dynamically generated profile, we'll have to ensure that we don't create a
|
||||
duplicated "dynamic" entry for that profile. If we want to convert the existing
|
||||
Powershell Core profiles into a dynamic profile, we'll need to make sure to add
|
||||
a `source` key to the profile. Everything else in the profile can remain the
|
||||
same. Once the `source` is added, we'll know to treat it as a dynamic profile,
|
||||
and it'll respond dynamically.
|
||||
|
||||
This is actually something that will automatically be covered by the scenario
|
||||
mentioned above in "Profiles with the same `guid` as a dynamic profile but not
|
||||
the same `source`". When we encounter the existing Powershell Core profiles that
|
||||
don't have a `source`, we'll automatically think they're the dynamically
|
||||
generated ones, and auto-migrate them.
|
||||
|
||||
#### Migrating Existing WSL Profiles
|
||||
|
||||
Similar to the above, so long as we ensure the WSL dynamic profile generator
|
||||
generates the _same_ GUIDs as it does currently, all the existing WSL profiles
|
||||
will automatically be migrated to dynamic profiles.
|
||||
|
||||
### Dynamic Profile Generators Need to be Enabled
|
||||
With the current proposal, profiles that are generated by a dynamic profile
|
||||
generator _need_ that generator to be enabled for the profile to appear in the
|
||||
list of profiles. If the generator isn't enabled, then the important parts of
|
||||
the profile (name, commandline) will never be set, and the profile's settings
|
||||
from the user settings will be ignored at runtime.
|
||||
|
||||
For generators where the generation of profiles might be a lengthy process, this
|
||||
could negatively impact startup time. Take for example, some hypothetical
|
||||
generator that needs to make web requests to generate dynamic profiles. Because
|
||||
we need the finalized settings to be able to launch the terminal, we'll be stuck
|
||||
loading until that generator is complete.
|
||||
|
||||
However, if the user disables that generator entirely, we'll never display that
|
||||
profile to the user, even if they've done that setup before.
|
||||
|
||||
So the trade-off with this design is that non-existent dynamic profiles will
|
||||
never roam to machines where they don't exist and aren't valid, but the
|
||||
generators _must_ be enabled to use the dynamic profiles.
|
||||
|
||||
## Future considerations
|
||||
* It's possible that a very similar layering loading mechanism could be used to
|
||||
layer per-machine settings with roaming settings. Currently, there's only one
|
||||
settings file, and it roams to all your devices. This could be problematic,
|
||||
for example, if one of your machines has a font installed, but another
|
||||
doesn't. A proposed solution to that problem was to have both roaming settings
|
||||
and per-machine settings. The code to layer settings from the defaults and the
|
||||
user settings could be re-used to handle layer the roaming and per-machine
|
||||
settings.
|
||||
* What if an extension wants to generate their own dynamic profiles? We've
|
||||
already outlined a contract that profile generators would have to follow to
|
||||
behave correctly. It's possible that we could abstract our implementation into
|
||||
a WinRT interface that extensions could implement, and be triggered just like
|
||||
other dynamic profile generators.
|
||||
* **Multiple settings files** - This could enable us to place color schemes into
|
||||
a seperate file (like `colorschemes.json`) and put keybindings into their own
|
||||
file as well, and reduce the number of settings in the user's `profiles.json`.
|
||||
It's unclear if this is something that we need quite yet, but the same
|
||||
layering functionality that enables this scenario could also enable more than
|
||||
two sources for settings.
|
||||
* **Global Default Profile Settings** - Say a user wants to override what the
|
||||
defaults for a profile are, so that they can set settings for _all_ their
|
||||
profiles at once? We could maybe introduce a profile in the user settings file
|
||||
with a special guid set to `"default`, that we look for first, and treat
|
||||
specially. We wouldn't include it in the list of profiles. When we're creating
|
||||
profiles, we'll start with that profile as our prototype, instead of using the
|
||||
default-constructed `Profile`. When we're serializing profiles, we'd again use
|
||||
that as the point of comparison to check if a setting's value has changed.
|
||||
There may be more unknowns with this proposal, so I leave it for a future
|
||||
feature spec.
|
||||
- We'll also want to make sure that when we're serializing default/dynamic
|
||||
profiles, we take into account the state from the global defaults, and we
|
||||
don't duplicate that inormation into the entries for those types of profiles
|
||||
in the user profiles.
|
||||
* **Re-ordering profiles** - Under "Solution Design", we provide an algorithm
|
||||
for decoding the settings. One of the steps mentioned is parsing the user
|
||||
settings to determine the ordering of the profiles. It's possible in the
|
||||
future we may want to give the user more control over this ordering. Maybe
|
||||
we'll want to allow the user to manually index the profiles. Or, as discussed
|
||||
in issues like #1571, we may want to allow the user to further customize the
|
||||
new tab dropdown, beyond just the order of profiles. The re-ordering step
|
||||
would be a great place to add code to support this re-ordering, with whatever
|
||||
algorithm we eventually land on. Determining such an algorithm is outside the
|
||||
scope of this spec, however.
|
||||
|
||||
## Resources
|
||||
N/A
|
||||
|
||||
|
||||
<!-- Footnotes -->
|
||||
|
||||
[#1348]: https://github.com/microsoft/terminal/issues/1348
|
||||
255
doc/specs/#976 - VT52 escape sequences.md
Normal file
255
doc/specs/#976 - VT52 escape sequences.md
Normal file
@@ -0,0 +1,255 @@
|
||||
---
|
||||
author: James Holderness @j4james
|
||||
created on: 2019-07-17
|
||||
last updated: 2019-07-28
|
||||
issue id: 976
|
||||
---
|
||||
|
||||
# VT52 Escape Sequences
|
||||
|
||||
## Abstract
|
||||
|
||||
This spec outlines the work required to split off the existing VT52 commands from the VT100 implementation, and extend the VT52 support to cover all of the core commands.
|
||||
|
||||
## Inspiration
|
||||
|
||||
The existing VT52 commands aren't currently implemented as a separate mode, so they conflict with sequences defined in the VT100 specification. This is blocking us from adding support for the VT100 Index (IND) escape sequence, which is one of the missing commands required to pass the test of cursor movements in Vttest.
|
||||
|
||||
## Solution Design
|
||||
|
||||
The basic idea is to add support for the [DECANM private mode sequence](https://vt100.net/docs/vt100-ug/chapter3.html#DECANM), which can then be used to switch from the default _ANSI_ mode, to a new _VT52_ mode. Once in _VT52_ mode, there is a separate [_Enter ANSI Mode_ sequence](https://vt100.net/docs/vt100-ug/chapter3.html#VT52ANSI) (`ESC <`) to switch back again.
|
||||
|
||||
In terms of implementation, there are a number of areas of the system that would need to be updated.
|
||||
|
||||
### The State Machine
|
||||
|
||||
In order to implement the VT52 compatibility mode correctly, we'll need to introduce a flag in the `StateMachine` class that indicates the mode that is currently active. When in VT52 mode, certain paths in the state diagram should not be followed - for example, you can't have CSI, OSC, or SS3 escape sequences. There would also need to be an additional state to handle VT52 parameters (for the _Direct Cursor Address_ command). These parameters take a different form to the typical VT100 parameters, as they follow the command character instead of preceding it.
|
||||
|
||||
It would probably be best to introduce a new dispatch method in the `IStateMachineEngine` interface to handle the parsed VT52 sequences, since the existing `ActionEscDispatch` does not support parameters (which are required for the _Direct Cursor Address_ command). I think it would also make for a cleaner implementation to have the VT52 commands separate from the VT100 code, and would likely have less impact on the performance that way.
|
||||
|
||||
### The Terminal Input
|
||||
|
||||
The escape sequences generated by the keyboard for function keys, cursor keys, and the numeric keypad, are not the same in VT52 mode as they are in ANSI mode. So there would need to be a flag in the `TerminalInput` class to keep track of the current mode, and thus be able to generate the appropriate sequences for that mode.
|
||||
|
||||
Technically the VT52 keyboard doesn't map directly to a typical PC keyboard, so we can't always work from the specs in deciding what sequences are required for each key. When in doubt, we should probably be trying to match the key sequences generated by XTerm. The sequences below are based on the default XTerm mappings.
|
||||
|
||||
**Function Keys**
|
||||
|
||||
The functions keys <kbd>F1</kbd> to <kbd>F4</kbd> generate a simple ESC prefix instead of SS3 (or CSI). These correspond with the four function keys on the VT100 keypad. In V52 mode they are not affected by modifiers.
|
||||
|
||||
Key | ANSI mode | VT52 mode
|
||||
---------------|-----------|-----------
|
||||
<kbd>F1</kbd> | `SS3 P` | `ESC P`
|
||||
<kbd>F2</kbd> | `SS3 Q` | `ESC Q`
|
||||
<kbd>F3</kbd> | `SS3 R` | `ESC R`
|
||||
<kbd>F4</kbd> | `SS3 S` | `ESC S`
|
||||
|
||||
The function keys <kbd>F5</kbd> to <kbd>F12</kbd> generate the same sequences as they do in ANSI mode, except that they are not affected by modifiers. These correspond with a subset of the top-row functions keys on the VT220, along with the Windows <kbd>Menu</kbd> key mapping to the VT220 <kbd>DO</kbd> key.
|
||||
|
||||
Key | Sequence
|
||||
----------------|-------------
|
||||
<kbd>F5</kbd> | `CSI 1 5 ~`
|
||||
<kbd>F6</kbd> | `CSI 1 7 ~`
|
||||
<kbd>F7</kbd> | `CSI 1 8 ~`
|
||||
<kbd>F8</kbd> | `CSI 1 9 ~`
|
||||
<kbd>F9</kbd> | `CSI 2 0 ~`
|
||||
<kbd>F10</kbd> | `CSI 2 1 ~`
|
||||
<kbd>F11</kbd> | `CSI 2 3 ~`
|
||||
<kbd>F12</kbd> | `CSI 2 4 ~`
|
||||
<kbd>Menu</kbd> | `CSI 2 9 ~`
|
||||
|
||||
**Cursor and Editing Keys**
|
||||
|
||||
The cursor keys generate a simple ESC prefix instead of CSI or SS3. These correspond with the cursor keys on the VT100, except for <kbd>Home</kbd> and <kbd>End</kbd>, which are XTerm extensions. In V52 mode, they are not affected by modifiers, nor are they affected by the DECCKM _Cursor Keys_ mode.
|
||||
|
||||
Key | ANSI mode | VT52 mode
|
||||
-----------------|-----------|-----------
|
||||
<kbd>Up</kbd> | `CSI A` | `ESC A`
|
||||
<kbd>Down</kbd> | `CSI B` | `ESC B`
|
||||
<kbd>Right</kbd> | `CSI C` | `ESC C`
|
||||
<kbd>Left</kbd> | `CSI D` | `ESC D`
|
||||
<kbd>End</kbd> | `CSI F` | `ESC F`
|
||||
<kbd>Home</kbd> | `CSI H` | `ESC H`
|
||||
|
||||
The "editing" keys generate the same sequences as they do in ANSI mode, except that they are not affected by modifiers. These correspond with a subset of the editing keys on the VT220.
|
||||
|
||||
Key | Sequence
|
||||
----------------|-----------
|
||||
<kbd>Ins</kbd> | `CSI 2 ~`
|
||||
<kbd>Del</kbd> | `CSI 3 ~`
|
||||
<kbd>PgUp</kbd> | `CSI 5 ~`
|
||||
<kbd>PgDn</kbd> | `CSI 6 ~`
|
||||
|
||||
**Numeric Keypad**
|
||||
|
||||
With <kbd>Num Lock</kbd> disabled, most of the keys on the numeric keypad function the same as cursor keys or editing keys, but with the addition of a center <kbd>5</kbd> key. As a described above, the cursor keys generate a simple ESC prefix instead of CSI or SS3, while the editing keys remain unchanged (with the exception of modifiers).
|
||||
|
||||
In V52 mode, most modifiers are ignored, except for <kbd>Shift</kbd>, which is the equivalent of enabling <kbd>Num Lock</kbd> (i.e. the keys just generate their corresponding digit characters or `.`). With <kbd>Num Lock</kbd> enabled, it's the other way arround - the digits are generated by default, while <kbd>Shift</kbd> enables the cursor/editing functionality.
|
||||
|
||||
Key | Alias | ANSI mode | VT52 mode
|
||||
-------------|-------|-----------|-----------
|
||||
<kbd>.</kbd> | Del | `CSI 3 ~` | `CSI 3 ~`
|
||||
<kbd>0</kbd> | Ins | `CSI 2 ~` | `CSI 2 ~`
|
||||
<kbd>1</kbd> | End | `CSI F` | `ESC F`
|
||||
<kbd>2</kbd> | Down | `CSI B` | `ESC B`
|
||||
<kbd>3</kbd> | PgDn | `CSI 6 ~` | `CSI 6 ~`
|
||||
<kbd>4</kbd> | Left | `CSI D` | `ESC D`
|
||||
<kbd>4</kbd> | Clear | `CSI E` | `ESC E`
|
||||
<kbd>6</kbd> | Right | `CSI C` | `ESC C`
|
||||
<kbd>7</kbd> | Home | `CSI H` | `ESC H`
|
||||
<kbd>8</kbd> | Up | `CSI A` | `ESC A`
|
||||
<kbd>9</kbd> | PgUp | `CSI 5 ~` | `CSI 5 ~`
|
||||
|
||||
When the DECKPAM _Alternate/Application Keypad Mode_ is set, though, the <kbd>Shift</kbd> modifier has a different affect on the numeric keypad. The sequences generated now correspond with the VT100/V52 numeric keypad keys. In VT52 mode, these sequences are not affected by any other modifiers, and this mode only applies when <kbd>Num Lock</kbd> is disabled.
|
||||
|
||||
Key | Alias | ANSI mode | VT52 mode
|
||||
-------------|-------|-----------|-----------
|
||||
<kbd>.</kbd> | Del | `SS3 2 n` | `ESC ? n`
|
||||
<kbd>0</kbd> | Ins | `SS3 2 p` | `ESC ? p`
|
||||
<kbd>1</kbd> | End | `SS3 2 q` | `ESC ? q `
|
||||
<kbd>2</kbd> | Down | `SS3 2 r` | `ESC ? r`
|
||||
<kbd>3</kbd> | PgDn | `SS3 2 s` | `ESC ? s`
|
||||
<kbd>4</kbd> | Left | `SS3 2 t` | `ESC ? t`
|
||||
<kbd>4</kbd> | Clear | `SS3 2 u` | `ESC ? u`
|
||||
<kbd>6</kbd> | Right | `SS3 2 v` | `ESC ? v`
|
||||
<kbd>7</kbd> | Home | `SS3 2 w` | `ESC ? w`
|
||||
<kbd>8</kbd> | Up | `SS3 2 x` | `ESC ? x`
|
||||
<kbd>9</kbd> | PgUp | `SS3 2 y` | `ESC ? y`
|
||||
|
||||
When the DECKPAM _Alternate/Application Keypad Mode_ is set, the "arithmetic" keys on the numeric keypad are also affected (this includes the <kbd>Enter</kbd> key). The sequences generated again correspond with the VT100/VT52 numeric keys (more or less), but this mapping is active even without the <kbd>Shift</kbd> modifier (and in VT52 mode all other modifiers are ignored too). As above, the mode only applies when <kbd>Num Lock</kbd> is disabled.
|
||||
|
||||
Key | ANSI mode | VT52 mode
|
||||
-----------------|-----------|-----------
|
||||
<kbd>*</kbd> | `SS3 j` | `ESC ? j`
|
||||
<kbd>+</kbd> | `SS3 k` | `ESC ? k`
|
||||
<kbd>-</kbd> | `SS3 m` | `ESC ? m`
|
||||
<kbd>/</kbd> | `SS3 o` | `ESC ? o`
|
||||
<kbd>Enter</kbd> | `SS3 M` | `ESC ? M`
|
||||
|
||||
Note that the DECKPAM _Application Keypad Mode_ is not currently implemented in ANSI mode, so perhaps that needs to be addressed first, before trying to add support for the VT52 _Alternate Keypad Mode_.
|
||||
|
||||
### Changing Modes
|
||||
|
||||
The `_PrivateModeParamsHelper` method in the `AdaptDispatch` class would need to be extended to handle the DECANM mode parameter, and trigger a function to switch to VT52 mode. The typical pattern for this seems to be through a `PrivateXXX` method in the `ConGetSet` interface. Then the `ConhostInternalGetSet` implementation can pass that flag on to the active output buffer's `StateMachine`, and the active input buffer's `TerminalInput` instance.
|
||||
|
||||
Changing back from VT52 mode to ANSI mode would need to be achieved with a separate VT52 command (`ESC <`), since the VT100 CSI mode sequences would no longer be active. This would be handled in the same place as the other VT52 commands, in the `OutputStateMachineEngine`, and then passed on to the mode selection method in the `AdaptDispatch` class described above (essentially the equivalent of the DECANM private mode being set).
|
||||
|
||||
### Additional VT52 Commands
|
||||
|
||||
Most of the missing VT52 functionality can be implemented in terms of existing VT100 methods.
|
||||
|
||||
* The _Cursor Up_ (`ESC A`), _Cursor Down_ (`ESC B`), _Cursor Left_ (`ESC D`), and _Cursor Right_ (`ESC C`) commands are already implemented.
|
||||
* The _Enter Graphics Mode_ (`ESC F`) and _Exit Graphics Mode_ (`ESC G`) commands can probably use the existing `DesignateCharset` method, although this would require a new `VTCharacterSets` option with a corresponding table of characters (see below).
|
||||
* The _Reverse Line Feed_ (`ESC I`) command can use the existing `ReverseLineFeed` method.
|
||||
* The _Erase to End of Display_ (`ESC J`) and _Erase to End of Line_ (`ESC K`) commands can use the existing `EraseInDisplay` and `EraseInLine` methods.
|
||||
* The _Cursor Home_ (`ESC H`) and _Direct Cursor Address_ (`ESC Y`) commands can probably be implemented using the `CursorPosition` method. Technically the _Direct Cursor Address_ has different rules for the boundary conditions (the CUP command clamps out of range coordinates, while the _Direct Cursor Address_ command ignores them, judged individually - one may be ignored while the other is interpreted). Nobody seems to get that right, though, so it's probably not that big a deal.
|
||||
* The _Identify_ (`ESC Z`) command may be the only one that doesn't build on existing functionality, but it should be a fairly trivial addition to the `AdaptDispatch` class. For a terminal emulating VT52, the identifying sequence should be `ESC / Z`.
|
||||
* The _Enter Keypad Mode_ (`ESC =`) and _Exit Keypad Mode_ (`ESC >`) commands can use the existing `SetKeypadMode` method, assuming the `TerminalInput` class already knows to generate different sequences when in VT52 mode (as described in the _Terminal Input_ section above).
|
||||
* The _Enter ANSI Mode_ (`ESC <`) command can just call through to the new mode selection method in the `AdaptDispatch` class as discussed in the _Changing Modes_ section above.
|
||||
|
||||
There are also a few VT52 print commands, but those are not technically part of the core command set, and considering we don't yet support any of the VT102 print commands, I think they can probably be considered out of scope for now. Briefly they are:
|
||||
|
||||
* _Auto Print_ on (`ESC ^`) and off (`ESC _`) commands. In auto print mode, a display line prints after you move the cursor off the line, or during an auto wrap.
|
||||
* _Print Controller_ on (`ESC W`) and off (`ESC X`) commands. When enabled, the terminal transmits received characters to the printer without displaying them.
|
||||
* The _Print Cursor Line_ (`ESC V`) command prints the display line with the cursor.
|
||||
* The _Print Screen_ (`ESC ]`) command prints the screen (or at least the scrolling region).
|
||||
|
||||
I suspect most, if not all of these, would be direct equivalents of the VT102 print commands, if we ever implemented those.
|
||||
|
||||
### Graphic Mode Character Set
|
||||
|
||||
The table below lists suggested mappings for the _Graphics Mode_ character set, based on the descriptions in the [VT102 User Guide](https://vt100.net/docs/vt102-ug/table5-15.html).
|
||||
|
||||
Note that there is only the one _fraction numerator_ character in Unicode, so superscript digits have instead been used for the numerators 3, 5, and 7. There are also not enough _horizontal scan line_ characters (for the _bar at scan x_ characters), so each of them is used twice to cover the full range.
|
||||
|
||||
ASCII Character |Mapped Glyph |Unicode Value |Spec Description
|
||||
----------------|---------------|---------------|----------------
|
||||
_ | |U+0020 |Blank
|
||||
` | |U+0020 |Reserved
|
||||
a |█ |U+2588 |Solid rectangle
|
||||
b |⅟ |U+215F |1/
|
||||
c |³ |U+00B3 |3/
|
||||
d |⁵ |U+2075 |5/
|
||||
e |⁷ |U+2077 |7/
|
||||
f |° |U+00B0 |Degrees
|
||||
g |± |U+00B1 |Plus or minus
|
||||
h |→ |U+2192 |Right arrow
|
||||
i |… |U+2026 |Ellipsis (dots)
|
||||
j |÷ |U+00F7 |Divide by
|
||||
k |↓ |U+2193 |Down arrow
|
||||
l |⎺ |U+23BA |Bar at scan 0
|
||||
m |⎺ |U+23BA |Bar at scan 1
|
||||
n |⎻ |U+23BB |Bar at scan 2
|
||||
o |⎻ |U+23BB |Bar at scan 3
|
||||
p |⎼ |U+23BC |Bar at scan 4
|
||||
q |⎼ |U+23BC |Bar at scan 5
|
||||
r |⎽ |U+23BD |Bar at scan 6
|
||||
s |⎽ |U+23BD |Bar at scan 7
|
||||
t |₀ |U+2080 |Subscript 0
|
||||
u |₁ |U+2081 |Subscript 1
|
||||
v |₂ |U+2082 |Subscript 2
|
||||
w |₃ |U+2083 |Subscript 3
|
||||
x |₄ |U+2084 |Subscript 4
|
||||
y |₅ |U+2085 |Subscript 5
|
||||
z |₆ |U+2086 |Subscript 6
|
||||
{ |₇ |U+2087 |Subscript 7
|
||||
\| |₈ |U+2088 |Subscript 8
|
||||
} |₉ |U+2089 |Subscript 9
|
||||
\~ |¶ |U+00B6 |Paragraph
|
||||
|
||||
### Testing
|
||||
|
||||
A simple unit test will need to be added to the `AdapterTest` class, to confirm that calls to toggle between the ANSI and VT52 modes in the `AdaptDispatch` class are correctly forwarded to the corresponding `PrivateXXX` handler in the `ConGetSet` interface.
|
||||
|
||||
The majority of the testing would be handled in the `StateMachineExternalTest` class though. These tests would confirm that the various VT52 sequences trigger the expected methods in the `ITermDispatch` interface when VT52 Mode is enabled, and also that they don't do anything when in ANSI mode.
|
||||
|
||||
There shouldn't really be any need for additional tests in the `ScreenBufferTests` class, since we're relying on existing VT100 functionality which should already be tested there.
|
||||
|
||||
For fuzzing support, we'll need to add the DECANM option to the `GeneratePrivateModeParamToken` method in the `VTCommandFuzzer` class, and also probably add two additional token generator methods - one specifically for the _Direct Cursor Address_ command, which requires parameters, and another to handle the remaining parameterless commands.
|
||||
|
||||
In terms of manual testing, it can be useful to run the _Test of VT52 mode_ option in Vttest, and confirm that everything looks correct there. It's also worth going through some of the options in the The _Test of keyboard_ section, since those tests aren't only intended for the later VT models - they do cover the VT52 keyboard as well.
|
||||
|
||||
## UI/UX Design
|
||||
|
||||
There is no additional UI associated with this feature.
|
||||
|
||||
## Capabilities
|
||||
|
||||
### Accessibility
|
||||
|
||||
This should not impact accessibility any more than the existing escape sequences.
|
||||
|
||||
### Security
|
||||
|
||||
This should not introduce any new security issues.
|
||||
|
||||
### Reliability
|
||||
|
||||
This should not introduce any new reliability issues.
|
||||
|
||||
### Compatibility
|
||||
|
||||
This could be a breaking change for code that relies on the few existing VT52 commands being available without a mode change. However, that functionality is non-standard, and has not been around for that long. There is almost certainly more benefit in being able to implement the missing VT100 functionality than there is in retaining that non-standard behaviour.
|
||||
|
||||
### Performance, Power, and Efficiency
|
||||
|
||||
The additional mode flags and associated processing in the `StateMachine` and `TerminalInput` classes could have some performance impact, but that is unlikely to be significant.
|
||||
|
||||
## Potential Issues
|
||||
|
||||
The only negative impacts I can think of would be the potential for breaking changes, and the possible impact on performance, as discussed in the _Compatibility_ and _Performance_ sections above. But as with any new code, there is always the possibility of new bugs being introduced as well.
|
||||
|
||||
## Future considerations
|
||||
|
||||
As mentioned in the _Inspiration_ section, having the VT52 functionality isolated with a new mode would enable us to implement the VT100 Index (IND) escape sequence, which currently conflicts with the VT52 _Cursor Left_ command.
|
||||
|
||||
## Resources
|
||||
|
||||
* [VT52 Mode Control Sequences](https://vt100.net/docs/vt100-ug/chapter3.html#S3.3.5)
|
||||
* [VT100 ANSI/VT52 Mode (DECANM)](https://vt100.net/docs/vt100-ug/chapter3.html#DECANM)
|
||||
* [VT100 Index Sequence (IND)](https://vt100.net/docs/vt100-ug/chapter3.html#IND)
|
||||
* [VTTEST Test Utility](https://invisible-island.net/vttest/)
|
||||
* [DEC STD 070 Video Systems Reference Manual](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381)
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
In Openconsole, `dev/main` is the master branch for the repo.
|
||||
|
||||
Any branch that begins with `dev/` is recognized by our CI system and will automatically run x86 and amd64 builds and run our unit and feature tests. For feature branchs the pattern we use is `dev/<alias>/<whatever you want here>`. ex. `dev/austdi/SomeCoolUnicodeFeature`. The important parts are the dev prefix and your alias.
|
||||
Any branch that begins with `dev/` is recognized by our CI system and will automatically run x86 and amd64 builds and run our unit and feature tests. For feature branches the pattern we use is `dev/<alias>/<whatever you want here>`. ex. `dev/austdi/SomeCoolUnicodeFeature`. The important parts are the dev prefix and your alias.
|
||||
|
||||
`inbox` is a special branch that coordinates Openconsole code to the main OS repo.
|
||||
|
||||
@@ -15,12 +15,12 @@ Because we build outside of the OS repo, we need a way to get code back into it
|
||||
|
||||
## What to do when cherry-picking to inbox fails
|
||||
|
||||
Sometimes VSTS doesn't want to allow a cherry pick to the inbox branch. It might have a valid reason or it might just be finicky. You'll need to complete the merge manually on a local machine. The steps are:
|
||||
Sometimes VSTS doesn't want to allow a cherry pick to the inbox branch. It might have a valid reason, or it might just be finicky. You'll need to complete the merge manually on a local machine. The steps are:
|
||||
|
||||
1. make sure you have pulled the latest commits for the `dev/main` and `inbox` branches
|
||||
2. make a new branch from inbox
|
||||
3. cherry-pick the commits from the PR to the newly created branch (this is easier if you squashed your commits when you merged into `dev/main`
|
||||
4. fix any merge conficts and commit
|
||||
4. fix any merge conflicts and commit
|
||||
5. push the new branch to the remote
|
||||
6. create a new PR of that branch in `inbox`
|
||||
7. complete PR and continue on to completing the auto-created PR in the OS repo
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
# Editing Windows Terminal JSON Settings
|
||||
|
||||
One way (currently the only way) to configure Windows Terminal is by editing the profiles.json settings file. At
|
||||
the time of writing you can open the settings file in your default editor by selecting
|
||||
`Settings` from the WT pull down menu.
|
||||
One way (currently the only way) to configure Windows Terminal is by editing the
|
||||
`profiles.json` settings file. At the time of writing you can open the settings
|
||||
file in your default editor by selecting `Settings` from the WT pull down menu.
|
||||
|
||||
The settings are stored in the file `$env:LocalAppData\Packages\Microsoft.WindowsTerminal_<randomString>\RoamingState\profiles.json`
|
||||
The settings are stored in the file `$env:LocalAppData\Packages\Microsoft.WindowsTerminal_<randomString>\RoamingState\profiles.json`.
|
||||
|
||||
Details of specific settings can be found [here](../cascadia/SettingsSchema.md). A general introduction is provided below.
|
||||
As of [#2515](https://github.com/microsoft/terminal/pull/2515), the settings are
|
||||
split into _two_ files: a hardcoded `defaults.json`, and `profiles.json`, which
|
||||
contains the user settings. Users should only be concerned with the contents of
|
||||
the `profiles.json`, which contains their customizations. The `defaults.json`
|
||||
file is only provided as a reference of what the default settings are. For more
|
||||
details on how these two files work, see [Settings
|
||||
Layering](#settings-layering). To view the default settings file, click on the
|
||||
"Settings" button while holding the <kbd>Alt</kbd> key.
|
||||
|
||||
Details of specific settings can be found [here](../cascadia/SettingsSchema.md).
|
||||
A general introduction is provided below.
|
||||
|
||||
The settings are grouped under four headings:
|
||||
|
||||
@@ -17,12 +27,13 @@ The settings are grouped under four headings:
|
||||
|
||||
## Global Settings
|
||||
|
||||
These settings define startup defaults.
|
||||
These settings define startup defaults, and application-wide settings that might
|
||||
not affect a particular terminal instance.
|
||||
|
||||
* Theme
|
||||
* Title Bar options
|
||||
* Initial size
|
||||
* Default profile used when WT is started
|
||||
* Default profile used when the Windows Terminal is started
|
||||
|
||||
Example settings include
|
||||
|
||||
@@ -31,10 +42,13 @@ Example settings include
|
||||
"initialCols" : 120,
|
||||
"initialRows" : 50,
|
||||
"requestedTheme" : "system",
|
||||
"keybinding" : []
|
||||
"keybindings" : []
|
||||
...
|
||||
```
|
||||
|
||||
These global properties can exist either in the root json object, or in and
|
||||
object under a root property `"globals"`.
|
||||
|
||||
## Key Bindings
|
||||
|
||||
This is an array of key chords and shortcuts to invoke various commands.
|
||||
@@ -43,10 +57,29 @@ Each command can have more than one key binding.
|
||||
NOTE: Key bindings is a subfield of the global settings and
|
||||
key bindings apply to all profiles in the same manner.
|
||||
|
||||
For example, here's a sample of the default keybindings:
|
||||
|
||||
```json
|
||||
{
|
||||
"keybindings":
|
||||
[
|
||||
{ "command": "closePane", "keys": ["ctrl+shift+w"] },
|
||||
{ "command": "copy", "keys": ["ctrl+shift+c"] },
|
||||
{ "command": "newTab", "keys": ["ctrl+shift+t"] },
|
||||
// etc.
|
||||
]
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Profiles
|
||||
|
||||
A profile contains the settings applied when a new WT tab is opened. Each profile is identified by a GUID and contains
|
||||
a number of other fields.
|
||||
A profile contains the settings applied when a new WT tab is opened. Each
|
||||
profile is identified by a GUID and contains a number of other fields.
|
||||
|
||||
> 👉 **Note**: The `guid` property is the unique identifier for a profile. If
|
||||
> multiple profiles all have the same `guid` value, you may see unexpected
|
||||
> behavior.
|
||||
|
||||
* Which command to execute on startup - this can include arguments.
|
||||
* Starting directory
|
||||
@@ -67,14 +100,24 @@ Example settings include
|
||||
"fontSize" : 9,
|
||||
"guid" : "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}",
|
||||
"name" : "Debian",
|
||||
"startingDirectory" : "%USERPROFILE%/wslhome"
|
||||
"startingDirectory" : "%USERPROFILE%\\wslhome"
|
||||
....
|
||||
```
|
||||
|
||||
> 👉 **Note**: To use backslashes in any path field, you'll need to escape them following JSON escaping rules (like shown above). As an alternative, you can use forward slashes ("%USERPROFILE%/wslhome").
|
||||
|
||||
The profile GUID is used to reference the default profile in the global settings.
|
||||
|
||||
The values for background image stretch mode are documented [here](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.media.stretch)
|
||||
|
||||
### Hiding a profile
|
||||
|
||||
If you want to remove a profile from the list of profiles in the new tab
|
||||
dropdown, but keep the profile around in your `profiles.json` file, you can add
|
||||
the property `"hidden": true` to the profile's json. This can also be used to
|
||||
remove the default `cmd` and PowerShell profiles, if the user does not wish to
|
||||
see them.
|
||||
|
||||
## Color Schemes
|
||||
|
||||
Each scheme defines the color values to be used for various terminal escape sequences.
|
||||
@@ -95,11 +138,67 @@ Each schema is identified by the name field. Examples include
|
||||
|
||||
The schema name can then be referenced in one or more profiles.
|
||||
|
||||
## Settings layering
|
||||
|
||||
The runtime settings are actually constructed from _three_ sources:
|
||||
* The default settings, which are hardcoded into the application, and available
|
||||
in `defaults.json`. This includes the default keybindings, color schemes, and
|
||||
profiles for both Windows PowerShell and Command Prompt (`cmd.exe`).
|
||||
* Dynamic Profiles, which are generated at runtime. These include Powershell
|
||||
Core, the Azure Cloud Shell connector, and profiles for and WSL distros.
|
||||
* The user settings from `profiles.json`.
|
||||
|
||||
Settings from each of these sources are "layered" upon the settings from
|
||||
previous sources. In this manner, the user settings in `profiles.json` can
|
||||
contain _only the changes from the default settings_. For example, if a user
|
||||
would like to only change the color scheme of the default `cmd` profile to
|
||||
"Solarized Dark", you could change your cmd profile to the following:
|
||||
|
||||
```js
|
||||
{
|
||||
// Make changes here to the cmd.exe profile
|
||||
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
|
||||
"colorScheme": "Solarized Dark"
|
||||
}
|
||||
```
|
||||
|
||||
Here, we're know we're changing the `cmd` profile, because the `guid`
|
||||
`"{0caa0dad-35be-5f56-a8ff-afceeeaa6101}"` is `cmd`'s unique GUID. Any profiles
|
||||
with that GUID will all be treated as the same object. Any changes in that
|
||||
profile will overwrite those from the defaults.
|
||||
|
||||
Similarly, you can overwrite settings from a color scheme by defining a color
|
||||
scheme in `profiles.json` with the same name as a default color scheme.
|
||||
|
||||
If you'd like to unbind a keystroke that's bound to an action in the default
|
||||
keybindings, you can set the `"command"` to `"unbound"` or `null`. This will
|
||||
allow the keystroke to fallthough to the commandline application instead of
|
||||
performing the default action.
|
||||
|
||||
### Dynamic Profiles
|
||||
|
||||
When dynamic profiles are created at runtime, they'll be added to the
|
||||
`profiles.json` file. You can identify these profiles by the presence of a
|
||||
`"source"` property. These profiles are tied to their source - if you uninstall
|
||||
a linux distro, then the profile will remain in your `profiles.json` file, but
|
||||
the profile will be hidden.
|
||||
|
||||
If you'd like to disable a particular dynamic profile source, you can add that
|
||||
`source` to the global `"disabledProfileSources"` array. For example, if you'd
|
||||
like to hide all the WSL profiles, you could add the following setting:
|
||||
|
||||
```json
|
||||
|
||||
"disabledProfileSources": ["Microsoft.Terminal.WSL"],
|
||||
...
|
||||
|
||||
```
|
||||
|
||||
## Configuration Examples:
|
||||
|
||||
### Add a custom background to the WSL Debian terminal profile
|
||||
|
||||
1. Download the Debian SVG logo https://www.debian.org/logos/openlogo.svg
|
||||
1. Download the Debian JPG logo https://www.debian.org/logos/openlogo-100.jpg
|
||||
2. Put the image in the
|
||||
`$env:LocalAppData\Packages\Microsoft.WindowsTerminal_<randomString>\RoamingState\`
|
||||
directory (same directory as your `profiles.json` file).
|
||||
@@ -108,9 +207,10 @@ The schema name can then be referenced in one or more profiles.
|
||||
3. Open your WT json properties file.
|
||||
4. Under the Debian Linux profile, add the following fields:
|
||||
```json
|
||||
"backgroundImage": "ms-appdata:///Roaming/openlogo.jpg",
|
||||
"backgroundImageOpacity": 0.3,
|
||||
"backgroundImageStretchMode": "Fill",
|
||||
"backgroundImage": "ms-appdata:///Roaming/openlogo-100.jpg",
|
||||
"backgroundImageOpacity": 1,
|
||||
"backgroundImageStretchMode" : "none",
|
||||
"backgroundImageAlignment" : "topRight",
|
||||
```
|
||||
5. Make sure that `useAcrylic` is `false`.
|
||||
6. Save the file.
|
||||
@@ -124,5 +224,54 @@ then you should use the URI style path name given in the above example.
|
||||
More information about UWP URI schemes [here](https://docs.microsoft.com/en-us/windows/uwp/app-resources/uri-schemes).
|
||||
3. Instead of using a UWP URI you can use a:
|
||||
1. URL such as
|
||||
`http://open.esa.int/files/2017/03/Mayer_and_Bond_craters_seen_by_SMART-1-350x346.jpg`
|
||||
`http://open.esa.int/files/2017/03/Mayer_and_Bond_craters_seen_by_SMART-1-350x346.jpg`
|
||||
2. Local file location such as `C:\Users\Public\Pictures\openlogo.jpg`
|
||||
|
||||
### Adding Copy and Paste Keybindings
|
||||
|
||||
As of [#1093](https://github.com/microsoft/terminal/pull/1093) (first available
|
||||
in Windows Terminal v0.3), the Windows Terminal now supports copy and paste
|
||||
keyboard shortcuts. However, if you installed and ran the terminal before that,
|
||||
you won't automatically get the new keybindings added to your settings. If you'd
|
||||
like to add shortcuts for copy and paste, you can do so by inserting the
|
||||
following objects into your `globals.keybindings` array:
|
||||
|
||||
```json
|
||||
{ "command": "copy", "keys": ["ctrl+shift+c"] },
|
||||
{ "command": "paste", "keys": ["ctrl+shift+v"] }
|
||||
```
|
||||
|
||||
This will add copy and paste on <kbd>ctrl+shift+c</kbd>
|
||||
and <kbd>ctrl+shift+v</kbd> respectively.
|
||||
|
||||
You can set the keybindings to whatever you'd like. If you prefer
|
||||
<kbd>ctrl+c</kbd> to copy, then set the `keys` to `"ctrl+c"`.
|
||||
|
||||
You can even set multiple keybindings for a single action if you'd like. For example:
|
||||
|
||||
```json
|
||||
|
||||
{
|
||||
"command" : "paste",
|
||||
"keys" :
|
||||
[
|
||||
"ctrl+shift+v"
|
||||
]
|
||||
},
|
||||
{
|
||||
"command" : "paste",
|
||||
"keys" :
|
||||
[
|
||||
"shift+insert"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
will bind both <kbd>ctrl+shift+v</kbd> and
|
||||
<kbd>shift+Insert</kbd> to `paste`.
|
||||
|
||||
Note: If you set your copy keybinding to `"ctrl+c"`, you'll only be able to send
|
||||
an interrupt to the commandline application using <kbd>Ctrl+C</kbd> when there's
|
||||
no text selection. Additionally, if you set `paste` to `"ctrl+v"`, commandline
|
||||
applications won't be able to read a ctrl+v from the input. For these reasons,
|
||||
we suggest `"ctrl+shift+c"` and `"ctrl+shift+v"`
|
||||
|
||||
@@ -7,14 +7,14 @@ change. If you notice an error in the docs, please raise an issue. Or better yet
|
||||
|
||||
### From Source Code
|
||||
|
||||
Follow the instructions in this repo's [README](/README.md#developer-guidance).
|
||||
To compile Windows Terminal yourself using the source code, follow the instructions in the [README](/README.md#developer-guidance).
|
||||
|
||||
### From the Microsoft Store
|
||||
|
||||
1. Make sure you have upgraded to the current Windows 10 release (at least 1903)
|
||||
2. Search for Windows Terminal in the Store
|
||||
3. Review the minimum system settings to ensure you can successfully install Windows Terminal
|
||||
4. Install in the normal fashion
|
||||
1. Make sure you have upgraded to the current Windows 10 release (at least build `1903`). To determine your build number, see [winver](https://docs.microsoft.com/en-us/windows/client-management/windows-version-search).
|
||||
2. Open the Windows Terminal listing in the [Microsoft Store](https://aka.ms/install-terminal).
|
||||
3. Review the minimum system requirements to confirm you can successfully install Windows Terminal.
|
||||
4. Click `Get` to begin the installation process.
|
||||
|
||||
## Starting Windows Terminal
|
||||
|
||||
@@ -36,16 +36,18 @@ default shell is displayed (default shortcut `Ctrl+Shift+1`).
|
||||
|
||||
## Running a Different Shell
|
||||
|
||||
Note: The following text assumes you have WSL installed.
|
||||
Note: This section assumes you already have _Windows Subsystem for Linux_ (WSL) installed. For more information, see [the installation guide](https://docs.microsoft.com/en-us/windows/wsl/install-win10).
|
||||
|
||||
To choose a different shell (e.g. `cmd.exe` or WSL `bash`) then
|
||||
Windows Terminal uses PowerShell as its default shell. You can also use Windows Terminal to launch other shells, such as `cmd.exe` or WSL's `bash`:
|
||||
|
||||
1. Select the `down` button next to the `+` in the tab bar
|
||||
2. Choose your new shell from the list (more on how to extend the list in the config section)
|
||||
1. In the tab bar, click the `⌵` button to view the available shells.
|
||||
2. Choose your shell from the dropdown list. The new shell session will open in a new tab.
|
||||
|
||||
To customize the shell list, see the _Configuring Windows Terminal_ section below.
|
||||
|
||||
## Starting a new PowerShell tab with admin privilege
|
||||
|
||||
There is no current plan to support this feature for security reaons. See issue [#623](https://github.com/microsoft/terminal/issues/632)
|
||||
There is no current plan to support this feature for security reasons. See issue [#623](https://github.com/microsoft/terminal/issues/632)
|
||||
|
||||
## Using cut and paste in the Terminal window
|
||||
|
||||
@@ -65,16 +67,15 @@ Not currently supported "out of the box". See issue [#1060](https://github.com/m
|
||||
|
||||
## Configuring Windows Terminal
|
||||
|
||||
At the time of writing all Windows Terminal settings are managed via a json file.
|
||||
All Windows Terminal settings are currently managed using the `profiles.json` file, located within `$env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe/RoamingState`.
|
||||
|
||||
From the `down` button in the top bar select Settings (default shortcut `Ctrl+,`).
|
||||
To open the settings file from Windows Terminal:
|
||||
|
||||
Your default json editor will open up the Terminal settings file. The file can be found
|
||||
at `$env:LocalAppData\Packages\Microsoft.WindowsTerminal_<randomString>/RoamingState`
|
||||
1. Click the `⌵` button in the top bar.
|
||||
2. From the dropdown list, click `Settings`. You can also use a shortcut: `Ctrl+,`.
|
||||
3. Your default `json` editor will open the settings file.
|
||||
|
||||
An introduction to the the various settings can be found [here](UsingJsonSettings.md).
|
||||
|
||||
The list of valid settings can be found in the [Profiles.json Documentation](../cascadia/SettingsSchema.md) doc.
|
||||
For an introduction to the various settings, see [Using Json Settings](UsingJsonSettings.md). The list of valid settings can be found in the [profiles.json documentation](../cascadia/SettingsSchema.md) section.
|
||||
|
||||
## Tips and Tricks:
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace MiniTerm
|
||||
internal static Process Start(string command, IntPtr attributes, IntPtr hPC)
|
||||
{
|
||||
var startupInfo = ConfigureProcessThread(hPC, attributes);
|
||||
var processInfo = RunProcess(ref startupInfo, "cmd.exe");
|
||||
var processInfo = RunProcess(ref startupInfo, command);
|
||||
return new Process(startupInfo, processInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RuleSet Name="Console Rules" Description="These rules enforce static analysis on console code." ToolsVersion="15.0">
|
||||
|
||||
<Include Path="cppcorecheckrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckrules.ruleset" Action="Error" />
|
||||
|
||||
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
|
||||
<Rule Id="C6001" Action="Error" />
|
||||
<Rule Id="C6011" Action="Error" />
|
||||
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
|
||||
<Rule Id="C6001" Action="Error" />
|
||||
<Rule Id="C6011" Action="Error" />
|
||||
<!-- We can't do dynamic cast because RTTI is off. -->
|
||||
<!-- RTTI is off because Windows OS policies believe RTTI has too much binary size impact for the value and is less portable than RTTI-off modules. -->
|
||||
<Rule Id="C26466" Action="None" />
|
||||
</Rules>
|
||||
|
||||
|
||||
</RuleSet>
|
||||
|
||||
@@ -46,7 +46,7 @@ void ATTR_ROW::Resize(const size_t newWidth)
|
||||
{
|
||||
// Get the attribute that covers the final column of old width.
|
||||
const auto runPos = FindAttrIndex(_cchRowWidth - 1, nullptr);
|
||||
auto& run = _list[runPos];
|
||||
auto& run = _list.at(runPos);
|
||||
|
||||
// Extend its length by the additional columns we're adding.
|
||||
run.SetLength(run.GetLength() + newWidth - _cchRowWidth);
|
||||
@@ -60,7 +60,7 @@ void ATTR_ROW::Resize(const size_t newWidth)
|
||||
// Get the attribute that covers the final column of the new width
|
||||
size_t CountOfAttr = 0;
|
||||
const auto runPos = FindAttrIndex(newWidth - 1, &CountOfAttr);
|
||||
auto& run = _list[runPos];
|
||||
auto& run = _list.at(runPos);
|
||||
|
||||
// CountOfAttr was given to us as "how many columns left from this point forward are covered by the returned run"
|
||||
// So if the original run was B5 covering a 5 size OldWidth and we have a NewWidth of 3
|
||||
@@ -108,7 +108,7 @@ TextAttribute ATTR_ROW::GetAttrByColumn(const size_t column,
|
||||
{
|
||||
THROW_HR_IF(E_INVALIDARG, column >= _cchRowWidth);
|
||||
const auto runPos = FindAttrIndex(column, pApplies);
|
||||
return _list[runPos].GetAttributes();
|
||||
return _list.at(runPos).GetAttributes();
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@@ -290,10 +290,10 @@ void ATTR_ROW::ReplaceAttrs(const TextAttribute& toBeReplacedAttr, const TextAtt
|
||||
// two elements in our internal list.
|
||||
else if (_list.size() == 2 && newAttrs.at(0).GetLength() == 1)
|
||||
{
|
||||
auto left = _list.begin();
|
||||
const auto left = _list.begin();
|
||||
if (iStart == left->GetLength() && NewAttr == left->GetAttributes())
|
||||
{
|
||||
auto right = left + 1;
|
||||
const auto right = left + 1;
|
||||
left->IncrementLength();
|
||||
right->DecrementLength();
|
||||
|
||||
|
||||
@@ -6,21 +6,21 @@
|
||||
#include "AttrRowIterator.hpp"
|
||||
#include "AttrRow.hpp"
|
||||
|
||||
AttrRowIterator AttrRowIterator::CreateEndIterator(const ATTR_ROW* const attrRow)
|
||||
AttrRowIterator AttrRowIterator::CreateEndIterator(const ATTR_ROW* const attrRow) noexcept
|
||||
{
|
||||
AttrRowIterator it{ attrRow };
|
||||
it._setToEnd();
|
||||
return it;
|
||||
}
|
||||
|
||||
AttrRowIterator::AttrRowIterator(const ATTR_ROW* const attrRow) :
|
||||
AttrRowIterator::AttrRowIterator(const ATTR_ROW* const attrRow) noexcept :
|
||||
_pAttrRow{ attrRow },
|
||||
_run{ attrRow->_list.cbegin() },
|
||||
_currentAttributeIndex{ 0 }
|
||||
{
|
||||
}
|
||||
|
||||
AttrRowIterator::operator bool() const noexcept
|
||||
AttrRowIterator::operator bool() const
|
||||
{
|
||||
return _run < _pAttrRow->_list.cend();
|
||||
}
|
||||
@@ -139,7 +139,7 @@ void AttrRowIterator::_decrement(size_t count)
|
||||
|
||||
// Routine Description:
|
||||
// - sets fields on the iterator to describe the end() state of the ATTR_ROW
|
||||
void AttrRowIterator::_setToEnd()
|
||||
void AttrRowIterator::_setToEnd() noexcept
|
||||
{
|
||||
_run = _pAttrRow->_list.cend();
|
||||
_currentAttributeIndex = 0;
|
||||
|
||||
@@ -29,11 +29,11 @@ public:
|
||||
using pointer = TextAttribute*;
|
||||
using reference = TextAttribute&;
|
||||
|
||||
static AttrRowIterator CreateEndIterator(const ATTR_ROW* const attrRow);
|
||||
static AttrRowIterator CreateEndIterator(const ATTR_ROW* const attrRow) noexcept;
|
||||
|
||||
AttrRowIterator(const ATTR_ROW* const attrRow);
|
||||
AttrRowIterator(const ATTR_ROW* const attrRow) noexcept;
|
||||
|
||||
operator bool() const noexcept;
|
||||
operator bool() const;
|
||||
|
||||
bool operator==(const AttrRowIterator& it) const;
|
||||
bool operator!=(const AttrRowIterator& it) const;
|
||||
@@ -57,5 +57,5 @@ private:
|
||||
|
||||
void _increment(size_t count);
|
||||
void _decrement(size_t count);
|
||||
void _setToEnd();
|
||||
void _setToEnd() noexcept;
|
||||
};
|
||||
|
||||
@@ -84,7 +84,7 @@ size_t CharRow::size() const noexcept
|
||||
// - sRowWidth - The width of the row.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CharRow::Reset()
|
||||
void CharRow::Reset() noexcept
|
||||
{
|
||||
for (auto& cell : _data)
|
||||
{
|
||||
@@ -209,7 +209,7 @@ const DbcsAttribute& CharRow::DbcsAttrAt(const size_t column) const
|
||||
// Note: will throw exception if column is out of bounds
|
||||
DbcsAttribute& CharRow::DbcsAttrAt(const size_t column)
|
||||
{
|
||||
return const_cast<DbcsAttribute&>(static_cast<const CharRow* const>(this)->DbcsAttrAt(column));
|
||||
return _data.at(column).DbcsAttr();
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@@ -250,29 +250,6 @@ CharRow::reference CharRow::GlyphAt(const size_t column)
|
||||
return { *this, column };
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - returns string containing text data exactly how it's stored internally, including doubling of
|
||||
// leading/trailing cells.
|
||||
// Arguments:
|
||||
// - none
|
||||
// Return Value:
|
||||
// - text stored in char row
|
||||
// - Note: will throw exception if out of memory
|
||||
std::wstring CharRow::GetTextRaw() const
|
||||
{
|
||||
std::wstring wstr;
|
||||
wstr.reserve(_data.size());
|
||||
for (size_t i = 0; i < _data.size(); ++i)
|
||||
{
|
||||
auto glyph = GlyphAt(i);
|
||||
for (auto it = glyph.begin(); it != glyph.end(); ++it)
|
||||
{
|
||||
wstr.push_back(*it);
|
||||
}
|
||||
}
|
||||
return wstr;
|
||||
}
|
||||
|
||||
std::wstring CharRow::GetText() const
|
||||
{
|
||||
std::wstring wstr;
|
||||
@@ -280,24 +257,24 @@ std::wstring CharRow::GetText() const
|
||||
|
||||
for (size_t i = 0; i < _data.size(); ++i)
|
||||
{
|
||||
auto glyph = GlyphAt(i);
|
||||
const auto glyph = GlyphAt(i);
|
||||
if (!DbcsAttrAt(i).IsTrailing())
|
||||
{
|
||||
for (auto it = glyph.begin(); it != glyph.end(); ++it)
|
||||
for (const auto wch : glyph)
|
||||
{
|
||||
wstr.push_back(*it);
|
||||
wstr.push_back(wch);
|
||||
}
|
||||
}
|
||||
}
|
||||
return wstr;
|
||||
}
|
||||
|
||||
UnicodeStorage& CharRow::GetUnicodeStorage()
|
||||
UnicodeStorage& CharRow::GetUnicodeStorage() noexcept
|
||||
{
|
||||
return _pParent->GetUnicodeStorage();
|
||||
}
|
||||
|
||||
const UnicodeStorage& CharRow::GetUnicodeStorage() const
|
||||
const UnicodeStorage& CharRow::GetUnicodeStorage() const noexcept
|
||||
{
|
||||
return _pParent->GetUnicodeStorage();
|
||||
}
|
||||
@@ -308,7 +285,7 @@ const UnicodeStorage& CharRow::GetUnicodeStorage() const
|
||||
// - column - the column to generate the key for
|
||||
// Return Value:
|
||||
// - the COORD key for data access from UnicodeStorage for the column
|
||||
COORD CharRow::GetStorageKey(const size_t column) const
|
||||
COORD CharRow::GetStorageKey(const size_t column) const noexcept
|
||||
{
|
||||
return { gsl::narrow<SHORT>(column), _pParent->GetId() };
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
void SetDoubleBytePadded(const bool doubleBytePadded) noexcept;
|
||||
bool WasDoubleBytePadded() const noexcept;
|
||||
size_t size() const noexcept;
|
||||
void Reset();
|
||||
void Reset() noexcept;
|
||||
[[nodiscard]] HRESULT Resize(const size_t newSize) noexcept;
|
||||
size_t MeasureLeft() const;
|
||||
size_t MeasureRight() const noexcept;
|
||||
@@ -64,9 +64,6 @@ public:
|
||||
void ClearGlyph(const size_t column);
|
||||
std::wstring GetText() const;
|
||||
|
||||
// other functions implemented at the template class level
|
||||
std::wstring GetTextRaw() const;
|
||||
|
||||
// working with glyphs
|
||||
const reference GlyphAt(const size_t column) const;
|
||||
reference GlyphAt(const size_t column);
|
||||
@@ -78,9 +75,9 @@ public:
|
||||
iterator end() noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
|
||||
UnicodeStorage& GetUnicodeStorage();
|
||||
const UnicodeStorage& GetUnicodeStorage() const;
|
||||
COORD GetStorageKey(const size_t column) const;
|
||||
UnicodeStorage& GetUnicodeStorage() noexcept;
|
||||
const UnicodeStorage& GetUnicodeStorage() const noexcept;
|
||||
COORD GetStorageKey(const size_t column) const noexcept;
|
||||
|
||||
void UpdateParent(ROW* const pParent) noexcept;
|
||||
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
// default glyph value, used for reseting the character data portion of a cell
|
||||
static constexpr wchar_t DefaultValue = UNICODE_SPACE;
|
||||
|
||||
CharRowCell::CharRowCell() :
|
||||
CharRowCell::CharRowCell() noexcept :
|
||||
_wch{ DefaultValue },
|
||||
_attr{}
|
||||
{
|
||||
}
|
||||
|
||||
CharRowCell::CharRowCell(const wchar_t wch, const DbcsAttribute attr) :
|
||||
CharRowCell::CharRowCell(const wchar_t wch, const DbcsAttribute attr) noexcept :
|
||||
_wch{ wch },
|
||||
_attr{ attr }
|
||||
{
|
||||
@@ -22,7 +22,7 @@ CharRowCell::CharRowCell(const wchar_t wch, const DbcsAttribute attr) :
|
||||
|
||||
// Routine Description:
|
||||
// - "erases" the glyph. really sets it back to the default "empty" value
|
||||
void CharRowCell::EraseChars()
|
||||
void CharRowCell::EraseChars() noexcept
|
||||
{
|
||||
if (_attr.IsGlyphStored())
|
||||
{
|
||||
|
||||
@@ -27,10 +27,10 @@ Author(s):
|
||||
class CharRowCell final
|
||||
{
|
||||
public:
|
||||
CharRowCell();
|
||||
CharRowCell(const wchar_t wch, const DbcsAttribute attr);
|
||||
CharRowCell() noexcept;
|
||||
CharRowCell(const wchar_t wch, const DbcsAttribute attr) noexcept;
|
||||
|
||||
void EraseChars();
|
||||
void EraseChars() noexcept;
|
||||
void Reset() noexcept;
|
||||
|
||||
bool IsSpace() const noexcept;
|
||||
|
||||
@@ -91,6 +91,9 @@ CharRowCellReference::const_iterator CharRowCellReference::begin() const
|
||||
// - get read-only iterator to the end of the glyph data
|
||||
// Return Value:
|
||||
// - end iterator of the glyph data
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 26481)
|
||||
// TODO GH 2672: eliminate using pointers raw as begin/end markers in this class
|
||||
CharRowCellReference::const_iterator CharRowCellReference::end() const
|
||||
{
|
||||
if (_cellData().DbcsAttr().IsGlyphStored())
|
||||
@@ -103,6 +106,7 @@ CharRowCellReference::const_iterator CharRowCellReference::end() const
|
||||
return &_cellData().Char() + 1;
|
||||
}
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
bool operator==(const CharRowCellReference& ref, const std::vector<wchar_t>& glyph)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ class CharRowCellReference final
|
||||
public:
|
||||
using const_iterator = const wchar_t*;
|
||||
|
||||
CharRowCellReference(CharRow& parent, const size_t index) :
|
||||
CharRowCellReference(CharRow& parent, const size_t index) noexcept :
|
||||
_parent{ parent },
|
||||
_index{ index }
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
return _glyphStored;
|
||||
}
|
||||
|
||||
void SetGlyphStored(const bool stored)
|
||||
void SetGlyphStored(const bool stored) noexcept
|
||||
{
|
||||
_glyphStored = stored;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
static constexpr TextAttribute InvalidTextAttribute{ INVALID_COLOR, INVALID_COLOR };
|
||||
|
||||
OutputCell::OutputCell() :
|
||||
OutputCell::OutputCell() noexcept :
|
||||
_text{},
|
||||
_dbcsAttribute{},
|
||||
_textAttribute{ InvalidTextAttribute },
|
||||
@@ -111,7 +111,5 @@ void OutputCell::_setFromOutputCellView(const OutputCellView& cell)
|
||||
_dbcsAttribute = cell.DbcsAttr();
|
||||
_textAttribute = cell.TextAttr();
|
||||
_behavior = cell.TextAttrBehavior();
|
||||
|
||||
const auto& view = cell.Chars();
|
||||
_text = view;
|
||||
_text = cell.Chars();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ Author:
|
||||
|
||||
class InvalidCharInfoConversionException : public std::exception
|
||||
{
|
||||
const char* what() const noexcept
|
||||
const char* what() const noexcept override
|
||||
{
|
||||
return "Cannot convert to CHAR_INFO without explicit TextAttribute";
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class InvalidCharInfoConversionException : public std::exception
|
||||
class OutputCell final
|
||||
{
|
||||
public:
|
||||
OutputCell();
|
||||
OutputCell() noexcept;
|
||||
|
||||
OutputCell(const std::wstring_view charData,
|
||||
const DbcsAttribute dbcsAttribute,
|
||||
|
||||
@@ -17,7 +17,7 @@ static constexpr TextAttribute InvalidTextAttribute{ INVALID_COLOR, INVALID_COLO
|
||||
// Arguments:
|
||||
// - wch - The character to use for filling
|
||||
// - fillLimit - How many times to allow this value to be viewed/filled. Infinite if 0.
|
||||
OutputCellIterator::OutputCellIterator(const wchar_t& wch, const size_t fillLimit) :
|
||||
OutputCellIterator::OutputCellIterator(const wchar_t& wch, const size_t fillLimit) noexcept :
|
||||
_mode(Mode::Fill),
|
||||
_currentView(s_GenerateView(wch)),
|
||||
_run(),
|
||||
@@ -33,7 +33,7 @@ OutputCellIterator::OutputCellIterator(const wchar_t& wch, const size_t fillLimi
|
||||
// Arguments:
|
||||
// - attr - The color attribute to use for filling
|
||||
// - fillLimit - How many times to allow this value to be viewed/filled. Infinite if 0.
|
||||
OutputCellIterator::OutputCellIterator(const TextAttribute& attr, const size_t fillLimit) :
|
||||
OutputCellIterator::OutputCellIterator(const TextAttribute& attr, const size_t fillLimit) noexcept :
|
||||
_mode(Mode::Fill),
|
||||
_currentView(s_GenerateView(attr)),
|
||||
_run(),
|
||||
@@ -50,7 +50,7 @@ OutputCellIterator::OutputCellIterator(const TextAttribute& attr, const size_t f
|
||||
// - wch - The character to use for filling
|
||||
// - attr - The color attribute to use for filling
|
||||
// - fillLimit - How many times to allow this value to be viewed/filled. Infinite if 0.
|
||||
OutputCellIterator::OutputCellIterator(const wchar_t& wch, const TextAttribute& attr, const size_t fillLimit) :
|
||||
OutputCellIterator::OutputCellIterator(const wchar_t& wch, const TextAttribute& attr, const size_t fillLimit) noexcept :
|
||||
_mode(Mode::Fill),
|
||||
_currentView(s_GenerateView(wch, attr)),
|
||||
_run(),
|
||||
@@ -66,7 +66,7 @@ OutputCellIterator::OutputCellIterator(const wchar_t& wch, const TextAttribute&
|
||||
// Arguments:
|
||||
// - charInfo - The legacy character and color data to use for fililng (uses Unicode portion of text data)
|
||||
// - fillLimit - How many times to allow this value to be viewed/filled. Infinite if 0.
|
||||
OutputCellIterator::OutputCellIterator(const CHAR_INFO& charInfo, const size_t fillLimit) :
|
||||
OutputCellIterator::OutputCellIterator(const CHAR_INFO& charInfo, const size_t fillLimit) noexcept :
|
||||
_mode(Mode::Fill),
|
||||
_currentView(s_GenerateView(charInfo)),
|
||||
_run(),
|
||||
@@ -116,7 +116,12 @@ OutputCellIterator::OutputCellIterator(const std::wstring_view utf16Text, const
|
||||
// razzle cannot distinguish between a std::wstring_view and a std::basic_string_view<WORD>
|
||||
// NOTE: This one internally casts to wchar_t because Razzle sees WORD and wchar_t as the same type
|
||||
// despite that Visual Studio build can tell the difference.
|
||||
OutputCellIterator::OutputCellIterator(const std::basic_string_view<WORD> legacyAttrs, const bool /*unused*/) :
|
||||
#pragma warning(push)
|
||||
#pragma warning(suppress : 26490)
|
||||
// Suppresses reinterpret_cast. We're only doing this because Windows doesn't understand the type difference between wchar_t and DWORD.
|
||||
// It is not worth trying to separate that out further or risking performance over this particular warning here.
|
||||
// TODO GH 2673 - Investigate real wchar_t flag in Windows and resolve this audit issue
|
||||
OutputCellIterator::OutputCellIterator(const std::basic_string_view<WORD> legacyAttrs, const bool /*unused*/) noexcept :
|
||||
_mode(Mode::LegacyAttr),
|
||||
_currentView(s_GenerateViewLegacyAttr(legacyAttrs.at(0))),
|
||||
_run(std::wstring_view(reinterpret_cast<const wchar_t*>(legacyAttrs.data()), legacyAttrs.size())),
|
||||
@@ -126,12 +131,13 @@ OutputCellIterator::OutputCellIterator(const std::basic_string_view<WORD> legacy
|
||||
_fillLimit(0)
|
||||
{
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
// Routine Description:
|
||||
// - This is an iterator over legacy cell data. We will use the unicode text and the legacy color attribute.
|
||||
// Arguments:
|
||||
// - charInfos - Multiple cell with unicode text and legacy color data.
|
||||
OutputCellIterator::OutputCellIterator(const std::basic_string_view<CHAR_INFO> charInfos) :
|
||||
OutputCellIterator::OutputCellIterator(const std::basic_string_view<CHAR_INFO> charInfos) noexcept :
|
||||
_mode(Mode::CharInfo),
|
||||
_currentView(s_GenerateView(charInfos.at(0))),
|
||||
_run(charInfos),
|
||||
@@ -315,7 +321,7 @@ OutputCellIterator OutputCellIterator::operator++(int)
|
||||
// - Reference the view to fully-formed output cell data representing the underlying data source.
|
||||
// Return Value:
|
||||
// - Reference to the view
|
||||
const OutputCellView& OutputCellIterator::operator*() const
|
||||
const OutputCellView& OutputCellIterator::operator*() const noexcept
|
||||
{
|
||||
return _currentView;
|
||||
}
|
||||
@@ -324,7 +330,7 @@ const OutputCellView& OutputCellIterator::operator*() const
|
||||
// - Get pointer to the view to fully-formed output cell data representing the underlying data source.
|
||||
// Return Value:
|
||||
// - Pointer to the view
|
||||
const OutputCellView* OutputCellIterator::operator->() const
|
||||
const OutputCellView* OutputCellIterator::operator->() const noexcept
|
||||
{
|
||||
return &_currentView;
|
||||
}
|
||||
@@ -338,7 +344,7 @@ const OutputCellView* OutputCellIterator::operator->() const
|
||||
// - True if we just turned a lead half into a trailing half (and caller doesn't
|
||||
// need to further update the view).
|
||||
// - False if this wasn't applicable and the caller should update the view.
|
||||
bool OutputCellIterator::_TryMoveTrailing()
|
||||
bool OutputCellIterator::_TryMoveTrailing() noexcept
|
||||
{
|
||||
if (_currentView.DbcsAttr().IsLeading())
|
||||
{
|
||||
@@ -421,7 +427,7 @@ OutputCellView OutputCellIterator::s_GenerateView(const std::wstring_view view,
|
||||
// - wch - View representing a single UTF-16 character (that can be represented without surrogates)
|
||||
// Return Value:
|
||||
// - Object representing the view into this cell
|
||||
OutputCellView OutputCellIterator::s_GenerateView(const wchar_t& wch)
|
||||
OutputCellView OutputCellIterator::s_GenerateView(const wchar_t& wch) noexcept
|
||||
{
|
||||
const auto glyph = std::wstring_view(&wch, 1);
|
||||
|
||||
@@ -443,7 +449,7 @@ OutputCellView OutputCellIterator::s_GenerateView(const wchar_t& wch)
|
||||
// - attr - View representing a single color
|
||||
// Return Value:
|
||||
// - Object representing the view into this cell
|
||||
OutputCellView OutputCellIterator::s_GenerateView(const TextAttribute& attr)
|
||||
OutputCellView OutputCellIterator::s_GenerateView(const TextAttribute& attr) noexcept
|
||||
{
|
||||
return OutputCellView({}, {}, attr, TextAttributeBehavior::StoredOnly);
|
||||
}
|
||||
@@ -458,7 +464,7 @@ OutputCellView OutputCellIterator::s_GenerateView(const TextAttribute& attr)
|
||||
// - attr - View representing a single color
|
||||
// Return Value:
|
||||
// - Object representing the view into this cell
|
||||
OutputCellView OutputCellIterator::s_GenerateView(const wchar_t& wch, const TextAttribute& attr)
|
||||
OutputCellView OutputCellIterator::s_GenerateView(const wchar_t& wch, const TextAttribute& attr) noexcept
|
||||
{
|
||||
const auto glyph = std::wstring_view(&wch, 1);
|
||||
|
||||
@@ -480,12 +486,12 @@ OutputCellView OutputCellIterator::s_GenerateView(const wchar_t& wch, const Text
|
||||
// - legacyAttr - View representing a single legacy color
|
||||
// Return Value:
|
||||
// - Object representing the view into this cell
|
||||
OutputCellView OutputCellIterator::s_GenerateViewLegacyAttr(const WORD& legacyAttr)
|
||||
OutputCellView OutputCellIterator::s_GenerateViewLegacyAttr(const WORD& legacyAttr) noexcept
|
||||
{
|
||||
WORD cleanAttr = legacyAttr;
|
||||
WI_ClearAllFlags(cleanAttr, COMMON_LVB_SBCSDBCS); // don't use legacy lead/trailing byte flags for colors
|
||||
|
||||
TextAttribute attr(cleanAttr);
|
||||
const TextAttribute attr(cleanAttr);
|
||||
return s_GenerateView(attr);
|
||||
}
|
||||
|
||||
@@ -498,7 +504,7 @@ OutputCellView OutputCellIterator::s_GenerateViewLegacyAttr(const WORD& legacyAt
|
||||
// - charInfo - character and attribute pair representing a single cell
|
||||
// Return Value:
|
||||
// - Object representing the view into this cell
|
||||
OutputCellView OutputCellIterator::s_GenerateView(const CHAR_INFO& charInfo)
|
||||
OutputCellView OutputCellIterator::s_GenerateView(const CHAR_INFO& charInfo) noexcept
|
||||
{
|
||||
const auto glyph = std::wstring_view(&charInfo.Char.UnicodeChar, 1);
|
||||
|
||||
|
||||
@@ -33,14 +33,14 @@ public:
|
||||
using pointer = OutputCellView*;
|
||||
using reference = OutputCellView&;
|
||||
|
||||
OutputCellIterator(const wchar_t& wch, const size_t fillLimit = 0);
|
||||
OutputCellIterator(const TextAttribute& attr, const size_t fillLimit = 0);
|
||||
OutputCellIterator(const wchar_t& wch, const TextAttribute& attr, const size_t fillLimit = 0);
|
||||
OutputCellIterator(const CHAR_INFO& charInfo, const size_t fillLimit = 0);
|
||||
OutputCellIterator(const wchar_t& wch, const size_t fillLimit = 0) noexcept;
|
||||
OutputCellIterator(const TextAttribute& attr, const size_t fillLimit = 0) noexcept;
|
||||
OutputCellIterator(const wchar_t& wch, const TextAttribute& attr, const size_t fillLimit = 0) noexcept;
|
||||
OutputCellIterator(const CHAR_INFO& charInfo, const size_t fillLimit = 0) noexcept;
|
||||
OutputCellIterator(const std::wstring_view utf16Text);
|
||||
OutputCellIterator(const std::wstring_view utf16Text, const TextAttribute attribute);
|
||||
OutputCellIterator(const std::basic_string_view<WORD> legacyAttributes, const bool unused);
|
||||
OutputCellIterator(const std::basic_string_view<CHAR_INFO> charInfos);
|
||||
OutputCellIterator(const std::basic_string_view<WORD> legacyAttributes, const bool unused) noexcept;
|
||||
OutputCellIterator(const std::basic_string_view<CHAR_INFO> charInfos) noexcept;
|
||||
OutputCellIterator(const std::basic_string_view<OutputCell> cells);
|
||||
~OutputCellIterator() = default;
|
||||
|
||||
@@ -55,8 +55,8 @@ public:
|
||||
OutputCellIterator& operator++();
|
||||
OutputCellIterator operator++(int);
|
||||
|
||||
const OutputCellView& operator*() const;
|
||||
const OutputCellView* operator->() const;
|
||||
const OutputCellView& operator*() const noexcept;
|
||||
const OutputCellView* operator->() const noexcept;
|
||||
|
||||
private:
|
||||
enum class Mode
|
||||
@@ -97,7 +97,7 @@ private:
|
||||
|
||||
TextAttribute _attr;
|
||||
|
||||
bool _TryMoveTrailing();
|
||||
bool _TryMoveTrailing() noexcept;
|
||||
|
||||
static OutputCellView s_GenerateView(const std::wstring_view view);
|
||||
|
||||
@@ -108,11 +108,11 @@ private:
|
||||
const TextAttribute attr,
|
||||
const TextAttributeBehavior behavior);
|
||||
|
||||
static OutputCellView s_GenerateView(const wchar_t& wch);
|
||||
static OutputCellView s_GenerateViewLegacyAttr(const WORD& legacyAttr);
|
||||
static OutputCellView s_GenerateView(const TextAttribute& attr);
|
||||
static OutputCellView s_GenerateView(const wchar_t& wch, const TextAttribute& attr);
|
||||
static OutputCellView s_GenerateView(const CHAR_INFO& charInfo);
|
||||
static OutputCellView s_GenerateView(const wchar_t& wch) noexcept;
|
||||
static OutputCellView s_GenerateViewLegacyAttr(const WORD& legacyAttr) noexcept;
|
||||
static OutputCellView s_GenerateView(const TextAttribute& attr) noexcept;
|
||||
static OutputCellView s_GenerateView(const wchar_t& wch, const TextAttribute& attr) noexcept;
|
||||
static OutputCellView s_GenerateView(const CHAR_INFO& charInfo) noexcept;
|
||||
|
||||
static OutputCellView s_GenerateView(const OutputCell& cell);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
// Routine Description:
|
||||
// - Constucts an empty in-memory region for holding output buffer cell data.
|
||||
OutputCellRect::OutputCellRect() :
|
||||
OutputCellRect::OutputCellRect() noexcept :
|
||||
_rows(0),
|
||||
_cols(0)
|
||||
{
|
||||
@@ -64,7 +64,7 @@ OutputCellIterator OutputCellRect::GetRowIter(const size_t row) const
|
||||
// - Pointer to the location in the rectangle that represents the start of the requested row.
|
||||
OutputCell* OutputCellRect::_FindRowOffset(const size_t row)
|
||||
{
|
||||
return (_storage.data() + (row * _cols));
|
||||
return &_storage.at(row * _cols);
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@@ -76,7 +76,7 @@ OutputCell* OutputCellRect::_FindRowOffset(const size_t row)
|
||||
// - Pointer to the location in the rectangle that represents the start of the requested row.
|
||||
const OutputCell* OutputCellRect::_FindRowOffset(const size_t row) const
|
||||
{
|
||||
return (_storage.data() + (row * _cols));
|
||||
return &_storage.at(row * _cols);
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
|
||||
@@ -29,7 +29,7 @@ Revision History:
|
||||
class OutputCellRect final
|
||||
{
|
||||
public:
|
||||
OutputCellRect();
|
||||
OutputCellRect() noexcept;
|
||||
OutputCellRect(const size_t rows, const size_t cols);
|
||||
|
||||
gsl::span<OutputCell> GetRow(const size_t row);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
OutputCellView::OutputCellView(const std::wstring_view view,
|
||||
const DbcsAttribute dbcsAttr,
|
||||
const TextAttribute textAttr,
|
||||
const TextAttributeBehavior behavior) :
|
||||
const TextAttributeBehavior behavior) noexcept :
|
||||
_view(view),
|
||||
_dbcsAttr(dbcsAttr),
|
||||
_textAttr(textAttr),
|
||||
@@ -27,7 +27,9 @@ OutputCellView::OutputCellView(const std::wstring_view view,
|
||||
// - Returns reference to view over text data
|
||||
// Return Value:
|
||||
// - Reference to UTF-16 character data
|
||||
const std::wstring_view& OutputCellView::Chars() const noexcept
|
||||
// C26445 - suppressed to enable the `TextBufferTextIterator::operator->` method which needs a non-temporary memory location holding the wstring_view.
|
||||
// TODO: GH 2681 - remove this suppression by reconciling the probably bad design of the iterators that leads to this being required.
|
||||
[[gsl::suppress(26445)]] const std::wstring_view& OutputCellView::Chars() const noexcept
|
||||
{
|
||||
return _view;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
OutputCellView(const std::wstring_view view,
|
||||
const DbcsAttribute dbcsAttr,
|
||||
const TextAttribute textAttr,
|
||||
const TextAttributeBehavior behavior);
|
||||
const TextAttributeBehavior behavior) noexcept;
|
||||
|
||||
const std::wstring_view& Chars() const noexcept;
|
||||
size_t Columns() const noexcept;
|
||||
|
||||
@@ -30,14 +30,14 @@ size_t ROW::size() const noexcept
|
||||
return _rowWidth;
|
||||
}
|
||||
|
||||
const CharRow& ROW::GetCharRow() const
|
||||
const CharRow& ROW::GetCharRow() const noexcept
|
||||
{
|
||||
return _charRow;
|
||||
}
|
||||
|
||||
CharRow& ROW::GetCharRow()
|
||||
CharRow& ROW::GetCharRow() noexcept
|
||||
{
|
||||
return const_cast<CharRow&>(static_cast<const ROW* const>(this)->GetCharRow());
|
||||
return _charRow;
|
||||
}
|
||||
|
||||
const ATTR_ROW& ROW::GetAttrRow() const noexcept
|
||||
@@ -47,7 +47,7 @@ const ATTR_ROW& ROW::GetAttrRow() const noexcept
|
||||
|
||||
ATTR_ROW& ROW::GetAttrRow() noexcept
|
||||
{
|
||||
return const_cast<ATTR_ROW&>(static_cast<const ROW* const>(this)->GetAttrRow());
|
||||
return _attrRow;
|
||||
}
|
||||
|
||||
SHORT ROW::GetId() const noexcept
|
||||
@@ -132,12 +132,12 @@ RowCellIterator ROW::AsCellIter(const size_t startIndex, const size_t count) con
|
||||
return RowCellIterator(*this, startIndex, count);
|
||||
}
|
||||
|
||||
UnicodeStorage& ROW::GetUnicodeStorage()
|
||||
UnicodeStorage& ROW::GetUnicodeStorage() noexcept
|
||||
{
|
||||
return _pParent->GetUnicodeStorage();
|
||||
}
|
||||
|
||||
const UnicodeStorage& ROW::GetUnicodeStorage() const
|
||||
const UnicodeStorage& ROW::GetUnicodeStorage() const noexcept
|
||||
{
|
||||
return _pParent->GetUnicodeStorage();
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ public:
|
||||
|
||||
size_t size() const noexcept;
|
||||
|
||||
const CharRow& GetCharRow() const;
|
||||
CharRow& GetCharRow();
|
||||
const CharRow& GetCharRow() const noexcept;
|
||||
CharRow& GetCharRow() noexcept;
|
||||
|
||||
const ATTR_ROW& GetAttrRow() const noexcept;
|
||||
ATTR_ROW& GetAttrRow() noexcept;
|
||||
@@ -54,8 +54,8 @@ public:
|
||||
RowCellIterator AsCellIter(const size_t startIndex) const;
|
||||
RowCellIterator AsCellIter(const size_t startIndex, const size_t count) const;
|
||||
|
||||
UnicodeStorage& GetUnicodeStorage();
|
||||
const UnicodeStorage& GetUnicodeStorage() const;
|
||||
UnicodeStorage& GetUnicodeStorage() noexcept;
|
||||
const UnicodeStorage& GetUnicodeStorage() const noexcept;
|
||||
|
||||
OutputCellIterator WriteCells(OutputCellIterator it, const size_t index, const bool setWrap, std::optional<size_t> limitRight = std::nullopt);
|
||||
|
||||
|
||||
@@ -37,38 +37,38 @@ bool RowCellIterator::operator!=(const RowCellIterator& it) const noexcept
|
||||
return !(*this == it);
|
||||
}
|
||||
|
||||
RowCellIterator& RowCellIterator::operator+=(const ptrdiff_t& movement)
|
||||
RowCellIterator& RowCellIterator::operator+=(const ptrdiff_t& movement) noexcept
|
||||
{
|
||||
_pos += movement;
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
RowCellIterator& RowCellIterator::operator++()
|
||||
RowCellIterator& RowCellIterator::operator++() noexcept
|
||||
{
|
||||
return this->operator+=(1);
|
||||
}
|
||||
|
||||
RowCellIterator RowCellIterator::operator++(int)
|
||||
RowCellIterator RowCellIterator::operator++(int) noexcept
|
||||
{
|
||||
auto temp(*this);
|
||||
operator++();
|
||||
return temp;
|
||||
}
|
||||
|
||||
RowCellIterator RowCellIterator::operator+(const ptrdiff_t& movement)
|
||||
RowCellIterator RowCellIterator::operator+(const ptrdiff_t& movement) noexcept
|
||||
{
|
||||
auto temp(*this);
|
||||
temp += movement;
|
||||
return temp;
|
||||
}
|
||||
|
||||
const OutputCellView& RowCellIterator::operator*() const
|
||||
const OutputCellView& RowCellIterator::operator*() const noexcept
|
||||
{
|
||||
return _view;
|
||||
}
|
||||
|
||||
const OutputCellView* RowCellIterator::operator->() const
|
||||
const OutputCellView* RowCellIterator::operator->() const noexcept
|
||||
{
|
||||
return &_view;
|
||||
}
|
||||
|
||||
@@ -38,13 +38,13 @@ public:
|
||||
bool operator==(const RowCellIterator& it) const noexcept;
|
||||
bool operator!=(const RowCellIterator& it) const noexcept;
|
||||
|
||||
RowCellIterator& operator+=(const ptrdiff_t& movement);
|
||||
RowCellIterator& operator++();
|
||||
RowCellIterator operator++(int);
|
||||
RowCellIterator operator+(const ptrdiff_t& movement);
|
||||
RowCellIterator& operator+=(const ptrdiff_t& movement) noexcept;
|
||||
RowCellIterator& operator++() noexcept;
|
||||
RowCellIterator operator++(int) noexcept;
|
||||
RowCellIterator operator+(const ptrdiff_t& movement) noexcept;
|
||||
|
||||
const OutputCellView& operator*() const;
|
||||
const OutputCellView* operator->() const;
|
||||
const OutputCellView& operator*() const noexcept;
|
||||
const OutputCellView* operator->() const noexcept;
|
||||
|
||||
private:
|
||||
const ROW& _row;
|
||||
|
||||
@@ -16,7 +16,7 @@ bool TextAttribute::IsLegacy() const noexcept
|
||||
// - color that should be displayed as the foreground color
|
||||
COLORREF TextAttribute::CalculateRgbForeground(std::basic_string_view<COLORREF> colorTable,
|
||||
COLORREF defaultFgColor,
|
||||
COLORREF defaultBgColor) const
|
||||
COLORREF defaultBgColor) const noexcept
|
||||
{
|
||||
return _IsReverseVideo() ? _GetRgbBackground(colorTable, defaultBgColor) : _GetRgbForeground(colorTable, defaultFgColor);
|
||||
}
|
||||
@@ -29,7 +29,7 @@ COLORREF TextAttribute::CalculateRgbForeground(std::basic_string_view<COLORREF>
|
||||
// - color that should be displayed as the background color
|
||||
COLORREF TextAttribute::CalculateRgbBackground(std::basic_string_view<COLORREF> colorTable,
|
||||
COLORREF defaultFgColor,
|
||||
COLORREF defaultBgColor) const
|
||||
COLORREF defaultBgColor) const noexcept
|
||||
{
|
||||
return _IsReverseVideo() ? _GetRgbForeground(colorTable, defaultFgColor) : _GetRgbBackground(colorTable, defaultBgColor);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ COLORREF TextAttribute::CalculateRgbBackground(std::basic_string_view<COLORREF>
|
||||
// Return Value:
|
||||
// - color that is stored as the foreground color
|
||||
COLORREF TextAttribute::_GetRgbForeground(std::basic_string_view<COLORREF> colorTable,
|
||||
COLORREF defaultColor) const
|
||||
COLORREF defaultColor) const noexcept
|
||||
{
|
||||
return _foreground.GetColor(colorTable, defaultColor, _isBold);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ COLORREF TextAttribute::_GetRgbForeground(std::basic_string_view<COLORREF> color
|
||||
// Return Value:
|
||||
// - color that is stored as the background color
|
||||
COLORREF TextAttribute::_GetRgbBackground(std::basic_string_view<COLORREF> colorTable,
|
||||
COLORREF defaultColor) const
|
||||
COLORREF defaultColor) const noexcept
|
||||
{
|
||||
return _background.GetColor(colorTable, defaultColor, false);
|
||||
}
|
||||
@@ -75,22 +75,22 @@ WORD TextAttribute::GetMetaAttributes() const noexcept
|
||||
return wMeta;
|
||||
}
|
||||
|
||||
void TextAttribute::SetForeground(const COLORREF rgbForeground)
|
||||
void TextAttribute::SetForeground(const COLORREF rgbForeground) noexcept
|
||||
{
|
||||
_foreground = TextColor(rgbForeground);
|
||||
}
|
||||
|
||||
void TextAttribute::SetBackground(const COLORREF rgbBackground)
|
||||
void TextAttribute::SetBackground(const COLORREF rgbBackground) noexcept
|
||||
{
|
||||
_background = TextColor(rgbBackground);
|
||||
}
|
||||
|
||||
void TextAttribute::SetFromLegacy(const WORD wLegacy) noexcept
|
||||
{
|
||||
_wAttrLegacy = static_cast<WORD>(wLegacy & META_ATTRS);
|
||||
_wAttrLegacy = gsl::narrow_cast<WORD>(wLegacy & META_ATTRS);
|
||||
WI_ClearAllFlags(_wAttrLegacy, COMMON_LVB_SBCSDBCS);
|
||||
BYTE fgIndex = static_cast<BYTE>(wLegacy & FG_ATTRS);
|
||||
BYTE bgIndex = static_cast<BYTE>(wLegacy & BG_ATTRS) >> 4;
|
||||
const BYTE fgIndex = gsl::narrow_cast<BYTE>(wLegacy & FG_ATTRS);
|
||||
const BYTE bgIndex = gsl::narrow_cast<BYTE>(wLegacy & BG_ATTRS) >> 4;
|
||||
_foreground = TextColor(fgIndex);
|
||||
_background = TextColor(bgIndex);
|
||||
}
|
||||
@@ -98,16 +98,16 @@ void TextAttribute::SetFromLegacy(const WORD wLegacy) noexcept
|
||||
void TextAttribute::SetLegacyAttributes(const WORD attrs,
|
||||
const bool setForeground,
|
||||
const bool setBackground,
|
||||
const bool setMeta)
|
||||
const bool setMeta) noexcept
|
||||
{
|
||||
if (setForeground)
|
||||
{
|
||||
BYTE fgIndex = (BYTE)(attrs & FG_ATTRS);
|
||||
const BYTE fgIndex = gsl::narrow_cast<BYTE>(attrs & FG_ATTRS);
|
||||
_foreground = TextColor(fgIndex);
|
||||
}
|
||||
if (setBackground)
|
||||
{
|
||||
BYTE bgIndex = (BYTE)(attrs & BG_ATTRS) >> 4;
|
||||
const BYTE bgIndex = gsl::narrow_cast<BYTE>(attrs & BG_ATTRS) >> 4;
|
||||
_background = TextColor(bgIndex);
|
||||
}
|
||||
if (setMeta)
|
||||
@@ -133,17 +133,17 @@ void TextAttribute::SetIndexedAttributes(const std::optional<const BYTE> foregro
|
||||
{
|
||||
if (foreground)
|
||||
{
|
||||
BYTE fgIndex = (*foreground) & 0xFF;
|
||||
const BYTE fgIndex = (*foreground) & 0xFF;
|
||||
_foreground = TextColor(fgIndex);
|
||||
}
|
||||
if (background)
|
||||
{
|
||||
BYTE bgIndex = (*background) & 0xFF;
|
||||
const BYTE bgIndex = (*background) & 0xFF;
|
||||
_background = TextColor(bgIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void TextAttribute::SetColor(const COLORREF rgbColor, const bool fIsForeground)
|
||||
void TextAttribute::SetColor(const COLORREF rgbColor, const bool fIsForeground) noexcept
|
||||
{
|
||||
if (fIsForeground)
|
||||
{
|
||||
|
||||
@@ -39,9 +39,9 @@ public:
|
||||
}
|
||||
|
||||
constexpr TextAttribute(const WORD wLegacyAttr) noexcept :
|
||||
_wAttrLegacy{ static_cast<WORD>(wLegacyAttr & META_ATTRS) },
|
||||
_foreground{ static_cast<BYTE>(wLegacyAttr & FG_ATTRS) },
|
||||
_background{ static_cast<BYTE>((wLegacyAttr & BG_ATTRS) >> 4) },
|
||||
_wAttrLegacy{ gsl::narrow_cast<WORD>(wLegacyAttr & META_ATTRS) },
|
||||
_foreground{ gsl::narrow_cast<BYTE>(wLegacyAttr & FG_ATTRS) },
|
||||
_background{ gsl::narrow_cast<BYTE>((wLegacyAttr & BG_ATTRS) >> 4) },
|
||||
_isBold{ false }
|
||||
{
|
||||
// If we're given lead/trailing byte information with the legacy color, strip it.
|
||||
@@ -59,9 +59,9 @@ public:
|
||||
|
||||
constexpr WORD GetLegacyAttributes() const noexcept
|
||||
{
|
||||
BYTE fg = (_foreground.GetIndex() & FG_ATTRS);
|
||||
BYTE bg = (_background.GetIndex() << 4) & BG_ATTRS;
|
||||
WORD meta = (_wAttrLegacy & META_ATTRS);
|
||||
const BYTE fg = (_foreground.GetIndex() & FG_ATTRS);
|
||||
const BYTE bg = (_background.GetIndex() << 4) & BG_ATTRS;
|
||||
const WORD meta = (_wAttrLegacy & META_ATTRS);
|
||||
return (fg | bg | meta) | (_isBold ? FOREGROUND_INTENSITY : 0);
|
||||
}
|
||||
|
||||
@@ -80,20 +80,20 @@ public:
|
||||
constexpr WORD GetLegacyAttributes(const BYTE defaultFgIndex,
|
||||
const BYTE defaultBgIndex) const noexcept
|
||||
{
|
||||
BYTE fgIndex = _foreground.IsLegacy() ? _foreground.GetIndex() : defaultFgIndex;
|
||||
BYTE bgIndex = _background.IsLegacy() ? _background.GetIndex() : defaultBgIndex;
|
||||
BYTE fg = (fgIndex & FG_ATTRS);
|
||||
BYTE bg = (bgIndex << 4) & BG_ATTRS;
|
||||
WORD meta = (_wAttrLegacy & META_ATTRS);
|
||||
const BYTE fgIndex = _foreground.IsLegacy() ? _foreground.GetIndex() : defaultFgIndex;
|
||||
const BYTE bgIndex = _background.IsLegacy() ? _background.GetIndex() : defaultBgIndex;
|
||||
const BYTE fg = (fgIndex & FG_ATTRS);
|
||||
const BYTE bg = (bgIndex << 4) & BG_ATTRS;
|
||||
const WORD meta = (_wAttrLegacy & META_ATTRS);
|
||||
return (fg | bg | meta) | (_isBold ? FOREGROUND_INTENSITY : 0);
|
||||
}
|
||||
|
||||
COLORREF CalculateRgbForeground(std::basic_string_view<COLORREF> colorTable,
|
||||
COLORREF defaultFgColor,
|
||||
COLORREF defaultBgColor) const;
|
||||
COLORREF defaultBgColor) const noexcept;
|
||||
COLORREF CalculateRgbBackground(std::basic_string_view<COLORREF> colorTable,
|
||||
COLORREF defaultFgColor,
|
||||
COLORREF defaultBgColor) const;
|
||||
COLORREF defaultBgColor) const noexcept;
|
||||
|
||||
bool IsLeadingByte() const noexcept;
|
||||
bool IsTrailingByte() const noexcept;
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
void SetLegacyAttributes(const WORD attrs,
|
||||
const bool setForeground,
|
||||
const bool setBackground,
|
||||
const bool setMeta);
|
||||
const bool setMeta) noexcept;
|
||||
|
||||
void SetIndexedAttributes(const std::optional<const BYTE> foreground,
|
||||
const std::optional<const BYTE> background) noexcept;
|
||||
@@ -133,9 +133,9 @@ public:
|
||||
bool IsLegacy() const noexcept;
|
||||
bool IsBold() const noexcept;
|
||||
|
||||
void SetForeground(const COLORREF rgbForeground);
|
||||
void SetBackground(const COLORREF rgbBackground);
|
||||
void SetColor(const COLORREF rgbColor, const bool fIsForeground);
|
||||
void SetForeground(const COLORREF rgbForeground) noexcept;
|
||||
void SetBackground(const COLORREF rgbBackground) noexcept;
|
||||
void SetColor(const COLORREF rgbColor, const bool fIsForeground) noexcept;
|
||||
|
||||
void SetDefaultForeground() noexcept;
|
||||
void SetDefaultBackground() noexcept;
|
||||
@@ -150,9 +150,9 @@ public:
|
||||
|
||||
private:
|
||||
COLORREF _GetRgbForeground(std::basic_string_view<COLORREF> colorTable,
|
||||
COLORREF defaultColor) const;
|
||||
COLORREF defaultColor) const noexcept;
|
||||
COLORREF _GetRgbBackground(std::basic_string_view<COLORREF> colorTable,
|
||||
COLORREF defaultColor) const;
|
||||
COLORREF defaultColor) const noexcept;
|
||||
bool _IsReverseVideo() const noexcept;
|
||||
void _SetBoldness(const bool isBold) noexcept;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
// - rgbColor: the COLORREF containing the color information for this TextColor
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TextColor::SetColor(const COLORREF rgbColor)
|
||||
void TextColor::SetColor(const COLORREF rgbColor) noexcept
|
||||
{
|
||||
_meta = ColorType::IsRgb;
|
||||
_red = GetRValue(rgbColor);
|
||||
@@ -25,7 +25,7 @@ void TextColor::SetColor(const COLORREF rgbColor)
|
||||
// - index: the index of the colortable we should use for this TextColor.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TextColor::SetIndex(const BYTE index)
|
||||
void TextColor::SetIndex(const BYTE index) noexcept
|
||||
{
|
||||
_meta = ColorType::IsIndex;
|
||||
_index = index;
|
||||
@@ -38,7 +38,7 @@ void TextColor::SetIndex(const BYTE index)
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TextColor::SetDefault()
|
||||
void TextColor::SetDefault() noexcept
|
||||
{
|
||||
_meta = ColorType::IsDefault;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ void TextColor::SetDefault()
|
||||
// - a COLORREF containing the real value of this TextColor.
|
||||
COLORREF TextColor::GetColor(std::basic_string_view<COLORREF> colorTable,
|
||||
const COLORREF defaultColor,
|
||||
bool brighten) const
|
||||
bool brighten) const noexcept
|
||||
{
|
||||
if (IsDefault())
|
||||
{
|
||||
@@ -81,9 +81,9 @@ COLORREF TextColor::GetColor(std::basic_string_view<COLORREF> colorTable,
|
||||
// If we find a match, return instead the bright version of this color
|
||||
for (size_t i = 0; i < 8; i++)
|
||||
{
|
||||
if (colorTable[i] == defaultColor)
|
||||
if (colorTable.at(i) == defaultColor)
|
||||
{
|
||||
return colorTable[i + 8];
|
||||
return colorTable.at(i + 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,12 +102,12 @@ COLORREF TextColor::GetColor(std::basic_string_view<COLORREF> colorTable,
|
||||
if (brighten && _index < 8)
|
||||
{
|
||||
FAIL_FAST_IF(colorTable.size() < 16);
|
||||
FAIL_FAST_IF((size_t)(_index + 8) > (size_t)(colorTable.size()));
|
||||
return colorTable[_index + 8];
|
||||
FAIL_FAST_IF(gsl::narrow_cast<size_t>(_index) + 8 > colorTable.size());
|
||||
return colorTable.at(gsl::narrow_cast<size_t>(_index) + 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
return colorTable[_index];
|
||||
return colorTable.at(_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ COLORREF TextColor::GetColor(std::basic_string_view<COLORREF> colorTable,
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - a COLORREF containing our stored value
|
||||
COLORREF TextColor::_GetRGB() const
|
||||
COLORREF TextColor::_GetRGB() const noexcept
|
||||
{
|
||||
return RGB(_red, _green, _blue);
|
||||
}
|
||||
|
||||
@@ -91,13 +91,13 @@ public:
|
||||
return _meta == ColorType::IsRgb;
|
||||
}
|
||||
|
||||
void SetColor(const COLORREF rgbColor);
|
||||
void SetIndex(const BYTE index);
|
||||
void SetDefault();
|
||||
void SetColor(const COLORREF rgbColor) noexcept;
|
||||
void SetIndex(const BYTE index) noexcept;
|
||||
void SetDefault() noexcept;
|
||||
|
||||
COLORREF GetColor(std::basic_string_view<COLORREF> colorTable,
|
||||
const COLORREF defaultColor,
|
||||
const bool brighten) const;
|
||||
const bool brighten) const noexcept;
|
||||
|
||||
constexpr BYTE GetIndex() const noexcept
|
||||
{
|
||||
@@ -113,7 +113,7 @@ private:
|
||||
BYTE _green;
|
||||
BYTE _blue;
|
||||
|
||||
COLORREF _GetRGB() const;
|
||||
COLORREF _GetRGB() const noexcept;
|
||||
|
||||
#ifdef UNIT_TESTING
|
||||
friend class TextBufferTests;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "precomp.h"
|
||||
#include "UnicodeStorage.hpp"
|
||||
|
||||
UnicodeStorage::UnicodeStorage() :
|
||||
UnicodeStorage::UnicodeStorage() noexcept :
|
||||
_map{}
|
||||
{
|
||||
}
|
||||
@@ -35,7 +35,7 @@ void UnicodeStorage::StoreGlyph(const key_type key, const mapped_type& glyph)
|
||||
// - erases key and its associated data from the storage
|
||||
// Arguments:
|
||||
// - key - the key to remove
|
||||
void UnicodeStorage::Erase(const key_type key) noexcept
|
||||
void UnicodeStorage::Erase(const key_type key)
|
||||
{
|
||||
_map.erase(key);
|
||||
}
|
||||
|
||||
@@ -47,13 +47,13 @@ public:
|
||||
using key_type = typename COORD;
|
||||
using mapped_type = typename std::vector<wchar_t>;
|
||||
|
||||
UnicodeStorage();
|
||||
UnicodeStorage() noexcept;
|
||||
|
||||
const mapped_type& GetText(const key_type key) const;
|
||||
|
||||
void StoreGlyph(const key_type key, const mapped_type& glyph);
|
||||
|
||||
void Erase(const key_type key) noexcept;
|
||||
void Erase(const key_type key);
|
||||
|
||||
void Remap(const std::map<SHORT, SHORT>& rowMap, const std::optional<SHORT> width);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
// - Constructor to set default properties for Cursor
|
||||
// Arguments:
|
||||
// - ulSize - The height of the cursor within this buffer
|
||||
Cursor::Cursor(const ULONG ulSize, TextBuffer& parentBuffer) :
|
||||
Cursor::Cursor(const ULONG ulSize, TextBuffer& parentBuffer) noexcept :
|
||||
_parentBuffer{ parentBuffer },
|
||||
_cPosition{ 0 },
|
||||
_fHasMoved(false),
|
||||
@@ -87,36 +87,36 @@ ULONG Cursor::GetSize() const noexcept
|
||||
return _ulSize;
|
||||
}
|
||||
|
||||
void Cursor::SetHasMoved(const bool fHasMoved)
|
||||
void Cursor::SetHasMoved(const bool fHasMoved) noexcept
|
||||
{
|
||||
_fHasMoved = fHasMoved;
|
||||
}
|
||||
|
||||
void Cursor::SetIsVisible(const bool fIsVisible)
|
||||
void Cursor::SetIsVisible(const bool fIsVisible) noexcept
|
||||
{
|
||||
_fIsVisible = fIsVisible;
|
||||
_RedrawCursor();
|
||||
}
|
||||
|
||||
void Cursor::SetIsOn(const bool fIsOn)
|
||||
void Cursor::SetIsOn(const bool fIsOn) noexcept
|
||||
{
|
||||
_fIsOn = fIsOn;
|
||||
_RedrawCursorAlways();
|
||||
}
|
||||
|
||||
void Cursor::SetBlinkingAllowed(const bool fBlinkingAllowed)
|
||||
void Cursor::SetBlinkingAllowed(const bool fBlinkingAllowed) noexcept
|
||||
{
|
||||
_fBlinkingAllowed = fBlinkingAllowed;
|
||||
_RedrawCursorAlways();
|
||||
}
|
||||
|
||||
void Cursor::SetIsDouble(const bool fIsDouble)
|
||||
void Cursor::SetIsDouble(const bool fIsDouble) noexcept
|
||||
{
|
||||
_fIsDouble = fIsDouble;
|
||||
_RedrawCursor();
|
||||
}
|
||||
|
||||
void Cursor::SetIsConversionArea(const bool fIsConversionArea)
|
||||
void Cursor::SetIsConversionArea(const bool fIsConversionArea) noexcept
|
||||
{
|
||||
// Functionally the same as "Hide cursor"
|
||||
// Never called with TRUE, it's only used in the creation of a
|
||||
@@ -125,19 +125,19 @@ void Cursor::SetIsConversionArea(const bool fIsConversionArea)
|
||||
_RedrawCursorAlways();
|
||||
}
|
||||
|
||||
void Cursor::SetIsPopupShown(const bool fIsPopupShown)
|
||||
void Cursor::SetIsPopupShown(const bool fIsPopupShown) noexcept
|
||||
{
|
||||
// Functionally the same as "Hide cursor"
|
||||
_fIsPopupShown = fIsPopupShown;
|
||||
_RedrawCursorAlways();
|
||||
}
|
||||
|
||||
void Cursor::SetDelay(const bool fDelay)
|
||||
void Cursor::SetDelay(const bool fDelay) noexcept
|
||||
{
|
||||
_fDelay = fDelay;
|
||||
}
|
||||
|
||||
void Cursor::SetSize(const ULONG ulSize)
|
||||
void Cursor::SetSize(const ULONG ulSize) noexcept
|
||||
{
|
||||
_ulSize = ulSize;
|
||||
_RedrawCursor();
|
||||
@@ -195,7 +195,7 @@ void Cursor::_RedrawCursorAlways() noexcept
|
||||
CATCH_LOG();
|
||||
}
|
||||
|
||||
void Cursor::SetPosition(const COORD cPosition)
|
||||
void Cursor::SetPosition(const COORD cPosition) noexcept
|
||||
{
|
||||
_RedrawCursor();
|
||||
_cPosition.X = cPosition.X;
|
||||
@@ -204,50 +204,50 @@ void Cursor::SetPosition(const COORD cPosition)
|
||||
ResetDelayEOLWrap();
|
||||
}
|
||||
|
||||
void Cursor::SetXPosition(const int NewX)
|
||||
void Cursor::SetXPosition(const int NewX) noexcept
|
||||
{
|
||||
_RedrawCursor();
|
||||
_cPosition.X = (SHORT)NewX;
|
||||
_cPosition.X = gsl::narrow<SHORT>(NewX);
|
||||
_RedrawCursor();
|
||||
ResetDelayEOLWrap();
|
||||
}
|
||||
|
||||
void Cursor::SetYPosition(const int NewY)
|
||||
void Cursor::SetYPosition(const int NewY) noexcept
|
||||
{
|
||||
_RedrawCursor();
|
||||
_cPosition.Y = (SHORT)NewY;
|
||||
_cPosition.Y = gsl::narrow<SHORT>(NewY);
|
||||
_RedrawCursor();
|
||||
ResetDelayEOLWrap();
|
||||
}
|
||||
|
||||
void Cursor::IncrementXPosition(const int DeltaX)
|
||||
void Cursor::IncrementXPosition(const int DeltaX) noexcept
|
||||
{
|
||||
_RedrawCursor();
|
||||
_cPosition.X += (SHORT)DeltaX;
|
||||
_cPosition.X += gsl::narrow<SHORT>(DeltaX);
|
||||
_RedrawCursor();
|
||||
ResetDelayEOLWrap();
|
||||
}
|
||||
|
||||
void Cursor::IncrementYPosition(const int DeltaY)
|
||||
void Cursor::IncrementYPosition(const int DeltaY) noexcept
|
||||
{
|
||||
_RedrawCursor();
|
||||
_cPosition.Y += (SHORT)DeltaY;
|
||||
_cPosition.Y += gsl::narrow<SHORT>(DeltaY);
|
||||
_RedrawCursor();
|
||||
ResetDelayEOLWrap();
|
||||
}
|
||||
|
||||
void Cursor::DecrementXPosition(const int DeltaX)
|
||||
void Cursor::DecrementXPosition(const int DeltaX) noexcept
|
||||
{
|
||||
_RedrawCursor();
|
||||
_cPosition.X -= (SHORT)DeltaX;
|
||||
_cPosition.X -= gsl::narrow<SHORT>(DeltaX);
|
||||
_RedrawCursor();
|
||||
ResetDelayEOLWrap();
|
||||
}
|
||||
|
||||
void Cursor::DecrementYPosition(const int DeltaY)
|
||||
void Cursor::DecrementYPosition(const int DeltaY) noexcept
|
||||
{
|
||||
_RedrawCursor();
|
||||
_cPosition.Y -= (SHORT)DeltaY;
|
||||
_cPosition.Y -= gsl::narrow<SHORT>(DeltaY);
|
||||
_RedrawCursor();
|
||||
ResetDelayEOLWrap();
|
||||
}
|
||||
@@ -262,7 +262,7 @@ void Cursor::DecrementYPosition(const int DeltaY)
|
||||
// - OtherCursor - The cursor to copy properties from
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void Cursor::CopyProperties(const Cursor& OtherCursor)
|
||||
void Cursor::CopyProperties(const Cursor& OtherCursor) noexcept
|
||||
{
|
||||
// We shouldn't copy the position as it will be already rearranged by the resize operation.
|
||||
//_cPosition = pOtherCursor->_cPosition;
|
||||
@@ -288,34 +288,34 @@ void Cursor::CopyProperties(const Cursor& OtherCursor)
|
||||
_color = OtherCursor._color;
|
||||
}
|
||||
|
||||
void Cursor::DelayEOLWrap(const COORD coordDelayedAt)
|
||||
void Cursor::DelayEOLWrap(const COORD coordDelayedAt) noexcept
|
||||
{
|
||||
_coordDelayedAt = coordDelayedAt;
|
||||
_fDelayedEolWrap = true;
|
||||
}
|
||||
|
||||
void Cursor::ResetDelayEOLWrap()
|
||||
void Cursor::ResetDelayEOLWrap() noexcept
|
||||
{
|
||||
_coordDelayedAt = { 0 };
|
||||
_fDelayedEolWrap = false;
|
||||
}
|
||||
|
||||
COORD Cursor::GetDelayedAtPosition() const
|
||||
COORD Cursor::GetDelayedAtPosition() const noexcept
|
||||
{
|
||||
return _coordDelayedAt;
|
||||
}
|
||||
|
||||
bool Cursor::IsDelayedEOLWrap() const
|
||||
bool Cursor::IsDelayedEOLWrap() const noexcept
|
||||
{
|
||||
return _fDelayedEolWrap;
|
||||
}
|
||||
|
||||
void Cursor::StartDeferDrawing()
|
||||
void Cursor::StartDeferDrawing() noexcept
|
||||
{
|
||||
_fDeferCursorRedraw = true;
|
||||
}
|
||||
|
||||
void Cursor::EndDeferDrawing()
|
||||
void Cursor::EndDeferDrawing() noexcept
|
||||
{
|
||||
if (_fHaveDeferredCursorRedraw)
|
||||
{
|
||||
@@ -325,27 +325,27 @@ void Cursor::EndDeferDrawing()
|
||||
_fDeferCursorRedraw = FALSE;
|
||||
}
|
||||
|
||||
const CursorType Cursor::GetType() const
|
||||
const CursorType Cursor::GetType() const noexcept
|
||||
{
|
||||
return _cursorType;
|
||||
}
|
||||
|
||||
const bool Cursor::IsUsingColor() const
|
||||
const bool Cursor::IsUsingColor() const noexcept
|
||||
{
|
||||
return GetColor() != INVALID_COLOR;
|
||||
}
|
||||
|
||||
const COLORREF Cursor::GetColor() const
|
||||
const COLORREF Cursor::GetColor() const noexcept
|
||||
{
|
||||
return _color;
|
||||
}
|
||||
|
||||
void Cursor::SetColor(const unsigned int color)
|
||||
void Cursor::SetColor(const unsigned int color) noexcept
|
||||
{
|
||||
_color = (COLORREF)color;
|
||||
_color = gsl::narrow_cast<COLORREF>(color);
|
||||
}
|
||||
|
||||
void Cursor::SetType(const CursorType type)
|
||||
void Cursor::SetType(const CursorType type) noexcept
|
||||
{
|
||||
_cursorType = type;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class Cursor final
|
||||
public:
|
||||
static const unsigned int s_InvertCursorColor = INVALID_COLOR;
|
||||
|
||||
Cursor(const ULONG ulSize, TextBuffer& parentBuffer);
|
||||
Cursor(const ULONG ulSize, TextBuffer& parentBuffer) noexcept;
|
||||
|
||||
~Cursor();
|
||||
|
||||
@@ -50,41 +50,41 @@ public:
|
||||
ULONG GetSize() const noexcept;
|
||||
COORD GetPosition() const noexcept;
|
||||
|
||||
const CursorType GetType() const;
|
||||
const bool IsUsingColor() const;
|
||||
const COLORREF GetColor() const;
|
||||
const CursorType GetType() const noexcept;
|
||||
const bool IsUsingColor() const noexcept;
|
||||
const COLORREF GetColor() const noexcept;
|
||||
|
||||
void StartDeferDrawing();
|
||||
void EndDeferDrawing();
|
||||
void StartDeferDrawing() noexcept;
|
||||
void EndDeferDrawing() noexcept;
|
||||
|
||||
void SetHasMoved(const bool fHasMoved);
|
||||
void SetIsVisible(const bool fIsVisible);
|
||||
void SetIsOn(const bool fIsOn);
|
||||
void SetBlinkingAllowed(const bool fIsOn);
|
||||
void SetIsDouble(const bool fIsDouble);
|
||||
void SetIsConversionArea(const bool fIsConversionArea);
|
||||
void SetIsPopupShown(const bool fIsPopupShown);
|
||||
void SetDelay(const bool fDelay);
|
||||
void SetSize(const ULONG ulSize);
|
||||
void SetHasMoved(const bool fHasMoved) noexcept;
|
||||
void SetIsVisible(const bool fIsVisible) noexcept;
|
||||
void SetIsOn(const bool fIsOn) noexcept;
|
||||
void SetBlinkingAllowed(const bool fIsOn) noexcept;
|
||||
void SetIsDouble(const bool fIsDouble) noexcept;
|
||||
void SetIsConversionArea(const bool fIsConversionArea) noexcept;
|
||||
void SetIsPopupShown(const bool fIsPopupShown) noexcept;
|
||||
void SetDelay(const bool fDelay) noexcept;
|
||||
void SetSize(const ULONG ulSize) noexcept;
|
||||
void SetStyle(const ULONG ulSize, const COLORREF color, const CursorType type) noexcept;
|
||||
|
||||
void SetPosition(const COORD cPosition);
|
||||
void SetXPosition(const int NewX);
|
||||
void SetYPosition(const int NewY);
|
||||
void IncrementXPosition(const int DeltaX);
|
||||
void IncrementYPosition(const int DeltaY);
|
||||
void DecrementXPosition(const int DeltaX);
|
||||
void DecrementYPosition(const int DeltaY);
|
||||
void SetPosition(const COORD cPosition) noexcept;
|
||||
void SetXPosition(const int NewX) noexcept;
|
||||
void SetYPosition(const int NewY) noexcept;
|
||||
void IncrementXPosition(const int DeltaX) noexcept;
|
||||
void IncrementYPosition(const int DeltaY) noexcept;
|
||||
void DecrementXPosition(const int DeltaX) noexcept;
|
||||
void DecrementYPosition(const int DeltaY) noexcept;
|
||||
|
||||
void CopyProperties(const Cursor& OtherCursor);
|
||||
void CopyProperties(const Cursor& OtherCursor) noexcept;
|
||||
|
||||
void DelayEOLWrap(const COORD coordDelayedAt);
|
||||
void ResetDelayEOLWrap();
|
||||
COORD GetDelayedAtPosition() const;
|
||||
bool IsDelayedEOLWrap() const;
|
||||
void DelayEOLWrap(const COORD coordDelayedAt) noexcept;
|
||||
void ResetDelayEOLWrap() noexcept;
|
||||
COORD GetDelayedAtPosition() const noexcept;
|
||||
bool IsDelayedEOLWrap() const noexcept;
|
||||
|
||||
void SetColor(const unsigned int color);
|
||||
void SetType(const CursorType type);
|
||||
void SetColor(const unsigned int color) noexcept;
|
||||
void SetType(const CursorType type) noexcept;
|
||||
|
||||
private:
|
||||
TextBuffer& _parentBuffer;
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
#include "textBuffer.hpp"
|
||||
#include "CharRow.hpp"
|
||||
|
||||
#include "../types/inc/utils.hpp"
|
||||
#include "../types/inc/convert.hpp"
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
using namespace Microsoft::Console;
|
||||
using namespace Microsoft::Console::Types;
|
||||
|
||||
// Routine Description:
|
||||
@@ -47,7 +49,7 @@ TextBuffer::TextBuffer(const COORD screenBufferSize,
|
||||
// - OtherBuffer - The text buffer to copy properties from
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TextBuffer::CopyProperties(const TextBuffer& OtherBuffer)
|
||||
void TextBuffer::CopyProperties(const TextBuffer& OtherBuffer) noexcept
|
||||
{
|
||||
GetCursor().CopyProperties(OtherBuffer.GetCursor());
|
||||
}
|
||||
@@ -58,9 +60,9 @@ void TextBuffer::CopyProperties(const TextBuffer& OtherBuffer)
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - Total number of rows in the buffer
|
||||
UINT TextBuffer::TotalRowCount() const
|
||||
UINT TextBuffer::TotalRowCount() const noexcept
|
||||
{
|
||||
return static_cast<UINT>(_storage.size());
|
||||
return gsl::narrow<UINT>(_storage.size());
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@@ -76,7 +78,7 @@ const ROW& TextBuffer::GetRowByOffset(const size_t index) const
|
||||
|
||||
// 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;
|
||||
return _storage[offsetIndex];
|
||||
return _storage.at(offsetIndex);
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@@ -88,7 +90,11 @@ const ROW& TextBuffer::GetRowByOffset(const size_t index) const
|
||||
// - reference to the requested row. Asserts if out of bounds.
|
||||
ROW& TextBuffer::GetRowByOffset(const size_t index)
|
||||
{
|
||||
return const_cast<ROW&>(static_cast<const TextBuffer*>(this)->GetRowByOffset(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;
|
||||
return _storage.at(offsetIndex);
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@@ -540,7 +546,7 @@ bool TextBuffer::IncrementCircularBuffer()
|
||||
_renderTarget.TriggerCircling();
|
||||
|
||||
// First, clean out the old "first row" as it will become the "last row" of the buffer after the circle is performed.
|
||||
bool fSuccess = _storage.at(_firstRow).Reset(_currentAttributes);
|
||||
const bool fSuccess = _storage.at(_firstRow).Reset(_currentAttributes);
|
||||
if (fSuccess)
|
||||
{
|
||||
// Now proceed to increment.
|
||||
@@ -558,30 +564,45 @@ bool TextBuffer::IncrementCircularBuffer()
|
||||
|
||||
//Routine Description:
|
||||
// - Retrieves the position of the last non-space character on the final line of the text buffer.
|
||||
// - By default, we search the entire buffer to find the last non-space character
|
||||
//Arguments:
|
||||
// - <none>
|
||||
//Return Value:
|
||||
// - Coordinate position in screen coordinates (offset coordinates, not array index coordinates).
|
||||
COORD TextBuffer::GetLastNonSpaceCharacter() const
|
||||
{
|
||||
COORD coordEndOfText;
|
||||
// Always search the whole buffer, by starting at the bottom.
|
||||
coordEndOfText.Y = GetSize().BottomInclusive();
|
||||
return GetLastNonSpaceCharacter(GetSize());
|
||||
}
|
||||
|
||||
const ROW* pCurrRow = &GetRowByOffset(coordEndOfText.Y);
|
||||
//Routine Description:
|
||||
// - Retrieves the position of the last non-space character in the given viewport
|
||||
// - This is basically an optimized version of GetLastNonSpaceCharacter(), and can be called when
|
||||
// - we know the last character is within the given viewport (so we don't need to check the entire buffer)
|
||||
//Arguments:
|
||||
// - The viewport
|
||||
//Return value:
|
||||
// - Coordinate position (relative to the text buffer)
|
||||
COORD TextBuffer::GetLastNonSpaceCharacter(const Microsoft::Console::Types::Viewport viewport) const
|
||||
{
|
||||
COORD coordEndOfText = { 0 };
|
||||
// Search the given viewport by starting at the bottom.
|
||||
coordEndOfText.Y = viewport.BottomInclusive();
|
||||
|
||||
const auto& currRow = GetRowByOffset(coordEndOfText.Y);
|
||||
// The X position of the end of the valid text is the Right draw boundary (which is one beyond the final valid character)
|
||||
coordEndOfText.X = static_cast<short>(pCurrRow->GetCharRow().MeasureRight()) - 1;
|
||||
coordEndOfText.X = gsl::narrow<short>(currRow.GetCharRow().MeasureRight()) - 1;
|
||||
|
||||
// If the X coordinate turns out to be -1, the row was empty, we need to search backwards for the real end of text.
|
||||
bool fDoBackUp = (coordEndOfText.X < 0 && coordEndOfText.Y > 0); // this row is empty, and we're not at the top
|
||||
const auto viewportTop = viewport.Top();
|
||||
bool fDoBackUp = (coordEndOfText.X < 0 && coordEndOfText.Y > viewportTop); // this row is empty, and we're not at the top
|
||||
while (fDoBackUp)
|
||||
{
|
||||
coordEndOfText.Y--;
|
||||
pCurrRow = &GetRowByOffset(coordEndOfText.Y);
|
||||
const auto& backupRow = GetRowByOffset(coordEndOfText.Y);
|
||||
// We need to back up to the previous row if this line is empty, AND there are more rows
|
||||
|
||||
coordEndOfText.X = static_cast<short>(pCurrRow->GetCharRow().MeasureRight()) - 1;
|
||||
fDoBackUp = (coordEndOfText.X < 0 && coordEndOfText.Y > 0);
|
||||
coordEndOfText.X = gsl::narrow<short>(backupRow.GetCharRow().MeasureRight()) - 1;
|
||||
fDoBackUp = (coordEndOfText.X < 0 && coordEndOfText.Y > viewportTop);
|
||||
}
|
||||
|
||||
// don't allow negative results
|
||||
@@ -623,7 +644,7 @@ COORD TextBuffer::_GetPreviousFromCursor() const
|
||||
return coordPosition;
|
||||
}
|
||||
|
||||
const SHORT TextBuffer::GetFirstRowIndex() const
|
||||
const SHORT TextBuffer::GetFirstRowIndex() const noexcept
|
||||
{
|
||||
return _firstRow;
|
||||
}
|
||||
@@ -632,7 +653,7 @@ const Viewport TextBuffer::GetSize() const
|
||||
return Viewport::FromDimensions({ 0, 0 }, { gsl::narrow<SHORT>(_storage.at(0).size()), gsl::narrow<SHORT>(_storage.size()) });
|
||||
}
|
||||
|
||||
void TextBuffer::_SetFirstRowIndex(const SHORT FirstRowIndex)
|
||||
void TextBuffer::_SetFirstRowIndex(const SHORT FirstRowIndex) noexcept
|
||||
{
|
||||
_firstRow = FirstRowIndex;
|
||||
}
|
||||
@@ -738,12 +759,12 @@ void TextBuffer::ScrollRows(const SHORT firstRow, const SHORT size, const SHORT
|
||||
_RefreshRowIDs(std::nullopt);
|
||||
}
|
||||
|
||||
Cursor& TextBuffer::GetCursor()
|
||||
Cursor& TextBuffer::GetCursor() noexcept
|
||||
{
|
||||
return _cursor;
|
||||
}
|
||||
|
||||
const Cursor& TextBuffer::GetCursor() const
|
||||
const Cursor& TextBuffer::GetCursor() const noexcept
|
||||
{
|
||||
return _cursor;
|
||||
}
|
||||
@@ -778,7 +799,7 @@ void TextBuffer::Reset()
|
||||
// - newSize - new size of screen.
|
||||
// Return Value:
|
||||
// - Success if successful. Invalid parameter if screen buffer size is unexpected. No memory if allocation failed.
|
||||
[[nodiscard]] NTSTATUS TextBuffer::ResizeTraditional(const COORD newSize) noexcept
|
||||
[[nodiscard]] NTSTATUS TextBuffer::ResizeTraditional(const COORD newSize)
|
||||
{
|
||||
RETURN_HR_IF(E_INVALIDARG, newSize.X < 0 || newSize.Y < 0);
|
||||
|
||||
@@ -795,7 +816,7 @@ void TextBuffer::Reset()
|
||||
// rotate rows until the top row is at index 0
|
||||
try
|
||||
{
|
||||
const ROW& newTopRow = _storage[TopRowIndex];
|
||||
const ROW& newTopRow = _storage.at(TopRowIndex);
|
||||
while (&newTopRow != &_storage.front())
|
||||
{
|
||||
_storage.push_back(std::move(_storage.front()));
|
||||
@@ -826,12 +847,12 @@ void TextBuffer::Reset()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
const UnicodeStorage& TextBuffer::GetUnicodeStorage() const
|
||||
const UnicodeStorage& TextBuffer::GetUnicodeStorage() const noexcept
|
||||
{
|
||||
return _unicodeStorage;
|
||||
}
|
||||
|
||||
UnicodeStorage& TextBuffer::GetUnicodeStorage()
|
||||
UnicodeStorage& TextBuffer::GetUnicodeStorage() noexcept
|
||||
{
|
||||
return _unicodeStorage;
|
||||
}
|
||||
@@ -906,7 +927,7 @@ ROW& TextBuffer::_GetPrevRowNoWrap(const ROW& Row)
|
||||
}
|
||||
|
||||
THROW_HR_IF(E_FAIL, Row.GetId() == _firstRow);
|
||||
return _storage[prevRowIndex];
|
||||
return _storage.at(prevRowIndex);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -915,7 +936,7 @@ ROW& TextBuffer::_GetPrevRowNoWrap(const ROW& Row)
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - This buffer's current render target.
|
||||
Microsoft::Console::Render::IRenderTarget& TextBuffer::GetRenderTarget()
|
||||
Microsoft::Console::Render::IRenderTarget& TextBuffer::GetRenderTarget() noexcept
|
||||
{
|
||||
return _renderTarget;
|
||||
}
|
||||
@@ -960,9 +981,9 @@ const TextBuffer::TextAndColor TextBuffer::GetTextForClipboard(const bool lineSe
|
||||
std::vector<COLORREF> selectionBkAttr;
|
||||
|
||||
// preallocate to avoid reallocs
|
||||
selectionText.reserve(highlight.Width() + 2); // + 2 for \r\n if we munged it
|
||||
selectionFgAttr.reserve(highlight.Width() + 2);
|
||||
selectionBkAttr.reserve(highlight.Width() + 2);
|
||||
selectionText.reserve(gsl::narrow<size_t>(highlight.Width()) + 2); // + 2 for \r\n if we munged it
|
||||
selectionFgAttr.reserve(gsl::narrow<size_t>(highlight.Width()) + 2);
|
||||
selectionBkAttr.reserve(gsl::narrow<size_t>(highlight.Width()) + 2);
|
||||
|
||||
// copy char data into the string buffer, skipping trailing bytes
|
||||
while (it)
|
||||
@@ -981,6 +1002,8 @@ const TextBuffer::TextAndColor TextBuffer::GetTextForClipboard(const bool lineSe
|
||||
selectionBkAttr.push_back(CellBkAttr);
|
||||
}
|
||||
}
|
||||
#pragma warning(suppress : 26444)
|
||||
// TODO GH 2675: figure out why there's custom construction/destruction happening here
|
||||
it++;
|
||||
}
|
||||
|
||||
@@ -1028,3 +1051,193 @@ const TextBuffer::TextAndColor TextBuffer::GetTextForClipboard(const bool lineSe
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Generates a CF_HTML compliant structure based on the passed in text and color data
|
||||
// Arguments:
|
||||
// - rows - the text and color data we will format & encapsulate
|
||||
// - backgroundColor - default background color for characters, also used in padding
|
||||
// - fontHeightPoints - the unscaled font height
|
||||
// - fontFaceName - the name of the font used
|
||||
// - htmlTitle - value used in title tag of html header. Used to name the application
|
||||
// Return Value:
|
||||
// - string containing the generated HTML
|
||||
std::string TextBuffer::GenHTML(const TextAndColor& rows, const int fontHeightPoints, const PCWCHAR fontFaceName, const COLORREF backgroundColor, const std::string& htmlTitle)
|
||||
{
|
||||
try
|
||||
{
|
||||
// TODO: GH 602 the font name needs to be passed and stored around as an actual bounded type, not an implicit bounds on LF_FACESIZE
|
||||
const auto faceLength = wcsnlen_s(fontFaceName, LF_FACESIZE);
|
||||
const std::wstring_view faceNameView{ fontFaceName, faceLength };
|
||||
|
||||
std::ostringstream htmlBuilder;
|
||||
|
||||
// First we have to add some standard
|
||||
// HTML boiler plate required for CF_HTML
|
||||
// as part of the HTML Clipboard format
|
||||
const std::string htmlHeader =
|
||||
"<!DOCTYPE><HTML><HEAD><TITLE>" + htmlTitle + "</TITLE></HEAD><BODY>";
|
||||
htmlBuilder << htmlHeader;
|
||||
|
||||
htmlBuilder << "<!--StartFragment -->";
|
||||
|
||||
// apply global style in div element
|
||||
{
|
||||
htmlBuilder << "<DIV STYLE=\"";
|
||||
htmlBuilder << "display:inline-block;";
|
||||
htmlBuilder << "white-space:pre;";
|
||||
|
||||
htmlBuilder << "background-color:";
|
||||
htmlBuilder << Utils::ColorToHexString(backgroundColor);
|
||||
htmlBuilder << ";";
|
||||
|
||||
htmlBuilder << "font-family:";
|
||||
htmlBuilder << "'";
|
||||
htmlBuilder << ConvertToA(CP_UTF8, faceNameView);
|
||||
htmlBuilder << "',";
|
||||
// even with different font, add monospace as fallback
|
||||
htmlBuilder << "monospace;";
|
||||
|
||||
htmlBuilder << "font-size:";
|
||||
htmlBuilder << fontHeightPoints;
|
||||
htmlBuilder << "pt;";
|
||||
|
||||
// note: MS Word doesn't support padding (in this way at least)
|
||||
htmlBuilder << "padding:";
|
||||
htmlBuilder << 4; // todo: customizable padding
|
||||
htmlBuilder << "px;";
|
||||
|
||||
htmlBuilder << "\">";
|
||||
}
|
||||
|
||||
// copy text and info color from buffer
|
||||
bool hasWrittenAnyText = false;
|
||||
std::optional<COLORREF> fgColor = std::nullopt;
|
||||
std::optional<COLORREF> bkColor = std::nullopt;
|
||||
for (size_t row = 0; row < rows.text.size(); row++)
|
||||
{
|
||||
size_t startOffset = 0;
|
||||
|
||||
if (row != 0)
|
||||
{
|
||||
htmlBuilder << "<BR>";
|
||||
}
|
||||
|
||||
for (size_t col = 0; col < rows.text.at(row).length(); col++)
|
||||
{
|
||||
// do not include \r nor \n as they don't have attributes
|
||||
// and are not HTML friendly. For line break use '<BR>' instead.
|
||||
const bool isLastCharInRow =
|
||||
col == rows.text.at(row).length() - 1 ||
|
||||
rows.text.at(row).at(col + 1) == '\r' ||
|
||||
rows.text.at(row).at(col + 1) == '\n';
|
||||
|
||||
bool colorChanged = false;
|
||||
if (!fgColor.has_value() || rows.FgAttr.at(row).at(col) != fgColor.value())
|
||||
{
|
||||
fgColor = rows.FgAttr.at(row).at(col);
|
||||
colorChanged = true;
|
||||
}
|
||||
|
||||
if (!bkColor.has_value() || rows.BkAttr.at(row).at(col) != bkColor.value())
|
||||
{
|
||||
bkColor = rows.BkAttr.at(row).at(col);
|
||||
colorChanged = true;
|
||||
}
|
||||
|
||||
const auto writeAccumulatedChars = [&](bool includeCurrent) {
|
||||
if (col > startOffset)
|
||||
{
|
||||
const auto unescapedText = ConvertToA(CP_UTF8, std::wstring_view(rows.text.at(row)).substr(startOffset, col - startOffset + includeCurrent));
|
||||
for (const auto c : unescapedText)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '<':
|
||||
htmlBuilder << "<";
|
||||
break;
|
||||
case '>':
|
||||
htmlBuilder << ">";
|
||||
break;
|
||||
case '&':
|
||||
htmlBuilder << "&";
|
||||
break;
|
||||
default:
|
||||
htmlBuilder << c;
|
||||
}
|
||||
}
|
||||
|
||||
startOffset = col;
|
||||
}
|
||||
};
|
||||
|
||||
if (colorChanged)
|
||||
{
|
||||
writeAccumulatedChars(false);
|
||||
|
||||
if (hasWrittenAnyText)
|
||||
{
|
||||
htmlBuilder << "</SPAN>";
|
||||
}
|
||||
|
||||
htmlBuilder << "<SPAN STYLE=\"";
|
||||
htmlBuilder << "color:";
|
||||
htmlBuilder << Utils::ColorToHexString(fgColor.value());
|
||||
htmlBuilder << ";";
|
||||
htmlBuilder << "background-color:";
|
||||
htmlBuilder << Utils::ColorToHexString(bkColor.value());
|
||||
htmlBuilder << ";";
|
||||
htmlBuilder << "\">";
|
||||
}
|
||||
|
||||
hasWrittenAnyText = true;
|
||||
|
||||
if (isLastCharInRow)
|
||||
{
|
||||
writeAccumulatedChars(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasWrittenAnyText)
|
||||
{
|
||||
// last opened span wasn't closed in loop above, so close it now
|
||||
htmlBuilder << "</SPAN>";
|
||||
}
|
||||
|
||||
htmlBuilder << "</DIV>";
|
||||
|
||||
htmlBuilder << "<!--EndFragment -->";
|
||||
|
||||
constexpr std::string_view HtmlFooter = "</BODY></HTML>";
|
||||
htmlBuilder << HtmlFooter;
|
||||
|
||||
// once filled with values, there will be exactly 157 bytes in the clipboard header
|
||||
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();
|
||||
|
||||
// header required by HTML 0.9 format
|
||||
std::ostringstream clipHeaderBuilder;
|
||||
clipHeaderBuilder << "Version:0.9\r\n";
|
||||
clipHeaderBuilder << std::setfill('0');
|
||||
clipHeaderBuilder << "StartHTML:" << std::setw(10) << htmlStartPos << "\r\n";
|
||||
clipHeaderBuilder << "EndHTML:" << std::setw(10) << htmlEndPos << "\r\n";
|
||||
clipHeaderBuilder << "StartFragment:" << std::setw(10) << fragStartPos << "\r\n";
|
||||
clipHeaderBuilder << "EndFragment:" << std::setw(10) << fragEndPos << "\r\n";
|
||||
clipHeaderBuilder << "StartSelection:" << std::setw(10) << fragStartPos << "\r\n";
|
||||
clipHeaderBuilder << "EndSelection:" << std::setw(10) << fragEndPos << "\r\n";
|
||||
|
||||
return clipHeaderBuilder.str() + htmlBuilder.str();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_HR(wil::ResultFromCaughtException());
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
~TextBuffer() = default;
|
||||
|
||||
// Used for duplicating properties to another text buffer
|
||||
void CopyProperties(const TextBuffer& OtherBuffer);
|
||||
void CopyProperties(const TextBuffer& OtherBuffer) noexcept;
|
||||
|
||||
// row manipulation
|
||||
const ROW& GetRowByOffset(const size_t index) const;
|
||||
@@ -105,17 +105,18 @@ public:
|
||||
bool IncrementCircularBuffer();
|
||||
|
||||
COORD GetLastNonSpaceCharacter() const;
|
||||
COORD GetLastNonSpaceCharacter(const Microsoft::Console::Types::Viewport viewport) const;
|
||||
|
||||
Cursor& GetCursor();
|
||||
const Cursor& GetCursor() const;
|
||||
Cursor& GetCursor() noexcept;
|
||||
const Cursor& GetCursor() const noexcept;
|
||||
|
||||
const SHORT GetFirstRowIndex() const;
|
||||
const SHORT GetFirstRowIndex() const noexcept;
|
||||
|
||||
const Microsoft::Console::Types::Viewport GetSize() const;
|
||||
|
||||
void ScrollRows(const SHORT firstRow, const SHORT size, const SHORT delta);
|
||||
|
||||
UINT TotalRowCount() const;
|
||||
UINT TotalRowCount() const noexcept;
|
||||
|
||||
[[nodiscard]] TextAttribute GetCurrentAttributes() const noexcept;
|
||||
|
||||
@@ -123,12 +124,12 @@ public:
|
||||
|
||||
void Reset();
|
||||
|
||||
[[nodiscard]] HRESULT ResizeTraditional(const COORD newSize) noexcept;
|
||||
[[nodiscard]] HRESULT ResizeTraditional(const COORD newSize);
|
||||
|
||||
const UnicodeStorage& GetUnicodeStorage() const;
|
||||
UnicodeStorage& GetUnicodeStorage();
|
||||
const UnicodeStorage& GetUnicodeStorage() const noexcept;
|
||||
UnicodeStorage& GetUnicodeStorage() noexcept;
|
||||
|
||||
Microsoft::Console::Render::IRenderTarget& GetRenderTarget();
|
||||
Microsoft::Console::Render::IRenderTarget& GetRenderTarget() noexcept;
|
||||
|
||||
class TextAndColor
|
||||
{
|
||||
@@ -144,6 +145,12 @@ public:
|
||||
std::function<COLORREF(TextAttribute&)> GetForegroundColor,
|
||||
std::function<COLORREF(TextAttribute&)> GetBackgroundColor) const;
|
||||
|
||||
static std::string GenHTML(const TextAndColor& rows,
|
||||
const int fontHeightPoints,
|
||||
const PCWCHAR fontFaceName,
|
||||
const COLORREF backgroundColor,
|
||||
const std::string& htmlTitle);
|
||||
|
||||
private:
|
||||
std::deque<ROW> _storage;
|
||||
Cursor _cursor;
|
||||
@@ -159,7 +166,7 @@ private:
|
||||
|
||||
Microsoft::Console::Render::IRenderTarget& _renderTarget;
|
||||
|
||||
void _SetFirstRowIndex(const SHORT FirstRowIndex);
|
||||
void _SetFirstRowIndex(const SHORT FirstRowIndex) noexcept;
|
||||
|
||||
COORD _GetPreviousFromCursor() const;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ TextBufferCellIterator::operator bool() const noexcept
|
||||
// - it - The other iterator to compare to this one.
|
||||
// Return Value:
|
||||
// - True if it's the same text buffer and same cell position. False otherwise.
|
||||
bool TextBufferCellIterator::operator==(const TextBufferCellIterator& it) const noexcept
|
||||
bool TextBufferCellIterator::operator==(const TextBufferCellIterator& it) const
|
||||
{
|
||||
return _pos == it._pos &&
|
||||
&_buffer == &it._buffer &&
|
||||
@@ -81,7 +81,7 @@ bool TextBufferCellIterator::operator==(const TextBufferCellIterator& it) const
|
||||
// - it - The other iterator to compare to this one.
|
||||
// Return Value:
|
||||
// - True if it's the same text buffer and different cell position or if they're different buffers. False otherwise.
|
||||
bool TextBufferCellIterator::operator!=(const TextBufferCellIterator& it) const noexcept
|
||||
bool TextBufferCellIterator::operator!=(const TextBufferCellIterator& it) const
|
||||
{
|
||||
return !(*this == it);
|
||||
}
|
||||
@@ -212,7 +212,7 @@ void TextBufferCellIterator::_SetPos(const COORD newPos)
|
||||
|
||||
if (newPos.X != _pos.X)
|
||||
{
|
||||
const ptrdiff_t diff = newPos.X - _pos.X;
|
||||
const auto diff = gsl::narrow_cast<ptrdiff_t>(newPos.X) - gsl::narrow_cast<ptrdiff_t>(_pos.X);
|
||||
_attrIter += diff;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,10 @@ public:
|
||||
TextBufferCellIterator(const TextBuffer& buffer, COORD pos);
|
||||
TextBufferCellIterator(const TextBuffer& buffer, COORD pos, const Microsoft::Console::Types::Viewport limits);
|
||||
|
||||
~TextBufferCellIterator() = default;
|
||||
|
||||
operator bool() const noexcept;
|
||||
|
||||
bool operator==(const TextBufferCellIterator& it) const noexcept;
|
||||
bool operator!=(const TextBufferCellIterator& it) const noexcept;
|
||||
bool operator==(const TextBufferCellIterator& it) const;
|
||||
bool operator!=(const TextBufferCellIterator& it) const;
|
||||
|
||||
TextBufferCellIterator& operator+=(const ptrdiff_t& movement);
|
||||
TextBufferCellIterator& operator-=(const ptrdiff_t& movement);
|
||||
|
||||
@@ -16,7 +16,7 @@ using namespace Microsoft::Console::Types;
|
||||
// - Narrows the view of a cell iterator into a text only iterator.
|
||||
// Arguments:
|
||||
// - A cell iterator
|
||||
TextBufferTextIterator::TextBufferTextIterator(const TextBufferCellIterator& cellIt) :
|
||||
TextBufferTextIterator::TextBufferTextIterator(const TextBufferCellIterator& cellIt) noexcept :
|
||||
TextBufferCellIterator(cellIt)
|
||||
{
|
||||
}
|
||||
@@ -25,7 +25,8 @@ TextBufferTextIterator::TextBufferTextIterator(const TextBufferCellIterator& cel
|
||||
// - Returns the text information from the text buffer position addressed by this iterator.
|
||||
// Return Value:
|
||||
// - Read only UTF-16 text data
|
||||
const std::wstring_view TextBufferTextIterator::operator*() const
|
||||
// TODO GH 2682, fix design so this doesn't have to be suppressed.
|
||||
[[gsl::suppress(26434)]] const std::wstring_view TextBufferTextIterator::operator*() const noexcept
|
||||
{
|
||||
return _view.Chars();
|
||||
}
|
||||
@@ -34,7 +35,8 @@ const std::wstring_view TextBufferTextIterator::operator*() const
|
||||
// - Returns the text information from the text buffer position addressed by this iterator.
|
||||
// Return Value:
|
||||
// - Read only UTF-16 text data
|
||||
const std::wstring_view* TextBufferTextIterator::operator->() const
|
||||
// TODO GH 2682, fix design so this doesn't have to be suppressed.
|
||||
[[gsl::suppress(26434)]] const std::wstring_view* TextBufferTextIterator::operator->() const noexcept
|
||||
{
|
||||
return &_view.Chars();
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ class SCREEN_INFORMATION;
|
||||
class TextBufferTextIterator final : public TextBufferCellIterator
|
||||
{
|
||||
public:
|
||||
TextBufferTextIterator(const TextBufferCellIterator& cellIter);
|
||||
TextBufferTextIterator(const TextBufferCellIterator& cellIter) noexcept;
|
||||
|
||||
const std::wstring_view operator*() const;
|
||||
const std::wstring_view* operator->() const;
|
||||
const std::wstring_view operator*() const noexcept;
|
||||
const std::wstring_view* operator->() const noexcept;
|
||||
|
||||
protected:
|
||||
#if UNIT_TESTING
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?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)'==''" />
|
||||
<Import Project="$(OpenConsoleDir)src\wap-common.build.pre.props" />
|
||||
<PropertyGroup Label="Version">
|
||||
<!-- These fields are picked up by PackageES -->
|
||||
<VersionMajor>0</VersionMajor>
|
||||
<VersionMinor>2</VersionMinor>
|
||||
<VersionMinor>4</VersionMinor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
|
||||
@@ -249,6 +249,7 @@
|
||||
<Content Include="$(OpenConsoleDir)res\terminal\Wide310x150Logo.scale-400.png">
|
||||
<Link>Images\Wide310x150Logo.scale-400.png</Link>
|
||||
</Content>
|
||||
<!-- Profile Icons -->
|
||||
<Content Include="ProfileIcons\{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.scale-100.png" />
|
||||
<Content Include="ProfileIcons\{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.scale-200.png" />
|
||||
<Content Include="ProfileIcons\{574e775e-4f2a-5b96-ac1e-a2962a402336}.scale-100.png" />
|
||||
@@ -257,27 +258,18 @@
|
||||
<Content Include="ProfileIcons\{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.scale-200.png" />
|
||||
<Content Include="ProfileIcons\{9acb9455-ca41-5af7-950f-6bca1bc9722f}.scale-100.png" />
|
||||
<Content Include="ProfileIcons\{9acb9455-ca41-5af7-950f-6bca1bc9722f}.scale-200.png" />
|
||||
<Content Include="ProfileIcons\{b453ae62-4e3d-5e58-b989-0a998ec441b8}.scale-100.png" />
|
||||
<Content Include="ProfileIcons\{b453ae62-4e3d-5e58-b989-0a998ec441b8}.scale-200.png" />
|
||||
<!-- Default Settings -->
|
||||
<Content Include="$(OpenConsoleDir)src\cascadia\TerminalApp\defaults.json">
|
||||
<Link>defaults.json</Link>
|
||||
</Content>
|
||||
<!-- Resources -->
|
||||
<PRIResource Include="Resources\en-US\Resources.resw" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="$(OpenConsoleDir)src\wap-common.build.post.props" />
|
||||
<!--
|
||||
Microsoft.UI.Xaml contains some <Content> resource files that need to be included in our package.
|
||||
For some reason, they're not rolled up through dependent projects; if they were, their paths would
|
||||
be wrong.
|
||||
|
||||
WAP Packaging projects don't actually support nuget package references, so we added one manually.
|
||||
|
||||
This does mean that version changes to Microsoft.UI.Xaml must be manually reflected
|
||||
here.
|
||||
-->
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\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.2.2.190611001-prerelease\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
</Target>
|
||||
<!-- End workaround -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WindowsTerminal\WindowsTerminal.vcxproj" />
|
||||
<ProjectReference Include="..\..\host\exe\Host.EXE.vcxproj" />
|
||||
@@ -295,7 +287,8 @@
|
||||
<!-- Override the filename for OpenConsole.exe (only) -->
|
||||
<TargetPath Condition="'%(Filename)' == 'OpenConsole' and '%(Extension)' == '.exe'">conhost.exe</TargetPath>
|
||||
<!-- Blank the SourceProject here to vend all files into the root of the package. -->
|
||||
<SourceProject></SourceProject>
|
||||
<SourceProject>
|
||||
</SourceProject>
|
||||
</_FilteredNonWapProjProjectOutput>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
@@ -310,7 +303,8 @@
|
||||
important reasons), that doesn't work for us.
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<_GenerateProjectPriFileDependsOn>OpenConsoleLiftDesktopBridgePriFiles;$(_GenerateProjectPriFileDependsOn)</_GenerateProjectPriFileDependsOn>
|
||||
<!-- Only for MSBuild versions < 16.3.0 -->
|
||||
<_GenerateProjectPriFileDependsOn Condition="$(MSBuildVersion) < '16.3.0'">OpenConsoleLiftDesktopBridgePriFiles;$(_GenerateProjectPriFileDependsOn)</_GenerateProjectPriFileDependsOn>
|
||||
</PropertyGroup>
|
||||
<Target Name="OpenConsoleLiftDesktopBridgePriFiles" DependsOnTargets="_ConvertItems">
|
||||
<ItemGroup>
|
||||
@@ -320,4 +314,25 @@
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<!-- VS 16.3.0 added a rule to the WAP packaging project that removes all non-WAP payload, which we were relying on to
|
||||
roll up our subproject resources. We have to suppress that rule but keep part of its logic, because that rule is
|
||||
where the AppxPackagePayload items are created. -->
|
||||
<PropertyGroup>
|
||||
<!-- Only for MSBuild versions <= 16.4.0 -->
|
||||
<!-- TODO: Change this to hard less than once the 16.4.0 previews fix the bug. -->
|
||||
<WapProjBeforeGenerateAppxManifestDependsOn
|
||||
Condition="$(MSBuildVersion) <= '16.4.0'">
|
||||
$([MSBuild]::Unescape('$(WapProjBeforeGenerateAppxManifestDependsOn.Replace('_RemoveAllNonWapUWPItems', '_OpenConsoleRemoveAllNonWapUWPItems'))'))
|
||||
</WapProjBeforeGenerateAppxManifestDependsOn>
|
||||
</PropertyGroup>
|
||||
<Target Name="_OpenConsoleRemoveAllNonWapUWPItems">
|
||||
<ItemGroup>
|
||||
<AppxPackagePayload Include="@(WapProjPackageFile)" />
|
||||
<AppxUploadPackagePayload Include="@(UploadWapProjPackageFile)" />
|
||||
<!-- 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'" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.18362.0" MaxVersionTested="10.0.18362.0" />
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.18362.0" MaxVersionTested="10.0.18362.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.18362.0" MaxVersionTested="10.0.18362.0" />
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.18362.0" MaxVersionTested="10.0.18362.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 314 B |
Binary file not shown.
|
After Width: | Height: | Size: 573 B |
@@ -123,61 +123,16 @@
|
||||
<data name="AppName" xml:space="preserve">
|
||||
<value>Windows Terminal (Preview)</value>
|
||||
</data>
|
||||
<data name="InitialJsonParseErrorText" xml:space="preserve">
|
||||
<value>Settings could not be loaded from file - temporarily using the default settings. Check for syntax errors, including trailing commas.</value>
|
||||
</data>
|
||||
<data name="InitialJsonParseErrorTitle" xml:space="preserve">
|
||||
<value>Failed to load settings</value>
|
||||
</data>
|
||||
<data name="Ok" xml:space="preserve">
|
||||
<value>Ok</value>
|
||||
</data>
|
||||
<data name="ReloadJsonParseErrorText" xml:space="preserve">
|
||||
<value>Settings could not be reloaded from file. Check for syntax errors, including trailing commas.</value>
|
||||
</data>
|
||||
<data name="ReloadJsonParseErrorTitle" xml:space="preserve">
|
||||
<value>Failed to reload settings</value>
|
||||
</data>
|
||||
<data name="AppDescriptionDev" xml:space="preserve">
|
||||
<value>The Windows Terminal, but Unofficial</value>
|
||||
</data>
|
||||
<data name="AppNameDev" xml:space="preserve">
|
||||
<value>Windows Terminal (Dev Build)</value>
|
||||
</data>
|
||||
<data name="AboutTitleText" xml:space="preserve">
|
||||
<value>About</value>
|
||||
</data>
|
||||
<data name="VersionLabelText" xml:space="preserve">
|
||||
<value>Version:</value>
|
||||
</data>
|
||||
<data name="AppShortName" xml:space="preserve">
|
||||
<value>Terminal</value>
|
||||
</data>
|
||||
<data name="AppShortNameDev" xml:space="preserve">
|
||||
<value>Terminal (Dev)</value>
|
||||
</data>
|
||||
<data name="DocumentationLabelText" xml:space="preserve">
|
||||
<value>Documentation
|
||||
</value>
|
||||
</data>
|
||||
<data name="GettingStartedLabelText" xml:space="preserve">
|
||||
<value>Getting Started
|
||||
</value>
|
||||
</data>
|
||||
<data name="ReleaseNotesLabelText" xml:space="preserve">
|
||||
<value>Release Notes
|
||||
</value>
|
||||
</data>
|
||||
<data name="DocumentationUriValue" xml:space="preserve">
|
||||
<value>https://aka.ms/terminal-documentation</value>
|
||||
</data>
|
||||
<data name="GettingStartedUriValue" xml:space="preserve">
|
||||
<value>https://aka.ms/terminal-getting-started</value>
|
||||
</data>
|
||||
<data name="ReleaseNotesUriValue" xml:space="preserve">
|
||||
<value>https://aka.ms/terminal-release-notes</value>
|
||||
</data>
|
||||
<data name="FeedbackUriValue" xml:space="preserve">
|
||||
<value>https://aka.ms/terminal-feedback</value>
|
||||
</data>
|
||||
</root>
|
||||
234
src/cascadia/LocalTests_TerminalApp/ColorSchemeTests.cpp
Normal file
234
src/cascadia/LocalTests_TerminalApp/ColorSchemeTests.cpp
Normal file
@@ -0,0 +1,234 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include "../TerminalApp/ColorScheme.h"
|
||||
#include "../TerminalApp/CascadiaSettings.h"
|
||||
#include "JsonTestClass.h"
|
||||
|
||||
using namespace Microsoft::Console;
|
||||
using namespace TerminalApp;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
|
||||
namespace TerminalAppLocalTests
|
||||
{
|
||||
// Unfortunately, these tests _WILL NOT_ work in our CI, until we have a lab
|
||||
// machine available that can run Windows version 18362.
|
||||
|
||||
class ColorSchemeTests : public JsonTestClass
|
||||
{
|
||||
// Use a custom manifest to ensure that we can activate winrt types from
|
||||
// our test. This property will tell taef to manually use this as the
|
||||
// sxs manifest during this test class. It includes all the cppwinrt
|
||||
// types we've defined, so if your test is crashing for an unknown
|
||||
// reason, make sure it's included in that file.
|
||||
// If you want to do anything XAML-y, you'll need to run your test in a
|
||||
// packaged context. See TabTests.cpp for more details on that.
|
||||
BEGIN_TEST_CLASS(ColorSchemeTests)
|
||||
TEST_CLASS_PROPERTY(L"ActivationContext", L"TerminalApp.LocalTests.manifest")
|
||||
END_TEST_CLASS()
|
||||
|
||||
TEST_METHOD(CanLayerColorScheme);
|
||||
TEST_METHOD(LayerColorSchemeProperties);
|
||||
TEST_METHOD(LayerColorSchemesOnArray);
|
||||
|
||||
TEST_CLASS_SETUP(ClassSetup)
|
||||
{
|
||||
InitializeJsonReader();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void ColorSchemeTests::CanLayerColorScheme()
|
||||
{
|
||||
const std::string scheme0String{ R"({
|
||||
"name": "scheme0",
|
||||
"foreground": "#000000",
|
||||
"background": "#010101"
|
||||
})" };
|
||||
const std::string scheme1String{ R"({
|
||||
"name": "scheme1",
|
||||
"foreground": "#020202",
|
||||
"background": "#030303"
|
||||
})" };
|
||||
const std::string scheme2String{ R"({
|
||||
"name": "scheme0",
|
||||
"foreground": "#040404",
|
||||
"background": "#050505"
|
||||
})" };
|
||||
const std::string scheme3String{ R"({
|
||||
// "name": "scheme3",
|
||||
"foreground": "#060606",
|
||||
"background": "#070707"
|
||||
})" };
|
||||
|
||||
const auto scheme0Json = VerifyParseSucceeded(scheme0String);
|
||||
const auto scheme1Json = VerifyParseSucceeded(scheme1String);
|
||||
const auto scheme2Json = VerifyParseSucceeded(scheme2String);
|
||||
const auto scheme3Json = VerifyParseSucceeded(scheme3String);
|
||||
|
||||
const auto scheme0 = ColorScheme::FromJson(scheme0Json);
|
||||
|
||||
VERIFY_IS_TRUE(scheme0.ShouldBeLayered(scheme0Json));
|
||||
VERIFY_IS_FALSE(scheme0.ShouldBeLayered(scheme1Json));
|
||||
VERIFY_IS_TRUE(scheme0.ShouldBeLayered(scheme2Json));
|
||||
VERIFY_IS_FALSE(scheme0.ShouldBeLayered(scheme3Json));
|
||||
|
||||
const auto scheme1 = ColorScheme::FromJson(scheme1Json);
|
||||
|
||||
VERIFY_IS_FALSE(scheme1.ShouldBeLayered(scheme0Json));
|
||||
VERIFY_IS_TRUE(scheme1.ShouldBeLayered(scheme1Json));
|
||||
VERIFY_IS_FALSE(scheme1.ShouldBeLayered(scheme2Json));
|
||||
VERIFY_IS_FALSE(scheme1.ShouldBeLayered(scheme3Json));
|
||||
|
||||
const auto scheme3 = ColorScheme::FromJson(scheme3Json);
|
||||
|
||||
VERIFY_IS_FALSE(scheme3.ShouldBeLayered(scheme0Json));
|
||||
VERIFY_IS_FALSE(scheme3.ShouldBeLayered(scheme1Json));
|
||||
VERIFY_IS_FALSE(scheme3.ShouldBeLayered(scheme2Json));
|
||||
VERIFY_IS_FALSE(scheme3.ShouldBeLayered(scheme3Json));
|
||||
}
|
||||
|
||||
void ColorSchemeTests::LayerColorSchemeProperties()
|
||||
{
|
||||
const std::string scheme0String{ R"({
|
||||
"name": "scheme0",
|
||||
"foreground": "#000000",
|
||||
"background": "#010101",
|
||||
"red": "#010000",
|
||||
"green": "#000100",
|
||||
"blue": "#000001"
|
||||
})" };
|
||||
const std::string scheme1String{ R"({
|
||||
"name": "scheme1",
|
||||
"foreground": "#020202",
|
||||
"background": "#030303",
|
||||
"red": "#020000",
|
||||
|
||||
"blue": "#000002"
|
||||
})" };
|
||||
const std::string scheme2String{ R"({
|
||||
"name": "scheme0",
|
||||
"foreground": "#040404",
|
||||
"background": "#050505",
|
||||
"red": "#030000",
|
||||
"green": "#000300"
|
||||
})" };
|
||||
|
||||
const auto scheme0Json = VerifyParseSucceeded(scheme0String);
|
||||
const auto scheme1Json = VerifyParseSucceeded(scheme1String);
|
||||
const auto scheme2Json = VerifyParseSucceeded(scheme2String);
|
||||
|
||||
auto scheme0 = ColorScheme::FromJson(scheme0Json);
|
||||
VERIFY_ARE_EQUAL(L"scheme0", scheme0._schemeName);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 0, 0, 0), scheme0._defaultForeground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 1, 1, 1), scheme0._defaultBackground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 1, 0, 0), scheme0._table[XTERM_RED_ATTR]);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 0, 1, 0), scheme0._table[XTERM_GREEN_ATTR]);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 0, 0, 1), scheme0._table[XTERM_BLUE_ATTR]);
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Layering scheme1 on top of scheme0"));
|
||||
scheme0.LayerJson(scheme1Json);
|
||||
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 2, 2, 2), scheme0._defaultForeground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 3, 3, 3), scheme0._defaultBackground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 2, 0, 0), scheme0._table[XTERM_RED_ATTR]);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 0, 1, 0), scheme0._table[XTERM_GREEN_ATTR]);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 0, 0, 2), scheme0._table[XTERM_BLUE_ATTR]);
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Layering scheme2Json on top of (scheme0+scheme1)"));
|
||||
scheme0.LayerJson(scheme2Json);
|
||||
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 4, 4, 4), scheme0._defaultForeground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 5, 5, 5), scheme0._defaultBackground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 3, 0, 0), scheme0._table[XTERM_RED_ATTR]);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 0, 3, 0), scheme0._table[XTERM_GREEN_ATTR]);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 0, 0, 2), scheme0._table[XTERM_BLUE_ATTR]);
|
||||
}
|
||||
|
||||
void ColorSchemeTests::LayerColorSchemesOnArray()
|
||||
{
|
||||
const std::string scheme0String{ R"({
|
||||
"name": "scheme0",
|
||||
"foreground": "#000000",
|
||||
"background": "#010101"
|
||||
})" };
|
||||
const std::string scheme1String{ R"({
|
||||
"name": "scheme1",
|
||||
"foreground": "#020202",
|
||||
"background": "#030303"
|
||||
})" };
|
||||
const std::string scheme2String{ R"({
|
||||
"name": "scheme0",
|
||||
"foreground": "#040404",
|
||||
"background": "#050505"
|
||||
})" };
|
||||
const std::string scheme3String{ R"({
|
||||
// "name": "scheme3",
|
||||
"foreground": "#060606",
|
||||
"background": "#070707"
|
||||
})" };
|
||||
|
||||
const auto scheme0Json = VerifyParseSucceeded(scheme0String);
|
||||
const auto scheme1Json = VerifyParseSucceeded(scheme1String);
|
||||
const auto scheme2Json = VerifyParseSucceeded(scheme2String);
|
||||
const auto scheme3Json = VerifyParseSucceeded(scheme3String);
|
||||
|
||||
CascadiaSettings settings;
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings._globals.GetColorSchemes().size());
|
||||
VERIFY_IS_NULL(settings._FindMatchingColorScheme(scheme0Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingColorScheme(scheme1Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingColorScheme(scheme2Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingColorScheme(scheme3Json));
|
||||
|
||||
settings._LayerOrCreateColorScheme(scheme0Json);
|
||||
VERIFY_ARE_EQUAL(1u, settings._globals.GetColorSchemes().size());
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme0Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingColorScheme(scheme1Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme2Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingColorScheme(scheme3Json));
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 0, 0, 0), settings._globals.GetColorSchemes().at(0)._defaultForeground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 1, 1, 1), settings._globals.GetColorSchemes().at(0)._defaultBackground);
|
||||
|
||||
settings._LayerOrCreateColorScheme(scheme1Json);
|
||||
VERIFY_ARE_EQUAL(2u, settings._globals.GetColorSchemes().size());
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme0Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme1Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme2Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingColorScheme(scheme3Json));
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 0, 0, 0), settings._globals.GetColorSchemes().at(0)._defaultForeground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 1, 1, 1), settings._globals.GetColorSchemes().at(0)._defaultBackground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 2, 2, 2), settings._globals.GetColorSchemes().at(1)._defaultForeground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 3, 3, 3), settings._globals.GetColorSchemes().at(1)._defaultBackground);
|
||||
|
||||
settings._LayerOrCreateColorScheme(scheme2Json);
|
||||
VERIFY_ARE_EQUAL(2u, settings._globals.GetColorSchemes().size());
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme0Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme1Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme2Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingColorScheme(scheme3Json));
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 4, 4, 4), settings._globals.GetColorSchemes().at(0)._defaultForeground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 5, 5, 5), settings._globals.GetColorSchemes().at(0)._defaultBackground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 2, 2, 2), settings._globals.GetColorSchemes().at(1)._defaultForeground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 3, 3, 3), settings._globals.GetColorSchemes().at(1)._defaultBackground);
|
||||
|
||||
settings._LayerOrCreateColorScheme(scheme3Json);
|
||||
VERIFY_ARE_EQUAL(3u, settings._globals.GetColorSchemes().size());
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme0Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme1Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme2Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingColorScheme(scheme3Json));
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 4, 4, 4), settings._globals.GetColorSchemes().at(0)._defaultForeground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 5, 5, 5), settings._globals.GetColorSchemes().at(0)._defaultBackground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 2, 2, 2), settings._globals.GetColorSchemes().at(1)._defaultForeground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 3, 3, 3), settings._globals.GetColorSchemes().at(1)._defaultBackground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 6, 6, 6), settings._globals.GetColorSchemes().at(2)._defaultForeground);
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 7, 7, 7), settings._globals.GetColorSchemes().at(2)._defaultBackground);
|
||||
}
|
||||
}
|
||||
36
src/cascadia/LocalTests_TerminalApp/JsonTestClass.h
Normal file
36
src/cascadia/LocalTests_TerminalApp/JsonTestClass.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation
|
||||
Licensed under the MIT license.
|
||||
|
||||
Module Name:
|
||||
- JsonTestClass.h
|
||||
|
||||
Abstract:
|
||||
- This class is a helper that can be used to quickly create tests that need to
|
||||
read & parse json data. Test classes that need to read JSON should make sure
|
||||
to derive from this class, and also make sure to call InitializeJsonReader()
|
||||
in the TEST_CLASS_SETUP().
|
||||
|
||||
Author(s):
|
||||
Mike Griese (migrie) August-2019
|
||||
--*/
|
||||
|
||||
class JsonTestClass
|
||||
{
|
||||
public:
|
||||
void InitializeJsonReader()
|
||||
{
|
||||
_reader = std::unique_ptr<Json::CharReader>(Json::CharReaderBuilder::CharReaderBuilder().newCharReader());
|
||||
};
|
||||
Json::Value VerifyParseSucceeded(std::string content)
|
||||
{
|
||||
Json::Value root;
|
||||
std::string errs;
|
||||
const bool parseResult = _reader->parse(content.c_str(), content.c_str() + content.size(), &root, &errs);
|
||||
VERIFY_IS_TRUE(parseResult, winrt::to_hstring(errs).c_str());
|
||||
return root;
|
||||
};
|
||||
|
||||
protected:
|
||||
std::unique_ptr<Json::CharReader> _reader;
|
||||
};
|
||||
159
src/cascadia/LocalTests_TerminalApp/KeyBindingsTests.cpp
Normal file
159
src/cascadia/LocalTests_TerminalApp/KeyBindingsTests.cpp
Normal file
@@ -0,0 +1,159 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include "../TerminalApp/ColorScheme.h"
|
||||
#include "../TerminalApp/CascadiaSettings.h"
|
||||
#include "JsonTestClass.h"
|
||||
|
||||
using namespace Microsoft::Console;
|
||||
using namespace TerminalApp;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
|
||||
namespace TerminalAppLocalTests
|
||||
{
|
||||
// Unfortunately, these tests _WILL NOT_ work in our CI, until we have a lab
|
||||
// machine available that can run Windows version 18362.
|
||||
|
||||
class KeyBindingsTests : public JsonTestClass
|
||||
{
|
||||
// Use a custom manifest to ensure that we can activate winrt types from
|
||||
// our test. This property will tell taef to manually use this as the
|
||||
// sxs manifest during this test class. It includes all the cppwinrt
|
||||
// types we've defined, so if your test is crashing for an unknown
|
||||
// reason, make sure it's included in that file.
|
||||
// If you want to do anything XAML-y, you'll need to run your test in a
|
||||
// packaged context. See TabTests.cpp for more details on that.
|
||||
BEGIN_TEST_CLASS(KeyBindingsTests)
|
||||
TEST_CLASS_PROPERTY(L"ActivationContext", L"TerminalApp.LocalTests.manifest")
|
||||
END_TEST_CLASS()
|
||||
|
||||
TEST_METHOD(ManyKeysSameAction);
|
||||
TEST_METHOD(LayerKeybindings);
|
||||
TEST_METHOD(UnbindKeybindings);
|
||||
|
||||
TEST_CLASS_SETUP(ClassSetup)
|
||||
{
|
||||
InitializeJsonReader();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void KeyBindingsTests::ManyKeysSameAction()
|
||||
{
|
||||
const std::string bindings0String{ R"([ { "command": "copy", "keys": ["ctrl+c"] } ])" };
|
||||
const std::string bindings1String{ R"([ { "command": "copy", "keys": ["enter"] } ])" };
|
||||
const std::string bindings2String{ R"([
|
||||
{ "command": "paste", "keys": ["ctrl+v"] },
|
||||
{ "command": "paste", "keys": ["ctrl+shift+v"] }
|
||||
])" };
|
||||
|
||||
const auto bindings0Json = VerifyParseSucceeded(bindings0String);
|
||||
const auto bindings1Json = VerifyParseSucceeded(bindings1String);
|
||||
const auto bindings2Json = VerifyParseSucceeded(bindings2String);
|
||||
|
||||
auto appKeyBindings = winrt::make_self<winrt::TerminalApp::implementation::AppKeyBindings>();
|
||||
VERIFY_IS_NOT_NULL(appKeyBindings);
|
||||
VERIFY_ARE_EQUAL(0u, appKeyBindings->_keyShortcuts.size());
|
||||
|
||||
appKeyBindings->LayerJson(bindings0Json);
|
||||
VERIFY_ARE_EQUAL(1u, appKeyBindings->_keyShortcuts.size());
|
||||
|
||||
appKeyBindings->LayerJson(bindings1Json);
|
||||
VERIFY_ARE_EQUAL(2u, appKeyBindings->_keyShortcuts.size());
|
||||
|
||||
appKeyBindings->LayerJson(bindings2Json);
|
||||
VERIFY_ARE_EQUAL(4u, appKeyBindings->_keyShortcuts.size());
|
||||
}
|
||||
|
||||
void KeyBindingsTests::LayerKeybindings()
|
||||
{
|
||||
const std::string bindings0String{ R"([ { "command": "copy", "keys": ["ctrl+c"] } ])" };
|
||||
const std::string bindings1String{ R"([ { "command": "paste", "keys": ["ctrl+c"] } ])" };
|
||||
const std::string bindings2String{ R"([ { "command": "copy", "keys": ["enter"] } ])" };
|
||||
|
||||
const auto bindings0Json = VerifyParseSucceeded(bindings0String);
|
||||
const auto bindings1Json = VerifyParseSucceeded(bindings1String);
|
||||
const auto bindings2Json = VerifyParseSucceeded(bindings2String);
|
||||
|
||||
auto appKeyBindings = winrt::make_self<winrt::TerminalApp::implementation::AppKeyBindings>();
|
||||
VERIFY_IS_NOT_NULL(appKeyBindings);
|
||||
VERIFY_ARE_EQUAL(0u, appKeyBindings->_keyShortcuts.size());
|
||||
|
||||
appKeyBindings->LayerJson(bindings0Json);
|
||||
VERIFY_ARE_EQUAL(1u, appKeyBindings->_keyShortcuts.size());
|
||||
|
||||
appKeyBindings->LayerJson(bindings1Json);
|
||||
VERIFY_ARE_EQUAL(1u, appKeyBindings->_keyShortcuts.size());
|
||||
|
||||
appKeyBindings->LayerJson(bindings2Json);
|
||||
VERIFY_ARE_EQUAL(2u, appKeyBindings->_keyShortcuts.size());
|
||||
}
|
||||
|
||||
void KeyBindingsTests::UnbindKeybindings()
|
||||
{
|
||||
const std::string bindings0String{ R"([ { "command": "copy", "keys": ["ctrl+c"] } ])" };
|
||||
const std::string bindings1String{ R"([ { "command": "paste", "keys": ["ctrl+c"] } ])" };
|
||||
const std::string bindings2String{ R"([ { "command": "unbound", "keys": ["ctrl+c"] } ])" };
|
||||
const std::string bindings3String{ R"([ { "command": null, "keys": ["ctrl+c"] } ])" };
|
||||
const std::string bindings4String{ R"([ { "command": "garbage", "keys": ["ctrl+c"] } ])" };
|
||||
const std::string bindings5String{ R"([ { "command": 5, "keys": ["ctrl+c"] } ])" };
|
||||
|
||||
const auto bindings0Json = VerifyParseSucceeded(bindings0String);
|
||||
const auto bindings1Json = VerifyParseSucceeded(bindings1String);
|
||||
const auto bindings2Json = VerifyParseSucceeded(bindings2String);
|
||||
const auto bindings3Json = VerifyParseSucceeded(bindings3String);
|
||||
const auto bindings4Json = VerifyParseSucceeded(bindings4String);
|
||||
const auto bindings5Json = VerifyParseSucceeded(bindings5String);
|
||||
|
||||
auto appKeyBindings = winrt::make_self<winrt::TerminalApp::implementation::AppKeyBindings>();
|
||||
VERIFY_IS_NOT_NULL(appKeyBindings);
|
||||
VERIFY_ARE_EQUAL(0u, appKeyBindings->_keyShortcuts.size());
|
||||
|
||||
appKeyBindings->LayerJson(bindings0Json);
|
||||
VERIFY_ARE_EQUAL(1u, appKeyBindings->_keyShortcuts.size());
|
||||
|
||||
appKeyBindings->LayerJson(bindings1Json);
|
||||
VERIFY_ARE_EQUAL(1u, appKeyBindings->_keyShortcuts.size());
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Try unbinding a key using `\"unbound\"` to unbind the key"));
|
||||
appKeyBindings->LayerJson(bindings2Json);
|
||||
VERIFY_ARE_EQUAL(0u, appKeyBindings->_keyShortcuts.size());
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Try unbinding a key using `null` to unbind the key"));
|
||||
// First add back a good binding
|
||||
appKeyBindings->LayerJson(bindings0Json);
|
||||
VERIFY_ARE_EQUAL(1u, appKeyBindings->_keyShortcuts.size());
|
||||
// Then try layering in the bad setting
|
||||
appKeyBindings->LayerJson(bindings3Json);
|
||||
VERIFY_ARE_EQUAL(0u, appKeyBindings->_keyShortcuts.size());
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Try unbinding a key using an unrecognized command to unbind the key"));
|
||||
// First add back a good binding
|
||||
appKeyBindings->LayerJson(bindings0Json);
|
||||
VERIFY_ARE_EQUAL(1u, appKeyBindings->_keyShortcuts.size());
|
||||
// Then try layering in the bad setting
|
||||
appKeyBindings->LayerJson(bindings4Json);
|
||||
VERIFY_ARE_EQUAL(0u, appKeyBindings->_keyShortcuts.size());
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Try unbinding a key using a straight up invalid value to unbind the key"));
|
||||
// First add back a good binding
|
||||
appKeyBindings->LayerJson(bindings0Json);
|
||||
VERIFY_ARE_EQUAL(1u, appKeyBindings->_keyShortcuts.size());
|
||||
// Then try layering in the bad setting
|
||||
appKeyBindings->LayerJson(bindings5Json);
|
||||
VERIFY_ARE_EQUAL(0u, appKeyBindings->_keyShortcuts.size());
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Try unbinding a key that wasn't bound at all"));
|
||||
appKeyBindings->LayerJson(bindings2Json);
|
||||
VERIFY_ARE_EQUAL(0u, appKeyBindings->_keyShortcuts.size());
|
||||
}
|
||||
}
|
||||
296
src/cascadia/LocalTests_TerminalApp/ProfileTests.cpp
Normal file
296
src/cascadia/LocalTests_TerminalApp/ProfileTests.cpp
Normal file
@@ -0,0 +1,296 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include "../TerminalApp/ColorScheme.h"
|
||||
#include "../TerminalApp/CascadiaSettings.h"
|
||||
#include "JsonTestClass.h"
|
||||
|
||||
using namespace Microsoft::Console;
|
||||
using namespace TerminalApp;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
using namespace WEX::Common;
|
||||
|
||||
namespace TerminalAppLocalTests
|
||||
{
|
||||
// Unfortunately, these tests _WILL NOT_ work in our CI, until we have a lab
|
||||
// machine available that can run Windows version 18362.
|
||||
|
||||
class ProfileTests : public JsonTestClass
|
||||
{
|
||||
// Use a custom manifest to ensure that we can activate winrt types from
|
||||
// our test. This property will tell taef to manually use this as the
|
||||
// sxs manifest during this test class. It includes all the cppwinrt
|
||||
// types we've defined, so if your test is crashing for an unknown
|
||||
// reason, make sure it's included in that file.
|
||||
// If you want to do anything XAML-y, you'll need to run your test in a
|
||||
// packaged context. See TabTests.cpp for more details on that.
|
||||
BEGIN_TEST_CLASS(ProfileTests)
|
||||
TEST_CLASS_PROPERTY(L"ActivationContext", L"TerminalApp.LocalTests.manifest")
|
||||
END_TEST_CLASS()
|
||||
|
||||
TEST_METHOD(CanLayerProfile);
|
||||
TEST_METHOD(LayerProfileProperties);
|
||||
TEST_METHOD(LayerProfileIcon);
|
||||
TEST_METHOD(LayerProfilesOnArray);
|
||||
|
||||
TEST_CLASS_SETUP(ClassSetup)
|
||||
{
|
||||
InitializeJsonReader();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void ProfileTests::CanLayerProfile()
|
||||
{
|
||||
const std::string profile0String{ R"({
|
||||
"name" : "profile0",
|
||||
"guid" : "{6239a42c-1111-49a3-80bd-e8fdd045185c}"
|
||||
})" };
|
||||
const std::string profile1String{ R"({
|
||||
"name" : "profile1",
|
||||
"guid" : "{6239a42c-2222-49a3-80bd-e8fdd045185c}"
|
||||
})" };
|
||||
const std::string profile2String{ R"({
|
||||
"name" : "profile2",
|
||||
"guid" : "{6239a42c-1111-49a3-80bd-e8fdd045185c}"
|
||||
})" };
|
||||
const std::string profile3String{ R"({
|
||||
"name" : "profile3"
|
||||
})" };
|
||||
|
||||
const auto profile0Json = VerifyParseSucceeded(profile0String);
|
||||
const auto profile1Json = VerifyParseSucceeded(profile1String);
|
||||
const auto profile2Json = VerifyParseSucceeded(profile2String);
|
||||
const auto profile3Json = VerifyParseSucceeded(profile3String);
|
||||
|
||||
const auto profile0 = Profile::FromJson(profile0Json);
|
||||
|
||||
VERIFY_IS_FALSE(profile0.ShouldBeLayered(profile1Json));
|
||||
VERIFY_IS_TRUE(profile0.ShouldBeLayered(profile2Json));
|
||||
VERIFY_IS_FALSE(profile0.ShouldBeLayered(profile3Json));
|
||||
|
||||
const auto profile1 = Profile::FromJson(profile1Json);
|
||||
|
||||
VERIFY_IS_FALSE(profile1.ShouldBeLayered(profile0Json));
|
||||
// A profile _can_ be layered with itself, though what's the point?
|
||||
VERIFY_IS_TRUE(profile1.ShouldBeLayered(profile1Json));
|
||||
VERIFY_IS_FALSE(profile1.ShouldBeLayered(profile2Json));
|
||||
VERIFY_IS_FALSE(profile1.ShouldBeLayered(profile3Json));
|
||||
|
||||
const auto profile3 = Profile::FromJson(profile3Json);
|
||||
|
||||
VERIFY_IS_FALSE(profile3.ShouldBeLayered(profile0Json));
|
||||
// A profile _can_ be layered with itself, though what's the point?
|
||||
VERIFY_IS_FALSE(profile3.ShouldBeLayered(profile1Json));
|
||||
VERIFY_IS_FALSE(profile3.ShouldBeLayered(profile2Json));
|
||||
VERIFY_IS_FALSE(profile3.ShouldBeLayered(profile3Json));
|
||||
}
|
||||
|
||||
void ProfileTests::LayerProfileProperties()
|
||||
{
|
||||
const std::string profile0String{ R"({
|
||||
"name": "profile0",
|
||||
"guid": "{6239a42c-1111-49a3-80bd-e8fdd045185c}",
|
||||
"foreground": "#000000",
|
||||
"background": "#010101"
|
||||
})" };
|
||||
const std::string profile1String{ R"({
|
||||
"name": "profile1",
|
||||
"guid": "{6239a42c-1111-49a3-80bd-e8fdd045185c}",
|
||||
"foreground": "#020202",
|
||||
"startingDirectory": "C:/"
|
||||
})" };
|
||||
const std::string profile2String{ R"({
|
||||
"name": "profile2",
|
||||
"guid": "{6239a42c-1111-49a3-80bd-e8fdd045185c}",
|
||||
"foreground": "#030303"
|
||||
})" };
|
||||
|
||||
const auto profile0Json = VerifyParseSucceeded(profile0String);
|
||||
const auto profile1Json = VerifyParseSucceeded(profile1String);
|
||||
const auto profile2Json = VerifyParseSucceeded(profile2String);
|
||||
|
||||
auto profile0 = Profile::FromJson(profile0Json);
|
||||
VERIFY_IS_TRUE(profile0._defaultForeground.has_value());
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 0, 0, 0), profile0._defaultForeground.value());
|
||||
|
||||
VERIFY_IS_TRUE(profile0._defaultBackground.has_value());
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 1, 1, 1), profile0._defaultBackground.value());
|
||||
|
||||
VERIFY_ARE_EQUAL(L"profile0", profile0._name);
|
||||
|
||||
VERIFY_IS_FALSE(profile0._startingDirectory.has_value());
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Layering profile1 on top of profile0"));
|
||||
profile0.LayerJson(profile1Json);
|
||||
|
||||
VERIFY_IS_TRUE(profile0._defaultForeground.has_value());
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 2, 2, 2), profile0._defaultForeground.value());
|
||||
|
||||
VERIFY_IS_TRUE(profile0._defaultBackground.has_value());
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 1, 1, 1), profile0._defaultBackground.value());
|
||||
|
||||
VERIFY_ARE_EQUAL(L"profile1", profile0._name);
|
||||
|
||||
VERIFY_IS_TRUE(profile0._startingDirectory.has_value());
|
||||
VERIFY_ARE_EQUAL(L"C:/", profile0._startingDirectory.value());
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Layering profile2 on top of (profile0+profile1)"));
|
||||
profile0.LayerJson(profile2Json);
|
||||
|
||||
VERIFY_IS_TRUE(profile0._defaultForeground.has_value());
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 3, 3, 3), profile0._defaultForeground.value());
|
||||
|
||||
VERIFY_IS_TRUE(profile0._defaultBackground.has_value());
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 1, 1, 1), profile0._defaultBackground.value());
|
||||
|
||||
VERIFY_ARE_EQUAL(L"profile2", profile0._name);
|
||||
|
||||
VERIFY_IS_TRUE(profile0._startingDirectory.has_value());
|
||||
VERIFY_ARE_EQUAL(L"C:/", profile0._startingDirectory.value());
|
||||
}
|
||||
|
||||
void ProfileTests::LayerProfileIcon()
|
||||
{
|
||||
const std::string profile0String{ R"({
|
||||
"name": "profile0",
|
||||
"guid": "{6239a42c-1111-49a3-80bd-e8fdd045185c}",
|
||||
"icon": "not-null.png"
|
||||
})" };
|
||||
const std::string profile1String{ R"({
|
||||
"name": "profile1",
|
||||
"guid": "{6239a42c-1111-49a3-80bd-e8fdd045185c}",
|
||||
"icon": null
|
||||
})" };
|
||||
const std::string profile2String{ R"({
|
||||
"name": "profile2",
|
||||
"guid": "{6239a42c-1111-49a3-80bd-e8fdd045185c}"
|
||||
})" };
|
||||
const std::string profile3String{ R"({
|
||||
"name": "profile3",
|
||||
"guid": "{6239a42c-1111-49a3-80bd-e8fdd045185c}",
|
||||
"icon": "another-real.png"
|
||||
})" };
|
||||
|
||||
const auto profile0Json = VerifyParseSucceeded(profile0String);
|
||||
const auto profile1Json = VerifyParseSucceeded(profile1String);
|
||||
const auto profile2Json = VerifyParseSucceeded(profile2String);
|
||||
const auto profile3Json = VerifyParseSucceeded(profile3String);
|
||||
|
||||
auto profile0 = Profile::FromJson(profile0Json);
|
||||
VERIFY_IS_TRUE(profile0._icon.has_value());
|
||||
VERIFY_ARE_EQUAL(L"not-null.png", profile0._icon.value());
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Verify that layering an object the key set to null will clear the key"));
|
||||
profile0.LayerJson(profile1Json);
|
||||
VERIFY_IS_FALSE(profile0._icon.has_value());
|
||||
|
||||
profile0.LayerJson(profile2Json);
|
||||
VERIFY_IS_FALSE(profile0._icon.has_value());
|
||||
|
||||
profile0.LayerJson(profile3Json);
|
||||
VERIFY_IS_TRUE(profile0._icon.has_value());
|
||||
VERIFY_ARE_EQUAL(L"another-real.png", profile0._icon.value());
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Verify that layering an object _without_ the key will not clear the key"));
|
||||
profile0.LayerJson(profile2Json);
|
||||
VERIFY_IS_TRUE(profile0._icon.has_value());
|
||||
VERIFY_ARE_EQUAL(L"another-real.png", profile0._icon.value());
|
||||
|
||||
auto profile1 = Profile::FromJson(profile1Json);
|
||||
VERIFY_IS_FALSE(profile1._icon.has_value());
|
||||
profile1.LayerJson(profile3Json);
|
||||
VERIFY_IS_TRUE(profile1._icon.has_value());
|
||||
VERIFY_ARE_EQUAL(L"another-real.png", profile1._icon.value());
|
||||
}
|
||||
|
||||
void ProfileTests::LayerProfilesOnArray()
|
||||
{
|
||||
const std::string profile0String{ R"({
|
||||
"name" : "profile0",
|
||||
"guid" : "{6239a42c-0000-49a3-80bd-e8fdd045185c}"
|
||||
})" };
|
||||
const std::string profile1String{ R"({
|
||||
"name" : "profile1",
|
||||
"guid" : "{6239a42c-1111-49a3-80bd-e8fdd045185c}"
|
||||
})" };
|
||||
const std::string profile2String{ R"({
|
||||
"name" : "profile2",
|
||||
"guid" : "{6239a42c-2222-49a3-80bd-e8fdd045185c}"
|
||||
})" };
|
||||
const std::string profile3String{ R"({
|
||||
"name" : "profile3",
|
||||
"guid" : "{6239a42c-0000-49a3-80bd-e8fdd045185c}"
|
||||
})" };
|
||||
const std::string profile4String{ R"({
|
||||
"name" : "profile4",
|
||||
"guid" : "{6239a42c-0000-49a3-80bd-e8fdd045185c}"
|
||||
})" };
|
||||
|
||||
const auto profile0Json = VerifyParseSucceeded(profile0String);
|
||||
const auto profile1Json = VerifyParseSucceeded(profile1String);
|
||||
const auto profile2Json = VerifyParseSucceeded(profile2String);
|
||||
const auto profile3Json = VerifyParseSucceeded(profile3String);
|
||||
const auto profile4Json = VerifyParseSucceeded(profile4String);
|
||||
|
||||
CascadiaSettings settings;
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings._profiles.size());
|
||||
VERIFY_IS_NULL(settings._FindMatchingProfile(profile0Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingProfile(profile1Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingProfile(profile2Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingProfile(profile3Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingProfile(profile4Json));
|
||||
|
||||
settings._LayerOrCreateProfile(profile0Json);
|
||||
VERIFY_ARE_EQUAL(1u, settings._profiles.size());
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile0Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingProfile(profile1Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingProfile(profile2Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile3Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile4Json));
|
||||
|
||||
settings._LayerOrCreateProfile(profile1Json);
|
||||
VERIFY_ARE_EQUAL(2u, settings._profiles.size());
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile0Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile1Json));
|
||||
VERIFY_IS_NULL(settings._FindMatchingProfile(profile2Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile3Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile4Json));
|
||||
|
||||
settings._LayerOrCreateProfile(profile2Json);
|
||||
VERIFY_ARE_EQUAL(3u, settings._profiles.size());
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile0Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile1Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile2Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile3Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile4Json));
|
||||
VERIFY_ARE_EQUAL(L"profile0", settings._profiles.at(0)._name);
|
||||
|
||||
settings._LayerOrCreateProfile(profile3Json);
|
||||
VERIFY_ARE_EQUAL(3u, settings._profiles.size());
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile0Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile1Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile2Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile3Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile4Json));
|
||||
VERIFY_ARE_EQUAL(L"profile3", settings._profiles.at(0)._name);
|
||||
|
||||
settings._LayerOrCreateProfile(profile4Json);
|
||||
VERIFY_ARE_EQUAL(3u, settings._profiles.size());
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile0Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile1Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile2Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile3Json));
|
||||
VERIFY_IS_NOT_NULL(settings._FindMatchingProfile(profile4Json));
|
||||
VERIFY_ARE_EQUAL(L"profile4", settings._profiles.at(0)._name);
|
||||
}
|
||||
|
||||
}
|
||||
1128
src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp
Normal file
1128
src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp
Normal file
File diff suppressed because it is too large
Load Diff
110
src/cascadia/LocalTests_TerminalApp/TabTests.cpp
Normal file
110
src/cascadia/LocalTests_TerminalApp/TabTests.cpp
Normal file
@@ -0,0 +1,110 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include "../TerminalApp/ColorScheme.h"
|
||||
#include "../TerminalApp/Tab.h"
|
||||
|
||||
using namespace Microsoft::Console;
|
||||
using namespace TerminalApp;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
|
||||
namespace TerminalAppLocalTests
|
||||
{
|
||||
// Unfortunately, these tests _WILL NOT_ work in our CI, until we have a lab
|
||||
// machine available that can run Windows version 18362.
|
||||
|
||||
class TabTests
|
||||
{
|
||||
// For this set of tests, we need to activate some XAML content. To do
|
||||
// that, we need to be able to activate Xaml Islands(XI), using the Xaml
|
||||
// Hosting APIs. Because XI looks at the manifest of the exe running, we
|
||||
// can't just use the TerminalApp.Unit.Tests.manifest as our
|
||||
// ActivationContext. XI is going to inspect `te.exe`s manifest to try
|
||||
// and find the maxversiontested property, but te.exe hasn't set that.
|
||||
// Instead, this test will run as a UAP application, as a packaged
|
||||
// centenial (win32) app. We'll specify our own AppxManifest, so that
|
||||
// we'll be able to also load all the dll's for the types we've defined
|
||||
// (and want to use here). This does come with a minor caveat, as
|
||||
// deploying the appx takes a bit, so use sparingly (though it will
|
||||
// deploy once per class when used like this.)
|
||||
BEGIN_TEST_CLASS(TabTests)
|
||||
TEST_CLASS_PROPERTY(L"RunAs", L"UAP")
|
||||
TEST_CLASS_PROPERTY(L"UAP:AppXManifest", L"TerminalApp.LocalTests.AppxManifest.xml")
|
||||
END_TEST_CLASS()
|
||||
|
||||
// These four tests act as canary tests. If one of them fails, then they
|
||||
// can help you identify if something much lower in the stack has
|
||||
// failed.
|
||||
TEST_METHOD(TryInitXamlIslands);
|
||||
TEST_METHOD(TryCreateLocalWinRTType);
|
||||
TEST_METHOD(TryCreateXamlObjects);
|
||||
TEST_METHOD(TryCreateTab);
|
||||
|
||||
TEST_CLASS_SETUP(ClassSetup)
|
||||
{
|
||||
winrt::init_apartment(winrt::apartment_type::single_threaded);
|
||||
// Initialize the Xaml Hosting Manager
|
||||
_manager = winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager::InitializeForCurrentThread();
|
||||
_source = winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource{};
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager _manager{ nullptr };
|
||||
winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource _source{ nullptr };
|
||||
};
|
||||
|
||||
void TabTests::TryInitXamlIslands()
|
||||
{
|
||||
// Ensures that XAML Islands was initialized correctly
|
||||
VERIFY_IS_NOT_NULL(_manager);
|
||||
VERIFY_IS_NOT_NULL(_source);
|
||||
}
|
||||
|
||||
void TabTests::TryCreateLocalWinRTType()
|
||||
{
|
||||
// Verify we can create a WinRT type we authored
|
||||
// Just creating it is enough to know that everything is working.
|
||||
winrt::Microsoft::Terminal::Settings::TerminalSettings settings;
|
||||
VERIFY_IS_NOT_NULL(settings);
|
||||
auto oldFontSize = settings.FontSize();
|
||||
settings.FontSize(oldFontSize + 5);
|
||||
auto newFontSize = settings.FontSize();
|
||||
VERIFY_ARE_NOT_EQUAL(oldFontSize, newFontSize);
|
||||
}
|
||||
|
||||
void TabTests::TryCreateXamlObjects()
|
||||
{
|
||||
// Verify we can create a some XAML objects
|
||||
// Just creating all of them is enough to know that everything is working.
|
||||
winrt::Windows::UI::Xaml::Controls::UserControl controlRoot;
|
||||
VERIFY_IS_NOT_NULL(controlRoot);
|
||||
winrt::Windows::UI::Xaml::Controls::Grid root;
|
||||
VERIFY_IS_NOT_NULL(root);
|
||||
winrt::Windows::UI::Xaml::Controls::SwapChainPanel swapChainPanel;
|
||||
VERIFY_IS_NOT_NULL(swapChainPanel);
|
||||
winrt::Windows::UI::Xaml::Controls::Primitives::ScrollBar scrollBar;
|
||||
VERIFY_IS_NOT_NULL(scrollBar);
|
||||
}
|
||||
|
||||
void TabTests::TryCreateTab()
|
||||
{
|
||||
// Just try creating all of:
|
||||
// 1. one of our pure c++ types (Profile)
|
||||
// 2. one of our c++winrt types (TermControl)
|
||||
// 3. one of our types that uses MUX/Xaml (Tab).
|
||||
// Just creating all of them is enough to know that everything is working.
|
||||
const auto profileGuid{ Utils::CreateGuid() };
|
||||
winrt::Microsoft::Terminal::TerminalControl::TermControl term{};
|
||||
VERIFY_IS_NOT_NULL(term);
|
||||
|
||||
auto newTab = std::make_shared<Tab>(profileGuid, term);
|
||||
|
||||
VERIFY_IS_NOT_NULL(newTab);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap">
|
||||
|
||||
<!-- This file is used as the Appxmanifest for tests that _need_ to run in a
|
||||
packaged environment. It will be copied to the test's OutDir as part of the
|
||||
PostBuid step. It's highly similar to the "PackagedCwaFullTrust" manifest that
|
||||
TAEF ships with, with the following modifications:
|
||||
|
||||
1. All of our winrt types are included in this manifest, including types from
|
||||
MUX.dll. Should this list of types ever change, we'll need to manually
|
||||
update this file. The easiest way of doing that is deploying the app from
|
||||
VS, then copying the Extensions from the Appxmanifest.xml that's generated
|
||||
under `src/cascadia/CascadiaPackage/bin/$(platform)/$(configuration)/appx`.
|
||||
|
||||
2. We also _NEED_ the two vclibs listed under the `PackageDependency` block.
|
||||
|
||||
If your test fails for whatever reason, it's likely possible you're testing a
|
||||
type that's _not_ included in this file for some reason. So, here be dragons. -->
|
||||
|
||||
<Identity Name="TerminalApp.LocalTests.Package"
|
||||
ProcessorArchitecture="neutral"
|
||||
Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
|
||||
Version="1.0.0.0"
|
||||
ResourceId="en-us" />
|
||||
<Properties>
|
||||
<DisplayName>TerminalApp.LocalTests.Package Host Process</DisplayName>
|
||||
<PublisherDisplayName>Microsoft Corp.</PublisherDisplayName>
|
||||
<Logo>taef.png</Logo>
|
||||
<Description>TAEF Packaged Cwa FullTrust Application Host Process</Description>
|
||||
</Properties>
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.18362.0" MaxVersionTested="10.0.18362.0" />
|
||||
<PackageDependency Name="Microsoft.VCLibs.140.00.Debug" MinVersion="14.0.27023.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
|
||||
<PackageDependency Name="Microsoft.VCLibs.140.00.Debug.UWPDesktop" MinVersion="14.0.27027.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
|
||||
</Dependencies>
|
||||
<Resources>
|
||||
<Resource Language="en-us" />
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="TE.ProcessHost" Executable="TE.ProcessHost.exe" EntryPoint="Windows.FullTrustApplication">
|
||||
<uap:VisualElements DisplayName="TAEF Packaged Cwa FullTrust Application Host Process" Square150x150Logo="taef.png" Square44x44Logo="taef.png" Description="TAEF Packaged Cwa Application Host Process" BackgroundColor="#222222">
|
||||
<uap:SplashScreen Image="taef.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
<Capabilities>
|
||||
<rescap:Capability Name="runFullTrust"/>
|
||||
</Capabilities>
|
||||
|
||||
|
||||
|
||||
</Package>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
|
||||
<!-- This file is copied into ut_app/TerminalApp.Unit.Tests.manifest as part
|
||||
of the pre-build step for that project. Changes should only be made to the
|
||||
WindowsTerminal version of the file. -->
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows 10 1903 -->
|
||||
<!-- See https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/xaml-islands -->
|
||||
<!-- "maxversiontested" is CASE SENSITIVE. Do not change this.-->
|
||||
<maxversiontested Id="10.0.18362.0"/>
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
|
||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
</assembly>
|
||||
@@ -0,0 +1,180 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(SolutionDir)\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
|
||||
<Import Project="$(OpenConsoleDir)\src\common.build.pre.props" />
|
||||
|
||||
<!-- ========================= Headers ======================== -->
|
||||
<ItemGroup>
|
||||
<ClInclude Include="precomp.h" />
|
||||
<ClInclude Include="JsonTestClass.h" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- ========================= Cpp Files ======================== -->
|
||||
<ItemGroup>
|
||||
<ClCompile Include="SettingsTests.cpp" />
|
||||
<ClCompile Include="ProfileTests.cpp" />
|
||||
<ClCompile Include="ColorSchemeTests.cpp" />
|
||||
<ClCompile Include="KeyBindingsTests.cpp" />
|
||||
<ClCompile Include="TabTests.cpp" />
|
||||
<ClCompile Include="precomp.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<!-- You _NEED_ to include this file and the jsoncpp IncludePath (below) if
|
||||
you want to use jsoncpp -->
|
||||
<ClCompile Include="$(OpenConsoleDir)\dep\jsoncpp\jsoncpp.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- ========================= Project References ======================== -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(OpenConsoleDir)\src\cascadia\TerminalApp\lib\TerminalAppLib.vcxproj" />
|
||||
<ProjectReference Include="$(OpenConsoleDir)\src\types\lib\types.vcxproj" />
|
||||
|
||||
<!-- If you don't reference these projects here, the
|
||||
_ConsoleGenerateAdditionalWinmdManifests step won't gather the winmd's -->
|
||||
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\TerminalSettings\TerminalSettings.vcxproj" />
|
||||
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\TerminalControl\TerminalControl.vcxproj" />
|
||||
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\TerminalConnection\TerminalConnection.vcxproj" />
|
||||
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\TerminalApp\TerminalApp.vcxproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- ========================= Globals ======================== -->
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{CA5CAD1A-b11c-4ddb-a4fe-c3afae9b5506}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>TerminalAppLocalTests</RootNamespace>
|
||||
<ProjectName>LocalTests_TerminalApp</ProjectName>
|
||||
<TargetName>TerminalApp.LocalTests</TargetName>
|
||||
<WindowsTargetPlatformMinVersion>10.0.18362.0</WindowsTargetPlatformMinVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- ====================== Compiler & Linker Flags ===================== -->
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..;$(OpenConsoleDir)\dep\jsoncpp\json;$(OpenConsoleDir)src\inc;$(OpenConsoleDir)src\inc\test;$(WinRT_IncludePath)\..\cppwinrt\winrt;"$(OpenConsoleDir)\src\cascadia\TerminalApp\lib\Generated Files";%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeaderFile>precomp.h</PrecompiledHeaderFile>
|
||||
|
||||
<!-- Manually disable unreachable code warning, because jconcpp has a ton of that. -->
|
||||
<DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>WindowsApp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<GenerateManifest>true</GenerateManifest>
|
||||
<EmbedManifest>true</EmbedManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Careful reordering these. Some default props (contained in these files) are order sensitive. -->
|
||||
<Import Project="$(OpenConsoleDir)src\common.build.dll.props" />
|
||||
<Import Project="$(OpenConsoleDir)src\common.build.post.props" />
|
||||
<Import Project="$(OpenConsoleDir)src\common.build.tests.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Manually change our outdir to be in a subdirectory. We don't really want
|
||||
to put our output in the bin root, because if we do, we'll copy
|
||||
TerminalApp.winmd to the bin root, and then every subsequent mdmerge step
|
||||
(in _any_ cppwinrt project) will automatically try to pick up
|
||||
TerminalApp.winmd as a dependency (which is just wrong). This MUST be done
|
||||
after importing common.build.post.props-->
|
||||
<OutDir>$(OpenConsoleDir)\bin\$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(OpenConsoleDir)\obj\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<_CppWinrtBinRoot>"$(OpenConsoleDir)$(Platform)\$(Configuration)\"</_CppWinrtBinRoot>
|
||||
<!-- From Microsoft.UI.Xaml.targets -->
|
||||
<Native-Platform Condition="'$(Platform)' == 'Win32'">x86</Native-Platform>
|
||||
<Native-Platform Condition="'$(Platform)' != 'Win32'">$(Platform)</Native-Platform>
|
||||
<_MUXBinRoot>"$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\runtimes\win10-$(Native-Platform)\native\"</_MUXBinRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- We actually can just straight up reference MUX here, it's fine -->
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview6.2\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets" Condition="Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview6.2\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" />
|
||||
|
||||
<!-- This project will generate individual sxs manifests for each of our winrt libraries -->
|
||||
<Import Project="$(OpenConsoleDir)\build\rules\GenerateSxsManifestsFromWinmds.targets" />
|
||||
|
||||
<!-- This is important: actually add the _LocalTestsGenerateCombinedManifests
|
||||
target to the list of targets to run. -->
|
||||
<PropertyGroup>
|
||||
<BeforeLinkTargets Condition="'$(WindowsTargetPlatformVersion)' >= '10.0.18362.0'">
|
||||
$(BeforeLinkTargets);
|
||||
_LocalTestsGenerateCombinedManifests;
|
||||
_LocalTestsBuildAppxManifest;
|
||||
_LocalTestsCopyDependencies;
|
||||
</BeforeLinkTargets>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Step 1: Combine all our SxS manifests into a single SxS manifest. TAEF
|
||||
needs us to specify a single activation context at runtime, so we need a
|
||||
single file with all our types in it.-->
|
||||
<Target Name="_LocalTestsGenerateCombinedManifests"
|
||||
Inputs="@(_ConsoleWinmdManifest)"
|
||||
Outputs="$(OutDir)$(TargetName).manifest"
|
||||
DependsOnTargets="_ConsoleGenerateAdditionalWinmdManifests">
|
||||
|
||||
<Exec Command="mt.exe -manifest @(_ConsoleWinmdManifest, ' -manifest ') -out:$(OutDir)$(TargetName).manifest" />
|
||||
</Target>
|
||||
|
||||
<!-- Step 2: Take our combined SxS manifest, and use it to build an
|
||||
Appxmanifest.xml. We'll use the Appxmanifest.prototype.xml in this project's
|
||||
directory as a base, and the script will tak all our activatableClasses and
|
||||
turn them into appxmanifest-compatible Extensions -->
|
||||
<Target Name="_LocalTestsBuildAppxManifest"
|
||||
Inputs="$(OutDir)$(TargetName).manifest"
|
||||
Outputs="$(OutDir)$(TargetName).AppxManifest.xml"
|
||||
DependsOnTargets="_LocalTestsGenerateCombinedManifests">
|
||||
|
||||
<Exec Command="powershell.exe -noprofile –ExecutionPolicy Unrestricted $(OpenConsoleDir)\tools\GenerateAppxFromManifest.ps1 -SxSManifest $(OutDir)$(TargetName).manifest -AppxManifestPrototype $(TargetName).AppxManifest.prototype.xml -OutPath $(OutDir)$(TargetName).AppxManifest.xml" />
|
||||
|
||||
</Target>
|
||||
|
||||
<!-- Step 3: Manually copy all our dependent DLLs into our OutDir. For SxS
|
||||
activation to work, they all need to be in the same directory as our test dll.
|
||||
This is using code that's heavliy cribbed from WindowsTerminal.vcxproj, which
|
||||
is already cribbed from the GetPackagingOutputs in
|
||||
Microsoft.*.AppxPackage.targets. We're filtering this list down to the dlls,
|
||||
pris and xbfs, because this list _can_ contain directories, which will make
|
||||
the Copy task explode. -->
|
||||
|
||||
<PropertyGroup>
|
||||
<_ContinueOnError Condition="'$(BuildingProject)' == 'true'">true</_ContinueOnError>
|
||||
<_ContinueOnError Condition="'$(BuildingProject)' != 'true'">false</_ContinueOnError>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- First gather the files... -->
|
||||
<Target Name="MyGetPackagingOutputs" Returns="@(MyPackagingOutputs)">
|
||||
<MSBuild
|
||||
Projects="@(ProjectReferenceWithConfiguration)"
|
||||
Targets="GetPackagingOutputs"
|
||||
BuildInParallel="$(BuildInParallel)"
|
||||
Properties="%(ProjectReferenceWithConfiguration.SetConfiguration); %(ProjectReferenceWithConfiguration.SetPlatform)"
|
||||
Condition="'@(ProjectReferenceWithConfiguration)' != ''
|
||||
and '%(ProjectReferenceWithConfiguration.BuildReference)' == 'true'
|
||||
and '%(ProjectReferenceWithConfiguration.ReferenceOutputAssembly)' == 'true'"
|
||||
ContinueOnError="$(_ContinueOnError)">
|
||||
<Output TaskParameter="TargetOutputs" ItemName="_PackagingOutputsFromOtherProjects"/>
|
||||
</MSBuild>
|
||||
|
||||
<ItemGroup>
|
||||
<MyPackagingOutputs Include="@(_PackagingOutputsFromOtherProjects)" Condition="'%(Extension)'=='.dll' Or '%(Extension)'=='.pri' Or '%(Extension)'=='.xbf'" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<!-- Then copy the files to our outdir -->
|
||||
<Target Name="_LocalTestsCopyDependencies"
|
||||
DependsOnTargets="MyGetPackagingOutputs">
|
||||
|
||||
<Copy SourceFiles="@(MyPackagingOutputs)"
|
||||
SkipUnchangedFiles="true"
|
||||
DestinationFolder="$(OutDir)"
|
||||
/>
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
4
src/cascadia/LocalTests_TerminalApp/precomp.cpp
Normal file
4
src/cascadia/LocalTests_TerminalApp/precomp.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "precomp.h"
|
||||
53
src/cascadia/LocalTests_TerminalApp/precomp.h
Normal file
53
src/cascadia/LocalTests_TerminalApp/precomp.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation
|
||||
Licensed under the MIT license.
|
||||
|
||||
Module Name:
|
||||
- precomp.h
|
||||
|
||||
Abstract:
|
||||
- Contains external headers to include in the precompile phase of console build process.
|
||||
- Avoid including internal project headers. Instead include them only in the classes that need them (helps with test project building).
|
||||
|
||||
Author(s):
|
||||
- Carlos Zamora (cazamor) April 2019
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// This includes support libraries from the CRT, STL, WIL, and GSL
|
||||
#include "LibraryIncludes.h"
|
||||
// This is inexplicable, but for whatever reason, cppwinrt conflicts with the
|
||||
// SDK definition of this function, so the only fix is to undef it.
|
||||
// from WinBase.h
|
||||
// Windows::UI::Xaml::Media::Animation::IStoryboard::GetCurrentTime
|
||||
#ifdef GetCurrentTime
|
||||
#undef GetCurrentTime
|
||||
#endif
|
||||
|
||||
#include <WexTestClass.h>
|
||||
#include <json.h>
|
||||
#include "consoletaeftemplates.hpp"
|
||||
|
||||
// Needed just for XamlIslands to work at all:
|
||||
#include <winrt/Windows.system.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <winrt/Windows.UI.Xaml.Hosting.h>
|
||||
#include <windows.ui.xaml.hosting.desktopwindowxamlsource.h>
|
||||
|
||||
// Common includes for most tests:
|
||||
#include "../../inc/argb.h"
|
||||
#include "../../inc/conattrs.hpp"
|
||||
#include "../../types/inc/utils.hpp"
|
||||
#include "../../inc/DefaultSettings.h"
|
||||
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <winrt/windows.ui.core.h>
|
||||
#include <winrt/Windows.ui.input.h>
|
||||
#include <winrt/Windows.UI.Xaml.Controls.h>
|
||||
#include <winrt/Windows.UI.Xaml.Controls.Primitives.h>
|
||||
#include <winrt/Windows.ui.xaml.media.h>
|
||||
#include <winrt/Windows.ui.xaml.input.h>
|
||||
|
||||
#include <windows.ui.xaml.media.dxinterop.h>
|
||||
13
src/cascadia/TerminalApp/ActionArgs.cpp
Normal file
13
src/cascadia/TerminalApp/ActionArgs.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include "ActionArgs.h"
|
||||
|
||||
#include "ActionEventArgs.g.cpp"
|
||||
#include "CopyTextArgs.g.cpp"
|
||||
#include "NewTabWithProfileArgs.g.cpp"
|
||||
#include "SwitchToTabArgs.g.cpp"
|
||||
#include "ResizePaneArgs.g.cpp"
|
||||
#include "MoveFocusArgs.g.cpp"
|
||||
69
src/cascadia/TerminalApp/ActionArgs.h
Normal file
69
src/cascadia/TerminalApp/ActionArgs.h
Normal file
@@ -0,0 +1,69 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#pragma once
|
||||
|
||||
// HEY YOU: When adding ActionArgs types, make sure to add the corresponding
|
||||
// *.g.cpp to ActionArgs.cpp!
|
||||
#include "ActionEventArgs.g.h"
|
||||
#include "CopyTextArgs.g.h"
|
||||
#include "NewTabWithProfileArgs.g.h"
|
||||
#include "SwitchToTabArgs.g.h"
|
||||
#include "ResizePaneArgs.g.h"
|
||||
#include "MoveFocusArgs.g.h"
|
||||
|
||||
#include "../../cascadia/inc/cppwinrt_utils.h"
|
||||
|
||||
// Notes on defining ActionArgs and ActionEventArgs:
|
||||
// * All properties specific to an action should be defined as an ActionArgs
|
||||
// class that implements IActionArgs
|
||||
// * ActionEventArgs holds a single IActionArgs. For events that don't need
|
||||
// additional args, this can be nullptr.
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
struct ActionEventArgs : public ActionEventArgsT<ActionEventArgs>
|
||||
{
|
||||
ActionEventArgs() = default;
|
||||
ActionEventArgs(const TerminalApp::IActionArgs& args) :
|
||||
_ActionArgs{ args } {};
|
||||
GETSET_PROPERTY(IActionArgs, ActionArgs, nullptr);
|
||||
GETSET_PROPERTY(bool, Handled, false);
|
||||
};
|
||||
|
||||
struct CopyTextArgs : public CopyTextArgsT<CopyTextArgs>
|
||||
{
|
||||
CopyTextArgs() = default;
|
||||
GETSET_PROPERTY(bool, TrimWhitespace, false);
|
||||
};
|
||||
|
||||
struct NewTabWithProfileArgs : public NewTabWithProfileArgsT<NewTabWithProfileArgs>
|
||||
{
|
||||
NewTabWithProfileArgs() = default;
|
||||
GETSET_PROPERTY(int32_t, ProfileIndex, 0);
|
||||
};
|
||||
|
||||
struct SwitchToTabArgs : public SwitchToTabArgsT<SwitchToTabArgs>
|
||||
{
|
||||
SwitchToTabArgs() = default;
|
||||
GETSET_PROPERTY(int32_t, TabIndex, 0);
|
||||
};
|
||||
|
||||
struct ResizePaneArgs : public ResizePaneArgsT<ResizePaneArgs>
|
||||
{
|
||||
ResizePaneArgs() = default;
|
||||
GETSET_PROPERTY(TerminalApp::Direction, Direction, TerminalApp::Direction::Left);
|
||||
};
|
||||
|
||||
struct MoveFocusArgs : public MoveFocusArgsT<MoveFocusArgs>
|
||||
{
|
||||
MoveFocusArgs() = default;
|
||||
GETSET_PROPERTY(TerminalApp::Direction, Direction, TerminalApp::Direction::Left);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace winrt::TerminalApp::factory_implementation
|
||||
{
|
||||
BASIC_FACTORY(ActionEventArgs);
|
||||
}
|
||||
54
src/cascadia/TerminalApp/ActionArgs.idl
Normal file
54
src/cascadia/TerminalApp/ActionArgs.idl
Normal file
@@ -0,0 +1,54 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace TerminalApp
|
||||
{
|
||||
// An empty interface must specify an explicit [uuid] to ensure uniqueness.
|
||||
// We also manually have to specify a "version" attribute to make the compiler happy.
|
||||
[uuid("191C2BDE-1A60-4BAB-9765-D850F0EF2CAC")][version(1)] interface IActionArgs{};
|
||||
|
||||
interface IActionEventArgs
|
||||
{
|
||||
Boolean Handled;
|
||||
IActionArgs ActionArgs { get; };
|
||||
};
|
||||
|
||||
enum Direction
|
||||
{
|
||||
Left = 0,
|
||||
Right,
|
||||
Up,
|
||||
Down
|
||||
};
|
||||
|
||||
[default_interface] runtimeclass ActionEventArgs : IActionEventArgs
|
||||
{
|
||||
ActionEventArgs(IActionArgs args);
|
||||
};
|
||||
|
||||
[default_interface] runtimeclass CopyTextArgs : IActionArgs
|
||||
{
|
||||
Boolean TrimWhitespace { get; };
|
||||
};
|
||||
|
||||
[default_interface] runtimeclass NewTabWithProfileArgs : IActionArgs
|
||||
{
|
||||
Int32 ProfileIndex { get; };
|
||||
};
|
||||
|
||||
[default_interface] runtimeclass SwitchToTabArgs : IActionArgs
|
||||
{
|
||||
Int32 TabIndex { get; };
|
||||
};
|
||||
|
||||
[default_interface] runtimeclass ResizePaneArgs : IActionArgs
|
||||
{
|
||||
Direction Direction { get; };
|
||||
};
|
||||
|
||||
[default_interface] runtimeclass MoveFocusArgs : IActionArgs
|
||||
{
|
||||
Direction Direction { get; };
|
||||
};
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "Tab.h"
|
||||
#include "CascadiaSettings.h"
|
||||
#include "TerminalPage.h"
|
||||
#include "App.g.h"
|
||||
#include "App.base.h"
|
||||
#include "../../cascadia/inc/cppwinrt_utils.h"
|
||||
@@ -24,124 +25,67 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
public:
|
||||
App();
|
||||
~App() = default;
|
||||
|
||||
Windows::UI::Xaml::UIElement GetRoot() noexcept;
|
||||
|
||||
// Gets the current dragglable area in the non client region of the top level window
|
||||
Windows::UI::Xaml::Controls::Border GetDragBar() noexcept;
|
||||
|
||||
void Create(uint64_t hParentWnd);
|
||||
void Create();
|
||||
void LoadSettings();
|
||||
|
||||
Windows::Foundation::Point GetLaunchDimensions(uint32_t dpi);
|
||||
bool GetShowTabsInTitlebar();
|
||||
|
||||
~App();
|
||||
Windows::UI::Xaml::UIElement GetRoot() noexcept;
|
||||
|
||||
hstring GetTitle();
|
||||
|
||||
void IncomingConnection(uint64_t serverHandle);
|
||||
void IncomingConnection(hstring cmdline, hstring workingDir);
|
||||
hstring Title();
|
||||
void TitlebarClicked();
|
||||
|
||||
// -------------------------------- WinRT Events ---------------------------------
|
||||
DECLARE_EVENT(TitleChanged, _titleChangeHandlers, winrt::Microsoft::Terminal::TerminalControl::TitleChangedEventArgs);
|
||||
DECLARE_EVENT(LastTabClosed, _lastTabClosedHandlers, winrt::TerminalApp::LastTabClosedEventArgs);
|
||||
DECLARE_EVENT_WITH_TYPED_EVENT_HANDLER(TitleChanged, _titleChangeHandlers, winrt::Windows::Foundation::IInspectable, winrt::hstring);
|
||||
DECLARE_EVENT_WITH_TYPED_EVENT_HANDLER(LastTabClosed, _lastTabClosedHandlers, winrt::Windows::Foundation::IInspectable, winrt::TerminalApp::LastTabClosedEventArgs);
|
||||
DECLARE_EVENT_WITH_TYPED_EVENT_HANDLER(SetTitleBarContent, _setTitleBarContentHandlers, winrt::Windows::Foundation::IInspectable, winrt::Windows::UI::Xaml::UIElement);
|
||||
DECLARE_EVENT_WITH_TYPED_EVENT_HANDLER(RequestedThemeChanged, _requestedThemeChangedHandlers, TerminalApp::App, winrt::Windows::UI::Xaml::ElementTheme);
|
||||
|
||||
private:
|
||||
// If you add controls here, but forget to null them either here or in
|
||||
// the ctor, you're going to have a bad time. It'll mysteriously fail to
|
||||
// activate the app.
|
||||
// ALSO: If you add any UIElements as roots here, make sure they're
|
||||
// updated in _ApplyTheme. The two roots currently are _root and _tabRow
|
||||
// (which is a root when the tabs are in the titlebar.)
|
||||
Windows::UI::Xaml::Controls::Control _root{ nullptr };
|
||||
Microsoft::UI::Xaml::Controls::TabView _tabView{ nullptr };
|
||||
Windows::UI::Xaml::Controls::Grid _tabRow{ nullptr };
|
||||
Windows::UI::Xaml::Controls::Grid _tabContent{ nullptr };
|
||||
Windows::UI::Xaml::Controls::SplitButton _newTabButton{ nullptr };
|
||||
winrt::TerminalApp::MinMaxCloseControl _minMaxCloseControl{ nullptr };
|
||||
// updated in _ApplyTheme. The root currently is _root.
|
||||
winrt::com_ptr<TerminalPage> _root{ nullptr };
|
||||
|
||||
std::vector<std::shared_ptr<Tab>> _tabs;
|
||||
std::shared_ptr<::TerminalApp::CascadiaSettings> _settings{ nullptr };
|
||||
|
||||
std::unique_ptr<::TerminalApp::CascadiaSettings> _settings;
|
||||
std::shared_ptr<ScopedResourceLoader> _resourceLoader{ nullptr };
|
||||
|
||||
HRESULT _settingsLoadedResult;
|
||||
winrt::hstring _settingsLoadExceptionText{};
|
||||
|
||||
bool _loadedInitialSettings;
|
||||
std::shared_mutex _dialogLock;
|
||||
|
||||
wil::unique_folder_change_reader_nothrow _reader;
|
||||
|
||||
std::shared_mutex _dialogLock;
|
||||
|
||||
std::atomic<bool> _settingsReloadQueued{ false };
|
||||
|
||||
void _Create(uint64_t parentHWnd);
|
||||
void _CreateNewTabFlyout();
|
||||
fire_and_forget _ShowDialog(const winrt::Windows::Foundation::IInspectable& sender, winrt::Windows::UI::Xaml::Controls::ContentDialog dialog);
|
||||
void _ShowLoadErrorsDialog(const winrt::hstring& titleKey, const winrt::hstring& contentKey, HRESULT settingsLoadedResult);
|
||||
void _ShowLoadWarningsDialog();
|
||||
|
||||
fire_and_forget _ShowDialog(const winrt::Windows::Foundation::IInspectable& titleElement,
|
||||
const winrt::Windows::Foundation::IInspectable& contentElement,
|
||||
const winrt::hstring& closeButtonText);
|
||||
void _ShowOkDialog(const winrt::hstring& titleKey, const winrt::hstring& contentKey);
|
||||
void _ShowAboutDialog();
|
||||
void _OnLoaded(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
|
||||
[[nodiscard]] HRESULT _TryLoadSettings(const bool saveOnLoad) noexcept;
|
||||
[[nodiscard]] HRESULT _TryLoadSettings() noexcept;
|
||||
void _LoadSettings();
|
||||
void _OpenSettings();
|
||||
|
||||
void _HookupKeyBindings(TerminalApp::AppKeyBindings bindings) noexcept;
|
||||
|
||||
void _RegisterSettingsChange();
|
||||
fire_and_forget _DispatchReloadSettings();
|
||||
void _ReloadSettings();
|
||||
|
||||
void _SettingsButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
void _FeedbackButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
void _AboutButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
|
||||
void _UpdateTabView();
|
||||
void _UpdateTabIcon(std::shared_ptr<Tab> tab);
|
||||
void _UpdateTitle(std::shared_ptr<Tab> tab);
|
||||
|
||||
void _RegisterTerminalEvents(Microsoft::Terminal::TerminalControl::TermControl term, std::shared_ptr<Tab> hostingTab);
|
||||
|
||||
void _CreateNewTabFromSettings(GUID profileGuid, winrt::Microsoft::Terminal::Settings::TerminalSettings settings, std::optional<uint64_t> serverHandle = std::nullopt);
|
||||
|
||||
void _OpenNewTab(std::optional<int> profileIndex);
|
||||
void _DuplicateTabViewItem();
|
||||
void _CloseFocusedTab();
|
||||
void _SelectNextTab(const bool bMoveRight);
|
||||
void _SelectTab(const int tabIndex);
|
||||
|
||||
void _SetFocusedTabIndex(int tabIndex);
|
||||
int _GetFocusedTabIndex() const;
|
||||
|
||||
void _Scroll(int delta);
|
||||
void _CopyText(const bool trimTrailingWhitespace);
|
||||
void _PasteText();
|
||||
void _SplitVertical(const std::optional<GUID>& profileGuid);
|
||||
void _SplitHorizontal(const std::optional<GUID>& profileGuid);
|
||||
void _SplitPane(const Pane::SplitState splitType, const std::optional<GUID>& profileGuid);
|
||||
|
||||
// Todo: add more event implementations here
|
||||
// MSFT:20641986: Add keybindings for New Window
|
||||
void _ScrollPage(int delta);
|
||||
void _ResizePane(const Direction& direction);
|
||||
|
||||
void _OnLoaded(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
|
||||
void _OnTabSelectionChanged(const IInspectable& sender, const Windows::UI::Xaml::Controls::SelectionChangedEventArgs& eventArgs);
|
||||
void _OnTabClosing(const IInspectable& sender, const Microsoft::UI::Xaml::Controls::TabViewTabClosingEventArgs& eventArgs);
|
||||
void _OnTabItemsChanged(const IInspectable& sender, const Windows::Foundation::Collections::IVectorChangedEventArgs& eventArgs);
|
||||
void _OnTabClick(const IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs);
|
||||
void _OnContentSizeChanged(const IInspectable& sender, Windows::UI::Xaml::SizeChangedEventArgs const& e);
|
||||
|
||||
void _RemoveTabViewItem(const IInspectable& tabViewItem);
|
||||
|
||||
void _ApplyTheme(const Windows::UI::Xaml::ElementTheme& newTheme);
|
||||
|
||||
static Windows::UI::Xaml::Controls::IconElement _GetIconFromProfile(const ::TerminalApp::Profile& profile);
|
||||
|
||||
winrt::Microsoft::Terminal::TerminalControl::TermControl _GetFocusedControl();
|
||||
|
||||
void _CopyToClipboardHandler(const winrt::hstring& copiedData);
|
||||
void _CopyToClipboardHandler(const IInspectable& sender, const winrt::Microsoft::Terminal::TerminalControl::CopyToClipboardEventArgs& copiedData);
|
||||
void _PasteFromClipboardHandler(const IInspectable& sender, const Microsoft::Terminal::TerminalControl::PasteFromClipboardEventArgs& eventArgs);
|
||||
|
||||
static void _SetAcceleratorForMenuItem(Windows::UI::Xaml::Controls::MenuFlyoutItem& menuItem, const winrt::Microsoft::Terminal::Settings::KeyChord& keyChord);
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
namespace TerminalApp
|
||||
{
|
||||
delegate void LastTabClosedEventArgs();
|
||||
[default_interface]
|
||||
runtimeclass App : Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication
|
||||
[default_interface] runtimeclass App : Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication
|
||||
{
|
||||
App();
|
||||
|
||||
@@ -16,22 +15,21 @@ namespace TerminalApp
|
||||
// then it might look like TermApp just failed to activate, which will
|
||||
// cause you to chase down the rabbit hole of "why is TermApp not
|
||||
// registered?" when it definitely is.
|
||||
void Create(UInt64 hParentWnd);
|
||||
void Create();
|
||||
|
||||
void LoadSettings();
|
||||
|
||||
Windows.UI.Xaml.UIElement GetRoot();
|
||||
Windows.UI.Xaml.Controls.Border GetDragBar{ get; };
|
||||
|
||||
String Title { get; };
|
||||
|
||||
Windows.Foundation.Point GetLaunchDimensions(UInt32 dpi);
|
||||
Boolean GetShowTabsInTitlebar();
|
||||
void TitlebarClicked();
|
||||
|
||||
event Microsoft.Terminal.TerminalControl.TitleChangedEventArgs TitleChanged;
|
||||
event LastTabClosedEventArgs LastTabClosed;
|
||||
|
||||
String GetTitle();
|
||||
|
||||
void IncomingConnection(UInt64 serverHandle);
|
||||
void IncomingConnection(String cmdline, String workingDir);
|
||||
event Windows.Foundation.TypedEventHandler<Object, Windows.UI.Xaml.UIElement> SetTitleBarContent;
|
||||
event Windows.Foundation.TypedEventHandler<Object, String> TitleChanged;
|
||||
event Windows.Foundation.TypedEventHandler<Object, LastTabClosedEventArgs> LastTabClosed;
|
||||
event Windows.Foundation.TypedEventHandler<App, Windows.UI.Xaml.ElementTheme> RequestedThemeChanged;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,11 @@ the MIT License. See LICENSE in the project root for license information. -->
|
||||
<Setter Target="CloseButtonStyle" Value="{StaticResource AccentButtonStyle}" />
|
||||
</Style>
|
||||
|
||||
<!-- We need to manually create the error text brush as a
|
||||
theme-dependent brush. SystemControlErrorTextForegroundBrush
|
||||
is unfortunately static. -->
|
||||
<SolidColorBrush x:Name="ErrorTextBrush" Color="{ThemeResource SystemErrorTextColor}" />
|
||||
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Dark">
|
||||
<!-- Define resources for Dark mode here -->
|
||||
|
||||
191
src/cascadia/TerminalApp/AppActionHandlers.cpp
Normal file
191
src/cascadia/TerminalApp/AppActionHandlers.cpp
Normal file
@@ -0,0 +1,191 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "pch.h"
|
||||
#include "App.h"
|
||||
|
||||
#include "TerminalPage.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace winrt::Windows::ApplicationModel::DataTransfer;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Text;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Microsoft::Terminal::Settings;
|
||||
using namespace winrt::Microsoft::Terminal::TerminalControl;
|
||||
using namespace winrt::Microsoft::Terminal::TerminalConnection;
|
||||
using namespace ::TerminalApp;
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
namespace MUX = Microsoft::UI::Xaml;
|
||||
using IInspectable = Windows::Foundation::IInspectable;
|
||||
}
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
void TerminalPage::_HandleNewTab(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_OpenNewTab(std::nullopt);
|
||||
args.Handled(true);
|
||||
}
|
||||
void TerminalPage::_HandleOpenNewTabDropdown(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_OpenNewTabDropdown();
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleDuplicateTab(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_DuplicateTabViewItem();
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleCloseTab(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_CloseFocusedTab();
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleClosePane(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_CloseFocusedPane();
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleCloseWindow(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_CloseWindow();
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleScrollUp(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_Scroll(-1);
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleScrollDown(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_Scroll(1);
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleNextTab(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_SelectNextTab(true);
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandlePrevTab(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_SelectNextTab(false);
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleSplitVertical(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_SplitVertical(std::nullopt);
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleSplitHorizontal(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_SplitHorizontal(std::nullopt);
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleScrollUpPage(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_ScrollPage(-1);
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleScrollDownPage(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_ScrollPage(1);
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleOpenSettings(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
// TODO:GH#2557 Add an optional arg for opening the defaults here
|
||||
_LaunchSettings(false);
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandlePasteText(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
_PasteText();
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleNewTabWithProfile(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
if (const auto& realArgs = args.ActionArgs().try_as<TerminalApp::NewTabWithProfileArgs>())
|
||||
{
|
||||
_OpenNewTab({ realArgs.ProfileIndex() });
|
||||
args.Handled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleSwitchToTab(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
if (const auto& realArgs = args.ActionArgs().try_as<TerminalApp::SwitchToTabArgs>())
|
||||
{
|
||||
const auto handled = _SelectTab({ realArgs.TabIndex() });
|
||||
args.Handled(handled);
|
||||
}
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleResizePane(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
if (const auto& realArgs = args.ActionArgs().try_as<TerminalApp::ResizePaneArgs>())
|
||||
{
|
||||
_ResizePane(realArgs.Direction());
|
||||
args.Handled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleMoveFocus(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
if (const auto& realArgs = args.ActionArgs().try_as<TerminalApp::MoveFocusArgs>())
|
||||
{
|
||||
_MoveFocus(realArgs.Direction());
|
||||
args.Handled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void TerminalPage::_HandleCopyText(const IInspectable& /*sender*/,
|
||||
const TerminalApp::ActionEventArgs& args)
|
||||
{
|
||||
if (const auto& realArgs = args.ActionArgs().try_as<TerminalApp::CopyTextArgs>())
|
||||
{
|
||||
const auto handled = _CopyText(realArgs.TrimWhitespace());
|
||||
args.Handled(handled);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace winrt::Windows::Data::Json;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
@@ -19,6 +18,17 @@ namespace winrt::TerminalApp::implementation
|
||||
_keyShortcuts[chord] = action;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Remove the action that's bound to a particular KeyChord.
|
||||
// Arguments:
|
||||
// - chord: the keystroke to remove the action for.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void AppKeyBindings::ClearKeyBinding(const Settings::KeyChord& chord)
|
||||
{
|
||||
_keyShortcuts.erase(chord);
|
||||
}
|
||||
|
||||
Microsoft::Terminal::Settings::KeyChord AppKeyBindings::GetKeyBinding(TerminalApp::ShortcutAction const& action)
|
||||
{
|
||||
for (auto& kv : _keyShortcuts)
|
||||
@@ -47,129 +57,337 @@ namespace winrt::TerminalApp::implementation
|
||||
switch (action)
|
||||
{
|
||||
case ShortcutAction::CopyText:
|
||||
_CopyTextHandlers(true);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<CopyTextArgs>();
|
||||
args->TrimWhitespace(true);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_CopyTextHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::CopyTextWithoutNewlines:
|
||||
_CopyTextHandlers(false);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<CopyTextArgs>();
|
||||
args->TrimWhitespace(false);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_CopyTextHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::PasteText:
|
||||
_PasteTextHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_PasteTextHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::NewTab:
|
||||
_NewTabHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_NewTabHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::OpenNewTabDropdown:
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_OpenNewTabDropdownHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::DuplicateTab:
|
||||
_DuplicateTabHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_DuplicateTabHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::OpenSettings:
|
||||
_OpenSettingsHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_OpenSettingsHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
|
||||
case ShortcutAction::NewTabProfile0:
|
||||
_NewTabWithProfileHandlers(0);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<NewTabWithProfileArgs>();
|
||||
args->ProfileIndex(0);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_NewTabWithProfileHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::NewTabProfile1:
|
||||
_NewTabWithProfileHandlers(1);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<NewTabWithProfileArgs>();
|
||||
args->ProfileIndex(1);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_NewTabWithProfileHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::NewTabProfile2:
|
||||
_NewTabWithProfileHandlers(2);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<NewTabWithProfileArgs>();
|
||||
args->ProfileIndex(2);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_NewTabWithProfileHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::NewTabProfile3:
|
||||
_NewTabWithProfileHandlers(3);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<NewTabWithProfileArgs>();
|
||||
args->ProfileIndex(3);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_NewTabWithProfileHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::NewTabProfile4:
|
||||
_NewTabWithProfileHandlers(4);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<NewTabWithProfileArgs>();
|
||||
args->ProfileIndex(4);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_NewTabWithProfileHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::NewTabProfile5:
|
||||
_NewTabWithProfileHandlers(5);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<NewTabWithProfileArgs>();
|
||||
args->ProfileIndex(5);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_NewTabWithProfileHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::NewTabProfile6:
|
||||
_NewTabWithProfileHandlers(6);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<NewTabWithProfileArgs>();
|
||||
args->ProfileIndex(6);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_NewTabWithProfileHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::NewTabProfile7:
|
||||
_NewTabWithProfileHandlers(7);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<NewTabWithProfileArgs>();
|
||||
args->ProfileIndex(7);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_NewTabWithProfileHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::NewTabProfile8:
|
||||
_NewTabWithProfileHandlers(8);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<NewTabWithProfileArgs>();
|
||||
args->ProfileIndex(8);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_NewTabWithProfileHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
|
||||
case ShortcutAction::NewWindow:
|
||||
_NewWindowHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_NewWindowHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::CloseWindow:
|
||||
_CloseWindowHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_CloseWindowHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::CloseTab:
|
||||
_CloseTabHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_CloseTabHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::ClosePane:
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_ClosePaneHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
|
||||
case ShortcutAction::ScrollUp:
|
||||
_ScrollUpHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_ScrollUpHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::ScrollDown:
|
||||
_ScrollDownHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_ScrollDownHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::ScrollUpPage:
|
||||
_ScrollUpPageHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_ScrollUpPageHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::ScrollDownPage:
|
||||
_ScrollDownPageHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_ScrollDownPageHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
|
||||
case ShortcutAction::NextTab:
|
||||
_NextTabHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_NextTabHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::PrevTab:
|
||||
_PrevTabHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_PrevTabHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
|
||||
case ShortcutAction::SplitVertical:
|
||||
_SplitVerticalHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_SplitVerticalHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::SplitHorizontal:
|
||||
_SplitHorizontalHandlers();
|
||||
return true;
|
||||
{
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>();
|
||||
_SplitHorizontalHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
|
||||
case ShortcutAction::SwitchToTab0:
|
||||
_SwitchToTabHandlers(0);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<SwitchToTabArgs>();
|
||||
args->TabIndex(0);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_SwitchToTabHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::SwitchToTab1:
|
||||
_SwitchToTabHandlers(1);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<SwitchToTabArgs>();
|
||||
args->TabIndex(1);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_SwitchToTabHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::SwitchToTab2:
|
||||
_SwitchToTabHandlers(2);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<SwitchToTabArgs>();
|
||||
args->TabIndex(2);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_SwitchToTabHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::SwitchToTab3:
|
||||
_SwitchToTabHandlers(3);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<SwitchToTabArgs>();
|
||||
args->TabIndex(3);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_SwitchToTabHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::SwitchToTab4:
|
||||
_SwitchToTabHandlers(4);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<SwitchToTabArgs>();
|
||||
args->TabIndex(4);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_SwitchToTabHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::SwitchToTab5:
|
||||
_SwitchToTabHandlers(5);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<SwitchToTabArgs>();
|
||||
args->TabIndex(5);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_SwitchToTabHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::SwitchToTab6:
|
||||
_SwitchToTabHandlers(6);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<SwitchToTabArgs>();
|
||||
args->TabIndex(6);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_SwitchToTabHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::SwitchToTab7:
|
||||
_SwitchToTabHandlers(7);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<SwitchToTabArgs>();
|
||||
args->TabIndex(7);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_SwitchToTabHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::SwitchToTab8:
|
||||
_SwitchToTabHandlers(8);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<SwitchToTabArgs>();
|
||||
args->TabIndex(8);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_SwitchToTabHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::ResizePaneLeft:
|
||||
_ResizePaneHandlers(Direction::Left);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<ResizePaneArgs>();
|
||||
args->Direction(Direction::Left);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_ResizePaneHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::ResizePaneRight:
|
||||
_ResizePaneHandlers(Direction::Right);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<ResizePaneArgs>();
|
||||
args->Direction(Direction::Right);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_ResizePaneHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::ResizePaneUp:
|
||||
_ResizePaneHandlers(Direction::Up);
|
||||
return true;
|
||||
{
|
||||
auto args = winrt::make_self<ResizePaneArgs>();
|
||||
args->Direction(Direction::Up);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_ResizePaneHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::ResizePaneDown:
|
||||
_ResizePaneHandlers(Direction::Down);
|
||||
return true;
|
||||
|
||||
{
|
||||
auto args = winrt::make_self<ResizePaneArgs>();
|
||||
args->Direction(Direction::Down);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_ResizePaneHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::MoveFocusLeft:
|
||||
{
|
||||
auto args = winrt::make_self<MoveFocusArgs>();
|
||||
args->Direction(Direction::Left);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_MoveFocusHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::MoveFocusRight:
|
||||
{
|
||||
auto args = winrt::make_self<MoveFocusArgs>();
|
||||
args->Direction(Direction::Right);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_MoveFocusHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::MoveFocusUp:
|
||||
{
|
||||
auto args = winrt::make_self<MoveFocusArgs>();
|
||||
args->Direction(Direction::Up);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_MoveFocusHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
case ShortcutAction::MoveFocusDown:
|
||||
{
|
||||
auto args = winrt::make_self<MoveFocusArgs>();
|
||||
args->Direction(Direction::Down);
|
||||
auto eventArgs = winrt::make_self<ActionEventArgs>(*args);
|
||||
_MoveFocusHandlers(*this, *eventArgs);
|
||||
return eventArgs->Handled();
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -200,56 +418,4 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
return keyModifiers;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Handles the special case of providing a text override for the UI shortcut due to VK_OEM_COMMA issue.
|
||||
// Looks at the flags from the KeyChord modifiers and provides a concatenated string value of all
|
||||
// in the same order that XAML would put them as well.
|
||||
// Return Value:
|
||||
// - a WinRT hstring representation of the key modifiers for the shortcut
|
||||
//NOTE: This needs to be localized with https://github.com/microsoft/terminal/issues/794 if XAML framework issue not resolved before then
|
||||
winrt::hstring AppKeyBindings::FormatOverrideShortcutText(Settings::KeyModifiers modifiers)
|
||||
{
|
||||
std::wstring buffer{ L"" };
|
||||
|
||||
if (WI_IsFlagSet(modifiers, Settings::KeyModifiers::Ctrl))
|
||||
{
|
||||
buffer += L"Ctrl+";
|
||||
}
|
||||
if (WI_IsFlagSet(modifiers, Settings::KeyModifiers::Shift))
|
||||
{
|
||||
buffer += L"Shift+";
|
||||
}
|
||||
if (WI_IsFlagSet(modifiers, Settings::KeyModifiers::Alt))
|
||||
{
|
||||
buffer += L"Alt+";
|
||||
}
|
||||
|
||||
return winrt::hstring{ buffer };
|
||||
}
|
||||
|
||||
// -------------------------------- Events ---------------------------------
|
||||
// clang-format off
|
||||
DEFINE_EVENT(AppKeyBindings, CopyText, _CopyTextHandlers, TerminalApp::CopyTextEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, PasteText, _PasteTextHandlers, TerminalApp::PasteTextEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, NewTab, _NewTabHandlers, TerminalApp::NewTabEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, DuplicateTab, _DuplicateTabHandlers, TerminalApp::DuplicateTabEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, NewTabWithProfile, _NewTabWithProfileHandlers, TerminalApp::NewTabWithProfileEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, NewWindow, _NewWindowHandlers, TerminalApp::NewWindowEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, CloseWindow, _CloseWindowHandlers, TerminalApp::CloseWindowEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, CloseTab, _CloseTabHandlers, TerminalApp::CloseTabEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, SwitchToTab, _SwitchToTabHandlers, TerminalApp::SwitchToTabEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, NextTab, _NextTabHandlers, TerminalApp::NextTabEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, PrevTab, _PrevTabHandlers, TerminalApp::PrevTabEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, SplitVertical, _SplitVerticalHandlers, TerminalApp::SplitVerticalEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, SplitHorizontal, _SplitHorizontalHandlers, TerminalApp::SplitHorizontalEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, IncreaseFontSize, _IncreaseFontSizeHandlers, TerminalApp::IncreaseFontSizeEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, DecreaseFontSize, _DecreaseFontSizeHandlers, TerminalApp::DecreaseFontSizeEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, ScrollUp, _ScrollUpHandlers, TerminalApp::ScrollUpEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, ScrollDown, _ScrollDownHandlers, TerminalApp::ScrollDownEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, ScrollUpPage, _ScrollUpPageHandlers, TerminalApp::ScrollUpPageEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, ScrollDownPage, _ScrollDownPageHandlers, TerminalApp::ScrollDownPageEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, OpenSettings, _OpenSettingsHandlers, TerminalApp::OpenSettingsEventArgs);
|
||||
DEFINE_EVENT(AppKeyBindings, ResizePane, _ResizePaneHandlers, TerminalApp::ResizePaneEventArgs);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
@@ -4,8 +4,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "AppKeyBindings.g.h"
|
||||
#include "ActionArgs.h"
|
||||
#include "..\inc\cppwinrt_utils.h"
|
||||
|
||||
// fwdecl unittest classes
|
||||
namespace TerminalAppLocalTests
|
||||
{
|
||||
class SettingsTests;
|
||||
class KeyBindingsTests;
|
||||
}
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
struct KeyChordHash
|
||||
@@ -34,38 +42,48 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
bool TryKeyChord(winrt::Microsoft::Terminal::Settings::KeyChord const& kc);
|
||||
void SetKeyBinding(TerminalApp::ShortcutAction const& action, winrt::Microsoft::Terminal::Settings::KeyChord const& chord);
|
||||
void ClearKeyBinding(winrt::Microsoft::Terminal::Settings::KeyChord const& chord);
|
||||
Microsoft::Terminal::Settings::KeyChord GetKeyBinding(TerminalApp::ShortcutAction const& action);
|
||||
|
||||
static Windows::System::VirtualKeyModifiers ConvertVKModifiers(winrt::Microsoft::Terminal::Settings::KeyModifiers modifiers);
|
||||
static winrt::hstring FormatOverrideShortcutText(winrt::Microsoft::Terminal::Settings::KeyModifiers modifiers);
|
||||
|
||||
// Defined in AppKeyBindingsSerialization.cpp
|
||||
void LayerJson(const Json::Value& json);
|
||||
Json::Value ToJson();
|
||||
|
||||
// clang-format off
|
||||
DECLARE_EVENT(CopyText, _CopyTextHandlers, TerminalApp::CopyTextEventArgs);
|
||||
DECLARE_EVENT(PasteText, _PasteTextHandlers, TerminalApp::PasteTextEventArgs);
|
||||
DECLARE_EVENT(NewTab, _NewTabHandlers, TerminalApp::NewTabEventArgs);
|
||||
DECLARE_EVENT(DuplicateTab, _DuplicateTabHandlers, TerminalApp::DuplicateTabEventArgs);
|
||||
DECLARE_EVENT(NewTabWithProfile, _NewTabWithProfileHandlers, TerminalApp::NewTabWithProfileEventArgs);
|
||||
DECLARE_EVENT(NewWindow, _NewWindowHandlers, TerminalApp::NewWindowEventArgs);
|
||||
DECLARE_EVENT(CloseWindow, _CloseWindowHandlers, TerminalApp::CloseWindowEventArgs);
|
||||
DECLARE_EVENT(CloseTab, _CloseTabHandlers, TerminalApp::CloseTabEventArgs);
|
||||
DECLARE_EVENT(SwitchToTab, _SwitchToTabHandlers, TerminalApp::SwitchToTabEventArgs);
|
||||
DECLARE_EVENT(NextTab, _NextTabHandlers, TerminalApp::NextTabEventArgs);
|
||||
DECLARE_EVENT(PrevTab, _PrevTabHandlers, TerminalApp::PrevTabEventArgs);
|
||||
DECLARE_EVENT(SplitVertical, _SplitVerticalHandlers, TerminalApp::SplitVerticalEventArgs);
|
||||
DECLARE_EVENT(SplitHorizontal, _SplitHorizontalHandlers, TerminalApp::SplitHorizontalEventArgs);
|
||||
DECLARE_EVENT(IncreaseFontSize, _IncreaseFontSizeHandlers, TerminalApp::IncreaseFontSizeEventArgs);
|
||||
DECLARE_EVENT(DecreaseFontSize, _DecreaseFontSizeHandlers, TerminalApp::DecreaseFontSizeEventArgs);
|
||||
DECLARE_EVENT(ScrollUp, _ScrollUpHandlers, TerminalApp::ScrollUpEventArgs);
|
||||
DECLARE_EVENT(ScrollDown, _ScrollDownHandlers, TerminalApp::ScrollDownEventArgs);
|
||||
DECLARE_EVENT(ScrollUpPage, _ScrollUpPageHandlers, TerminalApp::ScrollUpPageEventArgs);
|
||||
DECLARE_EVENT(ScrollDownPage, _ScrollDownPageHandlers, TerminalApp::ScrollDownPageEventArgs);
|
||||
DECLARE_EVENT(OpenSettings, _OpenSettingsHandlers, TerminalApp::OpenSettingsEventArgs);
|
||||
DECLARE_EVENT(ResizePane, _ResizePaneHandlers, TerminalApp::ResizePaneEventArgs);
|
||||
TYPED_EVENT(CopyText, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(PasteText, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(NewTab, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(OpenNewTabDropdown,TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(DuplicateTab, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(NewTabWithProfile, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(NewWindow, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(CloseWindow, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(CloseTab, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(ClosePane, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(SwitchToTab, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(NextTab, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(PrevTab, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(SplitVertical, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(SplitHorizontal, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(IncreaseFontSize, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(DecreaseFontSize, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(ScrollUp, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(ScrollDown, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(ScrollUpPage, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(ScrollDownPage, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(OpenSettings, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(ResizePane, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
TYPED_EVENT(MoveFocus, TerminalApp::AppKeyBindings, TerminalApp::ActionEventArgs);
|
||||
// clang-format on
|
||||
|
||||
private:
|
||||
std::unordered_map<winrt::Microsoft::Terminal::Settings::KeyChord, TerminalApp::ShortcutAction, KeyChordHash, KeyChordEquality> _keyShortcuts;
|
||||
bool _DoAction(ShortcutAction action);
|
||||
|
||||
friend class TerminalAppLocalTests::SettingsTests;
|
||||
friend class TerminalAppLocalTests::KeyBindingsTests;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,17 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import "../ActionArgs.idl";
|
||||
|
||||
namespace TerminalApp
|
||||
{
|
||||
enum Direction
|
||||
{
|
||||
Left = 0,
|
||||
Right,
|
||||
Up,
|
||||
Down
|
||||
};
|
||||
|
||||
enum ShortcutAction
|
||||
{
|
||||
CopyText = 0,
|
||||
Invalid = 0,
|
||||
CopyText,
|
||||
CopyTextWithoutNewlines,
|
||||
PasteText,
|
||||
NewTab,
|
||||
OpenNewTabDropdown,
|
||||
DuplicateTab,
|
||||
NewTabProfile0,
|
||||
NewTabProfile1,
|
||||
@@ -30,6 +25,7 @@ namespace TerminalApp
|
||||
NewWindow,
|
||||
CloseWindow,
|
||||
CloseTab,
|
||||
ClosePane,
|
||||
NextTab,
|
||||
PrevTab,
|
||||
SplitVertical,
|
||||
@@ -53,59 +49,44 @@ namespace TerminalApp
|
||||
ResizePaneRight,
|
||||
ResizePaneUp,
|
||||
ResizePaneDown,
|
||||
MoveFocusLeft,
|
||||
MoveFocusRight,
|
||||
MoveFocusUp,
|
||||
MoveFocusDown,
|
||||
OpenSettings
|
||||
};
|
||||
|
||||
delegate void CopyTextEventArgs(Boolean trimWhitespace);
|
||||
delegate void PasteTextEventArgs();
|
||||
delegate void NewTabEventArgs();
|
||||
delegate void DuplicateTabEventArgs();
|
||||
delegate void NewTabWithProfileEventArgs(Int32 profileIndex);
|
||||
delegate void NewWindowEventArgs();
|
||||
delegate void CloseWindowEventArgs();
|
||||
delegate void CloseTabEventArgs();
|
||||
delegate void NextTabEventArgs();
|
||||
delegate void PrevTabEventArgs();
|
||||
delegate void SplitVerticalEventArgs();
|
||||
delegate void SplitHorizontalEventArgs();
|
||||
delegate void SwitchToTabEventArgs(Int32 profileIndex);
|
||||
delegate void IncreaseFontSizeEventArgs();
|
||||
delegate void DecreaseFontSizeEventArgs();
|
||||
delegate void ScrollUpEventArgs();
|
||||
delegate void ScrollDownEventArgs();
|
||||
delegate void ScrollUpPageEventArgs();
|
||||
delegate void ScrollDownPageEventArgs();
|
||||
delegate void OpenSettingsEventArgs();
|
||||
delegate void ResizePaneEventArgs(Direction direction);
|
||||
|
||||
[default_interface]
|
||||
runtimeclass AppKeyBindings : Microsoft.Terminal.Settings.IKeyBindings
|
||||
[default_interface] runtimeclass AppKeyBindings : Microsoft.Terminal.Settings.IKeyBindings
|
||||
{
|
||||
AppKeyBindings();
|
||||
|
||||
void SetKeyBinding(ShortcutAction action, Microsoft.Terminal.Settings.KeyChord chord);
|
||||
void ClearKeyBinding(Microsoft.Terminal.Settings.KeyChord chord);
|
||||
Microsoft.Terminal.Settings.KeyChord GetKeyBinding(ShortcutAction action);
|
||||
|
||||
event CopyTextEventArgs CopyText;
|
||||
event PasteTextEventArgs PasteText;
|
||||
event NewTabEventArgs NewTab;
|
||||
event DuplicateTabEventArgs DuplicateTab;
|
||||
event NewTabWithProfileEventArgs NewTabWithProfile;
|
||||
event NewWindowEventArgs NewWindow;
|
||||
event CloseWindowEventArgs CloseWindow;
|
||||
event CloseTabEventArgs CloseTab;
|
||||
event SwitchToTabEventArgs SwitchToTab;
|
||||
event NextTabEventArgs NextTab;
|
||||
event PrevTabEventArgs PrevTab;
|
||||
event SplitVerticalEventArgs SplitVertical;
|
||||
event SplitHorizontalEventArgs SplitHorizontal;
|
||||
event IncreaseFontSizeEventArgs IncreaseFontSize;
|
||||
event DecreaseFontSizeEventArgs DecreaseFontSize;
|
||||
event ScrollUpEventArgs ScrollUp;
|
||||
event ScrollDownEventArgs ScrollDown;
|
||||
event ScrollUpPageEventArgs ScrollUpPage;
|
||||
event ScrollDownPageEventArgs ScrollDownPage;
|
||||
event OpenSettingsEventArgs OpenSettings;
|
||||
event ResizePaneEventArgs ResizePane;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> CopyText;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> PasteText;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> NewTab;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> OpenNewTabDropdown;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> DuplicateTab;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> NewTabWithProfile;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> NewWindow;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> CloseWindow;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> CloseTab;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> ClosePane;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> SwitchToTab;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> NextTab;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> PrevTab;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> SplitVertical;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> SplitHorizontal;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> IncreaseFontSize;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> DecreaseFontSize;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> ScrollUp;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> ScrollDown;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> ScrollUpPage;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> ScrollDownPage;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> OpenSettings;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> ResizePane;
|
||||
event Windows.Foundation.TypedEventHandler<AppKeyBindings, ActionEventArgs> MoveFocus;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
// - A couple helper functions for serializing/deserializing an AppKeyBindings
|
||||
// to/from json.
|
||||
//
|
||||
// Author(s):
|
||||
// - Mike Griese - May 2019
|
||||
|
||||
#include "pch.h"
|
||||
#include "AppKeyBindingsSerialization.h"
|
||||
#include "AppKeyBindings.h"
|
||||
#include "KeyChordSerialization.h"
|
||||
#include "Utils.h"
|
||||
#include "JsonUtils.h"
|
||||
#include <winrt/Microsoft.Terminal.Settings.h>
|
||||
|
||||
using namespace winrt::Microsoft::Terminal::Settings;
|
||||
@@ -13,10 +19,14 @@ using namespace winrt::TerminalApp;
|
||||
static constexpr std::string_view KeysKey{ "keys" };
|
||||
static constexpr std::string_view CommandKey{ "command" };
|
||||
|
||||
// This key is reserved to remove a keybinding, instead of mapping it to an action.
|
||||
static constexpr std::string_view UnboundKey{ "unbound" };
|
||||
|
||||
static constexpr std::string_view CopyTextKey{ "copy" };
|
||||
static constexpr std::string_view CopyTextWithoutNewlinesKey{ "copyTextWithoutNewlines" };
|
||||
static constexpr std::string_view PasteTextKey{ "paste" };
|
||||
static constexpr std::string_view NewTabKey{ "newTab" };
|
||||
static constexpr std::string_view OpenNewTabDropdownKey{ "openNewTabDropdown" };
|
||||
static constexpr std::string_view DuplicateTabKey{ "duplicateTab" };
|
||||
static constexpr std::string_view NewTabWithProfile0Key{ "newTabProfile0" };
|
||||
static constexpr std::string_view NewTabWithProfile1Key{ "newTabProfile1" };
|
||||
@@ -30,6 +40,7 @@ static constexpr std::string_view NewTabWithProfile8Key{ "newTabProfile8" };
|
||||
static constexpr std::string_view NewWindowKey{ "newWindow" };
|
||||
static constexpr std::string_view CloseWindowKey{ "closeWindow" };
|
||||
static constexpr std::string_view CloseTabKey{ "closeTab" };
|
||||
static constexpr std::string_view ClosePaneKey{ "closePane" };
|
||||
static constexpr std::string_view SwitchtoTabKey{ "switchToTab" };
|
||||
static constexpr std::string_view NextTabKey{ "nextTab" };
|
||||
static constexpr std::string_view PrevTabKey{ "prevTab" };
|
||||
@@ -55,6 +66,10 @@ static constexpr std::string_view ResizePaneLeftKey{ "resizePaneLeft" };
|
||||
static constexpr std::string_view ResizePaneRightKey{ "resizePaneRight" };
|
||||
static constexpr std::string_view ResizePaneUpKey{ "resizePaneUp" };
|
||||
static constexpr std::string_view ResizePaneDownKey{ "resizePaneDown" };
|
||||
static constexpr std::string_view MoveFocusLeftKey{ "moveFocusLeft" };
|
||||
static constexpr std::string_view MoveFocusRightKey{ "moveFocusRight" };
|
||||
static constexpr std::string_view MoveFocusUpKey{ "moveFocusUp" };
|
||||
static constexpr std::string_view MoveFocusDownKey{ "moveFocusDown" };
|
||||
|
||||
// Specifically use a map here over an unordered_map. We want to be able to
|
||||
// iterate over these entries in-order when we're serializing the keybindings.
|
||||
@@ -69,6 +84,7 @@ static const std::map<std::string_view, ShortcutAction, std::less<>> commandName
|
||||
{ CopyTextWithoutNewlinesKey, ShortcutAction::CopyTextWithoutNewlines },
|
||||
{ PasteTextKey, ShortcutAction::PasteText },
|
||||
{ NewTabKey, ShortcutAction::NewTab },
|
||||
{ OpenNewTabDropdownKey, ShortcutAction::OpenNewTabDropdown },
|
||||
{ DuplicateTabKey, ShortcutAction::DuplicateTab },
|
||||
{ NewTabWithProfile0Key, ShortcutAction::NewTabProfile0 },
|
||||
{ NewTabWithProfile1Key, ShortcutAction::NewTabProfile1 },
|
||||
@@ -82,6 +98,7 @@ static const std::map<std::string_view, ShortcutAction, std::less<>> commandName
|
||||
{ NewWindowKey, ShortcutAction::NewWindow },
|
||||
{ CloseWindowKey, ShortcutAction::CloseWindow },
|
||||
{ CloseTabKey, ShortcutAction::CloseTab },
|
||||
{ ClosePaneKey, ShortcutAction::ClosePane },
|
||||
{ NextTabKey, ShortcutAction::NextTab },
|
||||
{ PrevTabKey, ShortcutAction::PrevTab },
|
||||
{ IncreaseFontSizeKey, ShortcutAction::IncreaseFontSize },
|
||||
@@ -105,7 +122,12 @@ static const std::map<std::string_view, ShortcutAction, std::less<>> commandName
|
||||
{ ResizePaneRightKey, ShortcutAction::ResizePaneRight },
|
||||
{ ResizePaneUpKey, ShortcutAction::ResizePaneUp },
|
||||
{ ResizePaneDownKey, ShortcutAction::ResizePaneDown },
|
||||
{ MoveFocusLeftKey, ShortcutAction::MoveFocusLeft },
|
||||
{ MoveFocusRightKey, ShortcutAction::MoveFocusRight },
|
||||
{ MoveFocusUpKey, ShortcutAction::MoveFocusUp },
|
||||
{ MoveFocusDownKey, ShortcutAction::MoveFocusDown },
|
||||
{ OpenSettingsKey, ShortcutAction::OpenSettings },
|
||||
{ UnboundKey, ShortcutAction::Invalid },
|
||||
};
|
||||
|
||||
// Function Description:
|
||||
@@ -145,7 +167,7 @@ static Json::Value _ShortcutAsJsonObject(const KeyChord& chord,
|
||||
// ShortcutAction.
|
||||
// Return Value:
|
||||
// - a Json::Value which is an equivalent serialization of this object.
|
||||
Json::Value AppKeyBindingsSerialization::ToJson(const winrt::TerminalApp::AppKeyBindings& bindings)
|
||||
Json::Value winrt::TerminalApp::implementation::AppKeyBindings::ToJson()
|
||||
{
|
||||
Json::Value bindingsArray;
|
||||
|
||||
@@ -156,7 +178,7 @@ Json::Value AppKeyBindingsSerialization::ToJson(const winrt::TerminalApp::AppKey
|
||||
const auto searchedForName = actionName.first;
|
||||
const auto searchedForAction = actionName.second;
|
||||
|
||||
if (const auto chord{ bindings.GetKeyBinding(searchedForAction) })
|
||||
if (const auto chord{ GetKeyBinding(searchedForAction) })
|
||||
{
|
||||
if (const auto serialization{ _ShortcutAsJsonObject(chord, searchedForName) })
|
||||
{
|
||||
@@ -175,53 +197,71 @@ Json::Value AppKeyBindingsSerialization::ToJson(const winrt::TerminalApp::AppKey
|
||||
// listed in `commandNames`, and `keys` is an array of keypresses. Currently,
|
||||
// the array should contain a single string, which can be deserialized into a
|
||||
// KeyChord.
|
||||
// - Applies the deserialized keybindings to the provided `bindings` object. If
|
||||
// a key chord in `json` is already bound to an action, that chord will be
|
||||
// overwritten with the new action. If a chord is bound to `null` or
|
||||
// `"unbound"`, then we'll clear the keybinding from the existing keybindings.
|
||||
// Arguments:
|
||||
// - json: and array of JsonObject's to deserialize into our _keyShortcuts mapping.
|
||||
// Return Value:
|
||||
// - the newly constructed AppKeyBindings object.
|
||||
winrt::TerminalApp::AppKeyBindings AppKeyBindingsSerialization::FromJson(const Json::Value& json)
|
||||
void winrt::TerminalApp::implementation::AppKeyBindings::LayerJson(const Json::Value& json)
|
||||
{
|
||||
winrt::TerminalApp::AppKeyBindings newBindings{};
|
||||
|
||||
for (const auto& value : json)
|
||||
{
|
||||
if (value.isObject())
|
||||
if (!value.isObject())
|
||||
{
|
||||
const auto commandString = value[JsonKey(CommandKey)];
|
||||
const auto keys = value[JsonKey(KeysKey)];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (commandString && keys)
|
||||
const auto commandVal = value[JsonKey(CommandKey)];
|
||||
const auto keys = value[JsonKey(KeysKey)];
|
||||
|
||||
if (keys)
|
||||
{
|
||||
if (!keys.isArray() || keys.size() != 1)
|
||||
{
|
||||
if (!keys.isArray() || keys.size() != 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const auto keyChordString = winrt::to_hstring(keys[0].asString());
|
||||
ShortcutAction action;
|
||||
continue;
|
||||
}
|
||||
const auto keyChordString = winrt::to_hstring(keys[0].asString());
|
||||
// Invalid is our placeholder that the action was not parsed.
|
||||
ShortcutAction action = ShortcutAction::Invalid;
|
||||
|
||||
// Try matching the command to one we have
|
||||
const auto found = commandNames.find(commandString.asString());
|
||||
// Only try to parse the action if it's actually a string value.
|
||||
// `null` will not pass this check.
|
||||
if (commandVal.isString())
|
||||
{
|
||||
auto commandString = commandVal.asString();
|
||||
|
||||
// Try matching the command to one we have. If we can't find the
|
||||
// action name in our list of names, let's just unbind that key.
|
||||
const auto found = commandNames.find(commandString);
|
||||
if (found != commandNames.end())
|
||||
{
|
||||
action = found->second;
|
||||
}
|
||||
}
|
||||
|
||||
// Try parsing the chord
|
||||
try
|
||||
{
|
||||
const auto chord = KeyChordSerialization::FromString(keyChordString);
|
||||
|
||||
// If we couldn't find the action they want to set the chord to,
|
||||
// or the action was `null` or `"unbound"`, just clear out the
|
||||
// keybinding. Otherwise, set the keybinding to the action we
|
||||
// found.
|
||||
if (action != ShortcutAction::Invalid)
|
||||
{
|
||||
SetKeyBinding(action, chord);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try parsing the chord
|
||||
try
|
||||
{
|
||||
const auto chord = KeyChordSerialization::FromString(keyChordString);
|
||||
newBindings.SetKeyBinding(action, chord);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
continue;
|
||||
ClearKeyBinding(chord);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return newBindings;
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
//
|
||||
// Module Name:
|
||||
// - AppKeyBindingsSerialization.h
|
||||
//
|
||||
// Abstract:
|
||||
// - A couple helper functions for serializing/deserializing an AppKeyBindings
|
||||
// to/from json. We need this to exist as external helper functions, rather
|
||||
// than defining these as methods on the AppKeyBindings class, because
|
||||
// AppKeyBindings is a winrt type. When we're working with a AppKeyBindings
|
||||
// object, we only have access to methods defined on the winrt interface (in
|
||||
// the idl). We don't have access to methods we define on the
|
||||
// implementation. Since JsonValue is not a winrt type, we can't define any
|
||||
// methods that operate on it in the idl.
|
||||
//
|
||||
// Author(s):
|
||||
// - Mike Griese - May 2019
|
||||
|
||||
#pragma once
|
||||
#include "AppKeyBindings.h"
|
||||
|
||||
class AppKeyBindingsSerialization final
|
||||
{
|
||||
public:
|
||||
static winrt::TerminalApp::AppKeyBindings FromJson(const Json::Value& json);
|
||||
static Json::Value ToJson(const winrt::TerminalApp::AppKeyBindings& bindings);
|
||||
};
|
||||
48
src/cascadia/TerminalApp/AzureCloudShellGenerator.cpp
Normal file
48
src/cascadia/TerminalApp/AzureCloudShellGenerator.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include <winrt/Microsoft.Terminal.TerminalConnection.h>
|
||||
|
||||
#include "AzureCloudShellGenerator.h"
|
||||
#include "LegacyProfileGeneratorNamespaces.h"
|
||||
|
||||
#include "../../types/inc/utils.hpp"
|
||||
#include "../../inc/DefaultSettings.h"
|
||||
#include "Utils.h"
|
||||
#include "DefaultProfileUtils.h"
|
||||
|
||||
using namespace ::TerminalApp;
|
||||
|
||||
std::wstring_view AzureCloudShellGenerator::GetNamespace()
|
||||
{
|
||||
return AzureGeneratorNamespace;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Checks if the Azure Cloud shell is available on this platform, and if it
|
||||
// is, creates a profile to be able to launch it.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - a vector with the Azure Cloud Shell connection profile, if available.
|
||||
std::vector<TerminalApp::Profile> AzureCloudShellGenerator::GenerateProfiles()
|
||||
{
|
||||
std::vector<TerminalApp::Profile> profiles;
|
||||
|
||||
if (winrt::Microsoft::Terminal::TerminalConnection::AzureConnection::IsAzureConnectionAvailable())
|
||||
{
|
||||
auto azureCloudShellProfile{ CreateDefaultProfile(L"Azure Cloud Shell") };
|
||||
azureCloudShellProfile.SetCommandline(L"Azure");
|
||||
azureCloudShellProfile.SetStartingDirectory(DEFAULT_STARTING_DIRECTORY);
|
||||
azureCloudShellProfile.SetColorScheme({ L"Vintage" });
|
||||
azureCloudShellProfile.SetAcrylicOpacity(0.6);
|
||||
azureCloudShellProfile.SetUseAcrylic(true);
|
||||
azureCloudShellProfile.SetCloseOnExit(false);
|
||||
azureCloudShellProfile.SetConnectionType(AzureConnectionType);
|
||||
profiles.emplace_back(azureCloudShellProfile);
|
||||
}
|
||||
|
||||
return profiles;
|
||||
}
|
||||
34
src/cascadia/TerminalApp/AzureCloudShellGenerator.h
Normal file
34
src/cascadia/TerminalApp/AzureCloudShellGenerator.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation
|
||||
Licensed under the MIT license.
|
||||
|
||||
Module Name:
|
||||
- AzureCloudShellGenerator
|
||||
|
||||
Abstract:
|
||||
- This is the dynamic profile generator for the azure cloud shell connector.
|
||||
Checks if the Azure Cloud shell is available on this platform, and if it is,
|
||||
creates a profile to be able to launch it.
|
||||
|
||||
Author(s):
|
||||
- Mike Griese - August 2019
|
||||
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
#include "IDynamicProfileGenerator.h"
|
||||
|
||||
static constexpr GUID AzureConnectionType = { 0xd9fcfdfa, 0xa479, 0x412c, { 0x83, 0xb7, 0xc5, 0x64, 0xe, 0x61, 0xcd, 0x62 } };
|
||||
|
||||
namespace TerminalApp
|
||||
{
|
||||
class AzureCloudShellGenerator : public TerminalApp::IDynamicProfileGenerator
|
||||
{
|
||||
public:
|
||||
AzureCloudShellGenerator() = default;
|
||||
~AzureCloudShellGenerator() = default;
|
||||
std::wstring_view GetNamespace() override;
|
||||
|
||||
std::vector<TerminalApp::Profile> GenerateProfiles() override;
|
||||
};
|
||||
};
|
||||
@@ -9,6 +9,11 @@
|
||||
#include "CascadiaSettings.h"
|
||||
#include "../../types/inc/utils.hpp"
|
||||
#include "../../inc/DefaultSettings.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#include "PowershellCoreProfileGenerator.h"
|
||||
#include "WslDistroGenerator.h"
|
||||
#include "AzureCloudShellGenerator.h"
|
||||
|
||||
using namespace winrt::Microsoft::Terminal::Settings;
|
||||
using namespace ::TerminalApp;
|
||||
@@ -16,383 +21,30 @@ using namespace winrt::Microsoft::Terminal::TerminalControl;
|
||||
using namespace winrt::TerminalApp;
|
||||
using namespace Microsoft::Console;
|
||||
|
||||
// {2bde4a90-d05f-401c-9492-e40884ead1d8}
|
||||
// uuidv5 properties: name format is UTF-16LE bytes
|
||||
static constexpr GUID TERMINAL_PROFILE_NAMESPACE_GUID = { 0x2bde4a90, 0xd05f, 0x401c, { 0x94, 0x92, 0xe4, 0x8, 0x84, 0xea, 0xd1, 0xd8 } };
|
||||
|
||||
static constexpr std::wstring_view PACKAGED_PROFILE_ICON_PATH{ L"ms-appx:///ProfileIcons/" };
|
||||
|
||||
static constexpr std::wstring_view PACKAGED_PROFILE_ICON_EXTENSION{ L".png" };
|
||||
static constexpr std::wstring_view DEFAULT_LINUX_ICON_GUID{ L"{9acb9455-ca41-5af7-950f-6bca1bc9722f}" };
|
||||
|
||||
CascadiaSettings::CascadiaSettings() :
|
||||
_globals{},
|
||||
_profiles{}
|
||||
CascadiaSettings(true)
|
||||
{
|
||||
}
|
||||
|
||||
CascadiaSettings::~CascadiaSettings()
|
||||
{
|
||||
}
|
||||
|
||||
ColorScheme _CreateCampbellScheme()
|
||||
{
|
||||
ColorScheme campbellScheme{ L"Campbell",
|
||||
RGB(204, 204, 204),
|
||||
RGB(12, 12, 12) };
|
||||
auto& campbellTable = campbellScheme.GetTable();
|
||||
auto campbellSpan = gsl::span<COLORREF>(&campbellTable[0], gsl::narrow<ptrdiff_t>(COLOR_TABLE_SIZE));
|
||||
Utils::InitializeCampbellColorTable(campbellSpan);
|
||||
Utils::SetColorTableAlpha(campbellSpan, 0xff);
|
||||
|
||||
return campbellScheme;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
|
||||
ColorScheme _CreateVintageScheme()
|
||||
{
|
||||
// as per https://github.com/microsoft/terminal/issues/1781
|
||||
ColorScheme vintageScheme { L"Vintage",
|
||||
RGB(192, 192, 192),
|
||||
RGB( 0, 0, 0) };
|
||||
auto& vintageTable = vintageScheme.GetTable();
|
||||
auto vintageSpan = gsl::span<COLORREF>(&vintageTable[0], gsl::narrow<ptrdiff_t>(COLOR_TABLE_SIZE));
|
||||
vintageTable[0] = RGB( 0, 0, 0); // black
|
||||
vintageTable[1] = RGB(128, 0, 0); // dark red
|
||||
vintageTable[2] = RGB( 0, 128, 0); // dark green
|
||||
vintageTable[3] = RGB(128, 128, 0); // dark yellow
|
||||
vintageTable[4] = RGB( 0, 0, 128); // dark blue
|
||||
vintageTable[5] = RGB(128, 0, 128); // dark magenta
|
||||
vintageTable[6] = RGB( 0, 128, 128); // dark cyan
|
||||
vintageTable[7] = RGB(192, 192, 192); // gray
|
||||
vintageTable[8] = RGB(128, 128, 128); // dark gray
|
||||
vintageTable[9] = RGB(255, 0, 0); // red
|
||||
vintageTable[10] = RGB( 0, 255, 0); // green
|
||||
vintageTable[11] = RGB(255, 255, 0); // yellow
|
||||
vintageTable[12] = RGB( 0, 0, 255); // blue
|
||||
vintageTable[13] = RGB(255, 0, 255); // magenta
|
||||
vintageTable[14] = RGB( 0, 255, 255); // cyan
|
||||
vintageTable[15] = RGB(255, 255, 255); // white
|
||||
Utils::SetColorTableAlpha(vintageSpan, 0xff);
|
||||
|
||||
return vintageScheme;
|
||||
}
|
||||
|
||||
ColorScheme _CreateOneHalfDarkScheme()
|
||||
{
|
||||
// First 8 dark colors per: https://github.com/sonph/onehalf/blob/master/putty/onehalf-dark.reg
|
||||
// Dark gray is per colortool scheme, the other 7 of the last 8 colors from the colortool
|
||||
// scheme are the same as their dark color equivalents.
|
||||
ColorScheme oneHalfDarkScheme { L"One Half Dark",
|
||||
RGB(220, 223, 228),
|
||||
RGB( 40, 44, 52) };
|
||||
auto& oneHalfDarkTable = oneHalfDarkScheme.GetTable();
|
||||
auto oneHalfDarkSpan = gsl::span<COLORREF>(&oneHalfDarkTable[0], gsl::narrow<ptrdiff_t>(COLOR_TABLE_SIZE));
|
||||
oneHalfDarkTable[0] = RGB( 40, 44, 52); // black
|
||||
oneHalfDarkTable[1] = RGB(224, 108, 117); // dark red
|
||||
oneHalfDarkTable[2] = RGB(152, 195, 121); // dark green
|
||||
oneHalfDarkTable[3] = RGB(229, 192, 123); // dark yellow
|
||||
oneHalfDarkTable[4] = RGB( 97, 175, 239); // dark blue
|
||||
oneHalfDarkTable[5] = RGB(198, 120, 221); // dark magenta
|
||||
oneHalfDarkTable[6] = RGB( 86, 182, 194); // dark cyan
|
||||
oneHalfDarkTable[7] = RGB(220, 223, 228); // gray
|
||||
oneHalfDarkTable[8] = RGB( 90, 99, 116); // dark gray
|
||||
oneHalfDarkTable[9] = RGB(224, 108, 117); // red
|
||||
oneHalfDarkTable[10] = RGB(152, 195, 121); // green
|
||||
oneHalfDarkTable[11] = RGB(229, 192, 123); // yellow
|
||||
oneHalfDarkTable[12] = RGB( 97, 175, 239); // blue
|
||||
oneHalfDarkTable[13] = RGB(198, 120, 221); // magenta
|
||||
oneHalfDarkTable[14] = RGB( 86, 182, 194); // cyan
|
||||
oneHalfDarkTable[15] = RGB(220, 223, 228); // white
|
||||
Utils::SetColorTableAlpha(oneHalfDarkSpan, 0xff);
|
||||
|
||||
return oneHalfDarkScheme;
|
||||
}
|
||||
|
||||
ColorScheme _CreateOneHalfLightScheme()
|
||||
{
|
||||
// First 8 dark colors per: https://github.com/sonph/onehalf/blob/master/putty/onehalf-light.reg
|
||||
// Last 8 colors per colortool scheme.
|
||||
ColorScheme oneHalfLightScheme { L"One Half Light",
|
||||
RGB(56, 58, 66),
|
||||
RGB(250, 250, 250) };
|
||||
auto& oneHalfLightTable = oneHalfLightScheme.GetTable();
|
||||
auto oneHalfLightSpan = gsl::span<COLORREF>(&oneHalfLightTable[0], gsl::narrow<ptrdiff_t>(COLOR_TABLE_SIZE));
|
||||
oneHalfLightTable[0] = RGB( 56, 58, 66); // black
|
||||
oneHalfLightTable[1] = RGB(228, 86, 73); // dark red
|
||||
oneHalfLightTable[2] = RGB( 80, 161, 79); // dark green
|
||||
oneHalfLightTable[3] = RGB(193, 131, 1); // dark yellow
|
||||
oneHalfLightTable[4] = RGB( 1, 132, 188); // dark blue
|
||||
oneHalfLightTable[5] = RGB(166, 38, 164); // dark magenta
|
||||
oneHalfLightTable[6] = RGB( 9, 151, 179); // dark cyan
|
||||
oneHalfLightTable[7] = RGB(250, 250, 250); // gray
|
||||
oneHalfLightTable[8] = RGB( 79, 82, 93); // dark gray
|
||||
oneHalfLightTable[9] = RGB(223, 108, 117); // red
|
||||
oneHalfLightTable[10] = RGB(152, 195, 121); // green
|
||||
oneHalfLightTable[11] = RGB(228, 192, 122); // yellow
|
||||
oneHalfLightTable[12] = RGB( 97, 175, 239); // blue
|
||||
oneHalfLightTable[13] = RGB(197, 119, 221); // magenta
|
||||
oneHalfLightTable[14] = RGB( 86, 181, 193); // cyan
|
||||
oneHalfLightTable[15] = RGB(255, 255, 255); // white
|
||||
Utils::SetColorTableAlpha(oneHalfLightSpan, 0xff);
|
||||
|
||||
return oneHalfLightScheme;
|
||||
}
|
||||
|
||||
ColorScheme _CreateSolarizedDarkScheme()
|
||||
{
|
||||
ColorScheme solarizedDarkScheme { L"Solarized Dark",
|
||||
RGB(131, 148, 150),
|
||||
RGB( 0, 43, 54) };
|
||||
auto& solarizedDarkTable = solarizedDarkScheme.GetTable();
|
||||
auto solarizedDarkSpan = gsl::span<COLORREF>(&solarizedDarkTable[0], gsl::narrow<ptrdiff_t>(COLOR_TABLE_SIZE));
|
||||
solarizedDarkTable[0] = RGB( 7, 54, 66);
|
||||
solarizedDarkTable[1] = RGB(220, 50, 47);
|
||||
solarizedDarkTable[2] = RGB(133, 153, 0);
|
||||
solarizedDarkTable[3] = RGB(181, 137, 0);
|
||||
solarizedDarkTable[4] = RGB( 38, 139, 210);
|
||||
solarizedDarkTable[5] = RGB(211, 54, 130);
|
||||
solarizedDarkTable[6] = RGB( 42, 161, 152);
|
||||
solarizedDarkTable[7] = RGB(238, 232, 213);
|
||||
solarizedDarkTable[8] = RGB( 0, 43, 54);
|
||||
solarizedDarkTable[9] = RGB(203, 75, 22);
|
||||
solarizedDarkTable[10] = RGB( 88, 110, 117);
|
||||
solarizedDarkTable[11] = RGB(101, 123, 131);
|
||||
solarizedDarkTable[12] = RGB(131, 148, 150);
|
||||
solarizedDarkTable[13] = RGB(108, 113, 196);
|
||||
solarizedDarkTable[14] = RGB(147, 161, 161);
|
||||
solarizedDarkTable[15] = RGB(253, 246, 227);
|
||||
Utils::SetColorTableAlpha(solarizedDarkSpan, 0xff);
|
||||
|
||||
return solarizedDarkScheme;
|
||||
}
|
||||
|
||||
ColorScheme _CreateSolarizedLightScheme()
|
||||
{
|
||||
ColorScheme solarizedLightScheme { L"Solarized Light",
|
||||
RGB(101, 123, 131),
|
||||
RGB(253, 246, 227) };
|
||||
auto& solarizedLightTable = solarizedLightScheme.GetTable();
|
||||
auto solarizedLightSpan = gsl::span<COLORREF>(&solarizedLightTable[0], gsl::narrow<ptrdiff_t>(COLOR_TABLE_SIZE));
|
||||
solarizedLightTable[0] = RGB( 7, 54, 66);
|
||||
solarizedLightTable[1] = RGB(220, 50, 47);
|
||||
solarizedLightTable[2] = RGB(133, 153, 0);
|
||||
solarizedLightTable[3] = RGB(181, 137, 0);
|
||||
solarizedLightTable[4] = RGB( 38, 139, 210);
|
||||
solarizedLightTable[5] = RGB(211, 54, 130);
|
||||
solarizedLightTable[6] = RGB( 42, 161, 152);
|
||||
solarizedLightTable[7] = RGB(238, 232, 213);
|
||||
solarizedLightTable[8] = RGB( 0, 43, 54);
|
||||
solarizedLightTable[9] = RGB(203, 75, 22);
|
||||
solarizedLightTable[10] = RGB( 88, 110, 117);
|
||||
solarizedLightTable[11] = RGB(101, 123, 131);
|
||||
solarizedLightTable[12] = RGB(131, 148, 150);
|
||||
solarizedLightTable[13] = RGB(108, 113, 196);
|
||||
solarizedLightTable[14] = RGB(147, 161, 161);
|
||||
solarizedLightTable[15] = RGB(253, 246, 227);
|
||||
Utils::SetColorTableAlpha(solarizedLightSpan, 0xff);
|
||||
|
||||
return solarizedLightScheme;
|
||||
}
|
||||
|
||||
// clang-format on
|
||||
|
||||
// Method Description:
|
||||
// - Create the set of schemes to use as the default schemes. Currently creates
|
||||
// five default color schemes - Campbell (the new cmd color scheme),
|
||||
// One Half Dark, One Half Light, Solarized Dark, and Solarized Light.
|
||||
// Constructor Description:
|
||||
// - Creates a new settings object. If addDynamicProfiles is true, we'll
|
||||
// automatically add the built-in profile generators to our list of profile
|
||||
// generators. Set this to `false` for unit testing.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CascadiaSettings::_CreateDefaultSchemes()
|
||||
// - addDynamicProfiles: if true, we'll add the built-in DPGs.
|
||||
CascadiaSettings::CascadiaSettings(const bool addDynamicProfiles)
|
||||
{
|
||||
_globals.GetColorSchemes().emplace_back(_CreateCampbellScheme());
|
||||
_globals.GetColorSchemes().emplace_back(_CreateVintageScheme());
|
||||
_globals.GetColorSchemes().emplace_back(_CreateOneHalfDarkScheme());
|
||||
_globals.GetColorSchemes().emplace_back(_CreateOneHalfLightScheme());
|
||||
_globals.GetColorSchemes().emplace_back(_CreateSolarizedDarkScheme());
|
||||
_globals.GetColorSchemes().emplace_back(_CreateSolarizedLightScheme());
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Create a set of profiles to use as the "default" profiles when initializing
|
||||
// the terminal. Currently, we create two or three profiles:
|
||||
// * one for cmd.exe
|
||||
// * one for powershell.exe (inbox Windows Powershell)
|
||||
// * if Powershell Core (pwsh.exe) is installed, we'll create another for
|
||||
// Powershell Core.
|
||||
void CascadiaSettings::_CreateDefaultProfiles()
|
||||
{
|
||||
auto cmdProfile{ _CreateDefaultProfile(L"cmd") };
|
||||
cmdProfile.SetFontFace(L"Consolas");
|
||||
cmdProfile.SetCommandline(L"cmd.exe");
|
||||
cmdProfile.SetStartingDirectory(DEFAULT_STARTING_DIRECTORY);
|
||||
cmdProfile.SetColorScheme({ L"Campbell" });
|
||||
cmdProfile.SetAcrylicOpacity(0.75);
|
||||
cmdProfile.SetUseAcrylic(true);
|
||||
|
||||
auto powershellProfile{ _CreateDefaultProfile(L"Windows PowerShell") };
|
||||
powershellProfile.SetCommandline(L"powershell.exe");
|
||||
powershellProfile.SetStartingDirectory(DEFAULT_STARTING_DIRECTORY);
|
||||
powershellProfile.SetColorScheme({ L"Campbell" });
|
||||
powershellProfile.SetDefaultBackground(POWERSHELL_BLUE);
|
||||
powershellProfile.SetUseAcrylic(false);
|
||||
|
||||
// If the user has installed PowerShell Core, we add PowerShell Core as a default.
|
||||
// PowerShell Core default folder is "%PROGRAMFILES%\PowerShell\[Version]\".
|
||||
std::filesystem::path psCoreCmdline{};
|
||||
if (_isPowerShellCoreInstalled(psCoreCmdline))
|
||||
if (addDynamicProfiles)
|
||||
{
|
||||
auto pwshProfile{ _CreateDefaultProfile(L"PowerShell Core") };
|
||||
pwshProfile.SetCommandline(psCoreCmdline);
|
||||
pwshProfile.SetStartingDirectory(DEFAULT_STARTING_DIRECTORY);
|
||||
pwshProfile.SetColorScheme({ L"Campbell" });
|
||||
|
||||
// If powershell core is installed, we'll use that as the default.
|
||||
// Otherwise, we'll use normal Windows Powershell as the default.
|
||||
_profiles.emplace_back(pwshProfile);
|
||||
_globals.SetDefaultProfile(pwshProfile.GetGuid());
|
||||
_profileGenerators.emplace_back(std::make_unique<PowershellCoreProfileGenerator>());
|
||||
_profileGenerators.emplace_back(std::make_unique<WslDistroGenerator>());
|
||||
_profileGenerators.emplace_back(std::make_unique<AzureCloudShellGenerator>());
|
||||
}
|
||||
else
|
||||
{
|
||||
_globals.SetDefaultProfile(powershellProfile.GetGuid());
|
||||
}
|
||||
|
||||
_profiles.emplace_back(powershellProfile);
|
||||
_profiles.emplace_back(cmdProfile);
|
||||
try
|
||||
{
|
||||
_AppendWslProfiles(_profiles);
|
||||
}
|
||||
CATCH_LOG()
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Set up some default keybindings for the terminal.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CascadiaSettings::_CreateDefaultKeybindings()
|
||||
{
|
||||
AppKeyBindings keyBindings = _globals.GetKeybindings();
|
||||
// Set up spme basic default keybindings
|
||||
// TODO:MSFT:20700157 read our settings from some source, and configure
|
||||
// keychord,action pairings from that file
|
||||
keyBindings.SetKeyBinding(ShortcutAction::NewTab,
|
||||
KeyChord{ KeyModifiers::Ctrl,
|
||||
static_cast<int>('T') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::DuplicateTab,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
static_cast<int>('D') });
|
||||
|
||||
keyBindings.SetKeyBinding(ShortcutAction::CloseTab,
|
||||
KeyChord{ KeyModifiers::Ctrl,
|
||||
static_cast<int>('W') });
|
||||
|
||||
keyBindings.SetKeyBinding(ShortcutAction::CopyText,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
static_cast<int>('C') });
|
||||
|
||||
keyBindings.SetKeyBinding(ShortcutAction::PasteText,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
static_cast<int>('V') });
|
||||
|
||||
keyBindings.SetKeyBinding(ShortcutAction::OpenSettings,
|
||||
KeyChord{ KeyModifiers::Ctrl,
|
||||
VK_OEM_COMMA });
|
||||
|
||||
keyBindings.SetKeyBinding(ShortcutAction::NextTab,
|
||||
KeyChord{ KeyModifiers::Ctrl,
|
||||
VK_TAB });
|
||||
|
||||
keyBindings.SetKeyBinding(ShortcutAction::PrevTab,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
VK_TAB });
|
||||
|
||||
// Yes these are offset by one.
|
||||
// Ideally, you'd want C-S-1 to open the _first_ profile, which is index 0
|
||||
keyBindings.SetKeyBinding(ShortcutAction::NewTabProfile0,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
static_cast<int>('1') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::NewTabProfile1,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
static_cast<int>('2') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::NewTabProfile2,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
static_cast<int>('3') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::NewTabProfile3,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
static_cast<int>('4') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::NewTabProfile4,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
static_cast<int>('5') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::NewTabProfile5,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
static_cast<int>('6') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::NewTabProfile6,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
static_cast<int>('7') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::NewTabProfile7,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
static_cast<int>('8') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::NewTabProfile8,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
static_cast<int>('9') });
|
||||
|
||||
keyBindings.SetKeyBinding(ShortcutAction::ScrollUp,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
VK_UP });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::ScrollDown,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
VK_DOWN });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::ScrollDownPage,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
VK_NEXT });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::ScrollUpPage,
|
||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||
VK_PRIOR });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab0,
|
||||
KeyChord{ KeyModifiers::Alt,
|
||||
static_cast<int>('1') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab1,
|
||||
KeyChord{ KeyModifiers::Alt,
|
||||
static_cast<int>('2') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab2,
|
||||
KeyChord{ KeyModifiers::Alt,
|
||||
static_cast<int>('3') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab3,
|
||||
KeyChord{ KeyModifiers::Alt,
|
||||
static_cast<int>('4') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab4,
|
||||
KeyChord{ KeyModifiers::Alt,
|
||||
static_cast<int>('5') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab5,
|
||||
KeyChord{ KeyModifiers::Alt,
|
||||
static_cast<int>('6') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab6,
|
||||
KeyChord{ KeyModifiers::Alt,
|
||||
static_cast<int>('7') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab7,
|
||||
KeyChord{ KeyModifiers::Alt,
|
||||
static_cast<int>('8') });
|
||||
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab8,
|
||||
KeyChord{ KeyModifiers::Alt,
|
||||
static_cast<int>('9') });
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Initialize this object with default color schemes, profiles, and keybindings.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CascadiaSettings::CreateDefaults()
|
||||
{
|
||||
_CreateDefaultProfiles();
|
||||
_CreateDefaultSchemes();
|
||||
_CreateDefaultKeybindings();
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -477,175 +129,230 @@ GlobalAppSettings& CascadiaSettings::GlobalSettings()
|
||||
return _globals;
|
||||
}
|
||||
|
||||
// Function Description:
|
||||
// - Returns true if the user has installed PowerShell Core. This will check
|
||||
// both %ProgramFiles% and %ProgramFiles(x86)%, and will return true if
|
||||
// powershell core was installed in either location.
|
||||
// Arguments:
|
||||
// - A ref of a path that receives the result of PowerShell Core pwsh.exe full path.
|
||||
// Method Description:
|
||||
// - Gets our list of warnings we found during loading. These are things that we
|
||||
// knew were bad when we called `_ValidateSettings` last.
|
||||
// Return Value:
|
||||
// - true iff powershell core (pwsh.exe) is present.
|
||||
bool CascadiaSettings::_isPowerShellCoreInstalled(std::filesystem::path& cmdline)
|
||||
// - a reference to our list of warnings.
|
||||
std::vector<TerminalApp::SettingsLoadWarnings>& CascadiaSettings::GetWarnings()
|
||||
{
|
||||
return _isPowerShellCoreInstalledInPath(L"%ProgramFiles%", cmdline) ||
|
||||
_isPowerShellCoreInstalledInPath(L"%ProgramFiles(x86)%", cmdline);
|
||||
}
|
||||
|
||||
// Function Description:
|
||||
// - Returns true if the user has installed PowerShell Core.
|
||||
// Arguments:
|
||||
// - A string that contains an environment-variable string in the form: %variableName%.
|
||||
// - A ref of a path that receives the result of PowerShell Core pwsh.exe full path.
|
||||
// Return Value:
|
||||
// - true iff powershell core (pwsh.exe) is present in the given path
|
||||
bool CascadiaSettings::_isPowerShellCoreInstalledInPath(const std::wstring_view programFileEnv, std::filesystem::path& cmdline)
|
||||
{
|
||||
std::filesystem::path psCorePath = ExpandEnvironmentVariableString(programFileEnv.data());
|
||||
psCorePath /= L"PowerShell";
|
||||
if (std::filesystem::exists(psCorePath))
|
||||
{
|
||||
for (auto& p : std::filesystem::directory_iterator(psCorePath))
|
||||
{
|
||||
psCorePath = p.path();
|
||||
psCorePath /= L"pwsh.exe";
|
||||
if (std::filesystem::exists(psCorePath))
|
||||
{
|
||||
cmdline = psCorePath;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Function Description:
|
||||
// - Adds all of the WSL profiles to the provided container.
|
||||
// Arguments:
|
||||
// - A ref to the profiles container where the WSL profiles are to be added
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CascadiaSettings::_AppendWslProfiles(std::vector<TerminalApp::Profile>& profileStorage)
|
||||
{
|
||||
wil::unique_handle readPipe;
|
||||
wil::unique_handle writePipe;
|
||||
SECURITY_ATTRIBUTES sa{ sizeof(sa), nullptr, true };
|
||||
THROW_IF_WIN32_BOOL_FALSE(CreatePipe(&readPipe, &writePipe, &sa, 0));
|
||||
STARTUPINFO si{};
|
||||
si.cb = sizeof(si);
|
||||
si.dwFlags = STARTF_USESTDHANDLES;
|
||||
si.hStdOutput = writePipe.get();
|
||||
si.hStdError = writePipe.get();
|
||||
wil::unique_process_information pi{};
|
||||
wil::unique_cotaskmem_string systemPath;
|
||||
THROW_IF_FAILED(wil::GetSystemDirectoryW(systemPath));
|
||||
std::wstring command(systemPath.get());
|
||||
command += L"\\wsl.exe --list";
|
||||
|
||||
THROW_IF_WIN32_BOOL_FALSE(CreateProcessW(nullptr,
|
||||
const_cast<LPWSTR>(command.c_str()),
|
||||
nullptr,
|
||||
nullptr,
|
||||
TRUE,
|
||||
CREATE_NO_WINDOW,
|
||||
nullptr,
|
||||
nullptr,
|
||||
&si,
|
||||
&pi));
|
||||
switch (WaitForSingleObject(pi.hProcess, INFINITE))
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
break;
|
||||
case WAIT_ABANDONED:
|
||||
case WAIT_TIMEOUT:
|
||||
THROW_HR(ERROR_CHILD_NOT_COMPLETE);
|
||||
case WAIT_FAILED:
|
||||
THROW_LAST_ERROR();
|
||||
default:
|
||||
THROW_HR(ERROR_UNHANDLED_EXCEPTION);
|
||||
}
|
||||
DWORD exitCode;
|
||||
if (GetExitCodeProcess(pi.hProcess, &exitCode) == false)
|
||||
{
|
||||
THROW_HR(E_INVALIDARG);
|
||||
}
|
||||
else if (exitCode != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DWORD bytesAvailable;
|
||||
THROW_IF_WIN32_BOOL_FALSE(PeekNamedPipe(readPipe.get(), nullptr, NULL, nullptr, &bytesAvailable, nullptr));
|
||||
std::wfstream pipe{ _wfdopen(_open_osfhandle((intptr_t)readPipe.get(), _O_WTEXT | _O_RDONLY), L"r") };
|
||||
// don't worry about the handle returned from wfdOpen, readPipe handle is already managed by wil
|
||||
// and closing the file handle will cause an error.
|
||||
std::wstring wline;
|
||||
std::getline(pipe, wline); // remove the header from the output.
|
||||
while (pipe.tellp() < bytesAvailable)
|
||||
{
|
||||
std::getline(pipe, wline);
|
||||
std::wstringstream wlinestream(wline);
|
||||
if (wlinestream)
|
||||
{
|
||||
std::wstring distName;
|
||||
std::getline(wlinestream, distName, L'\r');
|
||||
size_t firstChar = distName.find_first_of(L"( ");
|
||||
// Some localizations don't have a space between the name and "(Default)"
|
||||
// https://github.com/microsoft/terminal/issues/1168#issuecomment-500187109
|
||||
if (firstChar < distName.size())
|
||||
{
|
||||
distName.resize(firstChar);
|
||||
}
|
||||
auto WSLDistro{ _CreateDefaultProfile(distName) };
|
||||
WSLDistro.SetCommandline(L"wsl.exe -d " + distName);
|
||||
WSLDistro.SetColorScheme({ L"Campbell" });
|
||||
std::wstring iconPath{ PACKAGED_PROFILE_ICON_PATH };
|
||||
iconPath.append(DEFAULT_LINUX_ICON_GUID);
|
||||
iconPath.append(PACKAGED_PROFILE_ICON_EXTENSION);
|
||||
WSLDistro.SetIconPath(iconPath);
|
||||
profileStorage.emplace_back(WSLDistro);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Function Description:
|
||||
// - Get a environment variable string.
|
||||
// Arguments:
|
||||
// - A string that contains an environment-variable string in the form: %variableName%.
|
||||
// Return Value:
|
||||
// - a string of the expending environment-variable string.
|
||||
std::wstring CascadiaSettings::ExpandEnvironmentVariableString(std::wstring_view source)
|
||||
{
|
||||
std::wstring result{};
|
||||
DWORD requiredSize = 0;
|
||||
do
|
||||
{
|
||||
result.resize(requiredSize);
|
||||
requiredSize = ::ExpandEnvironmentStringsW(source.data(), result.data(), gsl::narrow<DWORD>(result.size()));
|
||||
} while (requiredSize != result.size());
|
||||
|
||||
// Trim the terminating null character
|
||||
result.resize(requiredSize - 1);
|
||||
return result;
|
||||
return _warnings;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Helper function for creating a skeleton default profile with a pre-populated
|
||||
// guid and name.
|
||||
// - Attempts to validate this settings structure. If there are critical errors
|
||||
// found, they'll be thrown as a SettingsLoadError. Non-critical errors, such
|
||||
// as not finding the default profile, will only result in an error. We'll add
|
||||
// all these warnings to our list of warnings, and the application can chose
|
||||
// to display these to the user.
|
||||
// Arguments:
|
||||
// - name: the name of the new profile.
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - A Profile, ready to be filled in
|
||||
Profile CascadiaSettings::_CreateDefaultProfile(const std::wstring_view name)
|
||||
// - <none>
|
||||
void CascadiaSettings::_ValidateSettings()
|
||||
{
|
||||
auto profileGuid{ Utils::CreateV5Uuid(TERMINAL_PROFILE_NAMESPACE_GUID, gsl::as_bytes(gsl::make_span(name))) };
|
||||
Profile newProfile{ profileGuid };
|
||||
_warnings.clear();
|
||||
|
||||
newProfile.SetName(static_cast<std::wstring>(name));
|
||||
// Make sure to check that profiles exists at all first and foremost:
|
||||
_ValidateProfilesExist();
|
||||
|
||||
std::wstring iconPath{ PACKAGED_PROFILE_ICON_PATH };
|
||||
iconPath.append(Utils::GuidToString(profileGuid));
|
||||
iconPath.append(PACKAGED_PROFILE_ICON_EXTENSION);
|
||||
// Verify all profiles actually had a GUID specified, otherwise generate a
|
||||
// GUID for them. Make sure to do this before de-duping profiles and
|
||||
// checking that the default profile is set.
|
||||
_ValidateProfilesHaveGuid();
|
||||
|
||||
newProfile.SetIconPath(iconPath);
|
||||
// Re-order profiles so that all profiles from the user's settings appear
|
||||
// before profiles that _weren't_ in the user profiles.
|
||||
_ReorderProfilesToMatchUserSettingsOrder();
|
||||
|
||||
return newProfile;
|
||||
// Remove hidden profiles _after_ re-ordering. The re-ordering uses the raw
|
||||
// json, and will get confused if the profile isn't in the list.
|
||||
_RemoveHiddenProfiles();
|
||||
|
||||
// Then do some validation on the profiles. The order of these does not
|
||||
// terribly matter.
|
||||
_ValidateNoDuplicateProfiles();
|
||||
_ValidateDefaultProfileExists();
|
||||
|
||||
// TODO:GH#2547 ensure that all the profile's color scheme names are
|
||||
// actually the names of schemes we've parsed. If the scheme doesn't exist,
|
||||
// just use the hardcoded defaults
|
||||
|
||||
// TODO:GH#2548 ensure there's at least one key bound. Display a warning if
|
||||
// there's _NO_ keys bound to any actions. That's highly irregular, and
|
||||
// likely an indication of an error somehow.
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Checks if the settings contain profiles at all. As we'll need to have some
|
||||
// profiles at all, we'll throw an error if there aren't any profiles.
|
||||
void CascadiaSettings::_ValidateProfilesExist()
|
||||
{
|
||||
const bool hasProfiles = !_profiles.empty();
|
||||
if (!hasProfiles)
|
||||
{
|
||||
// Throw an exception. This is an invalid state, and we want the app to
|
||||
// be able to gracefully use the default settings.
|
||||
|
||||
// We can't add the warning to the list of warnings here, because this
|
||||
// object is not going to be returned at any point.
|
||||
|
||||
throw ::TerminalApp::SettingsException(::TerminalApp::SettingsLoadErrors::NoProfiles);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Walks through each profile, and ensures that they had a GUID set at some
|
||||
// point. If the profile did _not_ have a GUID ever set for it, generate a
|
||||
// temporary runtime GUID for it. This valitation does not add any warnnings.
|
||||
void CascadiaSettings::_ValidateProfilesHaveGuid()
|
||||
{
|
||||
for (auto& profile : _profiles)
|
||||
{
|
||||
profile.GenerateGuidIfNecessary();
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Checks if the "globals.defaultProfile" is set to one of the profiles we
|
||||
// actually have. If the value is unset, or the value is set to something that
|
||||
// doesn't exist in the list of profiles, we'll arbitrarily pick the first
|
||||
// profile to use temporarily as the default.
|
||||
// - Appends a SettingsLoadWarnings::MissingDefaultProfile to our list of
|
||||
// warnings if we failed to find the default.
|
||||
void CascadiaSettings::_ValidateDefaultProfileExists()
|
||||
{
|
||||
const auto defaultProfileGuid = GlobalSettings().GetDefaultProfile();
|
||||
const bool nullDefaultProfile = defaultProfileGuid == GUID{};
|
||||
bool defaultProfileNotInProfiles = true;
|
||||
for (const auto& profile : _profiles)
|
||||
{
|
||||
if (profile.GetGuid() == defaultProfileGuid)
|
||||
{
|
||||
defaultProfileNotInProfiles = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nullDefaultProfile || defaultProfileNotInProfiles)
|
||||
{
|
||||
_warnings.push_back(::TerminalApp::SettingsLoadWarnings::MissingDefaultProfile);
|
||||
// Use the first profile as the new default
|
||||
|
||||
// _temporarily_ set the default profile to the first profile. Because
|
||||
// we're adding a warning, this settings change won't be re-serialized.
|
||||
GlobalSettings().SetDefaultProfile(_profiles[0].GetGuid());
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Checks to make sure there aren't any duplicate profiles in the list of
|
||||
// profiles. If so, we'll remove the subsequent entries (temporarily), as they
|
||||
// won't be accessible anyways.
|
||||
// - Appends a SettingsLoadWarnings::DuplicateProfile to our list of warnings if
|
||||
// we find any such duplicate.
|
||||
void CascadiaSettings::_ValidateNoDuplicateProfiles()
|
||||
{
|
||||
bool foundDupe = false;
|
||||
|
||||
std::vector<size_t> indiciesToDelete;
|
||||
|
||||
std::set<GUID> uniqueGuids;
|
||||
|
||||
// Try collecting all the unique guids. If we ever encounter a guid that's
|
||||
// already in the set, then we need to delete that profile.
|
||||
for (size_t i = 0; i < _profiles.size(); i++)
|
||||
{
|
||||
if (!uniqueGuids.insert(_profiles.at(i).GetGuid()).second)
|
||||
{
|
||||
foundDupe = true;
|
||||
indiciesToDelete.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all the duplicates we've marked
|
||||
// Walk backwards, so we don't accidentally shift any of the elements
|
||||
for (auto iter = indiciesToDelete.rbegin(); iter != indiciesToDelete.rend(); iter++)
|
||||
{
|
||||
_profiles.erase(_profiles.begin() + *iter);
|
||||
}
|
||||
|
||||
if (foundDupe)
|
||||
{
|
||||
_warnings.push_back(::TerminalApp::SettingsLoadWarnings::DuplicateProfile);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Re-orders the list of profiles to match what the user would expect them to
|
||||
// be. Orders profiles to be in the ordering { [profiles from user settings],
|
||||
// [default profiles that weren't in the user profiles]}.
|
||||
// - Does not set any warnings.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CascadiaSettings::_ReorderProfilesToMatchUserSettingsOrder()
|
||||
{
|
||||
std::set<GUID> uniqueGuids;
|
||||
std::deque<GUID> guidOrder;
|
||||
|
||||
auto collectGuids = [&](const auto& json) {
|
||||
for (auto profileJson : _GetProfilesJsonObject(json))
|
||||
{
|
||||
if (profileJson.isObject())
|
||||
{
|
||||
auto guid = Profile::GetGuidOrGenerateForJson(profileJson);
|
||||
if (uniqueGuids.insert(guid).second)
|
||||
{
|
||||
guidOrder.push_back(guid);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Push all the userSettings profiles' GUIDS into the set
|
||||
collectGuids(_userSettings);
|
||||
|
||||
// Push all the defaultSettings profiles' GUIDS into the set
|
||||
collectGuids(_defaultSettings);
|
||||
std::equal_to<GUID> equals;
|
||||
// Re-order the list of _profiles to match that ordering
|
||||
// for (gIndex=0 -> uniqueGuids.size)
|
||||
// pIndex = the pIndex of the profile with guid==guids[gIndex]
|
||||
// profiles.swap(pIndex <-> gIndex)
|
||||
// This is O(N^2), which is kinda rough. I'm sure there's a better way
|
||||
for (size_t gIndex = 0; gIndex < guidOrder.size(); gIndex++)
|
||||
{
|
||||
const auto guid = guidOrder.at(gIndex);
|
||||
for (size_t pIndex = gIndex; pIndex < _profiles.size(); pIndex++)
|
||||
{
|
||||
auto profileGuid = _profiles.at(pIndex).GetGuid();
|
||||
if (equals(profileGuid, guid))
|
||||
{
|
||||
std::iter_swap(_profiles.begin() + pIndex, _profiles.begin() + gIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Removes any profiles marked "hidden" from the list of profiles.
|
||||
// - Does not set any warnings.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CascadiaSettings::_RemoveHiddenProfiles()
|
||||
{
|
||||
// remove_if will move all the profiles where the lambda is true to the end
|
||||
// of the list, then return a iterator to the point in the list where those
|
||||
// profiles start. The erase call will then remove all of those profiles
|
||||
// from the list. This is the [erase-remove
|
||||
// idiom](https://en.wikipedia.org/wiki/Erase%E2%80%93remove_idiom)
|
||||
_profiles.erase(std::remove_if(_profiles.begin(),
|
||||
_profiles.end(),
|
||||
[](auto&& profile) { return profile.IsHidden(); }),
|
||||
_profiles.end());
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ Copyright (c) Microsoft Corporation
|
||||
Licensed under the MIT license.
|
||||
|
||||
Module Name:
|
||||
- CascadiaSettings.hpp
|
||||
- CascadiaSettings.h
|
||||
|
||||
Abstract:
|
||||
- This class acts as the container for all app settings. It's composed of two
|
||||
@@ -16,9 +16,24 @@ Author(s):
|
||||
|
||||
--*/
|
||||
#pragma once
|
||||
#include <winrt/Microsoft.Terminal.TerminalControl.h>
|
||||
#include <winrt/Microsoft.Terminal.TerminalConnection.h>
|
||||
#include "GlobalAppSettings.h"
|
||||
#include "TerminalWarnings.h"
|
||||
#include "Profile.h"
|
||||
#include "IDynamicProfileGenerator.h"
|
||||
|
||||
// fwdecl unittest classes
|
||||
namespace TerminalAppLocalTests
|
||||
{
|
||||
class SettingsTests;
|
||||
class ProfileTests;
|
||||
class ColorSchemeTests;
|
||||
class KeyBindingsTests;
|
||||
};
|
||||
namespace TerminalAppUnitTests
|
||||
{
|
||||
class DynamicProfileTests;
|
||||
};
|
||||
|
||||
namespace TerminalApp
|
||||
{
|
||||
@@ -29,9 +44,10 @@ class TerminalApp::CascadiaSettings final
|
||||
{
|
||||
public:
|
||||
CascadiaSettings();
|
||||
~CascadiaSettings();
|
||||
CascadiaSettings(const bool addDynamicProfiles);
|
||||
|
||||
static std::unique_ptr<CascadiaSettings> LoadAll(const bool saveOnLoad = true);
|
||||
static std::unique_ptr<CascadiaSettings> LoadDefaults();
|
||||
static std::unique_ptr<CascadiaSettings> LoadAll();
|
||||
void SaveAll() const;
|
||||
|
||||
winrt::Microsoft::Terminal::Settings::TerminalSettings MakeSettings(std::optional<GUID> profileGuid) const;
|
||||
@@ -44,28 +60,53 @@ public:
|
||||
|
||||
Json::Value ToJson() const;
|
||||
static std::unique_ptr<CascadiaSettings> FromJson(const Json::Value& json);
|
||||
void LayerJson(const Json::Value& json);
|
||||
|
||||
static std::wstring GetSettingsPath();
|
||||
static std::wstring GetSettingsPath(const bool useRoamingPath = false);
|
||||
static std::wstring GetDefaultSettingsPath();
|
||||
|
||||
const Profile* FindProfile(GUID profileGuid) const noexcept;
|
||||
|
||||
void CreateDefaults();
|
||||
std::vector<TerminalApp::SettingsLoadWarnings>& GetWarnings();
|
||||
|
||||
private:
|
||||
GlobalAppSettings _globals;
|
||||
std::vector<Profile> _profiles;
|
||||
std::vector<TerminalApp::SettingsLoadWarnings> _warnings;
|
||||
|
||||
void _CreateDefaultKeybindings();
|
||||
void _CreateDefaultSchemes();
|
||||
void _CreateDefaultProfiles();
|
||||
std::vector<std::unique_ptr<TerminalApp::IDynamicProfileGenerator>> _profileGenerators;
|
||||
|
||||
std::string _userSettingsString;
|
||||
Json::Value _userSettings;
|
||||
Json::Value _defaultSettings;
|
||||
|
||||
void _LayerOrCreateProfile(const Json::Value& profileJson);
|
||||
Profile* _FindMatchingProfile(const Json::Value& profileJson);
|
||||
void _LayerOrCreateColorScheme(const Json::Value& schemeJson);
|
||||
ColorScheme* _FindMatchingColorScheme(const Json::Value& schemeJson);
|
||||
void _ParseJsonString(std::string_view fileData, const bool isDefaultSettings);
|
||||
static const Json::Value& _GetProfilesJsonObject(const Json::Value& json);
|
||||
static const Json::Value& _GetDisabledProfileSourcesJsonObject(const Json::Value& json);
|
||||
bool _AppendDynamicProfilesToUserSettings();
|
||||
|
||||
void _LoadDynamicProfiles();
|
||||
|
||||
static bool _IsPackaged();
|
||||
static void _WriteSettings(const std::string_view content);
|
||||
static std::optional<std::string> _ReadSettings();
|
||||
static std::optional<std::string> _ReadUserSettings();
|
||||
static std::optional<std::string> _ReadFile(HANDLE hFile);
|
||||
|
||||
static bool _isPowerShellCoreInstalledInPath(const std::wstring_view programFileEnv, std::filesystem::path& cmdline);
|
||||
static bool _isPowerShellCoreInstalled(std::filesystem::path& cmdline);
|
||||
static void _AppendWslProfiles(std::vector<TerminalApp::Profile>& profileStorage);
|
||||
static std::wstring ExpandEnvironmentVariableString(std::wstring_view source);
|
||||
static Profile _CreateDefaultProfile(const std::wstring_view name);
|
||||
void _ValidateSettings();
|
||||
void _ValidateProfilesExist();
|
||||
void _ValidateProfilesHaveGuid();
|
||||
void _ValidateDefaultProfileExists();
|
||||
void _ValidateNoDuplicateProfiles();
|
||||
void _ReorderProfilesToMatchUserSettingsOrder();
|
||||
void _RemoveHiddenProfiles();
|
||||
|
||||
friend class TerminalAppLocalTests::SettingsTests;
|
||||
friend class TerminalAppLocalTests::ProfileTests;
|
||||
friend class TerminalAppLocalTests::ColorSchemeTests;
|
||||
friend class TerminalAppLocalTests::KeyBindingsTests;
|
||||
friend class TerminalAppUnitTests::DynamicProfileTests;
|
||||
};
|
||||
|
||||
@@ -4,11 +4,19 @@
|
||||
#include "pch.h"
|
||||
#include <argb.h>
|
||||
#include "CascadiaSettings.h"
|
||||
#include "AppKeyBindingsSerialization.h"
|
||||
#include "../../types/inc/utils.hpp"
|
||||
#include "utils.h"
|
||||
#include "JsonUtils.h"
|
||||
#include <appmodel.h>
|
||||
#include <shlobj.h>
|
||||
|
||||
// defaults.h is a file containing the default json settings in a std::string_view
|
||||
#include "defaults.h"
|
||||
// userDefault.h is like the above, but with a default template for the user's profiles.json.
|
||||
#include "userDefaults.h"
|
||||
// Both defaults.h and userDefaults.h are generated at build time into the
|
||||
// "Generated Files" directory.
|
||||
|
||||
using namespace ::TerminalApp;
|
||||
using namespace winrt::Microsoft::Terminal::TerminalControl;
|
||||
using namespace winrt::TerminalApp;
|
||||
@@ -17,12 +25,17 @@ using namespace ::Microsoft::Console;
|
||||
static constexpr std::wstring_view SettingsFilename{ L"profiles.json" };
|
||||
static constexpr std::wstring_view UnpackagedSettingsFolderName{ L"Microsoft\\Windows Terminal\\" };
|
||||
|
||||
static constexpr std::wstring_view DefaultsFilename{ L"defaults.json" };
|
||||
|
||||
static constexpr std::string_view ProfilesKey{ "profiles" };
|
||||
static constexpr std::string_view KeybindingsKey{ "keybindings" };
|
||||
static constexpr std::string_view GlobalsKey{ "globals" };
|
||||
static constexpr std::string_view SchemesKey{ "schemes" };
|
||||
|
||||
static constexpr std::string_view DisabledProfileSourcesKey{ "disabledProfileSources" };
|
||||
|
||||
static constexpr std::string_view Utf8Bom{ u8"\uFEFF" };
|
||||
static constexpr std::string_view DefaultProfilesIndentation{ " " };
|
||||
|
||||
// Method Description:
|
||||
// - Creates a CascadiaSettings from whatever's saved on disk, or instantiates
|
||||
@@ -30,70 +43,190 @@ static constexpr std::string_view Utf8Bom{ u8"\uFEFF" };
|
||||
// it will load the settings from our packaged localappdata. If we're
|
||||
// running as an unpackaged application, it will read it from the path
|
||||
// we've set under localappdata.
|
||||
// Arguments:
|
||||
// - saveOnLoad: If true, we'll write the settings back out after we load them,
|
||||
// to make sure the schema is updated.
|
||||
// - Loads both the settings from the defaults.json and the user's profiles.json
|
||||
// - Also runs and dynamic profile generators. If any of those generators create
|
||||
// new profiles, we'll write the user settings back to the file, with the new
|
||||
// profiles inserted into their list of profiles.
|
||||
// Return Value:
|
||||
// - a unique_ptr containing a new CascadiaSettings object.
|
||||
std::unique_ptr<CascadiaSettings> CascadiaSettings::LoadAll(const bool saveOnLoad)
|
||||
std::unique_ptr<CascadiaSettings> CascadiaSettings::LoadAll()
|
||||
{
|
||||
std::unique_ptr<CascadiaSettings> resultPtr;
|
||||
std::optional<std::string> fileData = _ReadSettings();
|
||||
auto resultPtr = LoadDefaults();
|
||||
|
||||
std::optional<std::string> fileData = _ReadUserSettings();
|
||||
const bool foundFile = fileData.has_value();
|
||||
if (foundFile)
|
||||
|
||||
// Make sure the file isn't totally empty. If it is, we'll treat the file
|
||||
// like it doesn't exist at all.
|
||||
const bool fileHasData = foundFile && !fileData.value().empty();
|
||||
bool needToWriteFile = false;
|
||||
if (fileHasData)
|
||||
{
|
||||
const auto actualData = fileData.value();
|
||||
|
||||
// Ignore UTF-8 BOM
|
||||
auto actualDataStart = actualData.c_str();
|
||||
if (actualData.compare(0, Utf8Bom.size(), Utf8Bom) == 0)
|
||||
{
|
||||
actualDataStart += Utf8Bom.size();
|
||||
}
|
||||
|
||||
// Parse the json data.
|
||||
Json::Value root;
|
||||
std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder::CharReaderBuilder().newCharReader() };
|
||||
std::string errs; // This string will recieve any error text from failing to parse.
|
||||
// `parse` will return false if it fails.
|
||||
if (!reader->parse(actualDataStart, actualData.c_str() + actualData.size(), &root, &errs))
|
||||
{
|
||||
// TODO:GH#990 display this exception text to the user, in a
|
||||
// copy-pasteable way.
|
||||
throw winrt::hresult_error(WEB_E_INVALID_JSON_STRING, winrt::to_hstring(errs));
|
||||
}
|
||||
resultPtr = FromJson(root);
|
||||
|
||||
if (resultPtr->GlobalSettings().GetDefaultProfile() == GUID{})
|
||||
{
|
||||
throw winrt::hresult_invalid_argument();
|
||||
}
|
||||
|
||||
if (saveOnLoad)
|
||||
{
|
||||
// Logically compare the json we've parsed from the file to what
|
||||
// we'd serialize at runtime. If the values are different, then
|
||||
// write the updated schema back out.
|
||||
const Json::Value reserialized = resultPtr->ToJson();
|
||||
if (reserialized != root)
|
||||
{
|
||||
resultPtr->SaveAll();
|
||||
}
|
||||
}
|
||||
resultPtr->_ParseJsonString(fileData.value(), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultPtr = std::make_unique<CascadiaSettings>();
|
||||
resultPtr->CreateDefaults();
|
||||
|
||||
// The settings file does not exist. Let's commit one.
|
||||
resultPtr->SaveAll();
|
||||
// We didn't find the user settings. We'll need to create a file
|
||||
// to use as the user defaults.
|
||||
// For now, just parse our user settings template as their user settings.
|
||||
resultPtr->_ParseJsonString(UserSettingsJson, false);
|
||||
needToWriteFile = true;
|
||||
}
|
||||
|
||||
// Load profiles from dynamic profile generators. _userSettings should be
|
||||
// created by now, because we're going to check in there for any generators
|
||||
// that should be disabled.
|
||||
resultPtr->_LoadDynamicProfiles();
|
||||
|
||||
// Apply the user's settings
|
||||
resultPtr->LayerJson(resultPtr->_userSettings);
|
||||
|
||||
// After layering the user settings, check if there are any new profiles
|
||||
// that need to be inserted into their user settings file.
|
||||
needToWriteFile = resultPtr->_AppendDynamicProfilesToUserSettings() || needToWriteFile;
|
||||
|
||||
// TODO:GH#2721 If powershell core is installed, we need to set that to the
|
||||
// default profile, but only when the settings file was newly created. We'll
|
||||
// re-write the segment of the user settings for "default profile" to have
|
||||
// the powershell core GUID instead.
|
||||
|
||||
// If we created the file, or found new dynamic profiles, write the user
|
||||
// settings string back to the file.
|
||||
if (needToWriteFile)
|
||||
{
|
||||
// If AppendDynamicProfilesToUserSettings (or the pwsh check above)
|
||||
// changed the file, then our local settings JSON is no longer accurate.
|
||||
// We should re-parse, but not re-layer
|
||||
resultPtr->_ParseJsonString(resultPtr->_userSettingsString, false);
|
||||
|
||||
_WriteSettings(resultPtr->_userSettingsString);
|
||||
}
|
||||
|
||||
// If this throws, the app will catch it and use the default settings
|
||||
resultPtr->_ValidateSettings();
|
||||
|
||||
return resultPtr;
|
||||
}
|
||||
|
||||
// Function Description:
|
||||
// - Creates a new CascadiaSettings object initialized with settings from the
|
||||
// hardcoded defaults.json.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - a unique_ptr to a CascadiaSettings with the settings from defaults.json
|
||||
std::unique_ptr<CascadiaSettings> CascadiaSettings::LoadDefaults()
|
||||
{
|
||||
auto resultPtr = std::make_unique<CascadiaSettings>();
|
||||
|
||||
// We already have the defaults in memory, because we stamp them into a
|
||||
// header as part of the build process. We don't need to bother with reading
|
||||
// them from a file (and the potential that could fail)
|
||||
resultPtr->_ParseJsonString(DefaultJson, true);
|
||||
resultPtr->LayerJson(resultPtr->_defaultSettings);
|
||||
|
||||
return resultPtr;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Runs each of the configured dynamic profile generators (DPGs). Adds
|
||||
// profiles from any DPGs that ran to the end of our list of profiles.
|
||||
// - Uses the Json::Value _userSettings to check which DPGs should not be run.
|
||||
// If the user settings has any namespaces in the "disabledProfileSources"
|
||||
// property, we'll ensure that any DPGs with a matching namespace _don't_ run.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CascadiaSettings::_LoadDynamicProfiles()
|
||||
{
|
||||
std::unordered_set<std::wstring> ignoredNamespaces;
|
||||
const auto disabledProfileSources = CascadiaSettings::_GetDisabledProfileSourcesJsonObject(_userSettings);
|
||||
if (disabledProfileSources.isArray())
|
||||
{
|
||||
for (const auto& ns : disabledProfileSources)
|
||||
{
|
||||
ignoredNamespaces.emplace(GetWstringFromJson(ns));
|
||||
}
|
||||
}
|
||||
|
||||
const GUID nullGuid{ 0 };
|
||||
for (auto& generator : _profileGenerators)
|
||||
{
|
||||
const std::wstring generatorNamespace{ generator->GetNamespace() };
|
||||
|
||||
if (ignoredNamespaces.find(generatorNamespace) != ignoredNamespaces.end())
|
||||
{
|
||||
// namespace should be ignored
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
auto profiles = generator->GenerateProfiles();
|
||||
for (auto& profile : profiles)
|
||||
{
|
||||
// If the profile did not have a GUID when it was generated,
|
||||
// we'll synthesize a GUID for it in _ValidateProfilesHaveGuid
|
||||
profile.SetSource(generatorNamespace);
|
||||
|
||||
_profiles.emplace_back(profile);
|
||||
}
|
||||
}
|
||||
CATCH_LOG_MSG("Dynamic Profile Namespace: \"%ls\"", generatorNamespace.data());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Attempts to read the given data as a string of JSON and parse that JSON
|
||||
// into a Json::Value.
|
||||
// - Will ignore leading UTF-8 BOMs.
|
||||
// - Additionally, will store the parsed JSON in this object, as either our
|
||||
// _defaultSettings or our _userSettings, depending on isDefaultSettings.
|
||||
// - Does _not_ apply the json onto our current settings. Callers should make
|
||||
// sure to call LayerJson to ensure the settings are applied.
|
||||
// Arguments:
|
||||
// - fileData: the string to parse as JSON data
|
||||
// - isDefaultSettings: if true, we should store the parsed JSON as our
|
||||
// defaultSettings. Otherwise, we'll store the parsed JSON as our user
|
||||
// settings.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CascadiaSettings::_ParseJsonString(std::string_view fileData, const bool isDefaultSettings)
|
||||
{
|
||||
// Ignore UTF-8 BOM
|
||||
auto actualDataStart = fileData.data();
|
||||
const auto actualDataEnd = fileData.data() + fileData.size();
|
||||
if (fileData.compare(0, Utf8Bom.size(), Utf8Bom) == 0)
|
||||
{
|
||||
actualDataStart += Utf8Bom.size();
|
||||
}
|
||||
|
||||
std::string errs; // This string will recieve any error text from failing to parse.
|
||||
std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder::CharReaderBuilder().newCharReader() };
|
||||
|
||||
// Parse the json data into either our defaults or user settings. We'll keep
|
||||
// these original json values around for later, in case we need to parse
|
||||
// their raw contents again.
|
||||
Json::Value& root = isDefaultSettings ? _defaultSettings : _userSettings;
|
||||
// `parse` will return false if it fails.
|
||||
if (!reader->parse(actualDataStart, actualDataEnd, &root, &errs))
|
||||
{
|
||||
// This will be caught by App::_TryLoadSettings, who will display
|
||||
// the text to the user.
|
||||
throw winrt::hresult_error(WEB_E_INVALID_JSON_STRING, winrt::to_hstring(errs));
|
||||
}
|
||||
|
||||
// If this is the user settings, also store away the original settings
|
||||
// string. We'll need to keep it around so we can modify it without
|
||||
// re-serializing their settings.
|
||||
if (!isDefaultSettings)
|
||||
{
|
||||
_userSettingsString = fileData;
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Serialize this settings structure, and save it to a file. The location of
|
||||
// the file changes depending whether we're running as a packaged
|
||||
@@ -113,6 +246,145 @@ void CascadiaSettings::SaveAll() const
|
||||
_WriteSettings(serializedString);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Finds all the dynamic profiles we've generated that _don't_ exist in the
|
||||
// user's settings. Generates a minimal blob of json for them, and inserts
|
||||
// them into the user's settings at the end of the list of profiles.
|
||||
// - Does not reformat the user's settings file.
|
||||
// - Does not write the file! Only modifies in-place the _userSettingsString
|
||||
// member. Callers should make sure to call
|
||||
// _WriteSettings(_userSettingsString) to make sure to persist these changes!
|
||||
// - Assumes that the `profiles` object is at an indentation of 4 spaces, and
|
||||
// therefore each profile should be indented 8 spaces. If the user's settings
|
||||
// have a different indentation, we'll still insert valid json, it'll just be
|
||||
// indented incorrectly.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - true iff we've made changes to the _userSettingsString that should be persisted.
|
||||
bool CascadiaSettings::_AppendDynamicProfilesToUserSettings()
|
||||
{
|
||||
// - Find the set of profiles that weren't either in the default profiles or
|
||||
// in the user profiles. TODO:GH#2723 Do this in not O(N^2)
|
||||
// - For each of those profiles,
|
||||
// * Diff them from the default profile
|
||||
// * Serialize that diff
|
||||
// * Insert that diff to the end of the list of profiles.
|
||||
|
||||
const Profile defaultProfile;
|
||||
|
||||
Json::StreamWriterBuilder wbuilder;
|
||||
// Use 4 spaces to indent instead of \t
|
||||
wbuilder.settings_["indentation"] = " ";
|
||||
|
||||
auto isInJsonObj = [](const auto& profile, const auto& json) {
|
||||
for (auto profileJson : _GetProfilesJsonObject(json))
|
||||
{
|
||||
if (profileJson.isObject())
|
||||
{
|
||||
if (profile.ShouldBeLayered(profileJson))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// If the profileJson doesn't have a GUID, then it might be in
|
||||
// the file still. We returned false because it shouldn't be
|
||||
// layered, but it might be a name-only profile.
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
bool changedFile = false;
|
||||
|
||||
// Get the index in the user settings string of the _last_ profile.
|
||||
// We want to start inserting profiles immediately following the last profile.
|
||||
const auto userProfilesObj = _GetProfilesJsonObject(_userSettings);
|
||||
auto numProfiles = userProfilesObj.size();
|
||||
size_t currentInsertIndex = 0;
|
||||
if (userProfilesObj && numProfiles == 0)
|
||||
{
|
||||
// There's a profiles object, but there's no profiles in it.
|
||||
currentInsertIndex = userProfilesObj.getOffsetStart() + 1;
|
||||
}
|
||||
else if (!userProfilesObj)
|
||||
{
|
||||
// There's no profiles object. Insert one right before the parent's closing }.
|
||||
currentInsertIndex = _userSettings.getOffsetLimit() - 1;
|
||||
std::string profileObjectSerialization = R"( "profiles": [)";
|
||||
if (_userSettings.size() > 0)
|
||||
{
|
||||
profileObjectSerialization.insert(0, ",\n");
|
||||
}
|
||||
_userSettingsString.insert(currentInsertIndex, profileObjectSerialization);
|
||||
currentInsertIndex += profileObjectSerialization.size();
|
||||
_userSettingsString.insert(currentInsertIndex, R"(])");
|
||||
changedFile = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto lastProfile = userProfilesObj[numProfiles - 1];
|
||||
currentInsertIndex = lastProfile.getOffsetLimit();
|
||||
}
|
||||
|
||||
for (const auto& profile : _profiles)
|
||||
{
|
||||
if (!profile.HasGuid())
|
||||
{
|
||||
// If the profile doesn't have a guid, it's a name-only profile.
|
||||
// During validation, we'll generate a GUID for the profile, but
|
||||
// validation occurs after this. We should ignore these types of
|
||||
// profiles.
|
||||
// If a dynamic profile was generated _without_ a GUID, we also
|
||||
// don't want it serialized here. The first check in
|
||||
// Profile::ShouldBeLayered checks that the profile has a guid. For a
|
||||
// dynamic profile without a GUID, that'll _never_ be true, so it
|
||||
// would be impossible to be layered.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip profiles that are in the user settings or the default settings.
|
||||
if (isInJsonObj(profile, _userSettings) || isInJsonObj(profile, _defaultSettings))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Generate a diff for the profile, that contains the minimal set of
|
||||
// changes to re-create this profile.
|
||||
const auto diff = profile.GenerateStub();
|
||||
auto profileSerialization = Json::writeString(wbuilder, diff);
|
||||
|
||||
// Add 8 spaces to the start of each line
|
||||
profileSerialization.insert(0, DefaultProfilesIndentation);
|
||||
// Get the first newline
|
||||
size_t pos = profileSerialization.find("\n");
|
||||
// for each newline...
|
||||
while (pos != std::string::npos)
|
||||
{
|
||||
// Insert 8 spaces immediately following the current newline
|
||||
profileSerialization.insert(pos + 1, DefaultProfilesIndentation);
|
||||
// Get the next newline
|
||||
pos = profileSerialization.find("\n", pos + 9);
|
||||
}
|
||||
|
||||
// Write a comma, newline to the file
|
||||
changedFile = true;
|
||||
if (numProfiles > 0)
|
||||
{
|
||||
_userSettingsString.insert(currentInsertIndex, ",");
|
||||
currentInsertIndex++;
|
||||
}
|
||||
_userSettingsString.insert(currentInsertIndex, "\n");
|
||||
currentInsertIndex++;
|
||||
|
||||
// Write the profile's serialization to the file
|
||||
_userSettingsString.insert(currentInsertIndex, profileSerialization);
|
||||
currentInsertIndex += profileSerialization.size();
|
||||
++numProfiles;
|
||||
}
|
||||
|
||||
return changedFile;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Serialize this object to a JsonObject.
|
||||
// Arguments:
|
||||
@@ -151,13 +423,28 @@ Json::Value CascadiaSettings::ToJson() const
|
||||
// - a new CascadiaSettings instance created from the values in `json`
|
||||
std::unique_ptr<CascadiaSettings> CascadiaSettings::FromJson(const Json::Value& json)
|
||||
{
|
||||
std::unique_ptr<CascadiaSettings> resultPtr = std::make_unique<CascadiaSettings>();
|
||||
auto resultPtr = std::make_unique<CascadiaSettings>();
|
||||
resultPtr->LayerJson(json);
|
||||
return resultPtr;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Layer values from the given json object on top of the existing properties
|
||||
// of this object. For any keys we're expecting to be able to parse in the
|
||||
// given object, we'll parse them and replace our settings with values from
|
||||
// the new json object. Properties that _aren't_ in the json object will _not_
|
||||
// be replaced.
|
||||
// Arguments:
|
||||
// - json: an object which should be a partial serialization of a CascadiaSettings object.
|
||||
// Return Value:
|
||||
// <none>
|
||||
void CascadiaSettings::LayerJson(const Json::Value& json)
|
||||
{
|
||||
if (auto globals{ json[GlobalsKey.data()] })
|
||||
{
|
||||
if (globals.isObject())
|
||||
{
|
||||
resultPtr->_globals = GlobalAppSettings::FromJson(globals);
|
||||
_globals.LayerJson(globals);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -165,53 +452,137 @@ std::unique_ptr<CascadiaSettings> CascadiaSettings::FromJson(const Json::Value&
|
||||
// If there's no globals key in the root object, then try looking at the
|
||||
// root object for those properties instead, to gracefully upgrade.
|
||||
// This will attempt to do the legacy keybindings loading too
|
||||
resultPtr->_globals = GlobalAppSettings::FromJson(json);
|
||||
|
||||
// If we didn't find keybindings in the legacy path, then they probably
|
||||
// don't exist in the file. Create the default keybindings if we
|
||||
// couldn't find any keybindings.
|
||||
auto keybindings{ json[KeybindingsKey.data()] };
|
||||
if (!keybindings)
|
||||
{
|
||||
resultPtr->_CreateDefaultKeybindings();
|
||||
}
|
||||
_globals.LayerJson(json);
|
||||
}
|
||||
|
||||
// TODO:MSFT:20737698 - Display an error if we failed to parse settings
|
||||
// What should we do here if these keys aren't found?For default profile,
|
||||
// we could always pick the first profile and just set that as the default.
|
||||
// Finding no schemes is probably fine, unless of course one profile
|
||||
// references a scheme. We could fail with come error saying the
|
||||
// profiles file is corrupted.
|
||||
// Not having any profiles is also bad - should we say the file is corrupted?
|
||||
// Or should we just recreate the default profiles?
|
||||
|
||||
auto& resultSchemes = resultPtr->_globals.GetColorSchemes();
|
||||
if (auto schemes{ json[SchemesKey.data()] })
|
||||
{
|
||||
for (auto schemeJson : schemes)
|
||||
{
|
||||
if (schemeJson.isObject())
|
||||
{
|
||||
auto scheme = ColorScheme::FromJson(schemeJson);
|
||||
resultSchemes.emplace_back(std::move(scheme));
|
||||
_LayerOrCreateColorScheme(schemeJson);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (auto profiles{ json[ProfilesKey.data()] })
|
||||
for (auto profileJson : _GetProfilesJsonObject(json))
|
||||
{
|
||||
for (auto profileJson : profiles)
|
||||
if (profileJson.isObject())
|
||||
{
|
||||
if (profileJson.isObject())
|
||||
{
|
||||
auto profile = Profile::FromJson(profileJson);
|
||||
resultPtr->_profiles.emplace_back(profile);
|
||||
}
|
||||
_LayerOrCreateProfile(profileJson);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resultPtr;
|
||||
// Method Description:
|
||||
// - Given a partial json serialization of a Profile object, either layers that
|
||||
// json on a matching Profile we already have, or creates a new Profile
|
||||
// object from those settings.
|
||||
// - For profiles that were created from a dynamic profile source, they'll have
|
||||
// both a guid and source guid that must both match. If a user profile with a
|
||||
// source set does not find a matching profile at load time, the profile
|
||||
// should be ignored.
|
||||
// Arguments:
|
||||
// - json: an object which may be a partial serialization of a Profile object.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CascadiaSettings::_LayerOrCreateProfile(const Json::Value& profileJson)
|
||||
{
|
||||
// Layer the json on top of an existing profile, if we have one:
|
||||
auto pProfile = _FindMatchingProfile(profileJson);
|
||||
if (pProfile)
|
||||
{
|
||||
pProfile->LayerJson(profileJson);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If this JSON represents a dynamic profile, we _shouldn't_ create the
|
||||
// profile here. We only want to create profiles for profiles without a
|
||||
// `source`. Dynamic profiles _must_ be layered on an existing profile.
|
||||
if (!Profile::IsDynamicProfileObject(profileJson))
|
||||
{
|
||||
auto profile = Profile::FromJson(profileJson);
|
||||
_profiles.emplace_back(profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Finds a profile from our list of profiles that matches the given json
|
||||
// object. Uses Profile::ShouldBeLayered to determine if the Json::Value is a
|
||||
// match or not. This method should be used to find a profile to layer the
|
||||
// given settings upon.
|
||||
// - Returns nullptr if no such match exists.
|
||||
// Arguments:
|
||||
// - json: an object which may be a partial serialization of a Profile object.
|
||||
// Return Value:
|
||||
// - a Profile that can be layered with the given json object, iff such a
|
||||
// profile exists.
|
||||
Profile* CascadiaSettings::_FindMatchingProfile(const Json::Value& profileJson)
|
||||
{
|
||||
for (auto& profile : _profiles)
|
||||
{
|
||||
if (profile.ShouldBeLayered(profileJson))
|
||||
{
|
||||
// HERE BE DRAGONS: Returning a pointer to a type in the vector is
|
||||
// maybe not the _safest_ thing, but we have a mind to make Profile
|
||||
// and ColorScheme winrt types in the future, so this will be safer
|
||||
// then.
|
||||
return &profile;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Given a partial json serialization of a ColorScheme object, either layers that
|
||||
// json on a matching ColorScheme we already have, or creates a new ColorScheme
|
||||
// object from those settings.
|
||||
// Arguments:
|
||||
// - json: an object which should be a partial serialization of a ColorScheme object.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CascadiaSettings::_LayerOrCreateColorScheme(const Json::Value& schemeJson)
|
||||
{
|
||||
// Layer the json on top of an existing profile, if we have one:
|
||||
auto pScheme = _FindMatchingColorScheme(schemeJson);
|
||||
if (pScheme)
|
||||
{
|
||||
pScheme->LayerJson(schemeJson);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto scheme = ColorScheme::FromJson(schemeJson);
|
||||
_globals.GetColorSchemes().emplace_back(scheme);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Finds a color scheme from our list of color schemes that matches the given
|
||||
// json object. Uses ColorScheme::ShouldBeLayered to determine if the
|
||||
// Json::Value is a match or not. This method should be used to find a color
|
||||
// scheme to layer the given settings upon.
|
||||
// - Returns nullptr if no such match exists.
|
||||
// Arguments:
|
||||
// - json: an object which should be a partial serialization of a ColorScheme object.
|
||||
// Return Value:
|
||||
// - a ColorScheme that can be layered with the given json object, iff such a
|
||||
// color scheme exists.
|
||||
ColorScheme* CascadiaSettings::_FindMatchingColorScheme(const Json::Value& schemeJson)
|
||||
{
|
||||
for (auto& scheme : _globals.GetColorSchemes())
|
||||
{
|
||||
if (scheme.ShouldBeLayered(schemeJson))
|
||||
{
|
||||
// HERE BE DRAGONS: Returning a pointer to a type in the vector is
|
||||
// maybe not the _safest_ thing, but we have a mind to make Profile
|
||||
// and ColorScheme winrt types in the future, so this will be safer
|
||||
// then.
|
||||
return &scheme;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Function Description:
|
||||
@@ -241,13 +612,18 @@ void CascadiaSettings::_WriteSettings(const std::string_view content)
|
||||
{
|
||||
auto pathToSettingsFile{ CascadiaSettings::GetSettingsPath() };
|
||||
|
||||
auto hOut = CreateFileW(pathToSettingsFile.c_str(), GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hOut == INVALID_HANDLE_VALUE)
|
||||
wil::unique_hfile hOut{ CreateFileW(pathToSettingsFile.c_str(),
|
||||
GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL,
|
||||
CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NULL) };
|
||||
if (!hOut)
|
||||
{
|
||||
THROW_LAST_ERROR();
|
||||
}
|
||||
THROW_LAST_ERROR_IF(!WriteFile(hOut, content.data(), gsl::narrow<DWORD>(content.size()), 0, 0));
|
||||
CloseHandle(hOut);
|
||||
THROW_LAST_ERROR_IF(!WriteFile(hOut.get(), content.data(), gsl::narrow<DWORD>(content.size()), 0, 0));
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -259,18 +635,83 @@ void CascadiaSettings::_WriteSettings(const std::string_view content)
|
||||
// otherwise the optional will be empty.
|
||||
// If the file exists, but we fail to read it, this can throw an exception
|
||||
// from reading the file
|
||||
std::optional<std::string> CascadiaSettings::_ReadSettings()
|
||||
std::optional<std::string> CascadiaSettings::_ReadUserSettings()
|
||||
{
|
||||
auto pathToSettingsFile{ CascadiaSettings::GetSettingsPath() };
|
||||
const auto hFile = CreateFileW(pathToSettingsFile.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
const auto pathToSettingsFile{ CascadiaSettings::GetSettingsPath() };
|
||||
wil::unique_hfile hFile{ CreateFileW(pathToSettingsFile.c_str(),
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
nullptr,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
nullptr) };
|
||||
|
||||
if (!hFile)
|
||||
{
|
||||
// If the file doesn't exist, that's fine. Just log the error and return
|
||||
// nullopt - we'll create the defaults.
|
||||
LOG_LAST_ERROR();
|
||||
return std::nullopt;
|
||||
// GH#1770 - Now that we're _not_ roaming our settings, do a quick check
|
||||
// to see if there's a file in the Roaming App data folder. If there is
|
||||
// a file there, but not in the LocalAppData, it's likely the user is
|
||||
// upgrading from a version of the terminal from before this change.
|
||||
// We'll try moving the file from the Roaming app data folder to the
|
||||
// local appdata folder.
|
||||
|
||||
const auto pathToRoamingSettingsFile{ CascadiaSettings::GetSettingsPath(true) };
|
||||
wil::unique_hfile hRoamingFile{ CreateFileW(pathToRoamingSettingsFile.c_str(),
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
nullptr,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
nullptr) };
|
||||
|
||||
if (hRoamingFile)
|
||||
{
|
||||
// Close the file handle, move it, and re-open the file in its new location.
|
||||
hRoamingFile.reset();
|
||||
|
||||
// Note: We're unsure if this is unsafe. Theoretically it's possible
|
||||
// that two instances of the app will try and move the settings file
|
||||
// simultaneously. We don't know what might happen in that scenario,
|
||||
// but we're also not sure how to safely lock the file to prevent
|
||||
// that from ocurring.
|
||||
THROW_LAST_ERROR_IF(!MoveFile(pathToRoamingSettingsFile.c_str(),
|
||||
pathToSettingsFile.c_str()));
|
||||
|
||||
hFile.reset(CreateFileW(pathToSettingsFile.c_str(),
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
nullptr,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
nullptr));
|
||||
|
||||
// hFile shouldn't be INVALID. That's unexpected - We just moved the
|
||||
// file, we should be able to open it. Throw the error so we can get
|
||||
// some information here.
|
||||
THROW_LAST_ERROR_IF(!hFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the roaming file didn't exist, and the local file doesn't exist,
|
||||
// that's fine. Just log the error and return nullopt - we'll
|
||||
// create the defaults.
|
||||
LOG_LAST_ERROR();
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
return _ReadFile(hFile.get());
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Reads the content in UTF-8 encoding of the given file using the Win32 APIs
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - an optional with the content of the file if we were able to read it. If we
|
||||
// fail to read it, this can throw an exception from reading the file
|
||||
std::optional<std::string> CascadiaSettings::_ReadFile(HANDLE hFile)
|
||||
{
|
||||
// fileSize is in bytes
|
||||
const auto fileSize = GetFileSize(hFile, nullptr);
|
||||
THROW_LAST_ERROR_IF(fileSize == INVALID_FILE_SIZE);
|
||||
@@ -279,7 +720,6 @@ std::optional<std::string> CascadiaSettings::_ReadSettings()
|
||||
|
||||
DWORD bytesRead = 0;
|
||||
THROW_LAST_ERROR_IF(!ReadFile(hFile, utf8buffer.get(), fileSize, &bytesRead, nullptr));
|
||||
CloseHandle(hFile);
|
||||
|
||||
// convert buffer to UTF-8 string
|
||||
std::string utf8string(utf8buffer.get(), fileSize);
|
||||
@@ -289,25 +729,27 @@ std::optional<std::string> CascadiaSettings::_ReadSettings()
|
||||
|
||||
// function Description:
|
||||
// - Returns the full path to the settings file, either within the application
|
||||
// package, or in its unpackaged location.
|
||||
// package, or in its unpackaged location. This path is under the "Local
|
||||
// AppData" folder, so it _doesn't_ roam to other machines.
|
||||
// - If the application is unpackaged,
|
||||
// the file will end up under e.g. C:\Users\admin\AppData\Roaming\Microsoft\Windows Terminal\profiles.json
|
||||
// the file will end up under e.g. C:\Users\admin\AppData\Local\Microsoft\Windows Terminal\profiles.json
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - the full path to the settings file
|
||||
std::wstring CascadiaSettings::GetSettingsPath()
|
||||
std::wstring CascadiaSettings::GetSettingsPath(const bool useRoamingPath)
|
||||
{
|
||||
wil::unique_cotaskmem_string roamingAppDataFolder;
|
||||
wil::unique_cotaskmem_string localAppDataFolder;
|
||||
// KF_FLAG_FORCE_APP_DATA_REDIRECTION, when engaged, causes SHGet... to return
|
||||
// the new AppModel paths (Packages/xxx/RoamingState, etc.) for standard path requests.
|
||||
// Using this flag allows us to avoid Windows.Storage.ApplicationData completely.
|
||||
if (FAILED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_FORCE_APP_DATA_REDIRECTION, 0, &roamingAppDataFolder)))
|
||||
const auto knowFolderId = useRoamingPath ? FOLDERID_RoamingAppData : FOLDERID_LocalAppData;
|
||||
if (FAILED(SHGetKnownFolderPath(knowFolderId, KF_FLAG_FORCE_APP_DATA_REDIRECTION, 0, &localAppDataFolder)))
|
||||
{
|
||||
THROW_LAST_ERROR();
|
||||
}
|
||||
|
||||
std::filesystem::path parentDirectoryForSettingsFile{ roamingAppDataFolder.get() };
|
||||
std::filesystem::path parentDirectoryForSettingsFile{ localAppDataFolder.get() };
|
||||
|
||||
if (!_IsPackaged())
|
||||
{
|
||||
@@ -319,3 +761,56 @@ std::wstring CascadiaSettings::GetSettingsPath()
|
||||
|
||||
return parentDirectoryForSettingsFile / SettingsFilename;
|
||||
}
|
||||
|
||||
std::wstring CascadiaSettings::GetDefaultSettingsPath()
|
||||
{
|
||||
// Both of these posts suggest getting the path to the exe, then removing
|
||||
// the exe's name to get the package root:
|
||||
// * https://blogs.msdn.microsoft.com/appconsult/2017/06/23/accessing-to-the-files-in-the-installation-folder-in-a-desktop-bridge-application/
|
||||
// * https://blogs.msdn.microsoft.com/appconsult/2017/03/06/handling-data-in-a-converted-desktop-app-with-the-desktop-bridge/
|
||||
//
|
||||
// This would break if we ever moved our exe out of the package root.
|
||||
// HOWEVER, if we try to look for a defaults.json that's simply in the same
|
||||
// directory as the exe, that will work for unpackaged scenarios as well. So
|
||||
// let's try that.
|
||||
|
||||
HMODULE hModule = GetModuleHandle(nullptr);
|
||||
THROW_LAST_ERROR_IF(hModule == nullptr);
|
||||
|
||||
std::wstring exePathString;
|
||||
THROW_IF_FAILED(wil::GetModuleFileNameW(hModule, exePathString));
|
||||
|
||||
const std::filesystem::path exePath{ exePathString };
|
||||
const std::filesystem::path rootDir = exePath.parent_path();
|
||||
return rootDir / DefaultsFilename;
|
||||
}
|
||||
|
||||
// Function Description:
|
||||
// - Gets the object in the given JSON object under the "profiles" key. Returns
|
||||
// null if there's no "profiles" key.
|
||||
// Arguments:
|
||||
// - json: the json object to get the profiles from.
|
||||
// Return Value:
|
||||
// - the Json::Value representing the profiles property from the given object
|
||||
const Json::Value& CascadiaSettings::_GetProfilesJsonObject(const Json::Value& json)
|
||||
{
|
||||
return json[JsonKey(ProfilesKey)];
|
||||
}
|
||||
|
||||
// Function Description:
|
||||
// - Gets the object in the given JSON object under the "disabledProfileSources"
|
||||
// key. Returns null if there's no "disabledProfileSources" key.
|
||||
// Arguments:
|
||||
// - json: the json object to get the disabled profile sources from.
|
||||
// Return Value:
|
||||
// - the Json::Value representing the `disabledProfileSources` property from the
|
||||
// given object
|
||||
const Json::Value& CascadiaSettings::_GetDisabledProfileSourcesJsonObject(const Json::Value& json)
|
||||
{
|
||||
// Check the globals first, then look in the root.
|
||||
if (json.isMember(JsonKey(GlobalsKey)))
|
||||
{
|
||||
return json[JsonKey(GlobalsKey)][JsonKey(DisabledProfileSourcesKey)];
|
||||
}
|
||||
return json[JsonKey(DisabledProfileSourcesKey)];
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
#include "ColorScheme.h"
|
||||
#include "../../types/inc/Utils.hpp"
|
||||
#include "Utils.h"
|
||||
#include "JsonUtils.h"
|
||||
|
||||
using namespace TerminalApp;
|
||||
using namespace ::Microsoft::Console;
|
||||
using namespace TerminalApp;
|
||||
using namespace winrt::Microsoft::Terminal::Settings;
|
||||
using namespace winrt::Microsoft::Terminal::TerminalControl;
|
||||
|
||||
@@ -66,7 +67,8 @@ void ColorScheme::ApplyScheme(TerminalSettings terminalSettings) const
|
||||
terminalSettings.DefaultForeground(_defaultForeground);
|
||||
terminalSettings.DefaultBackground(_defaultBackground);
|
||||
|
||||
for (int i = 0; i < _table.size(); i++)
|
||||
auto const tableCount = gsl::narrow_cast<int>(_table.size());
|
||||
for (int i = 0; i < tableCount; i++)
|
||||
{
|
||||
terminalSettings.SetColorTableEntry(i, _table[i]);
|
||||
}
|
||||
@@ -104,21 +106,54 @@ Json::Value ColorScheme::ToJson() const
|
||||
// - a new ColorScheme instance created from the values in `json`
|
||||
ColorScheme ColorScheme::FromJson(const Json::Value& json)
|
||||
{
|
||||
ColorScheme result{};
|
||||
ColorScheme result;
|
||||
result.LayerJson(json);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Returns true if we think the provided json object represents an instance of
|
||||
// the same object as this object. If true, we should layer that json object
|
||||
// on us, instead of creating a new object.
|
||||
// Arguments:
|
||||
// - json: The json object to query to see if it's the same
|
||||
// Return Value:
|
||||
// - true iff the json object has the same `name` as we do.
|
||||
bool ColorScheme::ShouldBeLayered(const Json::Value& json) const
|
||||
{
|
||||
if (const auto name{ json[JsonKey(NameKey)] })
|
||||
{
|
||||
const auto nameFromJson = GetWstringFromJson(name);
|
||||
return nameFromJson == _schemeName;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Layer values from the given json object on top of the existing properties
|
||||
// of this object. For any keys we're expecting to be able to parse in the
|
||||
// given object, we'll parse them and replace our settings with values from
|
||||
// the new json object. Properties that _aren't_ in the json object will _not_
|
||||
// be replaced.
|
||||
// Arguments:
|
||||
// - json: an object which should be a partial serialization of a ColorScheme object.
|
||||
// Return Value:
|
||||
// <none>
|
||||
void ColorScheme::LayerJson(const Json::Value& json)
|
||||
{
|
||||
if (auto name{ json[JsonKey(NameKey)] })
|
||||
{
|
||||
result._schemeName = winrt::to_hstring(name.asString());
|
||||
_schemeName = winrt::to_hstring(name.asString());
|
||||
}
|
||||
if (auto fgString{ json[JsonKey(ForegroundKey)] })
|
||||
{
|
||||
const auto color = Utils::ColorFromHexString(fgString.asString());
|
||||
result._defaultForeground = color;
|
||||
_defaultForeground = color;
|
||||
}
|
||||
if (auto bgString{ json[JsonKey(BackgroundKey)] })
|
||||
{
|
||||
const auto color = Utils::ColorFromHexString(bgString.asString());
|
||||
result._defaultBackground = color;
|
||||
_defaultBackground = color;
|
||||
}
|
||||
|
||||
// Legacy Deserialization. Leave in place to allow forward compatibility
|
||||
@@ -131,7 +166,7 @@ ColorScheme ColorScheme::FromJson(const Json::Value& json)
|
||||
if (tableEntry.isString())
|
||||
{
|
||||
auto color = Utils::ColorFromHexString(tableEntry.asString());
|
||||
result._table.at(i) = color;
|
||||
_table.at(i) = color;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -143,12 +178,10 @@ ColorScheme ColorScheme::FromJson(const Json::Value& json)
|
||||
if (auto str{ json[JsonKey(current)] })
|
||||
{
|
||||
const auto color = Utils::ColorFromHexString(str.asString());
|
||||
result._table.at(i) = color;
|
||||
_table.at(i) = color;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::wstring_view ColorScheme::GetName() const noexcept
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user