mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-06 22:29:43 +00:00
Compare commits
133 Commits
dev/migrie
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b47e924565 | ||
|
|
34ecd1757f | ||
|
|
93004173ec | ||
|
|
458a140ad7 | ||
|
|
cd68bd0dfd | ||
|
|
c8be59f4a9 | ||
|
|
0026b67dd6 | ||
|
|
00f4382d63 | ||
|
|
57f727c01f | ||
|
|
daa8c44505 | ||
|
|
763dab5d7f | ||
|
|
86fa001dd6 | ||
|
|
507a84664e | ||
|
|
35a9314aa5 | ||
|
|
68887fc94e | ||
|
|
83d35c1191 | ||
|
|
b54429823e | ||
|
|
d7fcc56b90 | ||
|
|
b6927b24e8 | ||
|
|
d33dd1ffce | ||
|
|
da5ec7b2a2 | ||
|
|
ba534aaad6 | ||
|
|
7541b71de8 | ||
|
|
ac9d3dcfbe | ||
|
|
f7b205fa78 | ||
|
|
ff126c5a2f | ||
|
|
91f68e2914 | ||
|
|
245a244f1b | ||
|
|
fc57c82f80 | ||
|
|
c24194a3f3 | ||
|
|
3ab1d724d2 | ||
|
|
e13d1a7b61 | ||
|
|
48543bb3e7 | ||
|
|
91b867102c | ||
|
|
4014100b2d | ||
|
|
3778924aa4 | ||
|
|
c01573b5d3 | ||
|
|
62a12eeb79 | ||
|
|
e457a1a868 | ||
|
|
1c0bbe72d3 | ||
|
|
cf694747a0 | ||
|
|
9444617bc6 | ||
|
|
b80f6de58c | ||
|
|
34bb1cbd01 | ||
|
|
b656fdd34f | ||
|
|
41e9c59879 | ||
|
|
680c7deb2f | ||
|
|
e9548969e4 | ||
|
|
7fe98a0344 | ||
|
|
5b1137ccff | ||
|
|
96e0232603 | ||
|
|
ae8347f336 | ||
|
|
3f1262e4c2 | ||
|
|
b50df20cfe | ||
|
|
7b6958405e | ||
|
|
65269c8311 | ||
|
|
3e5d6e71a2 | ||
|
|
dff8f15efa | ||
|
|
2b27d4ce91 | ||
|
|
172d9a7f64 | ||
|
|
02fd7a0c15 | ||
|
|
acf36d0e4f | ||
|
|
d45cc4c2e1 | ||
|
|
9700598ecb | ||
|
|
124cbd9e47 | ||
|
|
b6f5f2a323 | ||
|
|
9c4950cb32 | ||
|
|
3b53c6956c | ||
|
|
98d0613124 | ||
|
|
e7592ec3d4 | ||
|
|
b7a7aa0bc3 | ||
|
|
0fa286c011 | ||
|
|
12b12d5b07 | ||
|
|
f196285824 | ||
|
|
9fed14a95e | ||
|
|
c33a97955f | ||
|
|
a7d7362b95 | ||
|
|
9293867a06 | ||
|
|
2919d96c21 | ||
|
|
6c4878c8d5 | ||
|
|
90e7c28069 | ||
|
|
de49cf1d0d | ||
|
|
2b4b8dd1bd | ||
|
|
fa0cd8c7ed | ||
|
|
3c044f20cf | ||
|
|
9aea904229 | ||
|
|
f7b5ff322a | ||
|
|
9905bd5f09 | ||
|
|
e0f585251a | ||
|
|
9b1bb134bf | ||
|
|
e851c61777 | ||
|
|
f8ccf64252 | ||
|
|
5f590a5efa | ||
|
|
bf783842f2 | ||
|
|
20bfccefb7 | ||
|
|
9b636edad2 | ||
|
|
cb2cd7e219 | ||
|
|
aaf2395266 | ||
|
|
20fc57ee0f | ||
|
|
058cbd11e7 | ||
|
|
7235996b4d | ||
|
|
bc70a97fd7 | ||
|
|
e557a867ee | ||
|
|
49d008537f | ||
|
|
8bef5eefd5 | ||
|
|
039c80d443 | ||
|
|
c4c3c3116b | ||
|
|
7d503a4352 | ||
|
|
cceb0eaa68 | ||
|
|
713027b5e3 | ||
|
|
fcca88ab25 | ||
|
|
6b2ae625a5 | ||
|
|
a8b4044630 | ||
|
|
f087d03eb2 | ||
|
|
990e06b445 | ||
|
|
08646e5ca3 | ||
|
|
68e0af41a8 | ||
|
|
9b07cb8c71 | ||
|
|
5220738d8e | ||
|
|
0b0161d537 | ||
|
|
683f4e28d3 | ||
|
|
fc7b052461 | ||
|
|
8276b549e8 | ||
|
|
01a04906f3 | ||
|
|
96b9ba99b2 | ||
|
|
d37df8ab05 | ||
|
|
4f46129cb4 | ||
|
|
2485a638cb | ||
|
|
33470ad08e | ||
|
|
c5366cea75 | ||
|
|
477c04ab94 | ||
|
|
b8e6b8e27c | ||
|
|
539a5dc0af |
25
.github/actions/spell-check/advice.txt
vendored
25
.github/actions/spell-check/advice.txt
vendored
@@ -1,25 +0,0 @@
|
||||
<details>
|
||||
<summary>
|
||||
:pencil2: Contributor please read this
|
||||
</summary>
|
||||
|
||||
By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
|
||||
|
||||
:warning: The command is written for posix shells. You can copy the contents of each `perl` command excluding the outer `'` marks and dropping any `'"`/`"'` quotation mark pairs into a file and then run `perl file.pl` from the root of the repository to run the code. Alternatively, you can manually insert the items...
|
||||
|
||||
If the listed items are:
|
||||
* ... **misspelled**, then please *correct* them instead of using the command.
|
||||
* ... *names*, please add them to `.github/actions/spell-check/dictionary/names.txt`.
|
||||
* ... APIs, you can add them to a file in `.github/actions/spell-check/dictionary/`.
|
||||
* ... just things you're using, please add them to an appropriate file in `.github/actions/spell-check/expect/`.
|
||||
* ... tokens you only need in one place and shouldn't *generally be used*, you can add an item in an appropriate file in `.github/actions/spell-check/patterns/`.
|
||||
|
||||
See the `README.md` in each directory for more information.
|
||||
|
||||
:microscope: You can test your commits **without** *appending* to a PR by creating a new branch with that extra change and pushing it to your fork. The [:check-spelling](https://github.com/marketplace/actions/check-spelling) action will run in response to your **push** -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. :wink:
|
||||
|
||||
</details>
|
||||
|
||||
#### :warning: Reviewers
|
||||
At present, the action that triggered this message will not show its :x: in this PR unless the branch is within this repository.
|
||||
Thus, you **should** make sure that this comment has been addressed before encouraging the merge bot to merge this PR.
|
||||
93
.github/actions/spell-check/dictionary/apis.txt
vendored
93
.github/actions/spell-check/dictionary/apis.txt
vendored
@@ -1,93 +0,0 @@
|
||||
ACCEPTFILES
|
||||
ACCESSDENIED
|
||||
alignof
|
||||
bitfield
|
||||
bitfields
|
||||
CLASSNOTAVAILABLE
|
||||
cmdletbinding
|
||||
COLORPROPERTY
|
||||
CXICON
|
||||
CYICON
|
||||
D2DERR_SHADER_COMPILE_FAILED
|
||||
DERR
|
||||
environstrings
|
||||
EXPCMDFLAGS
|
||||
EXPCMDSTATE
|
||||
frac
|
||||
fullkbd
|
||||
futex
|
||||
GETDESKWALLPAPER
|
||||
GETHIGHCONTRAST
|
||||
Hashtable
|
||||
HIGHCONTRASTON
|
||||
HIGHCONTRASTW
|
||||
href
|
||||
IAsync
|
||||
IBind
|
||||
IBox
|
||||
IClass
|
||||
IComparable
|
||||
ICustom
|
||||
IDialog
|
||||
IDirect
|
||||
IExplorer
|
||||
IInheritable
|
||||
IMap
|
||||
IObject
|
||||
IStorage
|
||||
ITab
|
||||
ITaskbar
|
||||
LCID
|
||||
llabs
|
||||
localtime
|
||||
lround
|
||||
LSHIFT
|
||||
msappx
|
||||
NCHITTEST
|
||||
NCLBUTTONDBLCLK
|
||||
NCRBUTTONDBLCLK
|
||||
NOAGGREGATION
|
||||
NOPROGRESS
|
||||
NOREDIRECTIONBITMAP
|
||||
ntprivapi
|
||||
oaidl
|
||||
ocidl
|
||||
otms
|
||||
OUTLINETEXTMETRICW
|
||||
overridable
|
||||
PAGESCROLL
|
||||
RETURNCMD
|
||||
rfind
|
||||
roundf
|
||||
RSHIFT
|
||||
rx
|
||||
schandle
|
||||
semver
|
||||
serializer
|
||||
shobjidl
|
||||
SIZENS
|
||||
smoothstep
|
||||
GETDESKWALLPAPER
|
||||
snprintf
|
||||
spsc
|
||||
sregex
|
||||
STDCPP
|
||||
strchr
|
||||
Subheader
|
||||
Subpage
|
||||
UPDATEINIFILE
|
||||
syscall
|
||||
TBPF
|
||||
THEMECHANGED
|
||||
tmp
|
||||
tolower
|
||||
tx
|
||||
UPDATEINIFILE
|
||||
userenv
|
||||
wcsstr
|
||||
wcstoui
|
||||
wpc
|
||||
wsregex
|
||||
XDocument
|
||||
XElement
|
||||
XParse
|
||||
782
.github/actions/spell-check/dictionary/colors.txt
vendored
782
.github/actions/spell-check/dictionary/colors.txt
vendored
@@ -1,782 +0,0 @@
|
||||
snow
|
||||
ghost-white
|
||||
ghostwhite
|
||||
white-smoke
|
||||
whitesmoke
|
||||
gainsboro
|
||||
floral-white
|
||||
floralwhite
|
||||
old-lace
|
||||
oldlace
|
||||
linen
|
||||
antique-white
|
||||
antiquewhite
|
||||
papaya-whip
|
||||
papayawhip
|
||||
blanched-almond
|
||||
blanchedalmond
|
||||
bisque
|
||||
peach-puff
|
||||
peachpuff
|
||||
navajo-white
|
||||
navajowhite
|
||||
moccasin
|
||||
cornsilk
|
||||
ivory
|
||||
lemon-chiffon
|
||||
lemonchiffon
|
||||
seashell
|
||||
honeydew
|
||||
mint-cream
|
||||
mintcream
|
||||
azure
|
||||
alice-blue
|
||||
aliceblue
|
||||
lavender
|
||||
lavender-blush
|
||||
lavenderblush
|
||||
misty-rose
|
||||
mistyrose
|
||||
white
|
||||
black
|
||||
dark-slate-gray
|
||||
darkslategray
|
||||
dark-slate-grey
|
||||
darkslategrey
|
||||
dim-gray
|
||||
dimgray
|
||||
dim-grey
|
||||
dimgrey
|
||||
slate-gray
|
||||
slategray
|
||||
slate-grey
|
||||
slategrey
|
||||
light-slate-gray
|
||||
lightslategray
|
||||
light-slate-grey
|
||||
lightslategrey
|
||||
gray
|
||||
grey
|
||||
xray
|
||||
x11gray
|
||||
xrey
|
||||
x11grey
|
||||
web-gray
|
||||
webgray
|
||||
web-grey
|
||||
webgrey
|
||||
light-grey
|
||||
lightgrey
|
||||
light-gray
|
||||
lightgray
|
||||
midnight-blue
|
||||
midnightblue
|
||||
navy
|
||||
navy-blue
|
||||
navyblue
|
||||
cornflower-blue
|
||||
cornflowerblue
|
||||
dark-slate-blue
|
||||
darkslateblue
|
||||
slate-blue
|
||||
slateblue
|
||||
medium-slate-blue
|
||||
mediumslateblue
|
||||
light-slate-blue
|
||||
lightslateblue
|
||||
medium-blue
|
||||
mediumblue
|
||||
royal-blue
|
||||
royalblue
|
||||
blue
|
||||
dodger-blue
|
||||
dodgerblue
|
||||
deep-sky-blue
|
||||
deepskyblue
|
||||
sky-blue
|
||||
skyblue
|
||||
light-sky-blue
|
||||
lightskyblue
|
||||
steel-blue
|
||||
steelblue
|
||||
light-steel-blue
|
||||
lightsteelblue
|
||||
light-blue
|
||||
lightblue
|
||||
powder-blue
|
||||
powderblue
|
||||
pale-turquoise
|
||||
paleturquoise
|
||||
dark-turquoise
|
||||
darkturquoise
|
||||
medium-turquoise
|
||||
mediumturquoise
|
||||
turquoise
|
||||
cyan
|
||||
aqua
|
||||
light-cyan
|
||||
lightcyan
|
||||
cadet-blue
|
||||
cadetblue
|
||||
medium-aquamarine
|
||||
mediumaquamarine
|
||||
aquamarine
|
||||
dark-green
|
||||
darkgreen
|
||||
dark-olive-green
|
||||
darkolivegreen
|
||||
dark-sea-green
|
||||
darkseagreen
|
||||
sea-green
|
||||
seagreen
|
||||
medium-sea-green
|
||||
mediumseagreen
|
||||
light-sea-green
|
||||
lightseagreen
|
||||
pale-green
|
||||
palegreen
|
||||
spring-green
|
||||
springgreen
|
||||
lawn-green
|
||||
lawngreen
|
||||
green
|
||||
lime
|
||||
xreen
|
||||
x11green
|
||||
web-green
|
||||
webgreen
|
||||
chartreuse
|
||||
medium-spring-green
|
||||
mediumspringgreen
|
||||
green-yellow
|
||||
greenyellow
|
||||
lime-green
|
||||
limegreen
|
||||
yellow-green
|
||||
yellowgreen
|
||||
forest-green
|
||||
forestgreen
|
||||
olive-drab
|
||||
olivedrab
|
||||
dark-khaki
|
||||
darkkhaki
|
||||
khaki
|
||||
pale-goldenrod
|
||||
palegoldenrod
|
||||
light-goldenrod-yellow
|
||||
lightgoldenrodyellow
|
||||
light-yellow
|
||||
lightyellow
|
||||
yellow
|
||||
gold
|
||||
light-goldenrod
|
||||
lightgoldenrod
|
||||
goldenrod
|
||||
dark-goldenrod
|
||||
darkgoldenrod
|
||||
rosy-brown
|
||||
rosybrown
|
||||
indian-red
|
||||
indianred
|
||||
saddle-brown
|
||||
saddlebrown
|
||||
sienna
|
||||
peru
|
||||
burlywood
|
||||
beige
|
||||
wheat
|
||||
sandy-brown
|
||||
sandybrown
|
||||
tan
|
||||
chocolate
|
||||
firebrick
|
||||
brown
|
||||
dark-salmon
|
||||
darksalmon
|
||||
salmon
|
||||
light-salmon
|
||||
lightsalmon
|
||||
orange
|
||||
dark-orange
|
||||
darkorange
|
||||
coral
|
||||
light-coral
|
||||
lightcoral
|
||||
tomato
|
||||
orange-red
|
||||
orangered
|
||||
red
|
||||
hot-pink
|
||||
hotpink
|
||||
deep-pink
|
||||
deeppink
|
||||
pink
|
||||
light-pink
|
||||
lightpink
|
||||
pale-violet-red
|
||||
palevioletred
|
||||
maroon
|
||||
xaroon
|
||||
x11maroon
|
||||
web-maroon
|
||||
webmaroon
|
||||
medium-violet-red
|
||||
mediumvioletred
|
||||
violet-red
|
||||
violetred
|
||||
magenta
|
||||
fuchsia
|
||||
violet
|
||||
plum
|
||||
orchid
|
||||
medium-orchid
|
||||
mediumorchid
|
||||
dark-orchid
|
||||
darkorchid
|
||||
dark-violet
|
||||
darkviolet
|
||||
blue-violet
|
||||
blueviolet
|
||||
purple
|
||||
xurple
|
||||
x11purple
|
||||
web-purple
|
||||
webpurple
|
||||
medium-purple
|
||||
mediumpurple
|
||||
thistle
|
||||
snow1
|
||||
snow2
|
||||
snow3
|
||||
snow4
|
||||
seashell1
|
||||
seashell2
|
||||
seashell3
|
||||
seashell4
|
||||
antiquewhite1
|
||||
antiquewhite2
|
||||
antiquewhite3
|
||||
antiquewhite4
|
||||
bisque1
|
||||
bisque2
|
||||
bisque3
|
||||
bisque4
|
||||
peachpuff1
|
||||
peachpuff2
|
||||
peachpuff3
|
||||
peachpuff4
|
||||
navajowhite1
|
||||
navajowhite2
|
||||
navajowhite3
|
||||
navajowhite4
|
||||
lemonchiffon1
|
||||
lemonchiffon2
|
||||
lemonchiffon3
|
||||
lemonchiffon4
|
||||
cornsilk1
|
||||
cornsilk2
|
||||
cornsilk3
|
||||
cornsilk4
|
||||
ivory1
|
||||
ivory2
|
||||
ivory3
|
||||
ivory4
|
||||
honeydew1
|
||||
honeydew2
|
||||
honeydew3
|
||||
honeydew4
|
||||
lavenderblush1
|
||||
lavenderblush2
|
||||
lavenderblush3
|
||||
lavenderblush4
|
||||
mistyrose1
|
||||
mistyrose2
|
||||
mistyrose3
|
||||
mistyrose4
|
||||
azure1
|
||||
azure2
|
||||
azure3
|
||||
azure4
|
||||
slateblue1
|
||||
slateblue2
|
||||
slateblue3
|
||||
slateblue4
|
||||
royalblue1
|
||||
royalblue2
|
||||
royalblue3
|
||||
royalblue4
|
||||
blue1
|
||||
blue2
|
||||
blue3
|
||||
blue4
|
||||
dodgerblue1
|
||||
dodgerblue2
|
||||
dodgerblue3
|
||||
dodgerblue4
|
||||
steelblue1
|
||||
steelblue2
|
||||
steelblue3
|
||||
steelblue4
|
||||
deepskyblue1
|
||||
deepskyblue2
|
||||
deepskyblue3
|
||||
deepskyblue4
|
||||
skyblue1
|
||||
skyblue2
|
||||
skyblue3
|
||||
skyblue4
|
||||
lightskyblue1
|
||||
lightskyblue2
|
||||
lightskyblue3
|
||||
lightskyblue4
|
||||
slategray1
|
||||
slategray2
|
||||
slategray3
|
||||
slategray4
|
||||
lightsteelblue1
|
||||
lightsteelblue2
|
||||
lightsteelblue3
|
||||
lightsteelblue4
|
||||
lightblue1
|
||||
lightblue2
|
||||
lightblue3
|
||||
lightblue4
|
||||
lightcyan1
|
||||
lightcyan2
|
||||
lightcyan3
|
||||
lightcyan4
|
||||
paleturquoise1
|
||||
paleturquoise2
|
||||
paleturquoise3
|
||||
paleturquoise4
|
||||
cadetblue1
|
||||
cadetblue2
|
||||
cadetblue3
|
||||
cadetblue4
|
||||
turquoise1
|
||||
turquoise2
|
||||
turquoise3
|
||||
turquoise4
|
||||
cyan1
|
||||
cyan2
|
||||
cyan3
|
||||
cyan4
|
||||
darkslategray1
|
||||
darkslategray2
|
||||
darkslategray3
|
||||
darkslategray4
|
||||
aquamarine1
|
||||
aquamarine2
|
||||
aquamarine3
|
||||
aquamarine4
|
||||
darkseagreen1
|
||||
darkseagreen2
|
||||
darkseagreen3
|
||||
darkseagreen4
|
||||
seagreen1
|
||||
seagreen2
|
||||
seagreen3
|
||||
seagreen4
|
||||
palegreen1
|
||||
palegreen2
|
||||
palegreen3
|
||||
palegreen4
|
||||
springgreen1
|
||||
springgreen2
|
||||
springgreen3
|
||||
springgreen4
|
||||
green1
|
||||
green2
|
||||
green3
|
||||
green4
|
||||
chartreuse1
|
||||
chartreuse2
|
||||
chartreuse3
|
||||
chartreuse4
|
||||
olivedrab1
|
||||
olivedrab2
|
||||
olivedrab3
|
||||
olivedrab4
|
||||
darkolivegreen1
|
||||
darkolivegreen2
|
||||
darkolivegreen3
|
||||
darkolivegreen4
|
||||
khaki1
|
||||
khaki2
|
||||
khaki3
|
||||
khaki4
|
||||
lightgoldenrod1
|
||||
lightgoldenrod2
|
||||
lightgoldenrod3
|
||||
lightgoldenrod4
|
||||
lightyellow1
|
||||
lightyellow2
|
||||
lightyellow3
|
||||
lightyellow4
|
||||
yellow1
|
||||
yellow2
|
||||
yellow3
|
||||
yellow4
|
||||
gold1
|
||||
gold2
|
||||
gold3
|
||||
gold4
|
||||
goldenrod1
|
||||
goldenrod2
|
||||
goldenrod3
|
||||
goldenrod4
|
||||
darkgoldenrod1
|
||||
darkgoldenrod2
|
||||
darkgoldenrod3
|
||||
darkgoldenrod4
|
||||
rosybrown1
|
||||
rosybrown2
|
||||
rosybrown3
|
||||
rosybrown4
|
||||
indianred1
|
||||
indianred2
|
||||
indianred3
|
||||
indianred4
|
||||
sienna1
|
||||
sienna2
|
||||
sienna3
|
||||
sienna4
|
||||
burlywood1
|
||||
burlywood2
|
||||
burlywood3
|
||||
burlywood4
|
||||
wheat1
|
||||
wheat2
|
||||
wheat3
|
||||
wheat4
|
||||
tan1
|
||||
tan2
|
||||
tan3
|
||||
tan4
|
||||
chocolate1
|
||||
chocolate2
|
||||
chocolate3
|
||||
chocolate4
|
||||
firebrick1
|
||||
firebrick2
|
||||
firebrick3
|
||||
firebrick4
|
||||
brown1
|
||||
brown2
|
||||
brown3
|
||||
brown4
|
||||
salmon1
|
||||
salmon2
|
||||
salmon3
|
||||
salmon4
|
||||
lightsalmon1
|
||||
lightsalmon2
|
||||
lightsalmon3
|
||||
lightsalmon4
|
||||
orange1
|
||||
orange2
|
||||
orange3
|
||||
orange4
|
||||
darkorange1
|
||||
darkorange2
|
||||
darkorange3
|
||||
darkorange4
|
||||
coral1
|
||||
coral2
|
||||
coral3
|
||||
coral4
|
||||
tomato1
|
||||
tomato2
|
||||
tomato3
|
||||
tomato4
|
||||
orangered1
|
||||
orangered2
|
||||
orangered3
|
||||
orangered4
|
||||
red1
|
||||
red2
|
||||
red3
|
||||
red4
|
||||
deeppink1
|
||||
deeppink2
|
||||
deeppink3
|
||||
deeppink4
|
||||
hotpink1
|
||||
hotpink2
|
||||
hotpink3
|
||||
hotpink4
|
||||
pink1
|
||||
pink2
|
||||
pink3
|
||||
pink4
|
||||
lightpink1
|
||||
lightpink2
|
||||
lightpink3
|
||||
lightpink4
|
||||
palevioletred1
|
||||
palevioletred2
|
||||
palevioletred3
|
||||
palevioletred4
|
||||
maroon1
|
||||
maroon2
|
||||
maroon3
|
||||
maroon4
|
||||
violetred1
|
||||
violetred2
|
||||
violetred3
|
||||
violetred4
|
||||
magenta1
|
||||
magenta2
|
||||
magenta3
|
||||
magenta4
|
||||
orchid1
|
||||
orchid2
|
||||
orchid3
|
||||
orchid4
|
||||
plum1
|
||||
plum2
|
||||
plum3
|
||||
plum4
|
||||
mediumorchid1
|
||||
mediumorchid2
|
||||
mediumorchid3
|
||||
mediumorchid4
|
||||
darkorchid1
|
||||
darkorchid2
|
||||
darkorchid3
|
||||
darkorchid4
|
||||
purple1
|
||||
purple2
|
||||
purple3
|
||||
purple4
|
||||
mediumpurple1
|
||||
mediumpurple2
|
||||
mediumpurple3
|
||||
mediumpurple4
|
||||
thistle1
|
||||
thistle2
|
||||
thistle3
|
||||
thistle4
|
||||
gray0
|
||||
grey0
|
||||
gray1
|
||||
grey1
|
||||
gray2
|
||||
grey2
|
||||
gray3
|
||||
grey3
|
||||
gray4
|
||||
grey4
|
||||
gray5
|
||||
grey5
|
||||
gray6
|
||||
grey6
|
||||
gray7
|
||||
grey7
|
||||
gray8
|
||||
grey8
|
||||
gray9
|
||||
grey9
|
||||
gray10
|
||||
grey10
|
||||
gray11
|
||||
grey11
|
||||
gray12
|
||||
grey12
|
||||
gray13
|
||||
grey13
|
||||
gray14
|
||||
grey14
|
||||
gray15
|
||||
grey15
|
||||
gray16
|
||||
grey16
|
||||
gray17
|
||||
grey17
|
||||
gray18
|
||||
grey18
|
||||
gray19
|
||||
grey19
|
||||
gray20
|
||||
grey20
|
||||
gray21
|
||||
grey21
|
||||
gray22
|
||||
grey22
|
||||
gray23
|
||||
grey23
|
||||
gray24
|
||||
grey24
|
||||
gray25
|
||||
grey25
|
||||
gray26
|
||||
grey26
|
||||
gray27
|
||||
grey27
|
||||
gray28
|
||||
grey28
|
||||
gray29
|
||||
grey29
|
||||
gray30
|
||||
grey30
|
||||
gray31
|
||||
grey31
|
||||
gray32
|
||||
grey32
|
||||
gray33
|
||||
grey33
|
||||
gray34
|
||||
grey34
|
||||
gray35
|
||||
grey35
|
||||
gray36
|
||||
grey36
|
||||
gray37
|
||||
grey37
|
||||
gray38
|
||||
grey38
|
||||
gray39
|
||||
grey39
|
||||
gray40
|
||||
grey40
|
||||
gray41
|
||||
grey41
|
||||
gray42
|
||||
grey42
|
||||
gray43
|
||||
grey43
|
||||
gray44
|
||||
grey44
|
||||
gray45
|
||||
grey45
|
||||
gray46
|
||||
grey46
|
||||
gray47
|
||||
grey47
|
||||
gray48
|
||||
grey48
|
||||
gray49
|
||||
grey49
|
||||
gray50
|
||||
grey50
|
||||
gray51
|
||||
grey51
|
||||
gray52
|
||||
grey52
|
||||
gray53
|
||||
grey53
|
||||
gray54
|
||||
grey54
|
||||
gray55
|
||||
grey55
|
||||
gray56
|
||||
grey56
|
||||
gray57
|
||||
grey57
|
||||
gray58
|
||||
grey58
|
||||
gray59
|
||||
grey59
|
||||
gray60
|
||||
grey60
|
||||
gray61
|
||||
grey61
|
||||
gray62
|
||||
grey62
|
||||
gray63
|
||||
grey63
|
||||
gray64
|
||||
grey64
|
||||
gray65
|
||||
grey65
|
||||
gray66
|
||||
grey66
|
||||
gray67
|
||||
grey67
|
||||
gray68
|
||||
grey68
|
||||
gray69
|
||||
grey69
|
||||
gray70
|
||||
grey70
|
||||
gray71
|
||||
grey71
|
||||
gray72
|
||||
grey72
|
||||
gray73
|
||||
grey73
|
||||
gray74
|
||||
grey74
|
||||
gray75
|
||||
grey75
|
||||
gray76
|
||||
grey76
|
||||
gray77
|
||||
grey77
|
||||
gray78
|
||||
grey78
|
||||
gray79
|
||||
grey79
|
||||
gray80
|
||||
grey80
|
||||
gray81
|
||||
grey81
|
||||
gray82
|
||||
grey82
|
||||
gray83
|
||||
grey83
|
||||
gray84
|
||||
grey84
|
||||
gray85
|
||||
grey85
|
||||
gray86
|
||||
grey86
|
||||
gray87
|
||||
grey87
|
||||
gray88
|
||||
grey88
|
||||
gray89
|
||||
grey89
|
||||
gray90
|
||||
grey90
|
||||
gray91
|
||||
grey91
|
||||
gray92
|
||||
grey92
|
||||
gray93
|
||||
grey93
|
||||
gray94
|
||||
grey94
|
||||
gray95
|
||||
grey95
|
||||
gray96
|
||||
grey96
|
||||
gray97
|
||||
grey97
|
||||
gray98
|
||||
grey98
|
||||
gray99
|
||||
grey99
|
||||
gray100
|
||||
grey100
|
||||
dark-grey
|
||||
darkgrey
|
||||
dark-gray
|
||||
darkgray
|
||||
dark-blue
|
||||
darkblue
|
||||
dark-cyan
|
||||
darkcyan
|
||||
dark-magenta
|
||||
darkmagenta
|
||||
dark-red
|
||||
darkred
|
||||
light-green
|
||||
lightgreen
|
||||
crimson
|
||||
indigo
|
||||
olive
|
||||
rebecca-purple
|
||||
rebeccapurple
|
||||
silver
|
||||
teal
|
||||
479840
.github/actions/spell-check/dictionary/dictionary.txt
vendored
479840
.github/actions/spell-check/dictionary/dictionary.txt
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,3 +0,0 @@
|
||||
powf
|
||||
sqrtf
|
||||
isnan
|
||||
65
.github/actions/spell-check/excludes.txt
vendored
65
.github/actions/spell-check/excludes.txt
vendored
@@ -1,65 +0,0 @@
|
||||
(?:^|/)dirs$
|
||||
(?:^|/)go\.mod$
|
||||
(?:^|/)go\.sum$
|
||||
(?:^|/)package-lock\.json$
|
||||
(?:^|/)sources(?:|\.dep)$
|
||||
SUMS$
|
||||
\.ai$
|
||||
\.bmp$
|
||||
\.cer$
|
||||
\.class$
|
||||
\.crl$
|
||||
\.crt$
|
||||
\.csr$
|
||||
\.dll$
|
||||
\.DS_Store$
|
||||
\.eot$
|
||||
\.eps$
|
||||
\.exe$
|
||||
\.gif$
|
||||
\.graffle$
|
||||
\.gz$
|
||||
\.icns$
|
||||
\.ico$
|
||||
\.jar$
|
||||
\.jpeg$
|
||||
\.jpg$
|
||||
\.key$
|
||||
\.lib$
|
||||
\.lock$
|
||||
\.map$
|
||||
\.min\..
|
||||
\.mp3$
|
||||
\.mp4$
|
||||
\.otf$
|
||||
\.pbxproj$
|
||||
\.pdf$
|
||||
\.pem$
|
||||
\.png$
|
||||
\.psd$
|
||||
\.runsettings$
|
||||
\.sig$
|
||||
\.so$
|
||||
\.svg$
|
||||
\.svgz$
|
||||
\.tar$
|
||||
\.tgz$
|
||||
\.ttf$
|
||||
\.vsdx$
|
||||
\.woff
|
||||
\.xcf$
|
||||
\.xls
|
||||
\.xpm$
|
||||
\.yml$
|
||||
\.zip$
|
||||
^consolegit2gitfilters\.json$
|
||||
^dep/
|
||||
^oss/
|
||||
^doc/reference/UTF8-torture-test\.txt$
|
||||
^src/interactivity/onecore/BgfxEngine\.
|
||||
^src/renderer/wddmcon/WddmConRenderer\.
|
||||
^src/terminal/parser/ft_fuzzer/VTCommandFuzzer\.cpp$
|
||||
^src/tools/U8U16Test/(?:fr|ru|zh)\.txt$
|
||||
^\.github/actions/spell-check/
|
||||
^\.gitignore$
|
||||
^doc/reference/master-sequence-list.csv$
|
||||
@@ -1 +0,0 @@
|
||||
renamer
|
||||
@@ -1,7 +0,0 @@
|
||||
autogenerated
|
||||
CPPCORECHECK
|
||||
Debian
|
||||
filepath
|
||||
inplace
|
||||
KEYBDINPUT
|
||||
WINVER
|
||||
15
.github/actions/spell-check/expect/web.txt
vendored
15
.github/actions/spell-check/expect/web.txt
vendored
@@ -1,15 +0,0 @@
|
||||
http
|
||||
td
|
||||
www
|
||||
ecma
|
||||
rapidtables
|
||||
WCAG
|
||||
freedesktop
|
||||
ycombinator
|
||||
robertelder
|
||||
kovidgoyal
|
||||
leonerd
|
||||
fixterms
|
||||
uk
|
||||
winui
|
||||
appshellintegration
|
||||
@@ -1,23 +0,0 @@
|
||||
https://(?:(?:[-a-zA-Z0-9?&=]*\.|)microsoft\.com)/[-a-zA-Z0-9?&=_#\/.]*
|
||||
https://aka\.ms/[-a-zA-Z0-9?&=\/_]*
|
||||
https://www\.itscj\.ipsj\.or\.jp/iso-ir/[-0-9]+\.pdf
|
||||
https://www\.vt100\.net/docs/[-a-zA-Z0-9#_\/.]*
|
||||
https://www.w3.org/[-a-zA-Z0-9?&=\/_#]*
|
||||
https://(?:(?:www\.|)youtube\.com|youtu.be)/[-a-zA-Z0-9?&=]*
|
||||
https://[a-z-]+\.githubusercontent\.com/[-a-zA-Z0-9?&=_\/.]*
|
||||
[Pp]ublicKeyToken="?[0-9a-fA-F]{16}"?
|
||||
(?:[{"]|UniqueIdentifier>)[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}(?:[}"]|</UniqueIdentifier)
|
||||
(?:0[Xx]|\\x|U\+|#)[a-f0-9A-FGgRr]{2,}[Uu]?[Ll]{0,2}\b
|
||||
microsoft/cascadia-code\@[0-9a-fA-F]{40}
|
||||
\d+x\d+Logo
|
||||
Scro\&ll
|
||||
# selectionInput.cpp
|
||||
:\\windows\\syste\b
|
||||
TestUtils::VerifyExpectedString\(tb, L"[^"]+"
|
||||
(?:hostSm|mach)\.ProcessString\(L"[^"]+"
|
||||
\b([A-Za-z])\1{3,}\b
|
||||
0x[0-9A-Za-z]+
|
||||
Base64::s_(?:En|De)code\(L"[^"]+"
|
||||
VERIFY_ARE_EQUAL\(L"[^"]+"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\+/"
|
||||
std::memory_order_[\w]+
|
||||
15
.github/actions/spelling/README.md
vendored
Normal file
15
.github/actions/spelling/README.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# check-spelling/check-spelling configuration
|
||||
|
||||
File | Purpose | Format | Info
|
||||
-|-|-|-
|
||||
[allow/*.txt](allow/) | Add words to the dictionary | one word per line (only letters and `'`s allowed) | [allow](https://github.com/check-spelling/check-spelling/wiki/Configuration#allow)
|
||||
[reject.txt](reject.txt) | Remove words from the dictionary (after allow) | grep pattern matching whole dictionary words | [reject](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-reject)
|
||||
[excludes.txt](excludes.txt) | Files to ignore entirely | perl regular expression | [excludes](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-excludes)
|
||||
[patterns/*.txt](patterns/) | Patterns to ignore from checked lines | perl regular expression (order matters, first match wins) | [patterns](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-patterns)
|
||||
[candidate.patterns](candidate.patterns) | Patterns that might be worth adding to [patterns.txt](patterns.txt) | perl regular expression with optional comment block introductions (all matches will be suggested) | [candidates](https://github.com/check-spelling/check-spelling/wiki/Feature:-Suggest-patterns)
|
||||
[line_forbidden.patterns](line_forbidden.patterns) | Patterns to flag in checked lines | perl regular expression (order matters, first match wins) | [patterns](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-patterns)
|
||||
[expect/*.txt](expect.txt) | Expected words that aren't in the dictionary | one word per line (sorted, alphabetically) | [expect](https://github.com/check-spelling/check-spelling/wiki/Configuration#expect)
|
||||
[advice.md](advice.md) | Supplement for GitHub comment when unrecognized words are found | GitHub Markdown | [advice](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-advice)
|
||||
|
||||
Note: you can replace any of these files with a directory by the same name (minus the suffix)
|
||||
and then include multiple files inside that directory (with that suffix) to merge multiple files together.
|
||||
48
.github/actions/spelling/advice.md
vendored
Normal file
48
.github/actions/spelling/advice.md
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<!-- See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-advice --> <!-- markdownlint-disable MD033 MD041 -->
|
||||
<details>
|
||||
<summary>
|
||||
:pencil2: Contributor please read this
|
||||
</summary>
|
||||
|
||||
By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
|
||||
|
||||
:warning: The command is written for posix shells. If it doesn't work for you, you can manually _add_ (one word per line) / _remove_ items to `expect.txt` and the `excludes.txt` files.
|
||||
|
||||
If the listed items are:
|
||||
|
||||
* ... **misspelled**, then please *correct* them instead of using the command.
|
||||
* ... *names*, please add them to `.github/actions/spelling/allow/names.txt`.
|
||||
* ... APIs, you can add them to a file in `.github/actions/spelling/allow/`.
|
||||
* ... just things you're using, please add them to an appropriate file in `.github/actions/spelling/expect/`.
|
||||
* ... tokens you only need in one place and shouldn't *generally be used*, you can add an item in an appropriate file in `.github/actions/spelling/patterns/`.
|
||||
|
||||
See the `README.md` in each directory for more information.
|
||||
|
||||
:microscope: You can test your commits **without** *appending* to a PR by creating a new branch with that extra change and pushing it to your fork. The [check-spelling](https://github.com/marketplace/actions/check-spelling) action will run in response to your **push** -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. :wink:
|
||||
|
||||
|
||||
<details><summary>If the flagged items are :exploding_head: false positives</summary>
|
||||
|
||||
If items relate to a ...
|
||||
* binary file (or some other file you wouldn't want to check at all).
|
||||
|
||||
Please add a file path to the `excludes.txt` file matching the containing file.
|
||||
|
||||
File paths are Perl 5 Regular Expressions - you can [test](
|
||||
https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your files.
|
||||
|
||||
`^` refers to the file's path from the root of the repository, so `^README\.md$` would exclude [README.md](
|
||||
../tree/HEAD/README.md) (on whichever branch you're using).
|
||||
|
||||
* well-formed pattern.
|
||||
|
||||
If you can write a [pattern](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns) that would match it,
|
||||
try adding it to the `patterns.txt` file.
|
||||
|
||||
Patterns are Perl 5 Regular Expressions - you can [test](
|
||||
https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your lines.
|
||||
|
||||
Note that patterns can't match multiline strings.
|
||||
</details>
|
||||
|
||||
</details>
|
||||
@@ -1,6 +1,6 @@
|
||||
# Dictionaries are lists of words to accept unconditionally
|
||||
# Allow files are lists of words to accept unconditionally
|
||||
|
||||
While check spelling will complain about a whitelisted word
|
||||
While check spelling will complain about an expected word
|
||||
which is no longer present, you can include things here even if
|
||||
they are not otherwise present in the repository.
|
||||
|
||||
@@ -8,11 +8,11 @@ E.g., you could include a list of system APIs here, or potential
|
||||
contributors (so that if a future commit includes their name,
|
||||
it'll be accepted).
|
||||
|
||||
### Files
|
||||
## Files
|
||||
|
||||
| File | Description |
|
||||
| ---- | ----------- |
|
||||
| [Dictionary](dictionary.txt) | Primary US English dictionary |
|
||||
| [Allow](allow.txt) | Supplements to the dictionary |
|
||||
| [Chinese](chinese.txt) | Chinese words |
|
||||
| [Japanese](japanese.txt) | Japanese words |
|
||||
| [Microsoft](microsoft.txt) | Microsoft brand items |
|
||||
108
.github/actions/spelling/allow/allow.txt
vendored
Normal file
108
.github/actions/spelling/allow/allow.txt
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
admins
|
||||
allcolors
|
||||
Apc
|
||||
apc
|
||||
breadcrumb
|
||||
breadcrumbs
|
||||
bsd
|
||||
calt
|
||||
ccmp
|
||||
changelog
|
||||
clickable
|
||||
clig
|
||||
CMMI
|
||||
copyable
|
||||
cybersecurity
|
||||
dalet
|
||||
Dcs
|
||||
dcs
|
||||
dialytika
|
||||
dje
|
||||
downside
|
||||
downsides
|
||||
dze
|
||||
dzhe
|
||||
EDDB
|
||||
EDDC
|
||||
Enum'd
|
||||
Fitt
|
||||
formattings
|
||||
FTCS
|
||||
ftp
|
||||
fvar
|
||||
gantt
|
||||
gcc
|
||||
geeksforgeeks
|
||||
ghe
|
||||
github
|
||||
gje
|
||||
godbolt
|
||||
hostname
|
||||
hostnames
|
||||
https
|
||||
hyperlink
|
||||
hyperlinking
|
||||
hyperlinks
|
||||
iconify
|
||||
img
|
||||
inlined
|
||||
It'd
|
||||
kje
|
||||
libfuzzer
|
||||
libuv
|
||||
liga
|
||||
lje
|
||||
Llast
|
||||
llvm
|
||||
Lmid
|
||||
locl
|
||||
lol
|
||||
lorem
|
||||
Lorigin
|
||||
maxed
|
||||
minimalistic
|
||||
mkmk
|
||||
mnt
|
||||
mru
|
||||
nje
|
||||
noreply
|
||||
ogonek
|
||||
ok'd
|
||||
overlined
|
||||
pipeline
|
||||
postmodern
|
||||
ptys
|
||||
qof
|
||||
qps
|
||||
rclt
|
||||
reimplementation
|
||||
reserialization
|
||||
reserialize
|
||||
reserializes
|
||||
rlig
|
||||
runtimes
|
||||
shcha
|
||||
slnt
|
||||
Sos
|
||||
ssh
|
||||
timeline
|
||||
timelines
|
||||
timestamped
|
||||
TLDR
|
||||
tokenizes
|
||||
tonos
|
||||
toolset
|
||||
tshe
|
||||
ubuntu
|
||||
uiatextrange
|
||||
UIs
|
||||
und
|
||||
unregister
|
||||
versioned
|
||||
vsdevcmd
|
||||
We'd
|
||||
wildcards
|
||||
XBox
|
||||
YBox
|
||||
yeru
|
||||
zhe
|
||||
248
.github/actions/spelling/allow/apis.txt
vendored
Normal file
248
.github/actions/spelling/allow/apis.txt
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
ACCEPTFILES
|
||||
ACCESSDENIED
|
||||
acl
|
||||
aclapi
|
||||
alignas
|
||||
alignof
|
||||
APPLYTOSUBMENUS
|
||||
appxrecipe
|
||||
bitfield
|
||||
bitfields
|
||||
BUILDBRANCH
|
||||
BUILDMSG
|
||||
BUILDNUMBER
|
||||
BYCOMMAND
|
||||
BYPOSITION
|
||||
charconv
|
||||
CLASSNOTAVAILABLE
|
||||
CLOSEAPP
|
||||
cmdletbinding
|
||||
COLORPROPERTY
|
||||
colspan
|
||||
COMDLG
|
||||
commandlinetoargv
|
||||
comparand
|
||||
cstdint
|
||||
CXICON
|
||||
CYICON
|
||||
Dacl
|
||||
dataobject
|
||||
dcomp
|
||||
DERR
|
||||
dlldata
|
||||
DNE
|
||||
DONTADDTORECENT
|
||||
DWMSBT
|
||||
DWMWA
|
||||
DWMWA
|
||||
DWORDLONG
|
||||
endfor
|
||||
ENDSESSION
|
||||
enumset
|
||||
environstrings
|
||||
EXPCMDFLAGS
|
||||
EXPCMDSTATE
|
||||
filetime
|
||||
FILTERSPEC
|
||||
FORCEFILESYSTEM
|
||||
FORCEMINIMIZE
|
||||
frac
|
||||
fullkbd
|
||||
futex
|
||||
GETDESKWALLPAPER
|
||||
GETHIGHCONTRAST
|
||||
GETMOUSEHOVERTIME
|
||||
Hashtable
|
||||
HIGHCONTRASTON
|
||||
HIGHCONTRASTW
|
||||
hotkeys
|
||||
href
|
||||
hrgn
|
||||
HTCLOSE
|
||||
hwinsta
|
||||
HWINSTA
|
||||
IActivation
|
||||
IApp
|
||||
IAppearance
|
||||
IAsync
|
||||
IBind
|
||||
IBox
|
||||
IClass
|
||||
IComparable
|
||||
IComparer
|
||||
IConnection
|
||||
ICustom
|
||||
IDialog
|
||||
IDirect
|
||||
IExplorer
|
||||
IFACEMETHOD
|
||||
IFile
|
||||
IGraphics
|
||||
IInheritable
|
||||
IMap
|
||||
IMonarch
|
||||
IObject
|
||||
iosfwd
|
||||
IPackage
|
||||
IPeasant
|
||||
ISetup
|
||||
isspace
|
||||
IStorage
|
||||
istream
|
||||
IStringable
|
||||
ITab
|
||||
ITaskbar
|
||||
itow
|
||||
IUri
|
||||
IVirtual
|
||||
KEYSELECT
|
||||
LCID
|
||||
llabs
|
||||
llu
|
||||
localtime
|
||||
lround
|
||||
Lsa
|
||||
lsass
|
||||
LSHIFT
|
||||
LTGRAY
|
||||
MAINWINDOW
|
||||
memchr
|
||||
memicmp
|
||||
MENUCOMMAND
|
||||
MENUDATA
|
||||
MENUINFO
|
||||
MENUITEMINFOW
|
||||
mmeapi
|
||||
MOUSELEAVE
|
||||
mov
|
||||
mptt
|
||||
msappx
|
||||
MULTIPLEUSE
|
||||
NCHITTEST
|
||||
NCLBUTTONDBLCLK
|
||||
NCMOUSELEAVE
|
||||
NCMOUSEMOVE
|
||||
NCRBUTTONDBLCLK
|
||||
NIF
|
||||
NIN
|
||||
NOAGGREGATION
|
||||
NOASYNC
|
||||
NOCHANGEDIR
|
||||
NOPROGRESS
|
||||
NOREDIRECTIONBITMAP
|
||||
NOREPEAT
|
||||
NOTIFYBYPOS
|
||||
NOTIFYICON
|
||||
NOTIFYICONDATA
|
||||
ntprivapi
|
||||
oaidl
|
||||
ocidl
|
||||
ODR
|
||||
offsetof
|
||||
ofstream
|
||||
onefuzz
|
||||
osver
|
||||
OSVERSIONINFOEXW
|
||||
otms
|
||||
OUTLINETEXTMETRICW
|
||||
overridable
|
||||
PACL
|
||||
PAGESCROLL
|
||||
PATINVERT
|
||||
PEXPLICIT
|
||||
PICKFOLDERS
|
||||
pmr
|
||||
ptstr
|
||||
QUERYENDSESSION
|
||||
rcx
|
||||
REGCLS
|
||||
RETURNCMD
|
||||
rfind
|
||||
ROOTOWNER
|
||||
roundf
|
||||
RSHIFT
|
||||
SACL
|
||||
schandle
|
||||
semver
|
||||
serializer
|
||||
SETVERSION
|
||||
SHELLEXECUTEINFOW
|
||||
shobjidl
|
||||
SHOWHIDE
|
||||
SHOWMINIMIZED
|
||||
SHOWTIP
|
||||
SINGLEUSE
|
||||
SIZENS
|
||||
smoothstep
|
||||
snprintf
|
||||
spsc
|
||||
sregex
|
||||
SRWLOC
|
||||
SRWLOCK
|
||||
STDCPP
|
||||
STDMETHOD
|
||||
strchr
|
||||
strcpy
|
||||
streambuf
|
||||
strtoul
|
||||
Stubless
|
||||
Subheader
|
||||
Subpage
|
||||
syscall
|
||||
SYSTEMBACKDROP
|
||||
TABROW
|
||||
TASKBARCREATED
|
||||
TBPF
|
||||
THEMECHANGED
|
||||
tlg
|
||||
TME
|
||||
tmp
|
||||
tmpdir
|
||||
tolower
|
||||
toupper
|
||||
TRACKMOUSEEVENT
|
||||
TTask
|
||||
TVal
|
||||
UChar
|
||||
UFIELD
|
||||
ULARGE
|
||||
UOI
|
||||
UPDATEINIFILE
|
||||
userenv
|
||||
USEROBJECTFLAGS
|
||||
Viewbox
|
||||
virtualalloc
|
||||
wcsstr
|
||||
wcstoui
|
||||
winmain
|
||||
winsta
|
||||
winstamin
|
||||
wmemcmp
|
||||
wpc
|
||||
WSF
|
||||
wsregex
|
||||
wwinmain
|
||||
xchg
|
||||
XDocument
|
||||
XElement
|
||||
xfacet
|
||||
xhash
|
||||
XIcon
|
||||
xiosbase
|
||||
xlocale
|
||||
xlocbuf
|
||||
xlocinfo
|
||||
xlocmes
|
||||
xlocmon
|
||||
xlocnum
|
||||
xloctime
|
||||
XMax
|
||||
xmemory
|
||||
XParse
|
||||
xpath
|
||||
xstddef
|
||||
xstring
|
||||
xtree
|
||||
xutility
|
||||
YIcon
|
||||
YMax
|
||||
117
.github/actions/spelling/allow/colors.txt
vendored
Normal file
117
.github/actions/spelling/allow/colors.txt
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
alice
|
||||
aliceblue
|
||||
antiquewhite
|
||||
blanchedalmond
|
||||
blueviolet
|
||||
burlywood
|
||||
cadetblue
|
||||
cornflowerblue
|
||||
cornsilk
|
||||
cyan
|
||||
darkblue
|
||||
darkcyan
|
||||
darkgoldenrod
|
||||
darkgray
|
||||
darkgreen
|
||||
darkgrey
|
||||
darkkhaki
|
||||
darkmagenta
|
||||
darkolivegreen
|
||||
darkorange
|
||||
darkorchid
|
||||
darkred
|
||||
darksalmon
|
||||
darkseagreen
|
||||
darkslateblue
|
||||
darkslategray
|
||||
darkslategrey
|
||||
darkturquoise
|
||||
darkviolet
|
||||
deeppink
|
||||
deepskyblue
|
||||
dimgray
|
||||
dimgrey
|
||||
dodgerblue
|
||||
firebrick
|
||||
floralwhite
|
||||
forestgreen
|
||||
gainsboro
|
||||
ghostwhite
|
||||
greenyellow
|
||||
hotpink
|
||||
indian
|
||||
indianred
|
||||
lavenderblush
|
||||
lawngreen
|
||||
lemonchiffon
|
||||
lightblue
|
||||
lightcoral
|
||||
lightcyan
|
||||
lightgoldenrod
|
||||
lightgoldenrodyellow
|
||||
lightgray
|
||||
lightgreen
|
||||
lightgrey
|
||||
lightpink
|
||||
lightsalmon
|
||||
lightseagreen
|
||||
lightskyblue
|
||||
lightslateblue
|
||||
lightslategray
|
||||
lightslategrey
|
||||
lightsteelblue
|
||||
lightyellow
|
||||
limegreen
|
||||
mediumaquamarine
|
||||
mediumblue
|
||||
mediumorchid
|
||||
mediumpurple
|
||||
mediumseagreen
|
||||
mediumslateblue
|
||||
mediumspringgreen
|
||||
mediumturquoise
|
||||
mediumvioletred
|
||||
midnightblue
|
||||
mintcream
|
||||
mistyrose
|
||||
navajo
|
||||
navajowhite
|
||||
navyblue
|
||||
oldlace
|
||||
olivedrab
|
||||
orangered
|
||||
palegoldenrod
|
||||
palegreen
|
||||
paleturquoise
|
||||
palevioletred
|
||||
papayawhip
|
||||
peachpuff
|
||||
peru
|
||||
powderblue
|
||||
rebecca
|
||||
rebeccapurple
|
||||
rosybrown
|
||||
royalblue
|
||||
saddlebrown
|
||||
sandybrown
|
||||
seagreen
|
||||
sienna
|
||||
skyblue
|
||||
slateblue
|
||||
slategray
|
||||
slategrey
|
||||
springgreen
|
||||
steelblue
|
||||
violetred
|
||||
webgray
|
||||
webgreen
|
||||
webgrey
|
||||
webmaroon
|
||||
webpurple
|
||||
whitesmoke
|
||||
xaroon
|
||||
xray
|
||||
xreen
|
||||
xrey
|
||||
xurple
|
||||
yellowgreen
|
||||
@@ -1,8 +1,10 @@
|
||||
Consolas
|
||||
emoji
|
||||
emojis
|
||||
Extralight
|
||||
Gabriola
|
||||
Iosevka
|
||||
MDL
|
||||
Monofur
|
||||
Segoe
|
||||
wght
|
||||
11
.github/actions/spelling/allow/math.txt
vendored
Normal file
11
.github/actions/spelling/allow/math.txt
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
atan
|
||||
CPrime
|
||||
HBar
|
||||
HPrime
|
||||
isnan
|
||||
LPrime
|
||||
LStep
|
||||
powf
|
||||
RSub
|
||||
sqrtf
|
||||
ULP
|
||||
@@ -1,20 +1,50 @@
|
||||
ACLs
|
||||
ADMINS
|
||||
advapi
|
||||
altform
|
||||
altforms
|
||||
appendwttlogging
|
||||
appx
|
||||
appxbundle
|
||||
appxerror
|
||||
appxmanifest
|
||||
ATL
|
||||
backplating
|
||||
bitmaps
|
||||
BOMs
|
||||
CPLs
|
||||
cpptools
|
||||
cppvsdbg
|
||||
CPRs
|
||||
cryptbase
|
||||
DACL
|
||||
DACLs
|
||||
defaultlib
|
||||
diffs
|
||||
disposables
|
||||
dotnetfeed
|
||||
DTDs
|
||||
DWINRT
|
||||
enablewttlogging
|
||||
Intelli
|
||||
IVisual
|
||||
libucrt
|
||||
libucrtd
|
||||
LKG
|
||||
LOCKFILE
|
||||
Lxss
|
||||
mfcribbon
|
||||
microsoft
|
||||
microsoftonline
|
||||
MSAA
|
||||
msixbundle
|
||||
MSVC
|
||||
MSVCP
|
||||
muxc
|
||||
netcore
|
||||
Onefuzz
|
||||
osgvsowi
|
||||
PFILETIME
|
||||
pgc
|
||||
pgo
|
||||
pgosweep
|
||||
@@ -22,20 +52,34 @@ powerrename
|
||||
powershell
|
||||
propkey
|
||||
pscustomobject
|
||||
QWORD
|
||||
regedit
|
||||
robocopy
|
||||
SACLs
|
||||
sdkddkver
|
||||
Shobjidl
|
||||
Skype
|
||||
SRW
|
||||
sxs
|
||||
Sysinternals
|
||||
sysnative
|
||||
systemroot
|
||||
taskkill
|
||||
tasklist
|
||||
tdbuildteamid
|
||||
ucrt
|
||||
ucrtd
|
||||
unvirtualized
|
||||
VCRT
|
||||
vcruntime
|
||||
Virtualization
|
||||
visualstudio
|
||||
vscode
|
||||
VSTHRD
|
||||
winsdkver
|
||||
wlk
|
||||
wslpath
|
||||
wtl
|
||||
wtt
|
||||
wttlog
|
||||
Xamarin
|
||||
@@ -1,24 +1,30 @@
|
||||
Anup
|
||||
austdi
|
||||
arkthur
|
||||
Ballmer
|
||||
bhoj
|
||||
Bhojwani
|
||||
Bluloco
|
||||
carlos
|
||||
dhowett
|
||||
Diviness
|
||||
dsafa
|
||||
duhowett
|
||||
DXP
|
||||
ekg
|
||||
eryksun
|
||||
ethanschoonover
|
||||
Firefox
|
||||
Gatta
|
||||
glsl
|
||||
Gravell
|
||||
Grie
|
||||
Griese
|
||||
Hernan
|
||||
Howett
|
||||
Illhardt
|
||||
iquilezles
|
||||
italo
|
||||
jantari
|
||||
jerrysh
|
||||
Kaiyu
|
||||
@@ -30,8 +36,11 @@ Kourosh
|
||||
kowalczyk
|
||||
leonmsft
|
||||
Lepilleur
|
||||
lhecker
|
||||
lukesampson
|
||||
Macbook
|
||||
Manandhar
|
||||
masserano
|
||||
mbadolato
|
||||
Mehrain
|
||||
menger
|
||||
@@ -50,6 +59,8 @@ oising
|
||||
oldnewthing
|
||||
opengl
|
||||
osgwiki
|
||||
pabhojwa
|
||||
panos
|
||||
paulcam
|
||||
pauldotknopf
|
||||
PGP
|
||||
@@ -58,17 +69,23 @@ Rincewind
|
||||
rprichard
|
||||
Schoonover
|
||||
shadertoy
|
||||
Shomnipotence
|
||||
simioni
|
||||
Somuah
|
||||
sonph
|
||||
sonpham
|
||||
stakx
|
||||
talo
|
||||
thereses
|
||||
Walisch
|
||||
WDX
|
||||
Wellons
|
||||
Wirt
|
||||
Wojciech
|
||||
zadjii
|
||||
Zamor
|
||||
zamora
|
||||
Zamora
|
||||
zamora
|
||||
Zoey
|
||||
zorio
|
||||
Zverovich
|
||||
523
.github/actions/spelling/candidate.patterns
vendored
Normal file
523
.github/actions/spelling/candidate.patterns
vendored
Normal file
@@ -0,0 +1,523 @@
|
||||
# marker to ignore all code on line
|
||||
^.*/\* #no-spell-check-line \*/.*$
|
||||
# marker for ignoring a comment to the end of the line
|
||||
// #no-spell-check.*$
|
||||
|
||||
# patch hunk comments
|
||||
^\@\@ -\d+(?:,\d+|) \+\d+(?:,\d+|) \@\@ .*
|
||||
# git index header
|
||||
index [0-9a-z]{7,40}\.\.[0-9a-z]{7,40}
|
||||
|
||||
# cid urls
|
||||
(['"])cid:.*?\g{-1}
|
||||
|
||||
# data url in parens
|
||||
\(data:[^)]*?(?:[A-Z]{3,}|[A-Z][a-z]{2,}|[a-z]{3,})[^)]*\)
|
||||
# data url in quotes
|
||||
([`'"])data:.*?(?:[A-Z]{3,}|[A-Z][a-z]{2,}|[a-z]{3,}).*\g{-1}
|
||||
# data url
|
||||
data:[-a-zA-Z=;:/0-9+]*,\S*
|
||||
|
||||
# mailto urls
|
||||
mailto:[-a-zA-Z=;:/?%&0-9+@.]{3,}
|
||||
|
||||
# magnet urls
|
||||
magnet:[?=:\w]+
|
||||
|
||||
# magnet urls
|
||||
"magnet:[^"]+"
|
||||
|
||||
# obs:
|
||||
"obs:[^"]*"
|
||||
|
||||
# The `\b` here means a break, it's the fancy way to handle urls, but it makes things harder to read
|
||||
# In this examples content, I'm using a number of different ways to match things to show various approaches
|
||||
# asciinema
|
||||
\basciinema\.org/a/[0-9a-zA-Z]+
|
||||
|
||||
# apple
|
||||
\bdeveloper\.apple\.com/[-\w?=/]+
|
||||
# Apple music
|
||||
\bembed\.music\.apple\.com/fr/playlist/usr-share/[-\w.]+
|
||||
|
||||
# appveyor api
|
||||
\bci\.appveyor\.com/api/projects/status/[0-9a-z]+
|
||||
# appveyor project
|
||||
\bci\.appveyor\.com/project/(?:[^/\s"]*/){2}builds?/\d+/job/[0-9a-z]+
|
||||
|
||||
# Amazon
|
||||
|
||||
# Amazon
|
||||
\bamazon\.com/[-\w]+/(?:dp/[0-9A-Z]+|)
|
||||
# AWS S3
|
||||
\b\w*\.s3[^.]*\.amazonaws\.com/[-\w/&#%_?:=]*
|
||||
# AWS execute-api
|
||||
\b[0-9a-z]{10}\.execute-api\.[-0-9a-z]+\.amazonaws\.com\b
|
||||
# AWS ELB
|
||||
\b\w+\.[-0-9a-z]+\.elb\.amazonaws\.com\b
|
||||
# AWS SNS
|
||||
\bsns\.[-0-9a-z]+.amazonaws\.com/[-\w/&#%_?:=]*
|
||||
# AWS VPC
|
||||
vpc-\w+
|
||||
|
||||
# While you could try to match `http://` and `https://` by using `s?` in `https?://`, sometimes there
|
||||
# YouTube url
|
||||
\b(?:(?:www\.|)youtube\.com|youtu.be)/(?:channel/|embed/|user/|playlist\?list=|watch\?v=|v/|)[-a-zA-Z0-9?&=_%]*
|
||||
# YouTube music
|
||||
\bmusic\.youtube\.com/youtubei/v1/browse(?:[?&]\w+=[-a-zA-Z0-9?&=_]*)
|
||||
# YouTube tag
|
||||
<\s*youtube\s+id=['"][-a-zA-Z0-9?_]*['"]
|
||||
# YouTube image
|
||||
\bimg\.youtube\.com/vi/[-a-zA-Z0-9?&=_]*
|
||||
# Google Accounts
|
||||
\baccounts.google.com/[-_/?=.:;+%&0-9a-zA-Z]*
|
||||
# Google Analytics
|
||||
\bgoogle-analytics\.com/collect.[-0-9a-zA-Z?%=&_.~]*
|
||||
# Google APIs
|
||||
\bgoogleapis\.(?:com|dev)/[a-z]+/(?:v\d+/|)[a-z]+/[-@:./?=\w+|&]+
|
||||
# Google Storage
|
||||
\b[-a-zA-Z0-9.]*\bstorage\d*\.googleapis\.com(?:/\S*|)
|
||||
# Google Calendar
|
||||
\bcalendar\.google\.com/calendar(?:/u/\d+|)/embed\?src=[@./?=\w&%]+
|
||||
\w+\@group\.calendar\.google\.com\b
|
||||
# Google DataStudio
|
||||
\bdatastudio\.google\.com/(?:(?:c/|)u/\d+/|)(?:embed/|)(?:open|reporting|datasources|s)/[-0-9a-zA-Z]+(?:/page/[-0-9a-zA-Z]+|)
|
||||
# The leading `/` here is as opposed to the `\b` above
|
||||
# ... a short way to match `https://` or `http://` since most urls have one of those prefixes
|
||||
# Google Docs
|
||||
/docs\.google\.com/[a-z]+/(?:ccc\?key=\w+|(?:u/\d+|d/(?:e/|)[0-9a-zA-Z_-]+/)?(?:edit\?[-\w=#.]*|/\?[\w=&]*|))
|
||||
# Google Drive
|
||||
\bdrive\.google\.com/(?:file/d/|open)[-0-9a-zA-Z_?=]*
|
||||
# Google Groups
|
||||
\bgroups\.google\.com/(?:(?:forum/#!|d/)(?:msg|topics?|searchin)|a)/[^/\s"]+/[-a-zA-Z0-9$]+(?:/[-a-zA-Z0-9]+)*
|
||||
# Google Maps
|
||||
\bmaps\.google\.com/maps\?[\w&;=]*
|
||||
# Google themes
|
||||
themes\.googleusercontent\.com/static/fonts/[^/\s"]+/v\d+/[^.]+.
|
||||
# Google CDN
|
||||
\bclients2\.google(?:usercontent|)\.com[-0-9a-zA-Z/.]*
|
||||
# Goo.gl
|
||||
/goo\.gl/[a-zA-Z0-9]+
|
||||
# Google Chrome Store
|
||||
\bchrome\.google\.com/webstore/detail/[-\w]*(?:/\w*|)
|
||||
# Google Books
|
||||
\bgoogle\.(?:\w{2,4})/books(?:/\w+)*\?[-\w\d=&#.]*
|
||||
# Google Fonts
|
||||
\bfonts\.(?:googleapis|gstatic)\.com/[-/?=:;+&0-9a-zA-Z]*
|
||||
# Google Forms
|
||||
\bforms\.gle/\w+
|
||||
# Google Scholar
|
||||
\bscholar\.google\.com/citations\?user=[A-Za-z0-9_]+
|
||||
# Google Colab Research Drive
|
||||
\bcolab\.research\.google\.com/drive/[-0-9a-zA-Z_?=]*
|
||||
|
||||
# GitHub SHAs (api)
|
||||
\bapi.github\.com/repos(?:/[^/\s"]+){3}/[0-9a-f]+\b
|
||||
# GitHub SHAs (markdown)
|
||||
(?:\[`?[0-9a-f]+`?\]\(https:/|)/(?:www\.|)github\.com(?:/[^/\s"]+){2,}(?:/[^/\s")]+)(?:[0-9a-f]+(?:[-0-9a-zA-Z/#.]*|)\b|)
|
||||
# GitHub SHAs
|
||||
\bgithub\.com(?:/[^/\s"]+){2}[@#][0-9a-f]+\b
|
||||
# GitHub wiki
|
||||
\bgithub\.com/(?:[^/]+/){2}wiki/(?:(?:[^/]+/|)_history|[^/]+(?:/_compare|)/[0-9a-f.]{40,})\b
|
||||
# githubusercontent
|
||||
/[-a-z0-9]+\.githubusercontent\.com/[-a-zA-Z0-9?&=_\/.]*
|
||||
# githubassets
|
||||
\bgithubassets.com/[0-9a-f]+(?:[-/\w.]+)
|
||||
# gist github
|
||||
\bgist\.github\.com/[^/\s"]+/[0-9a-f]+
|
||||
# git.io
|
||||
\bgit\.io/[0-9a-zA-Z]+
|
||||
# GitHub JSON
|
||||
"node_id": "[-a-zA-Z=;:/0-9+]*"
|
||||
# Contributor
|
||||
\[[^\]]+\]\(https://github\.com/[^/\s"]+\)
|
||||
# GHSA
|
||||
GHSA(?:-[0-9a-z]{4}){3}
|
||||
|
||||
# GitLab commit
|
||||
\bgitlab\.[^/\s"]*/\S+/\S+/commit/[0-9a-f]{7,16}#[0-9a-f]{40}\b
|
||||
# GitLab merge requests
|
||||
\bgitlab\.[^/\s"]*/\S+/\S+/-/merge_requests/\d+/diffs#[0-9a-f]{40}\b
|
||||
# GitLab uploads
|
||||
\bgitlab\.[^/\s"]*/uploads/[-a-zA-Z=;:/0-9+]*
|
||||
# GitLab commits
|
||||
\bgitlab\.[^/\s"]*/(?:[^/\s"]+/){2}commits?/[0-9a-f]+\b
|
||||
|
||||
# binanace
|
||||
accounts.binance.com/[a-z/]*oauth/authorize\?[-0-9a-zA-Z&%]*
|
||||
|
||||
# bitbucket diff
|
||||
\bapi\.bitbucket\.org/\d+\.\d+/repositories/(?:[^/\s"]+/){2}diff(?:stat|)(?:/[^/\s"]+){2}:[0-9a-f]+
|
||||
# bitbucket repositories commits
|
||||
\bapi\.bitbucket\.org/\d+\.\d+/repositories/(?:[^/\s"]+/){2}commits?/[0-9a-f]+
|
||||
# bitbucket commits
|
||||
\bbitbucket\.org/(?:[^/\s"]+/){2}commits?/[0-9a-f]+
|
||||
|
||||
# bit.ly
|
||||
\bbit\.ly/\w+
|
||||
|
||||
# bitrise
|
||||
\bapp\.bitrise\.io/app/[0-9a-f]*/[\w.?=&]*
|
||||
|
||||
# bootstrapcdn.com
|
||||
\bbootstrapcdn\.com/[-./\w]+
|
||||
|
||||
# cdn.cloudflare.com
|
||||
\bcdnjs\.cloudflare\.com/[./\w]+
|
||||
|
||||
# circleci
|
||||
\bcircleci\.com/gh(?:/[^/\s"]+){1,5}.[a-z]+\?[-0-9a-zA-Z=&]+
|
||||
|
||||
# gitter
|
||||
\bgitter\.im(?:/[^/\s"]+){2}\?at=[0-9a-f]+
|
||||
|
||||
# gravatar
|
||||
\bgravatar\.com/avatar/[0-9a-f]+
|
||||
|
||||
# ibm
|
||||
[a-z.]*ibm\.com/[-_#=:%!?~.\\/\d\w]*
|
||||
|
||||
# imgur
|
||||
\bimgur\.com/[^.]+
|
||||
|
||||
# Internet Archive
|
||||
\barchive\.org/web/\d+/(?:[-\w.?,'/\\+&%$#_:]*)
|
||||
|
||||
# discord
|
||||
/discord(?:app\.com|\.gg)/(?:invite/)?[a-zA-Z0-9]{7,}
|
||||
|
||||
# Disqus
|
||||
\bdisqus\.com/[-\w/%.()!?&=_]*
|
||||
|
||||
# medium link
|
||||
\blink\.medium\.com/[a-zA-Z0-9]+
|
||||
# medium
|
||||
\bmedium\.com/\@?[^/\s"]+/[-\w]+
|
||||
|
||||
# microsoft
|
||||
\b(?:https?://|)(?:(?:download\.visualstudio|docs|msdn2?|research)\.microsoft|blogs\.msdn)\.com/[-_a-zA-Z0-9()=./%]*
|
||||
# powerbi
|
||||
\bapp\.powerbi\.com/reportEmbed/[^"' ]*
|
||||
# vs devops
|
||||
\bvisualstudio.com(?::443|)/[-\w/?=%&.]*
|
||||
# microsoft store
|
||||
\bmicrosoft\.com/store/apps/\w+
|
||||
|
||||
# mvnrepository.com
|
||||
\bmvnrepository\.com/[-0-9a-z./]+
|
||||
|
||||
# now.sh
|
||||
/[0-9a-z-.]+\.now\.sh\b
|
||||
|
||||
# oracle
|
||||
\bdocs\.oracle\.com/[-0-9a-zA-Z./_?#&=]*
|
||||
|
||||
# chromatic.com
|
||||
/\S+.chromatic.com\S*[")]
|
||||
|
||||
# codacy
|
||||
\bapi\.codacy\.com/project/badge/Grade/[0-9a-f]+
|
||||
|
||||
# compai
|
||||
\bcompai\.pub/v1/png/[0-9a-f]+
|
||||
|
||||
# mailgun api
|
||||
\.api\.mailgun\.net/v3/domains/[0-9a-z]+\.mailgun.org/messages/[0-9a-zA-Z=@]*
|
||||
# mailgun
|
||||
\b[0-9a-z]+.mailgun.org
|
||||
|
||||
# /message-id/
|
||||
/message-id/[-\w@./%]+
|
||||
|
||||
# Reddit
|
||||
\breddit\.com/r/[/\w_]*
|
||||
|
||||
# requestb.in
|
||||
\brequestb\.in/[0-9a-z]+
|
||||
|
||||
# sched
|
||||
\b[a-z0-9]+\.sched\.com\b
|
||||
|
||||
# Slack url
|
||||
slack://[a-zA-Z0-9?&=]+
|
||||
# Slack
|
||||
\bslack\.com/[-0-9a-zA-Z/_~?&=.]*
|
||||
# Slack edge
|
||||
\bslack-edge\.com/[-a-zA-Z0-9?&=%./]+
|
||||
# Slack images
|
||||
\bslack-imgs\.com/[-a-zA-Z0-9?&=%.]+
|
||||
|
||||
# shields.io
|
||||
\bshields\.io/[-\w/%?=&.:+;,]*
|
||||
|
||||
# stackexchange -- https://stackexchange.com/feeds/sites
|
||||
\b(?:askubuntu|serverfault|stack(?:exchange|overflow)|superuser).com/(?:questions/\w+/[-\w]+|a/)
|
||||
|
||||
# Sentry
|
||||
[0-9a-f]{32}\@o\d+\.ingest\.sentry\.io\b
|
||||
|
||||
# Twitter markdown
|
||||
\[\@[^[/\]:]*?\]\(https://twitter.com/[^/\s"')]*(?:/status/\d+(?:\?[-_0-9a-zA-Z&=]*|)|)\)
|
||||
# Twitter hashtag
|
||||
\btwitter\.com/hashtag/[\w?_=&]*
|
||||
# Twitter status
|
||||
\btwitter\.com/[^/\s"')]*(?:/status/\d+(?:\?[-_0-9a-zA-Z&=]*|)|)
|
||||
# Twitter profile images
|
||||
\btwimg\.com/profile_images/[_\w./]*
|
||||
# Twitter media
|
||||
\btwimg\.com/media/[-_\w./?=]*
|
||||
# Twitter link shortened
|
||||
\bt\.co/\w+
|
||||
|
||||
# facebook
|
||||
\bfburl\.com/[0-9a-z_]+
|
||||
# facebook CDN
|
||||
\bfbcdn\.net/[\w/.,]*
|
||||
# facebook watch
|
||||
\bfb\.watch/[0-9A-Za-z]+
|
||||
|
||||
# dropbox
|
||||
\bdropbox\.com/sh?/[^/\s"]+/[-0-9A-Za-z_.%?=&;]+
|
||||
|
||||
# ipfs protocol
|
||||
ipfs://[0-9a-z]*
|
||||
# ipfs url
|
||||
/ipfs/[0-9a-z]*
|
||||
|
||||
# w3
|
||||
\bw3\.org/[-0-9a-zA-Z/#.]+
|
||||
|
||||
# loom
|
||||
\bloom\.com/embed/[0-9a-f]+
|
||||
|
||||
# regex101
|
||||
\bregex101\.com/r/[^/\s"]+/\d+
|
||||
|
||||
# figma
|
||||
\bfigma\.com/file(?:/[0-9a-zA-Z]+/)+
|
||||
|
||||
# freecodecamp.org
|
||||
\bfreecodecamp\.org/[-\w/.]+
|
||||
|
||||
# image.tmdb.org
|
||||
\bimage\.tmdb\.org/[/\w.]+
|
||||
|
||||
# mermaid
|
||||
\bmermaid\.ink/img/[-\w]+|\bmermaid-js\.github\.io/mermaid-live-editor/#/edit/[-\w]+
|
||||
|
||||
# Wikipedia
|
||||
\ben\.wikipedia\.org/wiki/[-\w%.#]+
|
||||
|
||||
# gitweb
|
||||
[^"\s]+/gitweb/\S+;h=[0-9a-f]+
|
||||
|
||||
# HyperKitty lists
|
||||
/archives/list/[^@/]+\@[^/\s"]*/message/[^/\s"]*/
|
||||
|
||||
# lists
|
||||
/thread\.html/[^"\s]+
|
||||
|
||||
# list-management
|
||||
\blist-manage\.com/subscribe(?:[?&](?:u|id)=[0-9a-f]+)+
|
||||
|
||||
# kubectl.kubernetes.io/last-applied-configuration
|
||||
"kubectl.kubernetes.io/last-applied-configuration": ".*"
|
||||
|
||||
# pgp
|
||||
\bgnupg\.net/pks/lookup[?&=0-9a-zA-Z]*
|
||||
|
||||
# Spotify
|
||||
\bopen\.spotify\.com/embed/playlist/\w+
|
||||
|
||||
# Mastodon
|
||||
\bmastodon\.[-a-z.]*/(?:media/|\@)[?&=0-9a-zA-Z_]*
|
||||
|
||||
# scastie
|
||||
\bscastie\.scala-lang\.org/[^/]+/\w+
|
||||
|
||||
# images.unsplash.com
|
||||
\bimages\.unsplash\.com/(?:(?:flagged|reserve)/|)[-\w./%?=%&.;]+
|
||||
|
||||
# pastebin
|
||||
\bpastebin\.com/[\w/]+
|
||||
|
||||
# heroku
|
||||
\b\w+\.heroku\.com/source/archive/\w+
|
||||
|
||||
# quip
|
||||
\b\w+\.quip\.com/\w+(?:(?:#|/issues/)\w+)?
|
||||
|
||||
# badgen.net
|
||||
\bbadgen\.net/badge/[^")\]'\s]+
|
||||
|
||||
# statuspage.io
|
||||
\w+\.statuspage\.io\b
|
||||
|
||||
# media.giphy.com
|
||||
\bmedia\.giphy\.com/media/[^/]+/[\w.?&=]+
|
||||
|
||||
# tinyurl
|
||||
\btinyurl\.com/\w+
|
||||
|
||||
# getopts
|
||||
\bgetopts\s+(?:"[^"]+"|'[^']+')
|
||||
|
||||
# ANSI color codes
|
||||
(?:\\(?:u00|x)1b|\x1b)\[\d+(?:;\d+|)m
|
||||
|
||||
# URL escaped characters
|
||||
\%[0-9A-F][A-F]
|
||||
# IPv6
|
||||
\b(?:[0-9a-fA-F]{0,4}:){3,7}[0-9a-fA-F]{0,4}\b
|
||||
# c99 hex digits (not the full format, just one I've seen)
|
||||
0x[0-9a-fA-F](?:\.[0-9a-fA-F]*|)[pP]
|
||||
# Punycode
|
||||
\bxn--[-0-9a-z]+
|
||||
# sha
|
||||
sha\d+:[0-9]*[a-f]{3,}[0-9a-f]*
|
||||
# sha-... -- uses a fancy capture
|
||||
(['"]|")[0-9a-f]{40,}\g{-1}
|
||||
# hex runs
|
||||
\b[0-9a-fA-F]{16,}\b
|
||||
# hex in url queries
|
||||
=[0-9a-fA-F]*?(?:[A-F]{3,}|[a-f]{3,})[0-9a-fA-F]*?&
|
||||
# ssh
|
||||
(?:ssh-\S+|-nistp256) [-a-zA-Z=;:/0-9+]{12,}
|
||||
|
||||
# PGP
|
||||
\b(?:[0-9A-F]{4} ){9}[0-9A-F]{4}\b
|
||||
# GPG keys
|
||||
\b(?:[0-9A-F]{4} ){5}(?: [0-9A-F]{4}){5}\b
|
||||
# Well known gpg keys
|
||||
.well-known/openpgpkey/[\w./]+
|
||||
|
||||
# uuid:
|
||||
\b[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}\b
|
||||
# hex digits including css/html color classes:
|
||||
(?:[\\0][xX]|\\u|[uU]\+|#x?|\%23)[0-9_a-fA-FgGrR]*?[a-fA-FgGrR]{2,}[0-9_a-fA-FgGrR]*(?:[uUlL]{0,3}|u\d+)\b
|
||||
# integrity
|
||||
integrity="sha\d+-[-a-zA-Z=;:/0-9+]{40,}"
|
||||
|
||||
# https://www.gnu.org/software/groff/manual/groff.html
|
||||
# man troff content
|
||||
\\f[BCIPR]
|
||||
# '
|
||||
\\\(aq
|
||||
|
||||
# .desktop mime types
|
||||
^MimeTypes?=.*$
|
||||
# .desktop localized entries
|
||||
^[A-Z][a-z]+\[[a-z]+\]=.*$
|
||||
# Localized .desktop content
|
||||
Name\[[^\]]+\]=.*
|
||||
|
||||
# IServiceProvider
|
||||
\bI(?=(?:[A-Z][a-z]{2,})+\b)
|
||||
|
||||
# crypt
|
||||
"\$2[ayb]\$.{56}"
|
||||
|
||||
# scrypt / argon
|
||||
\$(?:scrypt|argon\d+[di]*)\$\S+
|
||||
|
||||
# Input to GitHub JSON
|
||||
content: "[-a-zA-Z=;:/0-9+]*="
|
||||
|
||||
# Python stringprefix / binaryprefix
|
||||
# Note that there's a high false positive rate, remove the `?=` and search for the regex to see if the matches seem like reasonable strings
|
||||
(?<!')\b(?:B|BR|Br|F|FR|Fr|R|RB|RF|Rb|Rf|U|UR|Ur|b|bR|br|f|fR|fr|r|rB|rF|rb|rf|u|uR|ur)'(?:[A-Z]{3,}|[A-Z][a-z]{2,}|[a-z]{3,})
|
||||
|
||||
# Regular expressions for (P|p)assword
|
||||
\([A-Z]\|[a-z]\)[a-z]+
|
||||
|
||||
# JavaScript regular expressions
|
||||
# javascript test regex
|
||||
/.*/[gim]*\.test\(
|
||||
# javascript match regex
|
||||
\.match\(/[^/\s"]*/[gim]*\s*
|
||||
# javascript match regex
|
||||
\.match\(/\\[b].*?/[gim]*\s*\)(?:;|$)
|
||||
# javascript regex
|
||||
^\s*/\\[b].*/[gim]*\s*(?:\)(?:;|$)|,$)
|
||||
# javascript replace regex
|
||||
\.replace\(/[^/\s"]*/[gim]*\s*,
|
||||
|
||||
# Go regular expressions
|
||||
regexp?\.MustCompile\(`[^`]*`\)
|
||||
|
||||
# sed regular expressions
|
||||
sed 's/(?:[^/]*?[a-zA-Z]{3,}[^/]*?/){2}
|
||||
|
||||
# go install
|
||||
go install(?:\s+[a-z]+\.[-@\w/.]+)+
|
||||
|
||||
# kubernetes pod status lists
|
||||
# https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase
|
||||
\w+(?:-\w+)+\s+\d+/\d+\s+(?:Running|Pending|Succeeded|Failed|Unknown)\s+
|
||||
|
||||
# kubectl - pods in CrashLoopBackOff
|
||||
\w+-[0-9a-f]+-\w+\s+\d+/\d+\s+CrashLoopBackOff\s+
|
||||
|
||||
# kubernetes object suffix
|
||||
-[0-9a-f]{10}-\w{5}\s
|
||||
|
||||
# posthog secrets
|
||||
posthog\.init\((['"])phc_[^"',]+\g{-1},
|
||||
|
||||
# xcode
|
||||
|
||||
# xcodeproject scenes
|
||||
(?:Controller|ID|id)="\w{3}-\w{2}-\w{3}"
|
||||
|
||||
# xcode api botches
|
||||
customObjectInstantitationMethod
|
||||
|
||||
# font awesome classes
|
||||
\.fa-[-a-z0-9]+
|
||||
|
||||
# Update Lorem based on your content (requires `ge` and `w` from https://github.com/jsoref/spelling; and `review` from https://github.com/check-spelling/check-spelling/wiki/Looking-for-items-locally )
|
||||
# grep '^[^#].*lorem' .github/actions/spelling/patterns.txt|perl -pne 's/.*i..\?://;s/\).*//' |tr '|' "\n"|sort -f |xargs -n1 ge|perl -pne 's/^[^:]*://'|sort -u|w|sed -e 's/ .*//'|w|review -
|
||||
# Warning, while `(?i)` is very neat and fancy, if you have some binary files that aren't proper unicode, you might run into:
|
||||
## Operation "substitution (s///)" returns its argument for non-Unicode code point 0x1C19AE (the code point will vary).
|
||||
## You could manually change `(?i)X...` to use `[Xx]...`
|
||||
## or you could add the files to your `excludes` file (a version after 0.0.19 should identify the file path)
|
||||
# Lorem
|
||||
(?:\w|\s|[,.])*\b(?i)(?:amet|consectetur|cursus|dolor|eros|ipsum|lacus|libero|ligula|lorem|magna|neque|nulla|suscipit|tempus)\b(?:\w|\s|[,.])*
|
||||
|
||||
# Non-English
|
||||
[a-zA-Z]*[ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź][a-zA-Z]{3}[a-zA-ZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź]*
|
||||
|
||||
# French
|
||||
# This corpus only had capital letters, but you probably want lowercase ones as well.
|
||||
\b[LN]'+[a-z]{2,}\b
|
||||
|
||||
# latex
|
||||
\\(?:n(?:ew|ormal|osub)|r(?:enew)|t(?:able(?:of|)|he|itle))(?=[a-z]+)
|
||||
|
||||
# the negative lookahead here is to allow catching 'templatesz' as a misspelling
|
||||
# but to otherwise recognize a Windows path with \templates\foo.template or similar:
|
||||
\\(?:necessary|r(?:eport|esolve[dr]?|esult)|t(?:arget|emplates?))(?![a-z])
|
||||
# ignore long runs of a single character:
|
||||
\b([A-Za-z])\g{-1}{3,}\b
|
||||
# Note that the next example is no longer necessary if you are using
|
||||
# to match a string starting with a `#`, use a character-class:
|
||||
[#]backwards
|
||||
# version suffix <word>v#
|
||||
(?:(?<=[A-Z]{2})V|(?<=[a-z]{2}|[A-Z]{2})v)\d+(?:\b|(?=[a-zA-Z_]))
|
||||
# Compiler flags (Scala)
|
||||
(?:^|[\t ,>"'`=(])-J-[DPWXY](?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,})
|
||||
# Compiler flags
|
||||
#(?:^|[\t ,"'`=(])-[DPWXYLlf](?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,})
|
||||
|
||||
# Compiler flags (linker)
|
||||
,-B
|
||||
# curl arguments
|
||||
\b(?:\\n|)curl(?:\s+-[a-zA-Z]{1,2}\b)*(?:\s+-[a-zA-Z]{3,})(?:\s+-[a-zA-Z]+)*
|
||||
# set arguments
|
||||
\bset(?:\s+-[abefimouxE]{1,2})*\s+-[abefimouxE]{3,}(?:\s+-[abefimouxE]+)*
|
||||
# tar arguments
|
||||
\b(?:\\n|)g?tar(?:\.exe|)(?:(?:\s+--[-a-zA-Z]+|\s+-[a-zA-Z]+|\s[ABGJMOPRSUWZacdfh-pr-xz]+\b)(?:=[^ ]*|))+
|
||||
# tput arguments -- https://man7.org/linux/man-pages/man5/terminfo.5.html -- technically they can be more than 5 chars long...
|
||||
\btput\s+(?:(?:-[SV]|-T\s*\w+)\s+)*\w{3,5}\b
|
||||
# macOS temp folders
|
||||
/var/folders/\w\w/[+\w]+/(?:T|-Caches-)/
|
||||
117
.github/actions/spelling/excludes.txt
vendored
Normal file
117
.github/actions/spelling/excludes.txt
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-excludes
|
||||
(?:(?i)\.png$)
|
||||
(?:^|/)(?i)COPYRIGHT
|
||||
(?:^|/)(?i)LICEN[CS]E
|
||||
(?:^|/)3rdparty/
|
||||
(?:^|/)dirs$
|
||||
(?:^|/)go\.mod$
|
||||
(?:^|/)go\.sum$
|
||||
(?:^|/)package(?:-lock|)\.json$
|
||||
(?:^|/)sources(?:|\.dep)$
|
||||
(?:^|/)vendor/
|
||||
\.a$
|
||||
\.ai$
|
||||
\.avi$
|
||||
\.bmp$
|
||||
\.bz2$
|
||||
\.cer$
|
||||
\.class$
|
||||
\.crl$
|
||||
\.crt$
|
||||
\.csr$
|
||||
\.dll$
|
||||
\.docx?$
|
||||
\.drawio$
|
||||
\.DS_Store$
|
||||
\.eot$
|
||||
\.eps$
|
||||
\.exe$
|
||||
\.gif$
|
||||
\.gitattributes$
|
||||
\.graffle$
|
||||
\.gz$
|
||||
\.icns$
|
||||
\.ico$
|
||||
\.jar$
|
||||
\.jks$
|
||||
\.jpeg$
|
||||
\.jpg$
|
||||
\.key$
|
||||
\.lib$
|
||||
\.lock$
|
||||
\.map$
|
||||
\.min\..
|
||||
\.mod$
|
||||
\.mp3$
|
||||
\.mp4$
|
||||
\.o$
|
||||
\.ocf$
|
||||
\.otf$
|
||||
\.pbxproj$
|
||||
\.pdf$
|
||||
\.pem$
|
||||
\.png$
|
||||
\.psd$
|
||||
\.pyc$
|
||||
\.runsettings$
|
||||
\.s$
|
||||
\.sig$
|
||||
\.so$
|
||||
\.svg$
|
||||
\.svgz$
|
||||
\.svgz?$
|
||||
\.tar$
|
||||
\.tgz$
|
||||
\.tiff?$
|
||||
\.ttf$
|
||||
\.vsdx$
|
||||
\.wav$
|
||||
\.webm$
|
||||
\.webp$
|
||||
\.woff
|
||||
\.woff2?$
|
||||
\.xcf$
|
||||
\.xls
|
||||
\.xlsx?$
|
||||
\.xpm$
|
||||
\.yml$
|
||||
\.zip$
|
||||
^\.github/actions/spelling/
|
||||
^\.github/fabricbot.json$
|
||||
^\.gitignore$
|
||||
^\Q.git-blame-ignore-revs\E$
|
||||
^\Q.github/workflows/spelling.yml\E$
|
||||
^\Qdoc/reference/windows-terminal-logo.ans\E$
|
||||
^\Qsamples/ConPTY/EchoCon/EchoCon/EchoCon.vcxproj.filters\E$
|
||||
^\Qsrc/host/exe/Host.EXE.vcxproj.filters\E$
|
||||
^\Qsrc/host/ft_host/chafa.txt\E$
|
||||
^\Qsrc/tools/closetest/CloseTest.vcxproj.filters\E$
|
||||
^\XamlStyler.json$
|
||||
^build/config/
|
||||
^consolegit2gitfilters\.json$
|
||||
^dep/
|
||||
^doc/reference/master-sequence-list.csv$
|
||||
^doc/reference/UTF8-torture-test\.txt$
|
||||
^oss/
|
||||
^src/host/ft_uia/run\.bat$
|
||||
^src/host/runft\.bat$
|
||||
^src/host/runut\.bat$
|
||||
^src/interactivity/onecore/BgfxEngine\.
|
||||
^src/renderer/atlas/
|
||||
^src/renderer/wddmcon/WddmConRenderer\.
|
||||
^src/terminal/adapter/ut_adapter/run\.bat$
|
||||
^src/terminal/parser/delfuzzpayload\.bat$
|
||||
^src/terminal/parser/ft_fuzzer/run\.bat$
|
||||
^src/terminal/parser/ft_fuzzer/VTCommandFuzzer\.cpp$
|
||||
^src/terminal/parser/ft_fuzzwrapper/run\.bat$
|
||||
^src/terminal/parser/ut_parser/Base64Test.cpp$
|
||||
^src/terminal/parser/ut_parser/run\.bat$
|
||||
^src/tools/integrity/packageuwp/ConsoleUWP\.appxSources$
|
||||
^src/tools/lnkd/lnkd\.bat$
|
||||
^src/tools/pixels/pixels\.bat$
|
||||
^src/tools/texttests/fira\.txt$
|
||||
^src/tools/U8U16Test/(?:fr|ru|zh)\.txt$
|
||||
^src/types/ut_types/UtilsTests.cpp$
|
||||
^tools/ReleaseEngineering/ServicingPipeline.ps1$
|
||||
ignore$
|
||||
SUMS$
|
||||
@@ -1,16 +1,23 @@
|
||||
AAAa
|
||||
AAAAA
|
||||
AAAAAAAAAAAAA
|
||||
AAAAAABBBBBBCCC
|
||||
AAAAABBBBBBCCC
|
||||
abcd
|
||||
abcd
|
||||
abcde
|
||||
abcdef
|
||||
ABCDEFG
|
||||
ABCDEFGH
|
||||
ABCDEFGHIJ
|
||||
abcdefghijk
|
||||
ABCDEFGHIJKLMNO
|
||||
abcdefghijklmnop
|
||||
ABCDEFGHIJKLMNOPQRST
|
||||
abcdefghijklmnopqrstuvwxyz
|
||||
ABCG
|
||||
ABE
|
||||
abf
|
||||
BBBBB
|
||||
BBBBBBBB
|
||||
BBBBBCCC
|
||||
BBBBCCCCC
|
||||
BBGGRR
|
||||
BBBBBBBBBBBBBBDDDD
|
||||
EFG
|
||||
EFGh
|
||||
QQQQQQQQQQABCDEFGHIJ
|
||||
@@ -19,7 +26,6 @@ QQQQQQQQQQABCDEFGHIJKLMNOPQRSTQQQQQQQQQQ
|
||||
QQQQQQQQQQABCDEFGHIJPQRSTQQQQQQQQQQ
|
||||
qrstuvwxyz
|
||||
qwerty
|
||||
QWERTYUIOP
|
||||
qwertyuiopasdfg
|
||||
YYYYYYYDDDDDDDDDDD
|
||||
ZAAZZ
|
||||
@@ -31,3 +37,4 @@ ZYXWVUT
|
||||
ZZBBZ
|
||||
ZZZBB
|
||||
ZZZBZ
|
||||
ZZZZZ
|
||||
File diff suppressed because it is too large
Load Diff
6
.github/actions/spelling/expect/web.txt
vendored
Normal file
6
.github/actions/spelling/expect/web.txt
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
WCAG
|
||||
winui
|
||||
appshellintegration
|
||||
mdtauk
|
||||
gfycat
|
||||
Guake
|
||||
62
.github/actions/spelling/line_forbidden.patterns
vendored
Normal file
62
.github/actions/spelling/line_forbidden.patterns
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
# reject `m_data` as there's a certain OS which has evil defines that break things if it's used elsewhere
|
||||
# \bm_data\b
|
||||
|
||||
# If you have a framework that uses `it()` for testing and `fit()` for debugging a specific test,
|
||||
# you might not want to check in code where you were debugging w/ `fit()`, in which case, you might want
|
||||
# to use this:
|
||||
#\bfit\(
|
||||
|
||||
# s.b. GitHub
|
||||
\bGithub\b
|
||||
|
||||
# s.b. GitLab
|
||||
\bGitlab\b
|
||||
|
||||
# s.b. JavaScript
|
||||
\bJavascript\b
|
||||
|
||||
# s.b. Microsoft
|
||||
\bMicroSoft\b
|
||||
|
||||
# s.b. another
|
||||
\ban[- ]other\b
|
||||
|
||||
# s.b. greater than
|
||||
\bgreater then\b
|
||||
|
||||
# s.b. into
|
||||
#\sin to\s
|
||||
|
||||
# s.b. opt-in
|
||||
\sopt in\s
|
||||
|
||||
# s.b. less than
|
||||
\bless then\b
|
||||
|
||||
# s.b. otherwise
|
||||
\bother[- ]wise\b
|
||||
|
||||
# s.b. nonexistent
|
||||
\bnon existing\b
|
||||
\b[Nn]o[nt][- ]existent\b
|
||||
|
||||
# s.b. preexisting
|
||||
[Pp]re[- ]existing
|
||||
|
||||
# s.b. preempt
|
||||
[Pp]re[- ]empt\b
|
||||
|
||||
# s.b. preemptively
|
||||
[Pp]re[- ]emptively
|
||||
|
||||
# s.b. reentrancy
|
||||
[Rr]e[- ]entrancy
|
||||
|
||||
# s.b. reentrant
|
||||
[Rr]e[- ]entrant
|
||||
|
||||
# s.b. workaround(s)
|
||||
#\bwork[- ]arounds?\b
|
||||
|
||||
# Reject duplicate words
|
||||
\s([A-Z]{3,}|[A-Z][a-z]{2,}|[a-z]{3,})\s\g{-1}\s
|
||||
96
.github/actions/spelling/patterns/patterns.txt
vendored
Normal file
96
.github/actions/spelling/patterns/patterns.txt
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns
|
||||
|
||||
https?://\S+
|
||||
[Pp]ublicKeyToken="?[0-9a-fA-F]{16}"?
|
||||
(?:[{"]|UniqueIdentifier>)[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}(?:[}"]|</UniqueIdentifier)
|
||||
(?:0[Xx]|\\x|U\+|#)[a-f0-9A-FGgRr]{2,}[Uu]?[Ll]{0,2}\b
|
||||
microsoft/cascadia-code\@[0-9a-fA-F]{40}
|
||||
\d+x\d+Logo
|
||||
Scro\&ll
|
||||
# selectionInput.cpp
|
||||
:\\windows\\syste\b
|
||||
TestUtils::VerifyExpectedString\(tb, L"[^"]+"
|
||||
(?:hostSm|mach)\.ProcessString\(L"[^"]+"
|
||||
\b([A-Za-z])\g{-1}{3,}\b
|
||||
0x[0-9A-Za-z]+
|
||||
Base64::s_(?:En|De)code\(L"[^"]+"
|
||||
VERIFY_ARE_EQUAL\(L"[^"]+"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\+/"
|
||||
std::memory_order_[\w]+
|
||||
D2DERR_SHADER_COMPILE_FAILED
|
||||
TIL_FEATURE_[0-9A-Z_]+
|
||||
vcvars\w*
|
||||
ROY\sG\.\sBIV
|
||||
!(?:(?i)ESC)!\[
|
||||
!(?:(?i)CSI)!(?:\d+(?:;\d+|)m|[ABCDF])
|
||||
|
||||
# Python stringprefix / binaryprefix
|
||||
\b(?:B|BR|Br|F|FR|Fr|R|RB|RF|Rb|Rf|U|UR|Ur|b|bR|br|f|fR|fr|r|rB|rF|rb|rf|u|uR|ur)'
|
||||
|
||||
# Automatically suggested patterns
|
||||
# hit-count: 3831 file-count: 582
|
||||
# IServiceProvider
|
||||
\bI(?=(?:[A-Z][a-z]{2,})+\b)
|
||||
|
||||
# hit-count: 71 file-count: 35
|
||||
# Compiler flags
|
||||
(?:^|[\t ,"'`=(])-[D](?=[A-Z]{2,}|[A-Z][a-z])
|
||||
(?:^|[\t ,"'`=(])-[X](?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,})
|
||||
|
||||
# hit-count: 41 file-count: 28
|
||||
# version suffix <word>v#
|
||||
(?:(?<=[A-Z]{2})V|(?<=[a-z]{2}|[A-Z]{2})v)\d+(?:\b|(?=[a-zA-Z_]))
|
||||
|
||||
# hit-count: 20 file-count: 9
|
||||
# hex runs
|
||||
\b[0-9a-fA-F]{16,}\b
|
||||
|
||||
# hit-count: 10 file-count: 7
|
||||
# uuid:
|
||||
\b[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}\b
|
||||
|
||||
# hit-count: 4 file-count: 4
|
||||
# mailto urls
|
||||
mailto:[-a-zA-Z=;:/?%&0-9+@.]{3,}
|
||||
|
||||
# hit-count: 4 file-count: 1
|
||||
# ANSI color codes
|
||||
(?:\\(?:u00|x)1b|\x1b)\[\d+(?:;\d+|)m
|
||||
|
||||
# hit-count: 2 file-count: 1
|
||||
# latex
|
||||
\\(?:n(?:ew|ormal|osub)|r(?:enew)|t(?:able(?:of|)|he|itle))(?=[a-z]+)
|
||||
|
||||
# hit-count: 1 file-count: 1
|
||||
# hex digits including css/html color classes:
|
||||
(?:[\\0][xX]|\\u|[uU]\+|#x?|\%23)[0-9_a-fA-FgGrR]*?[a-fA-FgGrR]{2,}[0-9_a-fA-FgGrR]*(?:[uUlL]{0,3}|u\d+)\b
|
||||
|
||||
# hit-count: 1 file-count: 1
|
||||
# Non-English
|
||||
[a-zA-Z]*[ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź][a-zA-Z]{3}[a-zA-ZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź]*
|
||||
|
||||
# hit-count: 1 file-count: 1
|
||||
# French
|
||||
# This corpus only had capital letters, but you probably want lowercase ones as well.
|
||||
\b[LN]'+[a-z]{2,}\b
|
||||
|
||||
# acceptable duplicates
|
||||
# ls directory listings
|
||||
[-bcdlpsw](?:[-r][-w][-sx]){3}\s+\d+\s+(\S+)\s+\g{-1}\s+\d+\s+
|
||||
# C/idl types + English ...
|
||||
\s(Guid|long|LONG|that) \g{-1}\s
|
||||
|
||||
# javadoc / .net
|
||||
(?:[\\@](?:groupname|param)|(?:public|private)(?:\s+static|\s+readonly)*)\s+(\w+)\s+\g{-1}\s
|
||||
|
||||
# Commit message -- Signed-off-by and friends
|
||||
^\s*(?:(?:Based-on-patch|Co-authored|Helped|Mentored|Reported|Reviewed|Signed-off)-by|Thanks-to): (?:[^<]*<[^>]*>|[^<]*)\s*$
|
||||
|
||||
# Autogenerated revert commit message
|
||||
^This reverts commit [0-9a-f]{40}\.$
|
||||
|
||||
# vtmode
|
||||
--vtmode\s+(\w+)\s+\g{-1}\s
|
||||
|
||||
# ignore long runs of a single character:
|
||||
\b([A-Za-z])\g{-1}{3,}\b
|
||||
12
.github/actions/spelling/reject.txt
vendored
Normal file
12
.github/actions/spelling/reject.txt
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
^attache$
|
||||
^attacher$
|
||||
^attachers$
|
||||
benefitting
|
||||
occurences?
|
||||
^dependan.*
|
||||
^oer$
|
||||
Sorce
|
||||
^[Ss]pae.*
|
||||
^untill$
|
||||
^untilling$
|
||||
^wether.*
|
||||
20
.github/workflows/spelling.yml
vendored
20
.github/workflows/spelling.yml
vendored
@@ -1,20 +0,0 @@
|
||||
name: Spell checking
|
||||
on:
|
||||
push:
|
||||
schedule:
|
||||
# * is a special character in YAML so you have to quote this string
|
||||
- cron: '15 * * * *'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Spell checking
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.0.0
|
||||
with:
|
||||
fetch-depth: 5
|
||||
- uses: check-spelling/check-spelling@0.0.16-alpha
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
bucket: .github/actions
|
||||
project: spell-check
|
||||
134
.github/workflows/spelling2.yml
vendored
Normal file
134
.github/workflows/spelling2.yml
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
# spelling.yml is blocked per https://github.com/check-spelling/check-spelling/security/advisories/GHSA-g86g-chm8-7r2p
|
||||
name: Spell checking
|
||||
|
||||
# Comment management is handled through a secondary job, for details see:
|
||||
# https://github.com/check-spelling/check-spelling/wiki/Feature%3A-Restricted-Permissions
|
||||
#
|
||||
# `jobs.comment-push` runs when a push is made to a repository and the `jobs.spelling` job needs to make a comment
|
||||
# (in odd cases, it might actually run just to collapse a commment, but that's fairly rare)
|
||||
# it needs `contents: write` in order to add a comment.
|
||||
#
|
||||
# `jobs.comment-pr` runs when a pull_request is made to a repository and the `jobs.spelling` job needs to make a comment
|
||||
# or collapse a comment (in the case where it had previously made a comment and now no longer needs to show a comment)
|
||||
# it needs `pull-requests: write` in order to manipulate those comments.
|
||||
|
||||
# Updating pull request branches is managed via comment handling.
|
||||
# For details, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-expect-list
|
||||
#
|
||||
# These elements work together to make it happen:
|
||||
#
|
||||
# `on.issue_comment`
|
||||
# This event listens to comments by users asking to update the metadata.
|
||||
#
|
||||
# `jobs.update`
|
||||
# This job runs in response to an issue_comment and will push a new commit
|
||||
# to update the spelling metadata.
|
||||
#
|
||||
# `with.experimental_apply_changes_via_bot`
|
||||
# Tells the action to support and generate messages that enable it
|
||||
# to make a commit to update the spelling metadata.
|
||||
#
|
||||
# `with.ssh_key`
|
||||
# In order to trigger workflows when the commit is made, you can provide a
|
||||
# secret (typically, a write-enabled github deploy key).
|
||||
#
|
||||
# For background, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-with-deploy-key
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
tags-ignore:
|
||||
- "**"
|
||||
pull_request_target:
|
||||
branches:
|
||||
- "**"
|
||||
tags-ignore:
|
||||
- "**"
|
||||
types:
|
||||
- 'opened'
|
||||
- 'reopened'
|
||||
- 'synchronize'
|
||||
issue_comment:
|
||||
types:
|
||||
- 'created'
|
||||
|
||||
jobs:
|
||||
spelling:
|
||||
name: Spell checking
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
actions: read
|
||||
outputs:
|
||||
followup: ${{ steps.spelling.outputs.followup }}
|
||||
runs-on: ubuntu-latest
|
||||
if: "contains(github.event_name, 'pull_request') || github.event_name == 'push'"
|
||||
concurrency:
|
||||
group: spelling-${{ github.event.pull_request.number || github.ref }}
|
||||
# note: If you use only_check_changed_files, you do not want cancel-in-progress
|
||||
cancel-in-progress: true
|
||||
steps:
|
||||
- name: check-spelling
|
||||
id: spelling
|
||||
uses: check-spelling/check-spelling@v0.0.21
|
||||
with:
|
||||
suppress_push_for_open_pull_request: 1
|
||||
checkout: true
|
||||
check_file_names: 1
|
||||
spell_check_this: check-spelling/spell-check-this@prerelease
|
||||
post_comment: 0
|
||||
use_magic_file: 1
|
||||
extra_dictionary_limit: 10
|
||||
extra_dictionaries:
|
||||
cspell:software-terms/src/software-terms.txt
|
||||
cspell:python/src/python/python-lib.txt
|
||||
cspell:node/node.txt
|
||||
cspell:cpp/src/stdlib-c.txt
|
||||
cspell:cpp/src/stdlib-cpp.txt
|
||||
cspell:fullstack/fullstack.txt
|
||||
cspell:filetypes/filetypes.txt
|
||||
cspell:html/html.txt
|
||||
cspell:cpp/src/compiler-msvc.txt
|
||||
cspell:python/src/common/extra.txt
|
||||
cspell:powershell/powershell.txt
|
||||
cspell:aws/aws.txt
|
||||
cspell:cpp/src/lang-keywords.txt
|
||||
cspell:npm/npm.txt
|
||||
cspell:dotnet/dotnet.txt
|
||||
cspell:python/src/python/python.txt
|
||||
cspell:css/css.txt
|
||||
cspell:cpp/src/stdlib-cmath.txt
|
||||
check_extra_dictionaries: ''
|
||||
|
||||
comment-push:
|
||||
name: Report (Push)
|
||||
# If your workflow isn't running on push, you can remove this job
|
||||
runs-on: ubuntu-latest
|
||||
needs: spelling
|
||||
permissions:
|
||||
contents: write
|
||||
if: (success() || failure()) && needs.spelling.outputs.followup && github.event_name == 'push'
|
||||
steps:
|
||||
- name: comment
|
||||
uses: check-spelling/check-spelling@v0.0.21
|
||||
with:
|
||||
checkout: true
|
||||
spell_check_this: check-spelling/spell-check-this@prerelease
|
||||
task: ${{ needs.spelling.outputs.followup }}
|
||||
|
||||
comment-pr:
|
||||
name: Report (PR)
|
||||
# If you workflow isn't running on pull_request*, you can remove this job
|
||||
runs-on: ubuntu-latest
|
||||
needs: spelling
|
||||
permissions:
|
||||
pull-requests: write
|
||||
if: (success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name, 'pull_request')
|
||||
steps:
|
||||
- name: comment
|
||||
uses: check-spelling/check-spelling@v0.0.21
|
||||
with:
|
||||
checkout: true
|
||||
spell_check_this: check-spelling/spell-check-this@prerelease
|
||||
task: ${{ needs.spelling.outputs.followup }}
|
||||
20
NuGet.Config
20
NuGet.Config
@@ -1,24 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
|
||||
<!-- Add repositories here to the list of available repositories -->
|
||||
|
||||
<!-- Dependencies that we must carry because they're not on public nuget feeds right now. -->
|
||||
<clear />
|
||||
<!-- Dependencies that we can turn on to force override for testing purposes before uploading. -->
|
||||
<!--<add key="Static Package Dependencies" value="dep\packages" />-->
|
||||
|
||||
<!-- Use our own NuGet Feed -->
|
||||
<add key="TerminalDependencies" value="https://pkgs.dev.azure.com/ms/terminal/_packaging/TerminalDependencies/nuget/v3/index.json" />
|
||||
|
||||
<!-- Temporarily? use the feeds from our friends in MUX for Helix test stuff -->
|
||||
<add key="dotnetfeed" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
|
||||
<add key="dnceng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
|
||||
<add key="MUX-Dependencies" value="https://pkgs.dev.azure.com/ms/microsoft-ui-xaml/_packaging/MUX-Dependencies/nuget/v3/index.json" />
|
||||
|
||||
<!-- Internal NuGet feeds that may not be accessible outside Microsoft corporate network -->
|
||||
<!--<add key="TAEF - internal" value="https://microsoft.pkgs.visualstudio.com/DefaultCollection/_packaging/Taef/nuget/v3/index.json" />
|
||||
<add key="OpenConsole - Internal" value="https://microsoft.pkgs.visualstudio.com/_packaging/OpenConsole/nuget/v3/index.json" />-->
|
||||
</packageSources>
|
||||
<disabledPackageSources>
|
||||
<clear />
|
||||
</disabledPackageSources>
|
||||
<config>
|
||||
<add key="repositorypath" value=".\packages" />
|
||||
</config>
|
||||
|
||||
412
OpenConsole.sln
412
OpenConsole.sln
File diff suppressed because it is too large
Load Diff
@@ -18,7 +18,7 @@ FOR %%A IN (TestHostApp.exe,te.exe,te.processhost.exe,conhost.exe,OpenConsole.ex
|
||||
|
||||
echo %TIME%
|
||||
|
||||
:: kill dhandler, which is a tool designed to handle unexpected windows appearing. But since our tests are
|
||||
:: kill dhandler, which is a tool designed to handle unexpected windows appearing. But since our tests are
|
||||
:: expected to show UI we don't want it running.
|
||||
taskkill -f -im dhandler.exe
|
||||
|
||||
@@ -28,7 +28,7 @@ echo %TIME%
|
||||
powershell -ExecutionPolicy Bypass .\InstallTestAppDependencies.ps1
|
||||
echo %TIME%
|
||||
|
||||
set testBinaryCandidates=TerminalApp.LocalTests.dll Conhost.UIA.Tests.dll
|
||||
set testBinaryCandidates=TerminalApp.LocalTests.dll SettingsModel.LocalTests.dll Conhost.UIA.Tests.dll
|
||||
set testBinaries=
|
||||
for %%B in (%testBinaryCandidates%) do (
|
||||
if exist %%B (
|
||||
@@ -103,4 +103,4 @@ copy /y *_subresults.json %HELIX_WORKITEM_UPLOAD_ROOT%
|
||||
|
||||
type testResults.xml
|
||||
|
||||
echo %TIME%
|
||||
echo %TIME%
|
||||
|
||||
@@ -5,14 +5,14 @@ parameters:
|
||||
testSuite: ''
|
||||
# If a Pipeline runs this template more than once, this parameter should be unique per build flavor to differentiate the
|
||||
# the different test runs:
|
||||
helixType: 'test/devtest'
|
||||
helixType: 'test/devtest'
|
||||
artifactName: 'drop'
|
||||
maxParallel: 4
|
||||
rerunPassesRequiredToAvoidFailure: 5
|
||||
taefQuery: ''
|
||||
# if 'useBuildOutputFromBuildId' is set, we will default to using a build from this pipeline:
|
||||
useBuildOutputFromPipeline: $(System.DefinitionId)
|
||||
matrix:
|
||||
matrix:
|
||||
# Release_x86:
|
||||
# buildPlatform: 'x86'
|
||||
# buildConfiguration: 'release'
|
||||
@@ -39,13 +39,13 @@ jobs:
|
||||
taefPath: $(Build.SourcesDirectory)\build\Helix\packages\taef.redist.wlk.10.57.200731005-develop\build\Binaries\$(buildPlatform)
|
||||
helixCommonArgs: '/binaryLogger:$(Build.SourcesDirectory)/${{parameters.name}}.$(buildPlatform).$(buildConfiguration).binlog /p:HelixBuild=$(Build.BuildId).$(buildPlatform).$(buildConfiguration) /p:Platform=$(buildPlatform) /p:Configuration=$(buildConfiguration) /p:HelixType=${{parameters.helixType}} /p:TestSuite=${{parameters.testSuite}} /p:ProjFilesPath=$(Build.ArtifactStagingDirectory) /p:rerunPassesRequiredToAvoidFailure=${{parameters.rerunPassesRequiredToAvoidFailure}}'
|
||||
|
||||
|
||||
|
||||
steps:
|
||||
- task: CmdLine@1
|
||||
displayName: 'Display build machine environment variables'
|
||||
inputs:
|
||||
filename: 'set'
|
||||
|
||||
|
||||
- task: NuGetToolInstaller@0
|
||||
displayName: 'Use NuGet 5.2.0'
|
||||
inputs:
|
||||
@@ -59,23 +59,23 @@ jobs:
|
||||
nugetConfigPath: nuget.config
|
||||
restoreDirectory: packages
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
- task: DownloadBuildArtifacts@0
|
||||
condition:
|
||||
and(succeeded(),eq(variables['useBuildOutputFromBuildId'],''))
|
||||
inputs:
|
||||
artifactName: ${{ parameters.artifactName }}
|
||||
inputs:
|
||||
artifactName: ${{ parameters.artifactName }}
|
||||
downloadPath: '$(artifactsDir)'
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
- task: DownloadBuildArtifacts@0
|
||||
condition:
|
||||
and(succeeded(),ne(variables['useBuildOutputFromBuildId'],''))
|
||||
inputs:
|
||||
inputs:
|
||||
buildType: specific
|
||||
buildVersionToDownload: specific
|
||||
project: $(System.TeamProjectId)
|
||||
pipeline: ${{ parameters.useBuildOutputFromPipeline }}
|
||||
buildId: $(useBuildOutputFromBuildId)
|
||||
artifactName: ${{ parameters.artifactName }}
|
||||
artifactName: ${{ parameters.artifactName }}
|
||||
downloadPath: '$(artifactsDir)'
|
||||
|
||||
- task: CmdLine@1
|
||||
@@ -90,7 +90,7 @@ jobs:
|
||||
targetType: filePath
|
||||
filePath: build\Helix\PrepareHelixPayload.ps1
|
||||
arguments: -Platform '$(buildPlatform)' -Configuration '$(buildConfiguration)' -ArtifactName '${{ parameters.artifactName }}'
|
||||
|
||||
|
||||
- task: CmdLine@1
|
||||
displayName: 'Display Helix payload contents'
|
||||
inputs:
|
||||
@@ -104,7 +104,16 @@ jobs:
|
||||
outputProjFileName: 'RunTestsInHelix-TerminalAppLocalTests.proj'
|
||||
testSuite: '${{ parameters.testSuite }}'
|
||||
taefQuery: ${{ parameters.taefQuery }}
|
||||
|
||||
|
||||
- template: helix-createprojfile-steps.yml
|
||||
parameters:
|
||||
condition: and(succeeded(),ne('${{ parameters.testSuite }}','NugetTestSuite'))
|
||||
testFilePath: '$(artifactsDir)\${{ parameters.artifactName }}\$(buildConfiguration)\$(buildPlatform)\Test\SettingsModel.LocalTests.dll'
|
||||
outputProjFileName: 'RunTestsInHelix-SettingsModelLocalTests.proj'
|
||||
testSuite: '${{ parameters.testSuite }}'
|
||||
taefQuery: ${{ parameters.taefQuery }}
|
||||
|
||||
|
||||
- template: helix-createprojfile-steps.yml
|
||||
parameters:
|
||||
condition: and(succeeded(),ne('${{ parameters.testSuite }}','NugetTestSuite'))
|
||||
@@ -118,7 +127,7 @@ jobs:
|
||||
inputs:
|
||||
PathtoPublish: $(Build.ArtifactStagingDirectory)
|
||||
artifactName: ${{ parameters.artifactName }}
|
||||
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: 'Run tests in Helix (open queues)'
|
||||
env:
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
"/res/terminal/",
|
||||
"/doc/specs/",
|
||||
"/doc/cascadia/",
|
||||
"/doc/user-docs/"
|
||||
"/doc/user-docs/",
|
||||
"/src/tools/MonarchPeasantSample/",
|
||||
],
|
||||
"SuffixFilters": [
|
||||
".dbb",
|
||||
@@ -38,5 +39,5 @@
|
||||
".rec",
|
||||
".err",
|
||||
".xlsx"
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
- Yes, the large majority of the `DEFINE_PROPERTYKEY` defs are the same, it's only the last byte of the guid that changes
|
||||
|
||||
2. Add matching fields to Settings.hpp
|
||||
- add getters, setters, the whole drill.
|
||||
- Add getters, setters, the whole drill.
|
||||
|
||||
3. Add to the propsheet
|
||||
- We need to add it to *reading and writing* the registry from the propsheet, and *reading* the link from the propsheet. Yes, that's weird, but the propsheet is smart enough to re-use ShortcutSerialization::s_SetLinkValues, but not smart enough to do the same with RegistrySerialization.
|
||||
|
||||
14
doc/TAEF.md
14
doc/TAEF.md
@@ -48,3 +48,17 @@ Invoke-OpenConsoleTests
|
||||
```
|
||||
|
||||
`Invoke-OpenConsoleTests` supports a number of options, which you can enumerate by running `Invoke-OpenConsoleTests -?`.
|
||||
|
||||
|
||||
### Debugging Tests
|
||||
|
||||
If you want to debug a test, you can do so by using the TAEF /waitForDebugger flag, such as:
|
||||
|
||||
runut *Tests.dll /name:TextBufferTests::TestInsertCharacter /waitForDebugger
|
||||
|
||||
Replace the test name with the one you want to debug. Then, TAEF will begin executing the test and output something like this:
|
||||
|
||||
TAEF: Waiting for debugger - PID <some PID> @ IP <some IP address>
|
||||
|
||||
You can then attach to that PID in your debugger of choice. In Visual Studio, you can use Debug -> Attach To Process, or you could use WinDbg or whatever you want.
|
||||
Once the debugger attaches, the test will execute and your breakpoints will be hit.
|
||||
|
||||
395
doc/cascadia/AddASetting.md
Normal file
395
doc/cascadia/AddASetting.md
Normal file
@@ -0,0 +1,395 @@
|
||||
# Adding Settings to Windows Terminal
|
||||
|
||||
Adding a setting to Windows Terminal is fairly straightforward. This guide serves as a reference on how to add a setting.
|
||||
|
||||
## 1. Terminal Settings Model
|
||||
|
||||
The Terminal Settings Model (`Microsoft.Terminal.Settings.Model`) is responsible for (de)serializing and exposing settings.
|
||||
|
||||
### `GETSET_SETTING` macro
|
||||
|
||||
The `GETSET_SETTING` macro can be used to implement inheritance for your new setting and store the setting in the settings model. It takes three parameters:
|
||||
- `type`: the type that the setting will be stored as
|
||||
- `name`: the name of the variable for storage
|
||||
- `defaultValue`: the value to use if the user does not define the setting anywhere
|
||||
|
||||
### Adding a Profile setting
|
||||
|
||||
This tutorial will add `CloseOnExitMode CloseOnExit` as a profile setting.
|
||||
|
||||
1. In `Profile.h`, declare/define the setting:
|
||||
|
||||
```c++
|
||||
GETSET_SETTING(CloseOnExitMode, CloseOnExit, CloseOnExitMode::Graceful)
|
||||
```
|
||||
|
||||
2. In `Profile.idl`, expose the setting via WinRT:
|
||||
|
||||
```c++
|
||||
Boolean HasCloseOnExit();
|
||||
void ClearCloseOnExit();
|
||||
CloseOnExitMode CloseOnExit;
|
||||
```
|
||||
|
||||
3. In `Profile.cpp`, add (de)serialization and copy logic:
|
||||
|
||||
```c++
|
||||
// Top of file:
|
||||
// - Add the serialization key
|
||||
static constexpr std::string_view CloseOnExitKey{ "closeOnExit" };
|
||||
|
||||
// CopySettings() or Copy():
|
||||
// - The setting is exposed in the Settings UI
|
||||
profile->_CloseOnExit = source->_CloseOnExit;
|
||||
|
||||
// LayerJson():
|
||||
// - get the value from the JSON
|
||||
JsonUtils::GetValueForKey(json, CloseOnExitKey, _CloseOnExit);
|
||||
|
||||
// ToJson():
|
||||
// - write the value to the JSON
|
||||
JsonUtils::SetValueForKey(json, CloseOnExitKey, _CloseOnExit);
|
||||
```
|
||||
|
||||
- If the setting is not a primitive type, in `TerminalSettingsSerializationHelpers.h` add (de)serialization logic for the accepted values:
|
||||
|
||||
```c++
|
||||
// For enum values...
|
||||
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::CloseOnExitMode)
|
||||
{
|
||||
JSON_MAPPINGS(3) = {
|
||||
pair_type{ "always", ValueType::Always },
|
||||
pair_type{ "graceful", ValueType::Graceful },
|
||||
pair_type{ "never", ValueType::Never },
|
||||
};
|
||||
};
|
||||
|
||||
// For enum flag values...
|
||||
JSON_FLAG_MAPPER(::winrt::Microsoft::Terminal::TerminalControl::CopyFormat)
|
||||
{
|
||||
JSON_MAPPINGS(5) = {
|
||||
pair_type{ "none", AllClear },
|
||||
pair_type{ "html", ValueType::HTML },
|
||||
pair_type{ "rtf", ValueType::RTF },
|
||||
pair_type{ "all", AllSet },
|
||||
};
|
||||
};
|
||||
|
||||
// NOTE: This is also where you can add functionality for...
|
||||
// - overloaded type support (i.e. accept a bool and an enum)
|
||||
// - custom (de)serialization logic (i.e. coordinates)
|
||||
```
|
||||
|
||||
### Adding a Global setting
|
||||
|
||||
Follow the "adding a Profile setting" instructions above, but do it on the `GlobalAppSettings` files.
|
||||
|
||||
### Adding an Action
|
||||
|
||||
This tutorial will add the `openSettings` action.
|
||||
|
||||
1. In `KeyMapping.idl`, declare the action:
|
||||
|
||||
```c++
|
||||
// Add the action to ShortcutAction
|
||||
enum ShortcutAction
|
||||
{
|
||||
OpenSettings
|
||||
}
|
||||
```
|
||||
|
||||
2. In `ActionAndArgs.cpp`, add serialization logic:
|
||||
|
||||
```c++
|
||||
// Top of file:
|
||||
// - Add the serialization key
|
||||
static constexpr std::string_view OpenSettingsKey{ "openSettings" };
|
||||
|
||||
// ActionKeyNamesMap:
|
||||
// - map the new enum to the json key
|
||||
{ OpenSettingsKey, ShortcutAction::OpenSettings },
|
||||
```
|
||||
|
||||
3. If the action should automatically generate a name when it appears in the Command Palette...
|
||||
```c++
|
||||
// In ActionAndArgs.cpp GenerateName() --> GeneratedActionNames
|
||||
{ ShortcutAction::OpenSettings, RS_(L"OpenSettingsCommandKey") },
|
||||
|
||||
// In Resources.resw for Microsoft.Terminal.Settings.Model.Lib,
|
||||
// add the generated name
|
||||
// NOTE: Visual Studio presents the resw file as a table.
|
||||
// If you choose to edit the file with a text editor,
|
||||
// the code should look something like this...
|
||||
<data name="OpenSettingsCommandKey" xml:space="preserve">
|
||||
<value>Open settings file</value>
|
||||
</data>
|
||||
```
|
||||
|
||||
4. If the action supports arguments...
|
||||
- In `ActionArgs.idl`, declare the arguments
|
||||
```c++
|
||||
[default_interface] runtimeclass OpenSettingsArgs : IActionArgs
|
||||
{
|
||||
// this declares the "target" arg
|
||||
SettingsTarget Target { get; };
|
||||
};
|
||||
```
|
||||
- In `ActionArgs.h`, define the new runtime class
|
||||
```c++
|
||||
struct OpenSettingsArgs : public OpenSettingsArgsT<OpenSettingsArgs>
|
||||
{
|
||||
OpenSettingsArgs() = default;
|
||||
|
||||
// adds a getter/setter for your argument, and defines the json key
|
||||
GETSET_PROPERTY(SettingsTarget, Target, SettingsTarget::SettingsFile);
|
||||
static constexpr std::string_view TargetKey{ "target" };
|
||||
|
||||
public:
|
||||
hstring GenerateName() const;
|
||||
|
||||
bool Equals(const IActionArgs& other)
|
||||
{
|
||||
auto otherAsUs = other.try_as<OpenSettingsArgs>();
|
||||
if (otherAsUs)
|
||||
{
|
||||
return otherAsUs->_Target == _Target;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
static FromJsonResult FromJson(const Json::Value& json)
|
||||
{
|
||||
// LOAD BEARING: Not using make_self here _will_ break you in the future!
|
||||
auto args = winrt::make_self<OpenSettingsArgs>();
|
||||
JsonUtils::GetValueForKey(json, TargetKey, args->_Target);
|
||||
return { *args, {} };
|
||||
}
|
||||
|
||||
IActionArgs Copy() const
|
||||
{
|
||||
auto copy{ winrt::make_self<OpenSettingsArgs>() };
|
||||
copy->_Target = _Target;
|
||||
return *copy;
|
||||
}
|
||||
};
|
||||
```
|
||||
- In `ActionArgs.cpp`, define `GenerateName()`. This is used to automatically generate a name when it appears in the Command Palette.
|
||||
- In `ActionAndArgs.cpp`, add serialization logic:
|
||||
|
||||
```c++
|
||||
// ActionKeyNamesMap --> argParsers
|
||||
{ ShortcutAction::OpenSettings, OpenSettingsArgs::FromJson },
|
||||
```
|
||||
|
||||
### Adding an Action Argument
|
||||
|
||||
Follow step 3 from the "adding an Action" instructions above, but modify the relevant `ActionArgs` files.
|
||||
|
||||
## 2. Setting Functionality
|
||||
|
||||
Now that the Terminal Settings Model is updated, Windows Terminal can read and write to the settings file. This section covers how to add functionality to your newly created setting.
|
||||
|
||||
### App-level settings
|
||||
|
||||
App-level settings are settings that affect the frame of Windows Terminal. Generally, these tend to be global settings. The `TerminalApp` project is responsible for presenting the frame of Windows Terminal. A few files of interest include:
|
||||
- `TerminalPage`: XAML control responsible for the look and feel of Windows Terminal
|
||||
- `AppLogic`: WinRT class responsible for window-related issues (i.e. the titlebar, focus mode, etc...)
|
||||
|
||||
Both have access to a `CascadiaSettings` object, for you to read the loaded setting and update Windows Terminal appropriately.
|
||||
|
||||
### Terminal-level settings
|
||||
|
||||
Terminal-level settings are settings that affect a shell session. Generally, these tend to be profile settings. The `TerminalApp` project is responsible for packaging this settings from the Terminal Settings Model to the terminal instance. There are two kinds of settings here:
|
||||
- `IControlSettings`:
|
||||
- These are settings that affect the `TerminalControl` (a XAML control that hosts a shell session).
|
||||
- Examples include background image customization, interactivity behavior (i.e. selection), acrylic and font customization.
|
||||
- The `TerminalControl` project has access to these settings via a saved `IControlSettings` member.
|
||||
- `ICoreSettings`:
|
||||
- These are settings that affect the `TerminalCore` (a lower level object that interacts with the text buffer).
|
||||
- Examples include initial size, history size, and cursor customization.
|
||||
- The `TerminalCore` project has access to these settings via a saved `ICoreSettings` member.
|
||||
|
||||
`TerminalApp` packages these settings into a `TerminalSettings : IControlSettings, ICoreSettings` object upon creating a new terminal instance. To do so, you must submit the following changes:
|
||||
- Declare the setting in `IControlSettings.idl` or `ICoreSettings.idl` (whichever is relevant to your setting). If your setting is an enum setting, declare the enum here instead of in the `TerminalSettingsModel` project.
|
||||
- In `TerminalSettings.h`, declare/define the setting...
|
||||
```c++
|
||||
// The GETSET_PROPERTY macro declares/defines a getter setter for the setting.
|
||||
// Like GETSET_SETTING, it takes in a type, name, and defaultValue.
|
||||
GETSET_PROPERTY(bool, UseAcrylic, false);
|
||||
```
|
||||
- In `TerminalSettings.cpp`...
|
||||
- update `_ApplyProfileSettings` for profile settings
|
||||
- update `_ApplyGlobalSettings` for global settings
|
||||
- If additional processing is necessary, that would happen here. For example, `backgroundImageAlignment` is stored as a `ConvergedAlignment` in the Terminal Settings Model, but converted into XAML's separate horizontal and vertical alignment enums for packaging.
|
||||
|
||||
### Actions
|
||||
|
||||
Actions are packaged as an `ActionAndArgs` object, then handled in `TerminalApp`. To add functionality for actions...
|
||||
- In the `ShortcutActionDispatch` files, dispatch an event when the action occurs...
|
||||
```c++
|
||||
// ShortcutActionDispatch.idl
|
||||
event Windows.Foundation.TypedEventHandler<ShortcutActionDispatch, Microsoft.Terminal.Settings.Model.ActionEventArgs> OpenSettings;
|
||||
|
||||
// ShortcutActionDispatch.h
|
||||
TYPED_EVENT(OpenSettings, TerminalApp::ShortcutActionDispatch, Microsoft::Terminal::Settings::Model::ActionEventArgs);
|
||||
|
||||
// ShortcutActionDispatch.cpp --> DoAction()
|
||||
// - dispatch the appropriate event
|
||||
case ShortcutAction::OpenSettings:
|
||||
{
|
||||
_OpenSettingsHandlers(*this, eventArgs);
|
||||
break;
|
||||
}
|
||||
```
|
||||
- In `TerminalPage` files, handle the event...
|
||||
```c++
|
||||
// TerminalPage.h
|
||||
// - declare the handler
|
||||
void _HandleOpenSettings(const IInspectable& sender, const Microsoft::Terminal::Settings::Model::ActionEventArgs& args);
|
||||
|
||||
// TerminalPage.cpp --> _RegisterActionCallbacks()
|
||||
// - register the handler
|
||||
_actionDispatch->OpenSettings({ this, &TerminalPage::_HandleOpenSettings });
|
||||
|
||||
// AppActionHandlers.cpp
|
||||
// - direct the function to the right place and call a helper function
|
||||
void TerminalPage::_HandleOpenSettings(const IInspectable& /*sender*/,
|
||||
const ActionEventArgs& args)
|
||||
{
|
||||
// NOTE: this if-statement can be omitted if the action does not support arguments
|
||||
if (const auto& realArgs = args.ActionArgs().try_as<OpenSettingsArgs>())
|
||||
{
|
||||
_LaunchSettings(realArgs.Target());
|
||||
args.Handled(true);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`AppActionHandlers` vary based on the action you want to perform. A few useful helper functions include:
|
||||
- `_GetFocusedTab()`: retrieves the focused tab
|
||||
- `_GetActiveControl()`: retrieves the active terminal control
|
||||
- `_GetTerminalTabImpl()`: tries to cast the given tab as a `TerminalTab` (a tab that hosts a terminal instance)
|
||||
|
||||
|
||||
## 3. Settings UI
|
||||
|
||||
### Exposing Enum Settings
|
||||
If the new setting supports enums, you need to expose a map of the enum and the respective value in the Terminal Settings Model's `EnumMappings`:
|
||||
|
||||
```c++
|
||||
// EnumMappings.idl
|
||||
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.CloseOnExitMode> CloseOnExitMode { get; };
|
||||
|
||||
// EnumMappings.h
|
||||
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, CloseOnExitMode> CloseOnExitMode();
|
||||
|
||||
// EnumMappings.cpp
|
||||
// - this macro leverages the json enum mapper in TerminalSettingsSerializationHelper to expose
|
||||
// the mapped values across project boundaries
|
||||
DEFINE_ENUM_MAP(Model::CloseOnExitMode, CloseOnExitMode);
|
||||
```
|
||||
|
||||
### Binding and Localizing the Enum Setting
|
||||
|
||||
Find the page in the Settings UI that the new setting fits best in. In this example, we are adding `LaunchMode`.
|
||||
1. In `Launch.idl`, expose the bindable setting...
|
||||
```c++
|
||||
// Expose the current value for the setting
|
||||
IInspectable CurrentLaunchMode;
|
||||
|
||||
// Expose the list of possible values
|
||||
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> LaunchModeList { get; };
|
||||
```
|
||||
|
||||
2. In `Launch.h`, declare the bindable enum setting...
|
||||
```c++
|
||||
// the GETSET_BINDABLE_ENUM_SETTING macro accepts...
|
||||
// - name: the name of the setting
|
||||
// - enumType: the type of the setting
|
||||
// - settingsModelName: how to retrieve the setting (use State() to get access to the settings model)
|
||||
// - settingNameInModel: the name of the setting in the terminal settings model
|
||||
GETSET_BINDABLE_ENUM_SETTING(LaunchMode, Model::LaunchMode, State().Settings().GlobalSettings, LaunchMode);
|
||||
```
|
||||
|
||||
3. In `Launch.cpp`, populate these functions...
|
||||
```c++
|
||||
// Constructor (after InitializeComponent())
|
||||
// the INITIALIZE_BINDABLE_ENUM_SETTING macro accepts...
|
||||
// - name: the name of the setting
|
||||
// - enumMappingsName: the name from the TerminalSettingsModel's EnumMappings
|
||||
// - enumType: the type for the enum
|
||||
// - resourceSectionAndType: prefix for the localization
|
||||
// - resourceProperty: postfix for the localization
|
||||
INITIALIZE_BINDABLE_ENUM_SETTING(LaunchMode, LaunchMode, LaunchMode, L"Globals_LaunchMode", L"Content");
|
||||
```
|
||||
|
||||
4. In `Resources.resw` for Microsoft.Terminal.Settings.Editor, add the localized text to expose each enum value. Use the following format: `<SettingGroup>_<SettingName><EnumValue>.Content`
|
||||
- `SettingGroup`:
|
||||
- `Globals` for global settings
|
||||
- `Profile` for profile settings
|
||||
- `SettingName`:
|
||||
- the Pascal-case format for the setting type (i.e. `LaunchMode` for `"launchMode"`)
|
||||
- `EnumValue`:
|
||||
- the json key for the setting value, but with the first letter capitalized (i.e. `Focus` for `"focus"`)
|
||||
- The resulting resw key should look something like this `Globals_LaunchModeFocus.Content`
|
||||
- This is the text that will be used in your control
|
||||
|
||||
### Updating the UI
|
||||
|
||||
#### Enum Settings
|
||||
|
||||
Now, create a XAML control in the relevant XAML file. Use the following tips and tricks to style everything appropriately:
|
||||
- Wrap the control in a `ContentPresenter` adhering to the `SettingContainerStyle` style
|
||||
- Bind `SelectedItem` to the relevant `Current<Setting>` (i.e. `CurrentLaunchMode`). Ensure it's a TwoWay binding
|
||||
- Bind `ItemsSource` to `<Setting>List` (i.e. `LaunchModeList`)
|
||||
- Set the ItemTemplate to the `Enum<ControlType>Template` (i.e. `EnumRadioButtonTemplate` for radio buttons)
|
||||
- Set the style to the appropriate one in `CommonResources.xaml`
|
||||
|
||||
```xml
|
||||
<!--Launch Mode-->
|
||||
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
|
||||
<muxc:RadioButtons x:Uid="Globals_LaunchMode"
|
||||
SelectedItem="{x:Bind CurrentLaunchMode, Mode="TwoWay"}"
|
||||
ItemsSource="{x:Bind LaunchModeList}"
|
||||
ItemTemplate="{StaticResource EnumRadioButtonTemplate}"
|
||||
Style="{StaticResource RadioButtonsSettingStyle}"/>
|
||||
</ContentPresenter>
|
||||
```
|
||||
|
||||
To add any localized text, add a `x:Uid`, and access the relevant property via the Resources.resw file. For example, `Globals_LaunchMode.Header` sets the header for this control. You can also set the tooltip text like this:
|
||||
`Globals_DefaultProfile.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip`.
|
||||
|
||||
#### Non-Enum Settings
|
||||
|
||||
Continue to reference `CommonResources.xaml` for appropriate styling and wrap the control with a similar `ContentPresenter`. However, instead of binding to the `Current<Setting>` and `<Setting>List`, bind directly to the setting via the state. Binding a setting like `altGrAliasing` should look something like this:
|
||||
```xml
|
||||
<!--AltGr Aliasing-->
|
||||
<ContentPresenter Style="{StaticResource SettingContainerStyle}">
|
||||
<CheckBox x:Uid="Profile_AltGrAliasing"
|
||||
IsChecked="{x:Bind State.Profile.AltGrAliasing, Mode=TwoWay}"
|
||||
Style="{StaticResource CheckBoxSettingStyle}"/>
|
||||
</ContentPresenter>
|
||||
```
|
||||
|
||||
#### Profile Settings
|
||||
|
||||
If you are specifically adding a Profile setting, in addition to the steps above, you need to make the setting observable by modifying the `Profiles` files...
|
||||
```c++
|
||||
// Profiles.idl --> ProfileViewModel
|
||||
// - this declares the setting as observable using the type and the name of the setting
|
||||
OBSERVABLE_PROJECTED_SETTING(Microsoft.Terminal.Settings.Model.CloseOnExitMode, CloseOnExit);
|
||||
|
||||
// Profiles.h --> ProfileViewModel
|
||||
// - this defines the setting as observable off of the _profile object
|
||||
OBSERVABLE_PROJECTED_SETTING(_profile, CloseOnExit);
|
||||
|
||||
// Profiles.h --> ProfileViewModel
|
||||
// - if the setting cannot be inherited by another profile (aka missing the Clear() function), use the following macro instead:
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_profile, Guid);
|
||||
```
|
||||
|
||||
The `ProfilePageNavigationState` holds a `ProfileViewModel`, which wraps the `Profile` object from the Terminal Settings Model. The `ProfileViewModel` makes all of the profile settings observable.
|
||||
|
||||
### Actions
|
||||
|
||||
Actions are not yet supported in the Settings UI.
|
||||
@@ -93,6 +93,8 @@
|
||||
"scrollDownPage",
|
||||
"scrollUp",
|
||||
"scrollUpPage",
|
||||
"scrollToBottom",
|
||||
"scrollToTop",
|
||||
"sendInput",
|
||||
"setColorScheme",
|
||||
"setTabColor",
|
||||
@@ -369,6 +371,13 @@
|
||||
"splitMode": {
|
||||
"default": "duplicate",
|
||||
"description": "Control how the pane splits. Only accepts \"duplicate\" which will duplicate the focused pane's profile into a new pane."
|
||||
},
|
||||
"size": {
|
||||
"default": 0.5,
|
||||
"description": "Specify how large the new pane should be, as a fraction of the current pane's size. 1.0 would be 'all of the current pane', and 0.0 is 'None of the parent'. Accepts floating point values from 0-1 (default 0.5).",
|
||||
"maximum": 1,
|
||||
"minimum": 0,
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -649,6 +658,10 @@
|
||||
"description": "Sets the default profile. Opens by clicking the \"+\" icon or typing the key binding assigned to \"newTab\".",
|
||||
"type": "string"
|
||||
},
|
||||
"startupActions": {
|
||||
"description": "Sets the list of actions to apply if no command line is provided. Uses the same format as command line arguments",
|
||||
"type": "string"
|
||||
},
|
||||
"disabledProfileSources": {
|
||||
"description": "Disables all the dynamic profile generators in this list, preventing them from adding their profiles to the list of profiles on startup.",
|
||||
"items": {
|
||||
@@ -922,9 +935,10 @@
|
||||
},
|
||||
"cursorShape": {
|
||||
"default": "bar",
|
||||
"description": "Sets the shape of the cursor. Possible values:\n -\"bar\" ( ┃, default )\n -\"emptyBox\" ( ▯ )\n -\"filledBox\" ( █ )\n -\"underscore\" ( ▁ )\n -\"vintage\" ( ▃ )",
|
||||
"description": "Sets the shape of the cursor. Possible values:\n -\"bar\" ( ┃, default )\n -\"doubleUnderscore\" ( ‗ )\n -\"emptyBox\" ( ▯ )\n -\"filledBox\" ( █ )\n -\"underscore\" ( ▁ )\n -\"vintage\" ( ▃ )",
|
||||
"enum": [
|
||||
"bar",
|
||||
"doubleUnderscore",
|
||||
"emptyBox",
|
||||
"filledBox",
|
||||
"underscore",
|
||||
|
||||
302
doc/specs/#2871 - Pane Navigation/#2871 - Pane Navigation.md
Normal file
302
doc/specs/#2871 - Pane Navigation/#2871 - Pane Navigation.md
Normal file
@@ -0,0 +1,302 @@
|
||||
---
|
||||
author: Mike Griese @zadjii-msft
|
||||
created on: 2020-11-23
|
||||
last updated: 2020-12-15
|
||||
issue id: #2871
|
||||
---
|
||||
|
||||
# Focus Pane Actions
|
||||
|
||||
## Abstract
|
||||
|
||||
Currently, the Terminal only allows users to navigate through panes
|
||||
_directionally_. However, we might also want to allow a user to navigate through
|
||||
panes in most recently used order ("MRU" order), or to navigate directly to a
|
||||
specific pane. This spec proposes some additional actions in order to enable
|
||||
these sorts of scenarios.
|
||||
|
||||
## Background
|
||||
|
||||
### Inspiration
|
||||
|
||||
`tmux` allows the user to navigate through panes using its `select-pane`
|
||||
command. The `select-pane` command works in the following way:
|
||||
|
||||
```
|
||||
select-pane [-DLlMmRU] [-T title] [-t target-pane]
|
||||
|
||||
Make pane target-pane the active pane in window target-window, or set its
|
||||
style (with -P). If one of -D, -L, -R, or -U is used, respectively the
|
||||
pane below, to the left, to the right, or above the target pane is used.
|
||||
-l is the same as using the last-pane command.
|
||||
|
||||
-m and -M are used to set and clear the marked pane. There is one marked
|
||||
pane at a time, setting a new marked pane clears the last. The marked pane
|
||||
is the default target for -s to join-pane, swap-pane and swap-window.
|
||||
```
|
||||
_from `man tmux`_.
|
||||
|
||||
The Terminal currently allows the user to navigate through panes with the
|
||||
`moveFocus` action, which only accepts a `direction` to move in.
|
||||
|
||||
Additionally, the Terminal allows movement between tabs with the `nextTab` and
|
||||
`prevTab` actions, who move between tabs either in-order or in MRU order.
|
||||
Furthermore, these actions may or may not display the "tab switcher" user
|
||||
interface, based on the value of `tabSwitcherMode`.
|
||||
|
||||
### User Stories
|
||||
|
||||
* **Scenario 1**: A user who wants to be able to split the window into 4 equal
|
||||
corners from the commandline. Currently this isn't possible, because the user
|
||||
cannot move focus during the startup actions - `split-pane` actions always end
|
||||
up splitting the current leaf in the tree of panes. (see [#5464])
|
||||
* **Scenario 2**: A user who wants to quickly navigate to the previous pane they
|
||||
had opened. (see [#2871])
|
||||
* **Scenario 3**: A user who wants to bind a keybinding like <kbd>alt+1</kbd>,
|
||||
<kbd>alt+2</kbd>, etc to immediately focus the first, second, etc. pane in a
|
||||
tab. (see [#5803])
|
||||
|
||||
### Future Considerations
|
||||
|
||||
There's been talk of updating the advanced tab switcher to also display panes,
|
||||
in addition to just tabs. This would allow users to navigate through the ATS
|
||||
directly to a pane, and see all the panes in a tab. Currently, `tabSwitcherMode`
|
||||
changes the behavior of `nextTab`, `prevTab` - should we just build the
|
||||
`paneSwitcherMode` directly into the action we end up designing?
|
||||
|
||||
## Solution Design
|
||||
|
||||
Does using the pane switcher with a theoretical `focusPane(target=id)` action
|
||||
even make sense? Certainly not! That's like `switchToTab(index=id)`, the user
|
||||
already knows which tab they want to go to, there's no reason to pop an
|
||||
ephemeral UI in front of them.
|
||||
|
||||
Similarly, it almost certainly doesn't make sense to display the pane switcher
|
||||
while moving focus directionally. Consider moving focus with a key bound to the
|
||||
arrow keys. Displaying another UI in front of them while moving focus with the
|
||||
arrow keys would be confusing.
|
||||
|
||||
Addressing Scenario 1 is relatively easy. So long as we add any of the proposed
|
||||
actions, including the existing `moveFocus` action as a subcommand that can be
|
||||
passed to `wt.exe`, then the user should be able to navigate through the panes
|
||||
they've created with the startup commandline, and build the tree of panes
|
||||
however they see fit.
|
||||
|
||||
Scenario 2 is more complicated, because MRU switching is always more
|
||||
complicated. Without a UI of some sort, there's no way to switch to another pane
|
||||
in the MRU order without also updating the MRU order as you go. So this would
|
||||
almost certainly necessitate a "pane switcher", like the tab switcher.
|
||||
|
||||
|
||||
### Proposal A: Add next, prev to moveFocus
|
||||
|
||||
* `moveFocus(direction="up|down|left|right|next|prev")`
|
||||
|
||||
* **Pros**:
|
||||
- Definitely gets the "MRU Pane Switching" scenario working
|
||||
* **Cons**:
|
||||
- Doesn't really address any of the other scenarios
|
||||
- How will it play with pane switching in the UI?
|
||||
- MRU switching without a dialog to track & display the MRU stack doesn't
|
||||
really work - this only allows to the user to navigate to the most recently
|
||||
used pane, or through all the panes in least-recently-used order. This is
|
||||
because switching to the MRU pane _will update the MRU pane_.
|
||||
|
||||
❌ This proposal is no longer being considered.
|
||||
|
||||
### Proposal B: focusNextPane, focusPrevPane with order, useSwitcher args
|
||||
|
||||
```json
|
||||
// Focus pane 1
|
||||
// - This is sensible, no arguments here
|
||||
{ "command": { "action": "focusPane", "id": 1 } },
|
||||
|
||||
// Focus the next MRU pane
|
||||
// - Without the switcher, this can only go one pane deep in the MRU stack
|
||||
// - presumably once there's a pane switcher, it would default to enabled?
|
||||
{ "command": { "action": "focusNextPane", "order": "mru" } },
|
||||
|
||||
// Focus the prev inOrder pane
|
||||
// - this seems straightforward
|
||||
{ "command": { "action": "focusPrevPane", "order": "inOrder" } },
|
||||
|
||||
// Focus the next pane, in mru order, explicitly disable the switcher
|
||||
// - The user opted in to only being able to MRU switch one deep. That's fine, that's what they want.
|
||||
{ "command": { "action": "focusNextPane", "order": "mru", "useSwitcher": false} },
|
||||
|
||||
// Focus the prev inOrder pane, explicitly with the switcher
|
||||
// - Maybe they disabled the switcher globally, but what it on for this action?
|
||||
{ "command": { "action": "focusPrevPane", "order": "inOrder", "useSwitcher": true } },
|
||||
```
|
||||
_From [discussion in the implementation
|
||||
PR](https://github.com/microsoft/terminal/pull/8183#issuecomment-729672645)_
|
||||
|
||||
Boiled down, that's three actions:
|
||||
* `focusPane(target=id)`
|
||||
* `focusNextPane(order="inOrder|mru", useSwitcher=true|false)`
|
||||
* `focusPrevPane(order="inOrder|mru", useSwitcher=true|false)`
|
||||
|
||||
* **Pros**:
|
||||
- Everything is explicit, including the option to use the pane switcher (when
|
||||
available)
|
||||
- Adds support for in-order pane switching
|
||||
- No "conditional parameters" - where providing one argument makes other
|
||||
arguments invalid or ambiguous.
|
||||
* **Cons**:
|
||||
- Doesn't really address any of the other scenarios
|
||||
- What does the "next most-recently-used tab" even mean? How is it different
|
||||
than "previous most-recently-used tab"? Semantically, these are the same
|
||||
thing!
|
||||
- No one's even asked for in-order pane switching. Is that a UX that even
|
||||
really makes sense?
|
||||
|
||||
❌ This proposal is no longer being considered.
|
||||
|
||||
> 👉 **NOTE**: At this point, we stopped considering navigating in both MRU
|
||||
> "directions", since both the next and prev MRU pane are the same thing. We're
|
||||
> now using "last" to mean "the previous MRU pane".
|
||||
|
||||
### Proposal C: One actions, combine the args
|
||||
|
||||
* `moveFocus(target=id|"up|down|left|right|last")`
|
||||
|
||||
* **Pros**:
|
||||
- Absolutely the least complicated action to author. There's only one
|
||||
parameter, `target`.
|
||||
- No "conditional parameters".
|
||||
* **Cons**:
|
||||
- How do we express this in the Settings UI? Mixed-type enums work fine for
|
||||
the font weight, where each enum value has a distinct integer value it maps
|
||||
to, but in this case, using `id` is entirely different from the other
|
||||
directional values
|
||||
|
||||
❌ This proposal is no longer being considered.
|
||||
|
||||
### Proposal D: Two actions
|
||||
|
||||
* `focusPane(target=id)`
|
||||
* `moveFocus(direction="up|down|left|right|last")`
|
||||
|
||||
* **Pros**:
|
||||
- Each action does explicitly one thing.
|
||||
* **Cons**:
|
||||
- two actions for _similar_ behavior
|
||||
- This now forks the "Direction" enum into "MoveFocusDirection" and
|
||||
"ResizeDirection" (because `resizePane(last)` doesn't make any sense).
|
||||
|
||||
This proposal doesn't really have any special consideration for the pane
|
||||
switcher UX. Neither of these actions would summon the pane switcher UX.
|
||||
|
||||
### Proposal E: Three actions
|
||||
|
||||
* `focusPane(target=id)`
|
||||
* `moveFocus(direction="up|down|left|right")`
|
||||
* `focusLastPane(usePaneSwitcher=false|true)`
|
||||
|
||||
In this design, neither `focusPane` nor `moveFocus` will summon the pane
|
||||
switcher UI (even once it's added). However, the `focusLastPane` one _could_,
|
||||
and subsequent keypresses could pop you through the MRU stack, while it's
|
||||
visible? The pane switcher could then display the panes for the tab in MRU
|
||||
order, and the user could just use the arrow keys to navigate the list if they
|
||||
so choose.
|
||||
|
||||
* **Pros**:
|
||||
- Each action does explicitly one thing.
|
||||
- Design accounts for future pane switcher UX
|
||||
* **Cons**:
|
||||
- Three separate actions for similar behavior
|
||||
|
||||
❌ This proposal is no longer being considered.
|
||||
|
||||
### Proposal F: It's literally just tmux
|
||||
|
||||
_Also known as the "one action to rule them all" proposal_
|
||||
|
||||
`focusPane(target=id, direction="up|down|left|right|last")`
|
||||
|
||||
Previously, this design was avoided, because what does `focusPane(target=4,
|
||||
direction=down)` do? Does it focus pane 4, or does it move focus down?
|
||||
|
||||
`tmux` solves this in one action by just doing both!
|
||||
|
||||
```
|
||||
Make pane target-pane the active pane ... If one of -D, -L, -R, or -U is used,
|
||||
respectively the pane below, to the left, to the right, or above the target pane
|
||||
is used.
|
||||
```
|
||||
_from `man tmux`_.
|
||||
|
||||
So `focusPane(target=1, direction=up)` will attempt to focus the pane above pane
|
||||
1. This action would not summon the pane switcher UX, even for
|
||||
`focusPane(direction=last)`
|
||||
|
||||
* **Pros**:
|
||||
- Fewest redundant actions
|
||||
* **Cons**:
|
||||
- Is this intuitive? That combining the params would do both, with `target`
|
||||
happening "first"?
|
||||
- Assumes that there will be a separate action added in the future for "Open
|
||||
the pane switcher (with some given ordering)"
|
||||
|
||||
|
||||
> 👉 **NOTE**: At this point, the author considered "Do we even want a separate
|
||||
> action to engage the tab switcher with panes expanded?" Perhaps panes being
|
||||
> visible in the tab switcher is just part fo the tab switcher's behavior. Maybe
|
||||
> there shouldn't be a separate "open the tab switcher with the panes expanded
|
||||
> to the pane I'm currently on, and the panes listed in MRU order" action.
|
||||
|
||||
❌ This proposal is no longer being considered.
|
||||
|
||||
## Conclusion
|
||||
|
||||
After much discussion as a team, we decided that **Proposal D** would be the
|
||||
best option. We felt that there wasn't a need to add any extra configuration to
|
||||
invoke the "pane switcher" as anything different than the "tab switcher". The
|
||||
"pane switcher" should really just exist as a part of the functionality of the
|
||||
advanced tab switcher, not as it's own thing.
|
||||
|
||||
Additionally, we concurred that the new "direction" value should be `prev`, not
|
||||
`last`, for consistency's sake.
|
||||
|
||||
## UI/UX Design
|
||||
|
||||
The only real UX being added with the agreed upon design is allowing the user to
|
||||
execute an action to move to the previously active pane within a single tab. No
|
||||
additional UX (including the pane switcher) is being prescribed in this spec at
|
||||
this time.
|
||||
|
||||
## Potential Issues
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><strong>Compatibility</strong></td>
|
||||
<td>
|
||||
|
||||
We've only adding a single enum value to an existing enum. Since we're not
|
||||
changing the meaning of any of the existing values, we do not expect any
|
||||
compatibility issues there. Additionally, we're not changing the default value
|
||||
of the `direction` param of the `moveFocus` action, so there are no further
|
||||
compatibility concerns there. Furthermore, no additional parameters are being
|
||||
added to the `moveFocus` action that would potentially give it a different
|
||||
meaning.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
In the current design, there's no way to move through all the panes with a
|
||||
single keybinding. For example, if a user wanted to bind <kbd>Alt+]</kbd> to
|
||||
move to the "next" pane, and <kbd>Alt+[</kbd> to move to the "previous" one.
|
||||
These movements would necessarily need to be in-order traversals, since there's
|
||||
no way of doing multiple MRU steps.
|
||||
|
||||
Fortunately, no one's really asked for traversing the panes in-order, so we're
|
||||
not really worried about this. Otherwise, it would maybe make sense for `last`
|
||||
to be the "previous MRU pane", and reserve `next`/`prev` for in-order traversal.
|
||||
|
||||
|
||||
[#2871]: https://github.com/microsoft/terminal/issues/2871
|
||||
[#5464]: https://github.com/microsoft/terminal/issues/5464
|
||||
[#5803]: https://github.com/microsoft/terminal/issues/5803
|
||||
|
||||
|
||||
BIN
res/Cascadia.ttf
BIN
res/Cascadia.ttf
Binary file not shown.
Binary file not shown.
@@ -17,5 +17,5 @@ Please consult the [license](https://raw.githubusercontent.com/microsoft/cascadi
|
||||
|
||||
### Fonts Included
|
||||
|
||||
* Cascadia Code, Cascadia Mono (2009.21)
|
||||
* from microsoft/cascadia-code@32f84124db1970fa5d032f0fe9019e6922961beb
|
||||
* Cascadia Code, Cascadia Mono (2102.25)
|
||||
* from microsoft/cascadia-code@911dc421f333e3b72b97381d16fee5b71eb48f04
|
||||
|
||||
@@ -11,10 +11,16 @@
|
||||
// - attr - the default text attribute
|
||||
// Return Value:
|
||||
// - constructed object
|
||||
// Note: will throw exception if unable to allocate memory for text attribute storage
|
||||
ATTR_ROW::ATTR_ROW(const UINT cchRowWidth, const TextAttribute attr)
|
||||
ATTR_ROW::ATTR_ROW(const UINT cchRowWidth, const TextAttribute attr) noexcept
|
||||
{
|
||||
_list.push_back(TextAttributeRun(cchRowWidth, attr));
|
||||
try
|
||||
{
|
||||
_list.emplace_back(TextAttributeRun(cchRowWidth, attr));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
FAIL_FAST_CAUGHT_EXCEPTION();
|
||||
}
|
||||
_cchRowWidth = cchRowWidth;
|
||||
}
|
||||
|
||||
@@ -25,7 +31,7 @@ ATTR_ROW::ATTR_ROW(const UINT cchRowWidth, const TextAttribute attr)
|
||||
void ATTR_ROW::Reset(const TextAttribute attr)
|
||||
{
|
||||
_list.clear();
|
||||
_list.push_back(TextAttributeRun(_cchRowWidth, attr));
|
||||
_list.emplace_back(TextAttributeRun(_cchRowWidth, attr));
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@@ -178,15 +184,15 @@ size_t ATTR_ROW::FindAttrIndex(const size_t index, size_t* const pApplies) const
|
||||
// Routine Description:
|
||||
// - Finds the hyperlink IDs present in this row and returns them
|
||||
// Return value:
|
||||
// - An unordered set containing the hyperlink IDs present in this row
|
||||
std::unordered_set<uint16_t> ATTR_ROW::GetHyperlinks()
|
||||
// - The hyperlink IDs present in this row
|
||||
std::vector<uint16_t> ATTR_ROW::GetHyperlinks()
|
||||
{
|
||||
std::unordered_set<uint16_t> ids;
|
||||
std::vector<uint16_t> ids;
|
||||
for (const auto& run : _list)
|
||||
{
|
||||
if (run.GetAttributes().IsHyperlink())
|
||||
{
|
||||
ids.emplace(run.GetAttributes().GetHyperlinkId());
|
||||
ids.emplace_back(run.GetAttributes().GetHyperlinkId());
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
@@ -402,7 +408,7 @@ void ATTR_ROW::ReplaceAttrs(const TextAttribute& toBeReplacedAttr, const TextAtt
|
||||
// The original run was 3 long. The insertion run was 1 long. We need 1 more for the
|
||||
// fact that an existing piece of the run was split in half (to hold the latter half).
|
||||
const size_t cNewRun = _list.size() + newAttrs.size() + 1;
|
||||
std::vector<TextAttributeRun> newRun;
|
||||
decltype(_list) newRun;
|
||||
newRun.reserve(cNewRun);
|
||||
|
||||
// We will start analyzing from the beginning of our existing run.
|
||||
@@ -595,8 +601,7 @@ std::vector<TextAttributeRun> ATTR_ROW::PackAttrs(const std::vector<TextAttribut
|
||||
{
|
||||
if (runs.empty() || runs.back().GetAttributes() != attr)
|
||||
{
|
||||
const TextAttributeRun run(1, attr);
|
||||
runs.push_back(run);
|
||||
runs.emplace_back(TextAttributeRun(1, attr));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -28,9 +28,16 @@ class ATTR_ROW final
|
||||
public:
|
||||
using const_iterator = typename AttrRowIterator;
|
||||
|
||||
ATTR_ROW(const UINT cchRowWidth, const TextAttribute attr);
|
||||
ATTR_ROW(const UINT cchRowWidth, const TextAttribute attr)
|
||||
noexcept;
|
||||
|
||||
void Reset(const TextAttribute attr);
|
||||
~ATTR_ROW() = default;
|
||||
|
||||
ATTR_ROW(const ATTR_ROW&) = default;
|
||||
ATTR_ROW& operator=(const ATTR_ROW&) = default;
|
||||
ATTR_ROW(ATTR_ROW&&)
|
||||
noexcept = default;
|
||||
ATTR_ROW& operator=(ATTR_ROW&&) noexcept = default;
|
||||
|
||||
TextAttribute GetAttrByColumn(const size_t column) const;
|
||||
TextAttribute GetAttrByColumn(const size_t column,
|
||||
@@ -41,7 +48,7 @@ public:
|
||||
size_t FindAttrIndex(const size_t index,
|
||||
size_t* const pApplies) const;
|
||||
|
||||
std::unordered_set<uint16_t> GetHyperlinks();
|
||||
std::vector<uint16_t> GetHyperlinks();
|
||||
|
||||
bool SetAttrToEnd(const UINT iStart, const TextAttribute attr);
|
||||
void ReplaceAttrs(const TextAttribute& toBeReplacedAttr, const TextAttribute& replaceWith) noexcept;
|
||||
@@ -63,12 +70,16 @@ public:
|
||||
|
||||
friend bool operator==(const ATTR_ROW& a, const ATTR_ROW& b) noexcept;
|
||||
friend class AttrRowIterator;
|
||||
friend class ROW;
|
||||
|
||||
private:
|
||||
std::vector<TextAttributeRun> _list;
|
||||
void Reset(const TextAttribute attr);
|
||||
|
||||
boost::container::small_vector<TextAttributeRun, 1> _list;
|
||||
size_t _cchRowWidth;
|
||||
|
||||
#ifdef UNIT_TESTING
|
||||
friend class AttrRowTests;
|
||||
friend class CommonState;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -39,19 +39,6 @@ bool AttrRowIterator::operator!=(const AttrRowIterator& it) const noexcept
|
||||
return !(*this == it);
|
||||
}
|
||||
|
||||
AttrRowIterator& AttrRowIterator::operator++() noexcept
|
||||
{
|
||||
_increment(1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
AttrRowIterator AttrRowIterator::operator++(int) noexcept
|
||||
{
|
||||
auto copy = *this;
|
||||
_increment(1);
|
||||
return copy;
|
||||
}
|
||||
|
||||
AttrRowIterator& AttrRowIterator::operator+=(const ptrdiff_t& movement)
|
||||
{
|
||||
if (!_exceeded)
|
||||
@@ -74,19 +61,6 @@ AttrRowIterator& AttrRowIterator::operator-=(const ptrdiff_t& movement)
|
||||
return this->operator+=(-movement);
|
||||
}
|
||||
|
||||
AttrRowIterator& AttrRowIterator::operator--() noexcept
|
||||
{
|
||||
_decrement(1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
AttrRowIterator AttrRowIterator::operator--(int) noexcept
|
||||
{
|
||||
auto copy = *this;
|
||||
_decrement(1);
|
||||
return copy;
|
||||
}
|
||||
|
||||
const TextAttribute* AttrRowIterator::operator->() const
|
||||
{
|
||||
THROW_HR_IF(E_BOUNDS, _exceeded);
|
||||
|
||||
@@ -38,20 +38,38 @@ public:
|
||||
bool operator==(const AttrRowIterator& it) const noexcept;
|
||||
bool operator!=(const AttrRowIterator& it) const noexcept;
|
||||
|
||||
AttrRowIterator& operator++() noexcept;
|
||||
AttrRowIterator operator++(int) noexcept;
|
||||
AttrRowIterator& operator++() noexcept
|
||||
{
|
||||
_increment(1);
|
||||
return *this;
|
||||
}
|
||||
AttrRowIterator operator++(int) noexcept
|
||||
{
|
||||
auto copy = *this;
|
||||
_increment(1);
|
||||
return copy;
|
||||
}
|
||||
|
||||
AttrRowIterator& operator+=(const ptrdiff_t& movement);
|
||||
AttrRowIterator& operator-=(const ptrdiff_t& movement);
|
||||
|
||||
AttrRowIterator& operator--() noexcept;
|
||||
AttrRowIterator operator--(int) noexcept;
|
||||
AttrRowIterator& operator--() noexcept
|
||||
{
|
||||
_decrement(1);
|
||||
return *this;
|
||||
}
|
||||
AttrRowIterator operator--(int) noexcept
|
||||
{
|
||||
auto copy = *this;
|
||||
_decrement(1);
|
||||
return copy;
|
||||
}
|
||||
|
||||
const TextAttribute* operator->() const;
|
||||
const TextAttribute& operator*() const;
|
||||
|
||||
private:
|
||||
std::vector<TextAttributeRun>::const_iterator _run;
|
||||
boost::container::small_vector_base<TextAttributeRun>::const_iterator _run;
|
||||
const ATTR_ROW* _pAttrRow;
|
||||
size_t _currentAttributeIndex; // index of TextAttribute within the current TextAttributeRun
|
||||
bool _exceeded;
|
||||
|
||||
@@ -15,57 +15,14 @@
|
||||
// Return Value:
|
||||
// - instantiated object
|
||||
// Note: will through if unable to allocate char/attribute buffers
|
||||
CharRow::CharRow(size_t rowWidth, ROW* const pParent) :
|
||||
_wrapForced{ false },
|
||||
_doubleBytePadded{ false },
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 26447) // small_vector's constructor says it can throw but it should not given how we use it. This suppresses this error for the AuditMode build.
|
||||
CharRow::CharRow(size_t rowWidth, ROW* const pParent) noexcept :
|
||||
_data(rowWidth, value_type()),
|
||||
_pParent{ FAIL_FAST_IF_NULL(pParent) }
|
||||
{
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Sets the wrap status for the current row
|
||||
// Arguments:
|
||||
// - wrapForced - True if the row ran out of space and we forced to wrap to the next row. False otherwise.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CharRow::SetWrapForced(const bool wrapForced) noexcept
|
||||
{
|
||||
_wrapForced = wrapForced;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Gets the wrap status for the current row
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - True if the row ran out of space and we were forced to wrap to the next row. False otherwise.
|
||||
bool CharRow::WasWrapForced() const noexcept
|
||||
{
|
||||
return _wrapForced;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Sets the double byte padding for the current row
|
||||
// Arguments:
|
||||
// - fWrapWasForced - True if the row ran out of space for a double byte character and we padded out the row. False otherwise.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void CharRow::SetDoubleBytePadded(const bool doubleBytePadded) noexcept
|
||||
{
|
||||
_doubleBytePadded = doubleBytePadded;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Gets the double byte padding status for the current row.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - True if the row didn't have space for a double byte character and we were padded out the row. False otherwise.
|
||||
bool CharRow::WasDoubleBytePadded() const noexcept
|
||||
{
|
||||
return _doubleBytePadded;
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
// Routine Description:
|
||||
// - gets the size of the row, in glyph cells
|
||||
@@ -90,9 +47,6 @@ void CharRow::Reset() noexcept
|
||||
{
|
||||
cell.Reset();
|
||||
}
|
||||
|
||||
_wrapForced = false;
|
||||
_doubleBytePadded = false;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@@ -141,7 +95,7 @@ typename CharRow::const_iterator CharRow::cend() const noexcept
|
||||
// - The calculated left boundary of the internal string.
|
||||
size_t CharRow::MeasureLeft() const noexcept
|
||||
{
|
||||
std::vector<value_type>::const_iterator it = _data.cbegin();
|
||||
const_iterator it = _data.cbegin();
|
||||
while (it != _data.cend() && it->IsSpace())
|
||||
{
|
||||
++it;
|
||||
@@ -155,9 +109,9 @@ size_t CharRow::MeasureLeft() const noexcept
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - The calculated right boundary of the internal string.
|
||||
size_t CharRow::MeasureRight() const noexcept
|
||||
size_t CharRow::MeasureRight() const
|
||||
{
|
||||
std::vector<value_type>::const_reverse_iterator it = _data.crbegin();
|
||||
const_reverse_iterator it = _data.crbegin();
|
||||
while (it != _data.crend() && it->IsSpace())
|
||||
{
|
||||
++it;
|
||||
|
||||
@@ -49,27 +49,21 @@ class CharRow final
|
||||
public:
|
||||
using glyph_type = typename wchar_t;
|
||||
using value_type = typename CharRowCell;
|
||||
using iterator = typename std::vector<value_type>::iterator;
|
||||
using const_iterator = typename std::vector<value_type>::const_iterator;
|
||||
using iterator = typename boost::container::small_vector_base<value_type>::iterator;
|
||||
using const_iterator = typename boost::container::small_vector_base<value_type>::const_iterator;
|
||||
using const_reverse_iterator = typename boost::container::small_vector_base<value_type>::const_reverse_iterator;
|
||||
using reference = typename CharRowCellReference;
|
||||
|
||||
CharRow(size_t rowWidth, ROW* const pParent);
|
||||
CharRow(size_t rowWidth, ROW* const pParent) noexcept;
|
||||
|
||||
void SetWrapForced(const bool wrap) noexcept;
|
||||
bool WasWrapForced() const noexcept;
|
||||
void SetDoubleBytePadded(const bool doubleBytePadded) noexcept;
|
||||
bool WasDoubleBytePadded() const noexcept;
|
||||
size_t size() const noexcept;
|
||||
void Reset() noexcept;
|
||||
[[nodiscard]] HRESULT Resize(const size_t newSize) noexcept;
|
||||
size_t MeasureLeft() const noexcept;
|
||||
size_t MeasureRight() const noexcept;
|
||||
void ClearCell(const size_t column);
|
||||
size_t MeasureRight() const;
|
||||
bool ContainsText() const noexcept;
|
||||
const DbcsAttribute& DbcsAttrAt(const size_t column) const;
|
||||
DbcsAttribute& DbcsAttrAt(const size_t column);
|
||||
void ClearGlyph(const size_t column);
|
||||
std::wstring GetText() const;
|
||||
|
||||
const DelimiterClass DelimiterClassAt(const size_t column, const std::wstring_view wordDelimiters) const;
|
||||
|
||||
@@ -80,9 +74,11 @@ public:
|
||||
// iterators
|
||||
iterator begin() noexcept;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator begin() const noexcept { return cbegin(); }
|
||||
|
||||
iterator end() noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
const_iterator end() const noexcept { return cend(); }
|
||||
|
||||
UnicodeStorage& GetUnicodeStorage() noexcept;
|
||||
const UnicodeStorage& GetUnicodeStorage() const noexcept;
|
||||
@@ -91,29 +87,21 @@ public:
|
||||
void UpdateParent(ROW* const pParent);
|
||||
|
||||
friend CharRowCellReference;
|
||||
friend constexpr bool operator==(const CharRow& a, const CharRow& b) noexcept;
|
||||
friend class ROW;
|
||||
|
||||
private:
|
||||
void Reset() noexcept;
|
||||
void ClearCell(const size_t column);
|
||||
std::wstring GetText() const;
|
||||
|
||||
protected:
|
||||
// Occurs when the user runs out of text in a given row and we're forced to wrap the cursor to the next line
|
||||
bool _wrapForced;
|
||||
|
||||
// Occurs when the user runs out of text to support a double byte character and we're forced to the next line
|
||||
bool _doubleBytePadded;
|
||||
|
||||
// storage for glyph data and dbcs attributes
|
||||
std::vector<value_type> _data;
|
||||
boost::container::small_vector<value_type, 120> _data;
|
||||
|
||||
// ROW that this CharRow belongs to
|
||||
ROW* _pParent;
|
||||
};
|
||||
|
||||
constexpr bool operator==(const CharRow& a, const CharRow& b) noexcept
|
||||
{
|
||||
return (a._wrapForced == b._wrapForced &&
|
||||
a._doubleBytePadded == b._doubleBytePadded &&
|
||||
a._data == b._data);
|
||||
}
|
||||
|
||||
template<typename InputIt1, typename InputIt2>
|
||||
void OverwriteColumns(InputIt1 startChars, InputIt1 endChars, InputIt2 startAttrs, CharRow::iterator outIt)
|
||||
{
|
||||
|
||||
@@ -8,18 +8,6 @@
|
||||
// default glyph value, used for resetting the character data portion of a cell
|
||||
static constexpr wchar_t DefaultValue = UNICODE_SPACE;
|
||||
|
||||
CharRowCell::CharRowCell() noexcept :
|
||||
_wch{ DefaultValue },
|
||||
_attr{}
|
||||
{
|
||||
}
|
||||
|
||||
CharRowCell::CharRowCell(const wchar_t wch, const DbcsAttribute attr) noexcept :
|
||||
_wch{ wch },
|
||||
_attr{ attr }
|
||||
{
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - "erases" the glyph. really sets it back to the default "empty" value
|
||||
void CharRowCell::EraseChars() noexcept
|
||||
|
||||
@@ -17,6 +17,7 @@ Author(s):
|
||||
#pragma once
|
||||
|
||||
#include "DbcsAttribute.hpp"
|
||||
#include "unicode.hpp"
|
||||
|
||||
#if (defined(_M_IX86) || defined(_M_AMD64))
|
||||
// currently CharRowCell's fields use 3 bytes of memory, leaving the 4th byte in unused. this leads
|
||||
@@ -27,8 +28,13 @@ Author(s):
|
||||
class CharRowCell final
|
||||
{
|
||||
public:
|
||||
CharRowCell() noexcept;
|
||||
CharRowCell(const wchar_t wch, const DbcsAttribute attr) noexcept;
|
||||
CharRowCell() noexcept = default;
|
||||
CharRowCell(const wchar_t wch, const DbcsAttribute attr) noexcept
|
||||
:
|
||||
_wch(wch),
|
||||
_attr(attr)
|
||||
{
|
||||
}
|
||||
|
||||
void EraseChars() noexcept;
|
||||
void Reset() noexcept;
|
||||
@@ -44,8 +50,8 @@ public:
|
||||
friend constexpr bool operator==(const CharRowCell& a, const CharRowCell& b) noexcept;
|
||||
|
||||
private:
|
||||
wchar_t _wch;
|
||||
DbcsAttribute _attr;
|
||||
wchar_t _wch{ UNICODE_SPACE };
|
||||
DbcsAttribute _attr{};
|
||||
};
|
||||
|
||||
#if (defined(_M_IX86) || defined(_M_AMD64))
|
||||
|
||||
@@ -32,8 +32,8 @@ public:
|
||||
}
|
||||
|
||||
~CharRowCellReference() = default;
|
||||
CharRowCellReference(const CharRowCellReference&) = default;
|
||||
CharRowCellReference(CharRowCellReference&&) = default;
|
||||
CharRowCellReference(const CharRowCellReference&) noexcept = default;
|
||||
CharRowCellReference(CharRowCellReference&&) noexcept = default;
|
||||
|
||||
void operator=(const CharRowCellReference&) = delete;
|
||||
void operator=(CharRowCellReference&&) = delete;
|
||||
|
||||
@@ -16,50 +16,17 @@
|
||||
// - pParent - the text buffer that this row belongs to
|
||||
// Return Value:
|
||||
// - constructed object
|
||||
ROW::ROW(const SHORT rowId, const short rowWidth, const TextAttribute fillAttribute, TextBuffer* const pParent) :
|
||||
ROW::ROW(const SHORT rowId, const unsigned short rowWidth, const TextAttribute fillAttribute, TextBuffer* const pParent) noexcept :
|
||||
_id{ rowId },
|
||||
_rowWidth{ gsl::narrow<size_t>(rowWidth) },
|
||||
_charRow{ gsl::narrow<size_t>(rowWidth), this },
|
||||
_attrRow{ gsl::narrow<UINT>(rowWidth), fillAttribute },
|
||||
_rowWidth{ rowWidth },
|
||||
_charRow{ rowWidth, this },
|
||||
_attrRow{ rowWidth, fillAttribute },
|
||||
_wrapForced{ false },
|
||||
_doubleBytePadded{ false },
|
||||
_pParent{ pParent }
|
||||
{
|
||||
}
|
||||
|
||||
size_t ROW::size() const noexcept
|
||||
{
|
||||
return _rowWidth;
|
||||
}
|
||||
|
||||
const CharRow& ROW::GetCharRow() const noexcept
|
||||
{
|
||||
return _charRow;
|
||||
}
|
||||
|
||||
CharRow& ROW::GetCharRow() noexcept
|
||||
{
|
||||
return _charRow;
|
||||
}
|
||||
|
||||
const ATTR_ROW& ROW::GetAttrRow() const noexcept
|
||||
{
|
||||
return _attrRow;
|
||||
}
|
||||
|
||||
ATTR_ROW& ROW::GetAttrRow() noexcept
|
||||
{
|
||||
return _attrRow;
|
||||
}
|
||||
|
||||
SHORT ROW::GetId() const noexcept
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
void ROW::SetId(const SHORT id) noexcept
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Sets all properties of the ROW to default values
|
||||
// Arguments:
|
||||
@@ -68,6 +35,8 @@ void ROW::SetId(const SHORT id) noexcept
|
||||
// - <none>
|
||||
bool ROW::Reset(const TextAttribute Attr)
|
||||
{
|
||||
_wrapForced = false;
|
||||
_doubleBytePadded = false;
|
||||
_charRow.Reset();
|
||||
try
|
||||
{
|
||||
@@ -87,7 +56,7 @@ bool ROW::Reset(const TextAttribute Attr)
|
||||
// - width - the new width, in cells
|
||||
// Return Value:
|
||||
// - S_OK if successful, otherwise relevant error
|
||||
[[nodiscard]] HRESULT ROW::Resize(const size_t width)
|
||||
[[nodiscard]] HRESULT ROW::Resize(const unsigned short width)
|
||||
{
|
||||
RETURN_IF_FAILED(_charRow.Resize(width));
|
||||
try
|
||||
@@ -113,25 +82,6 @@ void ROW::ClearColumn(const size_t column)
|
||||
_charRow.ClearCell(column);
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - gets the text of the row as it would be shown on the screen
|
||||
// Return Value:
|
||||
// - wstring containing text for the row
|
||||
std::wstring ROW::GetText() const
|
||||
{
|
||||
return _charRow.GetText();
|
||||
}
|
||||
|
||||
RowCellIterator ROW::AsCellIter(const size_t startIndex) const
|
||||
{
|
||||
return AsCellIter(startIndex, size() - startIndex);
|
||||
}
|
||||
|
||||
RowCellIterator ROW::AsCellIter(const size_t startIndex, const size_t count) const
|
||||
{
|
||||
return RowCellIterator(*this, startIndex, count);
|
||||
}
|
||||
|
||||
UnicodeStorage& ROW::GetUnicodeStorage() noexcept
|
||||
{
|
||||
return _pParent->GetUnicodeStorage();
|
||||
@@ -213,7 +163,7 @@ OutputCellIterator ROW::WriteCells(OutputCellIterator it, const size_t index, co
|
||||
else if (fillingLastColumn && it->DbcsAttr().IsLeading())
|
||||
{
|
||||
_charRow.ClearCell(currentIndex);
|
||||
_charRow.SetDoubleBytePadded(true);
|
||||
SetDoubleBytePadded(true);
|
||||
}
|
||||
// Otherwise, copy the data given and increment the iterator.
|
||||
else
|
||||
@@ -231,7 +181,7 @@ OutputCellIterator ROW::WriteCells(OutputCellIterator it, const size_t index, co
|
||||
if (wrap.has_value() && fillingLastColumn)
|
||||
{
|
||||
// set wrap status on the row to parameter's value.
|
||||
_charRow.SetWrapForced(wrap.value());
|
||||
SetWrapForced(*wrap);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -24,7 +24,6 @@ Revision History:
|
||||
#include "OutputCell.hpp"
|
||||
#include "OutputCellIterator.hpp"
|
||||
#include "CharRow.hpp"
|
||||
#include "RowCellIterator.hpp"
|
||||
#include "UnicodeStorage.hpp"
|
||||
|
||||
class TextBuffer;
|
||||
@@ -32,36 +31,39 @@ class TextBuffer;
|
||||
class ROW final
|
||||
{
|
||||
public:
|
||||
ROW(const SHORT rowId, const short rowWidth, const TextAttribute fillAttribute, TextBuffer* const pParent);
|
||||
ROW(const SHORT rowId, const unsigned short rowWidth, const TextAttribute fillAttribute, TextBuffer* const pParent)
|
||||
noexcept;
|
||||
|
||||
size_t size() const noexcept;
|
||||
size_t size() const noexcept { return _rowWidth; }
|
||||
|
||||
const CharRow& GetCharRow() const noexcept;
|
||||
CharRow& GetCharRow() noexcept;
|
||||
void SetWrapForced(const bool wrap) noexcept { _wrapForced = wrap; }
|
||||
bool WasWrapForced() const noexcept { return _wrapForced; }
|
||||
|
||||
const ATTR_ROW& GetAttrRow() const noexcept;
|
||||
ATTR_ROW& GetAttrRow() noexcept;
|
||||
void SetDoubleBytePadded(const bool doubleBytePadded) noexcept { _doubleBytePadded = doubleBytePadded; }
|
||||
bool WasDoubleBytePadded() const noexcept { return _doubleBytePadded; }
|
||||
|
||||
SHORT GetId() const noexcept;
|
||||
void SetId(const SHORT id) noexcept;
|
||||
const CharRow& GetCharRow() const noexcept { return _charRow; }
|
||||
CharRow& GetCharRow() noexcept { return _charRow; }
|
||||
|
||||
const ATTR_ROW& GetAttrRow() const noexcept { return _attrRow; }
|
||||
ATTR_ROW& GetAttrRow() noexcept { return _attrRow; }
|
||||
|
||||
SHORT GetId() const noexcept { return _id; }
|
||||
void SetId(const SHORT id) noexcept { _id = id; }
|
||||
|
||||
bool Reset(const TextAttribute Attr);
|
||||
[[nodiscard]] HRESULT Resize(const size_t width);
|
||||
[[nodiscard]] HRESULT Resize(const unsigned short width);
|
||||
|
||||
void ClearColumn(const size_t column);
|
||||
std::wstring GetText() const;
|
||||
|
||||
RowCellIterator AsCellIter(const size_t startIndex) const;
|
||||
RowCellIterator AsCellIter(const size_t startIndex, const size_t count) const;
|
||||
std::wstring GetText() const { return _charRow.GetText(); }
|
||||
|
||||
UnicodeStorage& GetUnicodeStorage() noexcept;
|
||||
const UnicodeStorage& GetUnicodeStorage() const noexcept;
|
||||
|
||||
OutputCellIterator WriteCells(OutputCellIterator it, const size_t index, const std::optional<bool> wrap = std::nullopt, std::optional<size_t> limitRight = std::nullopt);
|
||||
|
||||
friend bool operator==(const ROW& a, const ROW& b) noexcept;
|
||||
|
||||
#ifdef UNIT_TESTING
|
||||
friend constexpr bool operator==(const ROW& a, const ROW& b) noexcept;
|
||||
friend class RowTests;
|
||||
#endif
|
||||
|
||||
@@ -69,15 +71,19 @@ private:
|
||||
CharRow _charRow;
|
||||
ATTR_ROW _attrRow;
|
||||
SHORT _id;
|
||||
size_t _rowWidth;
|
||||
unsigned short _rowWidth;
|
||||
// Occurs when the user runs out of text in a given row and we're forced to wrap the cursor to the next line
|
||||
bool _wrapForced;
|
||||
// Occurs when the user runs out of text to support a double byte character and we're forced to the next line
|
||||
bool _doubleBytePadded;
|
||||
TextBuffer* _pParent; // non ownership pointer
|
||||
};
|
||||
|
||||
inline bool operator==(const ROW& a, const ROW& b) noexcept
|
||||
#ifdef UNIT_TESTING
|
||||
constexpr bool operator==(const ROW& a, const ROW& b) noexcept
|
||||
{
|
||||
return (a._charRow == b._charRow &&
|
||||
a._attrRow == b._attrRow &&
|
||||
a._rowWidth == b._rowWidth &&
|
||||
a._pParent == b._pParent &&
|
||||
// comparison is only used in the tests; this should suffice.
|
||||
return (a._pParent == b._pParent &&
|
||||
a._id == b._id);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include "RowCellIterator.hpp"
|
||||
#include "Row.hpp"
|
||||
|
||||
#include "../../types/inc/convert.hpp"
|
||||
#include "../../types/inc/Utf16Parser.hpp"
|
||||
|
||||
RowCellIterator::RowCellIterator(const ROW& row, const size_t start, const size_t length) :
|
||||
_row(row),
|
||||
_start(start),
|
||||
_length(length),
|
||||
_pos(start),
|
||||
_view(s_GenerateView(row, start))
|
||||
{
|
||||
}
|
||||
|
||||
RowCellIterator::operator bool() const noexcept
|
||||
{
|
||||
// In lieu of using start and end, this custom iterator type simply becomes bool false
|
||||
// when we run out of items to iterate over.
|
||||
return _pos < (_start + _length);
|
||||
}
|
||||
|
||||
bool RowCellIterator::operator==(const RowCellIterator& it) const noexcept
|
||||
{
|
||||
return _row == it._row &&
|
||||
_start == it._start &&
|
||||
_length == it._length &&
|
||||
_pos == it._pos;
|
||||
}
|
||||
bool RowCellIterator::operator!=(const RowCellIterator& it) const noexcept
|
||||
{
|
||||
return !(*this == it);
|
||||
}
|
||||
|
||||
RowCellIterator& RowCellIterator::operator+=(const ptrdiff_t& movement) noexcept
|
||||
{
|
||||
_pos += movement;
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
RowCellIterator& RowCellIterator::operator++() noexcept
|
||||
{
|
||||
return this->operator+=(1);
|
||||
}
|
||||
|
||||
RowCellIterator RowCellIterator::operator++(int) noexcept
|
||||
{
|
||||
auto temp(*this);
|
||||
operator++();
|
||||
return temp;
|
||||
}
|
||||
|
||||
RowCellIterator RowCellIterator::operator+(const ptrdiff_t& movement) noexcept
|
||||
{
|
||||
auto temp(*this);
|
||||
temp += movement;
|
||||
return temp;
|
||||
}
|
||||
|
||||
const OutputCellView& RowCellIterator::operator*() const noexcept
|
||||
{
|
||||
return _view;
|
||||
}
|
||||
|
||||
const OutputCellView* RowCellIterator::operator->() const noexcept
|
||||
{
|
||||
return &_view;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Member function to update the view to the current position in the buffer with
|
||||
// the data held on this object.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void RowCellIterator::_RefreshView()
|
||||
{
|
||||
_view = s_GenerateView(_row, _pos);
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Static function to create a view.
|
||||
// - It's pulled out statically so it can be used during construction with just the given
|
||||
// variables (so OutputCellView doesn't need an empty default constructor)
|
||||
// - This will infer the width of the glyph and apply the appropriate attributes to the view.
|
||||
// Arguments:
|
||||
// - view - View representing characters corresponding to a single glyph
|
||||
// - attr - Color attributes to apply to the text
|
||||
// Return Value:
|
||||
// - Object representing the view into this cell
|
||||
OutputCellView RowCellIterator::s_GenerateView(const ROW& row,
|
||||
const size_t pos)
|
||||
{
|
||||
const auto& charRow = row.GetCharRow();
|
||||
|
||||
const auto glyph = charRow.GlyphAt(pos);
|
||||
const auto dbcsAttr = charRow.DbcsAttrAt(pos);
|
||||
|
||||
const auto textAttr = row.GetAttrRow().GetAttrByColumn(pos);
|
||||
const auto behavior = TextAttributeBehavior::Stored;
|
||||
|
||||
return OutputCellView(glyph, dbcsAttr, textAttr, behavior);
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation
|
||||
Licensed under the MIT license.
|
||||
|
||||
Module Name:
|
||||
- RowCellIterator.hpp
|
||||
|
||||
Abstract:
|
||||
- Read-only view into cells already in the input buffer.
|
||||
- This is done for performance reasons (avoid heap allocs and copies).
|
||||
|
||||
Author:
|
||||
- Michael Niksa (MiNiksa) 12-Oct-2018
|
||||
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "OutputCellView.hpp"
|
||||
class ROW;
|
||||
|
||||
class RowCellIterator final
|
||||
{
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using value_type = OutputCellView;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = OutputCellView*;
|
||||
using reference = OutputCellView&;
|
||||
|
||||
RowCellIterator(const ROW& row, const size_t start, const size_t length);
|
||||
~RowCellIterator() = default;
|
||||
|
||||
RowCellIterator& operator=(const RowCellIterator& it) = delete;
|
||||
|
||||
operator bool() const noexcept;
|
||||
|
||||
bool operator==(const RowCellIterator& it) const noexcept;
|
||||
bool operator!=(const RowCellIterator& it) const noexcept;
|
||||
|
||||
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 noexcept;
|
||||
const OutputCellView* operator->() const noexcept;
|
||||
|
||||
private:
|
||||
const ROW& _row;
|
||||
const size_t _start;
|
||||
const size_t _length;
|
||||
|
||||
size_t _pos;
|
||||
OutputCellView _view;
|
||||
|
||||
void _RefreshView();
|
||||
static OutputCellView s_GenerateView(const ROW& row, const size_t pos);
|
||||
};
|
||||
@@ -1,47 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "precomp.h"
|
||||
#include "TextAttributeRun.hpp"
|
||||
|
||||
TextAttributeRun::TextAttributeRun() noexcept :
|
||||
_cchLength(0)
|
||||
{
|
||||
SetAttributes(TextAttribute(0));
|
||||
}
|
||||
|
||||
TextAttributeRun::TextAttributeRun(const size_t cchLength, const TextAttribute attr) noexcept :
|
||||
_cchLength(cchLength)
|
||||
{
|
||||
SetAttributes(attr);
|
||||
}
|
||||
|
||||
size_t TextAttributeRun::GetLength() const noexcept
|
||||
{
|
||||
return _cchLength;
|
||||
}
|
||||
|
||||
void TextAttributeRun::SetLength(const size_t cchLength) noexcept
|
||||
{
|
||||
_cchLength = cchLength;
|
||||
}
|
||||
|
||||
void TextAttributeRun::IncrementLength() noexcept
|
||||
{
|
||||
_cchLength++;
|
||||
}
|
||||
|
||||
void TextAttributeRun::DecrementLength() noexcept
|
||||
{
|
||||
_cchLength--;
|
||||
}
|
||||
|
||||
const TextAttribute& TextAttributeRun::GetAttributes() const noexcept
|
||||
{
|
||||
return _attributes;
|
||||
}
|
||||
|
||||
void TextAttributeRun::SetAttributes(const TextAttribute textAttribute) noexcept
|
||||
{
|
||||
_attributes = textAttribute;
|
||||
}
|
||||
@@ -25,20 +25,24 @@ Revision History:
|
||||
class TextAttributeRun final
|
||||
{
|
||||
public:
|
||||
TextAttributeRun() noexcept;
|
||||
TextAttributeRun(const size_t cchLength, const TextAttribute attr) noexcept;
|
||||
TextAttributeRun() = default;
|
||||
TextAttributeRun(const size_t cchLength, const TextAttribute attr) noexcept :
|
||||
_cchLength(gsl::narrow<unsigned int>(cchLength))
|
||||
{
|
||||
SetAttributes(attr);
|
||||
}
|
||||
|
||||
size_t GetLength() const noexcept;
|
||||
void SetLength(const size_t cchLength) noexcept;
|
||||
void IncrementLength() noexcept;
|
||||
void DecrementLength() noexcept;
|
||||
size_t GetLength() const noexcept { return _cchLength; }
|
||||
void SetLength(const size_t cchLength) noexcept { _cchLength = gsl::narrow<unsigned int>(cchLength); }
|
||||
void IncrementLength() noexcept { _cchLength++; }
|
||||
void DecrementLength() noexcept { _cchLength--; }
|
||||
|
||||
const TextAttribute& GetAttributes() const noexcept;
|
||||
void SetAttributes(const TextAttribute textAttribute) noexcept;
|
||||
const TextAttribute& GetAttributes() const noexcept { return _attributes; }
|
||||
void SetAttributes(const TextAttribute textAttribute) noexcept { _attributes = textAttribute; }
|
||||
|
||||
private:
|
||||
size_t _cchLength;
|
||||
TextAttribute _attributes;
|
||||
unsigned int _cchLength{ 0 };
|
||||
TextAttribute _attributes{ 0 };
|
||||
|
||||
#ifdef UNIT_TESTING
|
||||
friend class AttrRowTests;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<RootNamespace>bufferout</RootNamespace>
|
||||
<ProjectName>BufferOut</ProjectName>
|
||||
<TargetName>ConBufferOut</TargetName>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SolutionDir)src\common.build.pre.props" />
|
||||
<ItemGroup>
|
||||
@@ -18,11 +18,9 @@
|
||||
<ClCompile Include="..\OutputCellRect.cpp" />
|
||||
<ClCompile Include="..\OutputCellView.cpp" />
|
||||
<ClCompile Include="..\Row.cpp" />
|
||||
<ClCompile Include="..\RowCellIterator.cpp" />
|
||||
<ClCompile Include="..\search.cpp" />
|
||||
<ClCompile Include="..\TextColor.cpp" />
|
||||
<ClCompile Include="..\TextAttribute.cpp" />
|
||||
<ClCompile Include="..\TextAttributeRun.cpp" />
|
||||
<ClCompile Include="..\textBuffer.cpp" />
|
||||
<ClCompile Include="..\textBufferCellIterator.cpp" />
|
||||
<ClCompile Include="..\textBufferTextIterator.cpp" />
|
||||
@@ -45,7 +43,6 @@
|
||||
<ClInclude Include="..\OutputCellRect.hpp" />
|
||||
<ClInclude Include="..\OutputCellView.hpp" />
|
||||
<ClInclude Include="..\Row.hpp" />
|
||||
<ClInclude Include="..\RowCellIterator.hpp" />
|
||||
<ClInclude Include="..\search.h" />
|
||||
<ClInclude Include="..\TextColor.h" />
|
||||
<ClInclude Include="..\TextAttribute.h" />
|
||||
|
||||
@@ -37,10 +37,8 @@ SOURCES= \
|
||||
..\OutputCellRect.cpp \
|
||||
..\OutputCellView.cpp \
|
||||
..\Row.cpp \
|
||||
..\RowCellIterator.cpp \
|
||||
..\TextColor.cpp \
|
||||
..\TextAttribute.cpp \
|
||||
..\TextAttributeRun.cpp \
|
||||
..\textBuffer.cpp \
|
||||
..\textBufferCellIterator.cpp \
|
||||
..\textBufferTextIterator.cpp \
|
||||
|
||||
@@ -42,6 +42,7 @@ TextBuffer::TextBuffer(const COORD screenBufferSize,
|
||||
_currentPatternId{ 0 }
|
||||
{
|
||||
// initialize ROWs
|
||||
_storage.reserve(static_cast<size_t>(screenBufferSize.Y));
|
||||
for (size_t i = 0; i < static_cast<size_t>(screenBufferSize.Y); ++i)
|
||||
{
|
||||
_storage.emplace_back(static_cast<SHORT>(i), screenBufferSize.X, _currentAttributes, this);
|
||||
@@ -253,7 +254,7 @@ bool TextBuffer::_AssertValidDoubleByteSequence(const DbcsAttribute dbcsAttribut
|
||||
// Erase previous character into an N type.
|
||||
try
|
||||
{
|
||||
prevRow.GetCharRow().ClearCell(coordPrevPosition.X);
|
||||
prevRow.ClearColumn(coordPrevPosition.X);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -295,8 +296,8 @@ bool TextBuffer::_PrepareForDoubleByteSequence(const DbcsAttribute dbcsAttribute
|
||||
if (GetCursor().GetPosition().X == sBufferWidth - 1)
|
||||
{
|
||||
// set that we're wrapping for double byte reasons
|
||||
CharRow& charRow = GetRowByOffset(GetCursor().GetPosition().Y).GetCharRow();
|
||||
charRow.SetDoubleBytePadded(true);
|
||||
auto& row = GetRowByOffset(GetCursor().GetPosition().Y);
|
||||
row.SetDoubleBytePadded(true);
|
||||
|
||||
// then move the cursor forward and onto the next row
|
||||
fSuccess = IncrementCursor();
|
||||
@@ -479,7 +480,7 @@ void TextBuffer::_AdjustWrapOnCurrentRow(const bool fSet)
|
||||
const UINT uiCurrentRowOffset = GetCursor().GetPosition().Y;
|
||||
|
||||
// Set the wrap status as appropriate
|
||||
GetRowByOffset(uiCurrentRowOffset).GetCharRow().SetWrapForced(fSet);
|
||||
GetRowByOffset(uiCurrentRowOffset).SetWrapForced(fSet);
|
||||
}
|
||||
|
||||
//Routine Description:
|
||||
@@ -809,8 +810,7 @@ void TextBuffer::Reset()
|
||||
|
||||
for (auto& row : _storage)
|
||||
{
|
||||
row.GetCharRow().Reset();
|
||||
row.GetAttrRow().Reset(attr);
|
||||
row.Reset(attr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -837,11 +837,10 @@ void TextBuffer::Reset()
|
||||
const SHORT TopRowIndex = (GetFirstRowIndex() + TopRow) % currentSize.Y;
|
||||
|
||||
// rotate rows until the top row is at index 0
|
||||
const ROW& newTopRow = _storage.at(TopRowIndex);
|
||||
while (&newTopRow != &_storage.front())
|
||||
for (int i = 0; i < TopRowIndex; i++)
|
||||
{
|
||||
_storage.push_back(std::move(_storage.front()));
|
||||
_storage.pop_front();
|
||||
_storage.emplace_back(std::move(_storage.front()));
|
||||
_storage.erase(_storage.begin());
|
||||
}
|
||||
|
||||
_SetFirstRowIndex(0);
|
||||
@@ -1230,9 +1229,15 @@ void TextBuffer::_PruneHyperlinks()
|
||||
// If the buffer does not contain the same reference, we can remove that hyperlink from our map
|
||||
// This way, obsolete hyperlink references are cleared from our hyperlink map instead of hanging around
|
||||
// Get all the hyperlink references in the row we're erasing
|
||||
auto firstRowRefs = _storage.at(_firstRow).GetAttrRow().GetHyperlinks();
|
||||
if (!firstRowRefs.empty())
|
||||
const auto hyperlinks = _storage.at(_firstRow).GetAttrRow().GetHyperlinks();
|
||||
|
||||
if (!hyperlinks.empty())
|
||||
{
|
||||
// Move to unordered set so we can use hashed lookup of IDs instead of linear search.
|
||||
// Only make it an unordered set now because set always heap allocates but vector
|
||||
// doesn't when the set is empty (saving an allocation in the common case of no links.)
|
||||
std::unordered_set<uint16_t> firstRowRefs{ hyperlinks.cbegin(), hyperlinks.cend() };
|
||||
|
||||
const auto total = TotalRowCount();
|
||||
// Loop through all the rows in the buffer except the first row -
|
||||
// we have found all hyperlink references in the first row and put them in refs,
|
||||
@@ -1254,12 +1259,12 @@ void TextBuffer::_PruneHyperlinks()
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now delete obsolete references from our map
|
||||
for (auto hyperlinkReference : firstRowRefs)
|
||||
{
|
||||
RemoveHyperlinkFromMap(hyperlinkReference);
|
||||
// Now delete obsolete references from our map
|
||||
for (auto hyperlinkReference : firstRowRefs)
|
||||
{
|
||||
RemoveHyperlinkFromMap(hyperlinkReference);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1582,7 +1587,7 @@ const TextBuffer::TextAndColor TextBuffer::GetText(const bool includeCRLF,
|
||||
}
|
||||
|
||||
// We apply formatting to rows if the row was NOT wrapped or formatting of wrapped rows is allowed
|
||||
const bool shouldFormatRow = formatWrappedRows || !GetRowByOffset(iRow).GetCharRow().WasWrapForced();
|
||||
const bool shouldFormatRow = formatWrappedRows || !GetRowByOffset(iRow).WasWrapForced();
|
||||
|
||||
if (trimTrailingWhitespace)
|
||||
{
|
||||
@@ -2063,7 +2068,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
// included.)
|
||||
// As such, adjust the "right" to be the width of the row
|
||||
// to capture all these spaces
|
||||
if (charRow.WasWrapForced())
|
||||
if (row.WasWrapForced())
|
||||
{
|
||||
iRight = cOldColsTotal;
|
||||
|
||||
@@ -2072,7 +2077,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
// piece of padding because of a double byte LEADING
|
||||
// character, then remove one from the "right" to
|
||||
// leave this padding out of the copy process.
|
||||
if (charRow.WasDoubleBytePadded())
|
||||
if (row.WasDoubleBytePadded())
|
||||
{
|
||||
iRight--;
|
||||
}
|
||||
@@ -2136,7 +2141,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
// Only do so if we were not forced to wrap. If we did
|
||||
// force a word wrap, then the existing line break was
|
||||
// only because we ran out of space.
|
||||
if (iRight < cOldColsTotal && !charRow.WasWrapForced())
|
||||
if (iRight < cOldColsTotal && !row.WasWrapForced())
|
||||
{
|
||||
if (iRight == cOldCursorPos.X && iOldRow == cOldCursorPos.Y)
|
||||
{
|
||||
@@ -2180,7 +2185,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
const COORD coordNewCursor = newCursor.GetPosition();
|
||||
if (coordNewCursor.X == 0 && coordNewCursor.Y > 0)
|
||||
{
|
||||
if (newBuffer.GetRowByOffset(gsl::narrow_cast<size_t>(coordNewCursor.Y) - 1).GetCharRow().WasWrapForced())
|
||||
if (newBuffer.GetRowByOffset(gsl::narrow_cast<size_t>(coordNewCursor.Y) - 1).WasWrapForced())
|
||||
{
|
||||
hr = newBuffer.NewlineCursor() ? hr : E_OUTOFMEMORY;
|
||||
}
|
||||
@@ -2213,7 +2218,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
|
||||
// If the last row of the new buffer wrapped, there's going to be one less newline needed,
|
||||
// because the cursor is already on the next line
|
||||
if (newBuffer.GetRowByOffset(cNewLastChar.Y).GetCharRow().WasWrapForced())
|
||||
if (newBuffer.GetRowByOffset(cNewLastChar.Y).WasWrapForced())
|
||||
{
|
||||
iNewlines = std::max(iNewlines - 1, 0);
|
||||
}
|
||||
@@ -2221,7 +2226,7 @@ HRESULT TextBuffer::Reflow(TextBuffer& oldBuffer,
|
||||
{
|
||||
// if this buffer didn't wrap, but the old one DID, then the d(columns) of the
|
||||
// old buffer will be one more than in this buffer, so new need one LESS.
|
||||
if (oldBuffer.GetRowByOffset(cOldLastChar.Y).GetCharRow().WasWrapForced())
|
||||
if (oldBuffer.GetRowByOffset(cOldLastChar.Y).WasWrapForced())
|
||||
{
|
||||
iNewlines = std::max(iNewlines - 1, 0);
|
||||
}
|
||||
@@ -2410,8 +2415,8 @@ PointTree TextBuffer::GetPatterns(const size_t firstRow, const size_t lastRow) c
|
||||
// all the text into one string and find the patterns in that string
|
||||
for (auto i = firstRow; i <= lastRow; ++i)
|
||||
{
|
||||
auto row = GetRowByOffset(i);
|
||||
concatAll += row.GetCharRow().GetText();
|
||||
auto& row = GetRowByOffset(i);
|
||||
concatAll += row.GetText();
|
||||
}
|
||||
|
||||
// for each pattern we know of, iterate through the string
|
||||
|
||||
@@ -49,6 +49,8 @@ filling in the last row, and updating the screen.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "cursor.h"
|
||||
#include "Row.hpp"
|
||||
#include "TextAttribute.hpp"
|
||||
@@ -190,7 +192,7 @@ public:
|
||||
private:
|
||||
void _UpdateSize();
|
||||
Microsoft::Console::Types::Viewport _size;
|
||||
std::deque<ROW> _storage;
|
||||
std::vector<ROW> _storage;
|
||||
Cursor _cursor;
|
||||
|
||||
SHORT _firstRow; // indexes top row (not necessarily 0)
|
||||
|
||||
@@ -3,14 +3,9 @@
|
||||
|
||||
#include "precomp.h"
|
||||
#include "WexTestClass.h"
|
||||
#include "../../inc/consoletaeftemplates.hpp"
|
||||
#include "../../../inc/consoletaeftemplates.hpp"
|
||||
|
||||
#include "CommonState.hpp"
|
||||
|
||||
#include "globals.h"
|
||||
#include "../buffer/out/textBuffer.hpp"
|
||||
|
||||
#include "input.h"
|
||||
#include "../textBuffer.hpp"
|
||||
|
||||
using namespace WEX::Common;
|
||||
using namespace WEX::Logging;
|
||||
@@ -170,64 +165,54 @@ class AttrRowTests
|
||||
_Inout_ std::unique_ptr<TextAttributeRun[]>& outAttrRun,
|
||||
_Out_ size_t* const cOutAttrRun)
|
||||
{
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
RETURN_HR_IF(E_NOT_SUFFICIENT_BUFFER, cRowLength == 0);
|
||||
|
||||
if (cRowLength == 0)
|
||||
// first count up the deltas in the array
|
||||
size_t cDeltas = 1;
|
||||
|
||||
const TextAttribute* pPrevAttr = &rgAttrs[0];
|
||||
|
||||
for (size_t i = 1; i < cRowLength; i++)
|
||||
{
|
||||
status = STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
const TextAttribute* pCurAttr = &rgAttrs[i];
|
||||
|
||||
if (NT_SUCCESS(status))
|
||||
{
|
||||
// first count up the deltas in the array
|
||||
size_t cDeltas = 1;
|
||||
|
||||
const TextAttribute* pPrevAttr = &rgAttrs[0];
|
||||
|
||||
for (size_t i = 1; i < cRowLength; i++)
|
||||
if (*pCurAttr != *pPrevAttr)
|
||||
{
|
||||
const TextAttribute* pCurAttr = &rgAttrs[i];
|
||||
|
||||
if (*pCurAttr != *pPrevAttr)
|
||||
{
|
||||
cDeltas++;
|
||||
}
|
||||
|
||||
pPrevAttr = pCurAttr;
|
||||
cDeltas++;
|
||||
}
|
||||
|
||||
// This whole situation was too complicated with a one off holder for one row run
|
||||
// new method:
|
||||
// delete the old buffer
|
||||
// make a new buffer, one run + one run for each change
|
||||
// set the values for each run one run index at a time
|
||||
pPrevAttr = pCurAttr;
|
||||
}
|
||||
|
||||
std::unique_ptr<TextAttributeRun[]> attrRun = std::make_unique<TextAttributeRun[]>(cDeltas);
|
||||
status = NT_TESTNULL(attrRun.get());
|
||||
if (NT_SUCCESS(status))
|
||||
// This whole situation was too complicated with a one off holder for one row run
|
||||
// new method:
|
||||
// delete the old buffer
|
||||
// make a new buffer, one run + one run for each change
|
||||
// set the values for each run one run index at a time
|
||||
|
||||
std::unique_ptr<TextAttributeRun[]> attrRun = std::make_unique<TextAttributeRun[]>(cDeltas);
|
||||
RETURN_HR_IF_NULL(E_OUTOFMEMORY, attrRun);
|
||||
|
||||
TextAttributeRun* pCurrentRun = attrRun.get();
|
||||
pCurrentRun->SetAttributes(rgAttrs[0]);
|
||||
pCurrentRun->SetLength(1);
|
||||
for (size_t i = 1; i < cRowLength; i++)
|
||||
{
|
||||
if (pCurrentRun->GetAttributes() == rgAttrs[i])
|
||||
{
|
||||
TextAttributeRun* pCurrentRun = attrRun.get();
|
||||
pCurrentRun->SetAttributes(rgAttrs[0]);
|
||||
pCurrentRun->SetLength(pCurrentRun->GetLength() + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
pCurrentRun++;
|
||||
pCurrentRun->SetAttributes(rgAttrs[i]);
|
||||
pCurrentRun->SetLength(1);
|
||||
for (size_t i = 1; i < cRowLength; i++)
|
||||
{
|
||||
if (pCurrentRun->GetAttributes() == rgAttrs[i])
|
||||
{
|
||||
pCurrentRun->SetLength(pCurrentRun->GetLength() + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
pCurrentRun++;
|
||||
pCurrentRun->SetAttributes(rgAttrs[i]);
|
||||
pCurrentRun->SetLength(1);
|
||||
}
|
||||
}
|
||||
attrRun.swap(outAttrRun);
|
||||
*cOutAttrRun = cDeltas;
|
||||
}
|
||||
}
|
||||
attrRun.swap(outAttrRun);
|
||||
*cOutAttrRun = cDeltas;
|
||||
|
||||
return HRESULT_FROM_NT(status);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
NoThrowString LogRunElement(_In_ TextAttributeRun& run)
|
||||
@@ -235,6 +220,24 @@ class AttrRowTests
|
||||
return NoThrowString().Format(L"%wc%d", run.GetAttributes().GetLegacyAttributes(), run.GetLength());
|
||||
}
|
||||
|
||||
void LogChain(_In_ PCWSTR pwszPrefix,
|
||||
boost::container::small_vector_base<TextAttributeRun>& chain)
|
||||
{
|
||||
NoThrowString str(pwszPrefix);
|
||||
|
||||
if (chain.size() > 0)
|
||||
{
|
||||
str.Append(LogRunElement(chain[0]));
|
||||
|
||||
for (size_t i = 1; i < chain.size(); i++)
|
||||
{
|
||||
str.AppendFormat(L"->%s", (const wchar_t*)(LogRunElement(chain[i])));
|
||||
}
|
||||
}
|
||||
|
||||
Log::Comment(str);
|
||||
}
|
||||
|
||||
void LogChain(_In_ PCWSTR pwszPrefix,
|
||||
std::vector<TextAttributeRun>& chain)
|
||||
{
|
||||
@@ -707,10 +710,6 @@ class AttrRowTests
|
||||
|
||||
TEST_METHOD(TestResize)
|
||||
{
|
||||
CommonState state;
|
||||
state.PrepareGlobalFont();
|
||||
state.PrepareGlobalScreenBuffer();
|
||||
|
||||
pSingle->Resize(240);
|
||||
pChain->Resize(240);
|
||||
|
||||
@@ -728,8 +727,5 @@ class AttrRowTests
|
||||
|
||||
VERIFY_THROWS_SPECIFIC(pSingle->Resize(0), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_INVALIDARG; });
|
||||
VERIFY_THROWS_SPECIFIC(pChain->Resize(0), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_INVALIDARG; });
|
||||
|
||||
state.CleanupGlobalScreenBuffer();
|
||||
state.CleanupGlobalFont();
|
||||
}
|
||||
};
|
||||
856
src/buffer/out/ut_textbuffer/ReflowTests.cpp
Normal file
856
src/buffer/out/ut_textbuffer/ReflowTests.cpp
Normal file
@@ -0,0 +1,856 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "precomp.h"
|
||||
#include "WexTestClass.h"
|
||||
#include "../../inc/consoletaeftemplates.hpp"
|
||||
|
||||
#include "../textBuffer.hpp"
|
||||
#include "../../renderer/inc/DummyRenderTarget.hpp"
|
||||
#include "../../types/inc/Utf16Parser.hpp"
|
||||
#include "../../types/inc/GlyphWidth.hpp"
|
||||
|
||||
#include <IDataSource.h>
|
||||
|
||||
template<>
|
||||
class WEX::TestExecution::VerifyOutputTraits<wchar_t>
|
||||
{
|
||||
public:
|
||||
static WEX::Common::NoThrowString ToString(const wchar_t& wch)
|
||||
{
|
||||
return WEX::Common::NoThrowString().Format(L"'%c'", wch);
|
||||
}
|
||||
};
|
||||
|
||||
using namespace WEX::Common;
|
||||
using namespace WEX::Logging;
|
||||
using namespace WEX::TestExecution;
|
||||
|
||||
namespace
|
||||
{
|
||||
struct TestRow
|
||||
{
|
||||
std::wstring_view text;
|
||||
bool wrap;
|
||||
};
|
||||
|
||||
struct TestBuffer
|
||||
{
|
||||
COORD size;
|
||||
std::vector<TestRow> rows;
|
||||
COORD cursor;
|
||||
};
|
||||
|
||||
struct TestCase
|
||||
{
|
||||
std::wstring_view name;
|
||||
std::vector<TestBuffer> buffers;
|
||||
};
|
||||
|
||||
static constexpr auto true_due_to_exact_wrap_bug{ true };
|
||||
|
||||
static const TestCase testCases[] = {
|
||||
TestCase{
|
||||
L"No reflow required",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
{ L"AB ", false },
|
||||
{ L"$ ", false },
|
||||
{ L"CD ", false },
|
||||
{ L"EFG ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 0, 1 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 5, 5 }, // reduce width by 1
|
||||
{
|
||||
{ L"AB ", false },
|
||||
{ L"$ ", false },
|
||||
{ L"CD ", false },
|
||||
{ L"EFG ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 0, 1 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 4, 5 },
|
||||
{
|
||||
{ L"AB ", false },
|
||||
{ L"$ ", false },
|
||||
{ L"CD ", false },
|
||||
{ L"EFG ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 0, 1 } // cursor on $
|
||||
},
|
||||
},
|
||||
},
|
||||
TestCase{
|
||||
L"SBCS, cursor remains in buffer, no circling, no original wrap",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
{ L"ABCDEF", false },
|
||||
{ L"$ ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 0, 1 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 5, 5 }, // reduce width by 1
|
||||
{
|
||||
{ L"ABCDE", true },
|
||||
{ L"F$ ", false }, // [BUG] EXACT WRAP. $ should be alone on next line.
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 1, 1 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 6, 5 }, // grow width back to original
|
||||
{
|
||||
{ L"ABCDEF", true_due_to_exact_wrap_bug },
|
||||
{ L"$ ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 0, 1 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 7, 5 }, // grow width wider than original
|
||||
{
|
||||
{ L"ABCDEF$", true_due_to_exact_wrap_bug }, // EXACT WRAP BUG: $ should be alone on next line
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 6, 0 } // cursor on $
|
||||
},
|
||||
},
|
||||
},
|
||||
TestCase{
|
||||
L"SBCS, cursor remains in buffer, no circling, with original wrap",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
{ L"ABCDEF", true },
|
||||
{ L"G$ ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 1, 1 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 5, 5 }, // reduce width by 1
|
||||
{
|
||||
{ L"ABCDE", true },
|
||||
{ L"FG$ ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 2, 1 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 6, 5 }, // grow width back to original
|
||||
{
|
||||
{ L"ABCDEF", true },
|
||||
{ L"G$ ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 1, 1 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 7, 5 }, // grow width wider than original
|
||||
{
|
||||
{ L"ABCDEFG", true },
|
||||
{ L"$ ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 0, 1 } // cursor on $
|
||||
},
|
||||
},
|
||||
},
|
||||
TestCase{
|
||||
L"SBCS line padded with spaces (to wrap)",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
{ L"AB ", true }, // AB $ CD is one long wrapped line
|
||||
{ L"$ ", true },
|
||||
{ L"CD ", false },
|
||||
{ L"EFG ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 0, 1 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 7, 5 }, // reduce width by 1
|
||||
{
|
||||
{ L"AB $", true },
|
||||
{ L" CD", true_due_to_exact_wrap_bug },
|
||||
{ L" ", false },
|
||||
{ L"EFG ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 6, 0 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 8, 5 },
|
||||
{
|
||||
{ L"AB $ ", true },
|
||||
{ L" CD ", false }, // Goes to false because we hit the end of ..CD
|
||||
{ L"EFG ", false }, // [BUG] EFG moves up due to exact wrap bug above
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 6, 0 } // cursor on $
|
||||
},
|
||||
},
|
||||
},
|
||||
TestCase{
|
||||
L"DBCS, cursor remains in buffer, no circling, with original wrap",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
//--0123456--
|
||||
{ L"カタカ", true }, // KA TA KA
|
||||
{ L"ナ$ ", false }, // NA
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 2, 1 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 5, 5 }, // reduce width by 1
|
||||
{
|
||||
//--012345--
|
||||
{ L"カタ ", true }, // KA TA [FORCED SPACER]
|
||||
{ L"カナ$", true_due_to_exact_wrap_bug }, // KA NA
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 4, 1 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 6, 5 }, // grow width back to original
|
||||
{
|
||||
//--0123456--
|
||||
{ L"カタカ", true }, // KA TA KA
|
||||
{ L"ナ$ ", false }, // NA
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 2, 1 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 7, 5 }, // grow width wider than original (by one; no visible change!)
|
||||
{
|
||||
//--0123456--
|
||||
{ L"カタカ ", true }, // KA TA KA [FORCED SPACER]
|
||||
{ L"ナ$ ", false }, // NA
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 2, 1 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 8, 5 }, // grow width enough to fit second DBCS
|
||||
{
|
||||
//--01234567--
|
||||
{ L"カタカナ", true }, // KA TA KA NA
|
||||
{ L"$ ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 0, 1 } // cursor on $
|
||||
},
|
||||
},
|
||||
},
|
||||
TestCase{
|
||||
L"SBCS, cursor remains in buffer, with circling, no original wrap",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
{ L"ABCDEF", false },
|
||||
{ L"$ ", false },
|
||||
{ L"GHIJKL", false },
|
||||
{ L"MNOPQR", false },
|
||||
{ L"STUVWX", false },
|
||||
},
|
||||
{ 0, 1 } // cursor on $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 5, 5 }, // reduce width by 1
|
||||
{
|
||||
{ L"F$ ", false },
|
||||
{ L"GHIJK", true }, // [BUG] We should see GHIJK\n L\n MNOPQ\n R\n
|
||||
{ L"LMNOP", true }, // The wrapping here is irregular
|
||||
{ L"QRSTU", true },
|
||||
{ L"VWX ", false },
|
||||
},
|
||||
{ 1, 1 } // [BUG] cursor moves to 1,1 instead of sticking with the $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 6, 5 }, // going back to 6,5, the data lost has been destroyed
|
||||
{
|
||||
//{ L"F$ ", false }, // [BUG] this line is erroneously destroyed too!
|
||||
{ L"GHIJKL", true },
|
||||
{ L"MNOPQR", true },
|
||||
{ L"STUVWX", true },
|
||||
{ L" ", false },
|
||||
{ L" ", false }, // [BUG] this line is added
|
||||
},
|
||||
{ 1, 1 }, // [BUG] cursor does not follow [H], it sticks at 1,1
|
||||
},
|
||||
TestBuffer{
|
||||
{ 7, 5 }, // a number of errors are carried forward from the previous buffer
|
||||
{
|
||||
{ L"GHIJKLM", true },
|
||||
{ L"NOPQRST", true },
|
||||
{ L"UVWX ", false }, // [BUG] This line loses wrap for some reason
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 0, 1 }, // [BUG] The cursor moves to 0, 1 now, sticking with the [N] from before
|
||||
},
|
||||
},
|
||||
},
|
||||
TestCase{
|
||||
// The cursor is not found during character insertion.
|
||||
// Instead, it is found off the right edge of the text. This triggers
|
||||
// a separate cursor found codepath in the original algorithm.
|
||||
L"SBCS, cursor off rightmost char in non-wrapped line",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
{ L"ABCDEF", false },
|
||||
{ L"$ ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 1, 1 } // cursor *after* $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 5, 5 }, // reduce width by 1
|
||||
{
|
||||
{ L"ABCDE", true },
|
||||
{ L"F$ ", false }, // [BUG] EXACT WRAP. $ should be alone on next line.
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 2, 1 } // cursor follows space after $ to next line
|
||||
},
|
||||
},
|
||||
},
|
||||
TestCase{
|
||||
L"SBCS, cursor off rightmost char in wrapped line, which is then pushed off bottom",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
{ L"ABCDEF", true },
|
||||
{ L"GHIJKL", true },
|
||||
{ L"MNOPQR", true },
|
||||
{ L"STUVWX", true },
|
||||
{ L"YZ0 $ ", false },
|
||||
},
|
||||
{ 5, 4 } // cursor *after* $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 5, 5 }, // reduce width by 1
|
||||
{
|
||||
{ L"FGHIJ", true },
|
||||
{ L"KLMNO", true },
|
||||
{ L"PQRST", true },
|
||||
{ L"UVWXY", true },
|
||||
{ L"Z0 $ ", false },
|
||||
},
|
||||
{ 4, 4 } // cursor follows space after $ to newly introduced bottom line
|
||||
},
|
||||
},
|
||||
},
|
||||
TestCase{
|
||||
L"SBCS, cursor off in space to far right of text (end of buffer content)",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
{ L"ABCDEF", false },
|
||||
// v cursor
|
||||
{ L"$ ", false },
|
||||
// ^ cursor
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 5, 1 } // cursor in space far after $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 5, 5 }, // reduce width by 1
|
||||
{
|
||||
{ L"ABCDE", true },
|
||||
{ L"F$ ", true }, // [BUG] This line is marked wrapped, and I do not know why
|
||||
// v cursor
|
||||
{ L" ", false },
|
||||
// ^ cursor
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 1, 2 } // cursor stays same linear distance from $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 6, 5 }, // grow back to original size
|
||||
{
|
||||
{ L"ABCDEF", true_due_to_exact_wrap_bug },
|
||||
// v cursor [BUG] cursor does not retain linear distance from $
|
||||
{ L"$ ", false },
|
||||
// ^ cursor
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 4, 1 } // cursor stays same linear distance from $
|
||||
},
|
||||
},
|
||||
},
|
||||
TestCase{
|
||||
L"SBCS, cursor off in space to far right of text (middle of buffer content)",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
{ L"ABCDEF", false },
|
||||
// v cursor
|
||||
{ L"$ ", false },
|
||||
// ^ cursor
|
||||
{ L"BLAH ", false },
|
||||
{ L"BLAH ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 5, 1 } // cursor in space far after $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 5, 5 }, // reduce width by 1
|
||||
{
|
||||
{ L"ABCDE", true },
|
||||
{ L"F$ ", false },
|
||||
{ L"BLAH ", false },
|
||||
{ L"BLAH ", true }, // [BUG] this line wraps, no idea why
|
||||
// v cursor [BUG] cursor erroneously moved to end of all content
|
||||
{ L" ", false },
|
||||
// ^ cursor
|
||||
},
|
||||
{ 0, 4 } },
|
||||
TestBuffer{
|
||||
{ 6, 5 }, // grow back to original size
|
||||
{
|
||||
{ L"ABCDEF", true },
|
||||
{ L"$ ", false },
|
||||
{ L"BLAH ", false },
|
||||
// v cursor [BUG] cursor is pulled up to previous line because it was marked wrapped
|
||||
{ L"BLAH ", false },
|
||||
// ^ cursor
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 5, 3 } },
|
||||
},
|
||||
},
|
||||
TestCase{
|
||||
// Shrinking the buffer this much forces a multi-line wrap before the cursor
|
||||
L"SBCS, cursor off in space to far right of text (end of buffer content), aggressive shrink",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
{ L"ABCDEF", false },
|
||||
// v cursor
|
||||
{ L"$ ", false },
|
||||
// ^ cursor
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
{ L" ", false },
|
||||
},
|
||||
{ 5, 1 } // cursor in space far after $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 2, 5 }, // reduce width aggressively
|
||||
{
|
||||
{ L"CD", true },
|
||||
{ L"EF", true },
|
||||
{ L"$ ", true },
|
||||
{ L" ", true },
|
||||
// v cursor
|
||||
{ L" ", false },
|
||||
// ^ cursor
|
||||
},
|
||||
{ 1, 4 } },
|
||||
},
|
||||
},
|
||||
TestCase{
|
||||
L"SBCS, cursor off in space to far right of text (end of buffer content), fully wrapped, aggressive shrink",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
{ L"ABCDEF", true },
|
||||
// v cursor
|
||||
{ L"$ ", true },
|
||||
// ^ cursor
|
||||
{ L" ", true },
|
||||
{ L" ", true },
|
||||
{ L" ", true },
|
||||
},
|
||||
{ 5, 1 } // cursor in space far after $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 2, 5 }, // reduce width aggressively
|
||||
{
|
||||
{ L"EF", true },
|
||||
{ L"$ ", true },
|
||||
{ L" ", true },
|
||||
{ L" ", true },
|
||||
// v cursor [BUG] cursor does not maintain linear distance from $
|
||||
{ L" ", false },
|
||||
// ^ cursor
|
||||
},
|
||||
{ 1, 4 } },
|
||||
},
|
||||
},
|
||||
TestCase{
|
||||
L"SBCS, cursor off in space to far right of text (middle of buffer content), fully wrapped, aggressive shrink",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
{ L"ABCDEF", true },
|
||||
// v cursor
|
||||
{ L"$ ", true },
|
||||
// ^ cursor
|
||||
{ L" ", true },
|
||||
{ L" ", true },
|
||||
{ L" Q", true },
|
||||
},
|
||||
{ 5, 1 } // cursor in space far after $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 2, 5 }, // reduce width aggressively
|
||||
{
|
||||
{ L" ", true },
|
||||
{ L" ", true },
|
||||
{ L" ", true },
|
||||
{ L" Q", true },
|
||||
// v cursor [BUG] cursor jumps to end of world
|
||||
{ L" ", false }, // POTENTIAL [BUG] a whole new blank line is added for the cursor
|
||||
// ^ cursor
|
||||
},
|
||||
{ 1, 4 } },
|
||||
},
|
||||
},
|
||||
TestCase{
|
||||
L"SBCS, cursor off in space to far right of text (middle of buffer content), partially wrapped, aggressive shrink",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
{ L"ABCDEF", false },
|
||||
// v cursor
|
||||
{ L"$ ", false },
|
||||
// ^ cursor
|
||||
{ L" ", false },
|
||||
{ L" ", true },
|
||||
{ L" Q", true },
|
||||
},
|
||||
{ 5, 1 } // cursor in space far after $
|
||||
},
|
||||
TestBuffer{
|
||||
{ 2, 5 }, // reduce width aggressively
|
||||
{
|
||||
{ L" ", true },
|
||||
{ L" ", true },
|
||||
{ L" ", true },
|
||||
{ L" Q", true },
|
||||
// v cursor [BUG] cursor jumps to different place than fully wrapped case
|
||||
{ L" ", false },
|
||||
// ^ cursor
|
||||
},
|
||||
{ 0, 4 } },
|
||||
},
|
||||
},
|
||||
TestCase{
|
||||
// This triggers the cursor being walked forward w/ newlines to maintain
|
||||
// distance from the last char in the buffer
|
||||
L"SBCS, cursor at end of buffer, otherwise same as previous test",
|
||||
{
|
||||
TestBuffer{
|
||||
{ 6, 5 },
|
||||
{
|
||||
{ L"ABCDEF", false },
|
||||
{ L"$ ", false },
|
||||
{ L" Q", true },
|
||||
{ L" ", true },
|
||||
// v cursor
|
||||
{ L" ", true },
|
||||
// ^ cursor
|
||||
},
|
||||
{ 5, 4 } // cursor at end of buffer
|
||||
},
|
||||
TestBuffer{
|
||||
{ 2, 5 }, // reduce width aggressively
|
||||
{
|
||||
{ L" ", true },
|
||||
{ L" ", true },
|
||||
{ L" Q", true },
|
||||
{ L" ", false },
|
||||
// v cursor [BUG] cursor loses linear distance from Q; is this important?
|
||||
{ L" ", false },
|
||||
// ^ cursor
|
||||
},
|
||||
{ 0, 4 } },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
#pragma region TAEF hookup for the test case array above
|
||||
struct ArrayIndexTaefAdapterRow : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom | Microsoft::WRL::InhibitFtmBase>, IDataRow>
|
||||
{
|
||||
HRESULT RuntimeClassInitialize(const size_t index)
|
||||
{
|
||||
_index = index;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP GetTestData(BSTR /*pszName*/, SAFEARRAY** ppData) override
|
||||
{
|
||||
const auto indexString{ wil::str_printf<std::wstring>(L"%zu", _index) };
|
||||
auto safeArray{ SafeArrayCreateVector(VT_BSTR, 0, 1) };
|
||||
LONG index{ 0 };
|
||||
auto indexBstr{ wil::make_bstr(indexString.c_str()) };
|
||||
(void)SafeArrayPutElement(safeArray, &index, indexBstr.release());
|
||||
*ppData = safeArray;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP GetMetadataNames(SAFEARRAY** ppMetadataNames) override
|
||||
{
|
||||
*ppMetadataNames = nullptr;
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
STDMETHODIMP GetMetadata(BSTR /*pszName*/, SAFEARRAY** ppData) override
|
||||
{
|
||||
*ppData = nullptr;
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
STDMETHODIMP GetName(BSTR* ppszRowName) override
|
||||
{
|
||||
*ppszRowName = nullptr;
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
private:
|
||||
size_t _index;
|
||||
};
|
||||
|
||||
struct ArrayIndexTaefAdapterSource : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom | Microsoft::WRL::InhibitFtmBase>, IDataSource>
|
||||
{
|
||||
STDMETHODIMP Advance(IDataRow** ppDataRow) override
|
||||
{
|
||||
if (_index < std::extent<decltype(testCases)>::value)
|
||||
{
|
||||
Microsoft::WRL::MakeAndInitialize<ArrayIndexTaefAdapterRow>(ppDataRow, _index++);
|
||||
}
|
||||
else
|
||||
{
|
||||
*ppDataRow = nullptr;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP Reset() override
|
||||
{
|
||||
_index = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP GetTestDataNames(SAFEARRAY** names) override
|
||||
{
|
||||
auto safeArray{ SafeArrayCreateVector(VT_BSTR, 0, 1) };
|
||||
LONG index{ 0 };
|
||||
auto dataNameBstr{ wil::make_bstr(L"index") };
|
||||
(void)SafeArrayPutElement(safeArray, &index, dataNameBstr.release());
|
||||
*names = safeArray;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP GetTestDataType(BSTR /*name*/, BSTR* type) override
|
||||
{
|
||||
*type = nullptr;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
size_t _index{ 0 };
|
||||
};
|
||||
#pragma endregion
|
||||
}
|
||||
|
||||
extern "C" HRESULT __declspec(dllexport) __cdecl ReflowTestDataSource(IDataSource** ppDataSource, void*)
|
||||
{
|
||||
auto source{ Microsoft::WRL::Make<ArrayIndexTaefAdapterSource>() };
|
||||
return source.CopyTo(ppDataSource);
|
||||
}
|
||||
|
||||
class ReflowTests
|
||||
{
|
||||
TEST_CLASS(ReflowTests);
|
||||
|
||||
static DummyRenderTarget target;
|
||||
static std::unique_ptr<TextBuffer> _textBufferFromTestBuffer(const TestBuffer& testBuffer)
|
||||
{
|
||||
auto buffer = std::make_unique<TextBuffer>(testBuffer.size, TextAttribute{ 0x7 }, 0, target);
|
||||
|
||||
size_t i{};
|
||||
for (const auto& testRow : testBuffer.rows)
|
||||
{
|
||||
auto& row{ buffer->GetRowByOffset(i) };
|
||||
|
||||
auto& charRow{ row.GetCharRow() };
|
||||
row.SetWrapForced(testRow.wrap);
|
||||
|
||||
size_t j{};
|
||||
for (auto it{ charRow.begin() }; it != charRow.end(); ++it)
|
||||
{
|
||||
// Yes, we're about to manually create a buffer. It is unpleasant.
|
||||
const auto ch{ til::at(testRow.text, j) };
|
||||
it->Char() = ch;
|
||||
if (IsGlyphFullWidth(ch))
|
||||
{
|
||||
it->DbcsAttr().SetLeading();
|
||||
it++;
|
||||
it->Char() = ch;
|
||||
it->DbcsAttr().SetTrailing();
|
||||
}
|
||||
else
|
||||
{
|
||||
it->DbcsAttr().SetSingle();
|
||||
}
|
||||
j++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
buffer->GetCursor().SetPosition(testBuffer.cursor);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static std::unique_ptr<TextBuffer> _textBufferByReflowingTextBuffer(TextBuffer& originalBuffer, const COORD newSize)
|
||||
{
|
||||
auto buffer = std::make_unique<TextBuffer>(newSize, TextAttribute{ 0x7 }, 0, target);
|
||||
TextBuffer::Reflow(originalBuffer, *buffer, std::nullopt, std::nullopt);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static void _compareTextBufferAgainstTestBuffer(const TextBuffer& buffer, const TestBuffer& testBuffer)
|
||||
{
|
||||
VERIFY_ARE_EQUAL(testBuffer.cursor, buffer.GetCursor().GetPosition());
|
||||
VERIFY_ARE_EQUAL(testBuffer.size, buffer.GetSize().Dimensions());
|
||||
|
||||
size_t i{};
|
||||
for (const auto& testRow : testBuffer.rows)
|
||||
{
|
||||
NoThrowString indexString;
|
||||
const auto& row{ buffer.GetRowByOffset(i) };
|
||||
|
||||
const auto& charRow{ row.GetCharRow() };
|
||||
|
||||
indexString.Format(L"[Row %d]", i);
|
||||
VERIFY_ARE_EQUAL(testRow.wrap, row.WasWrapForced(), indexString);
|
||||
|
||||
size_t j{};
|
||||
for (auto it{ charRow.begin() }; it != charRow.end(); ++it)
|
||||
{
|
||||
indexString.Format(L"[Cell %d, %d; Text line index %d]", it - charRow.begin(), i, j);
|
||||
// Yes, we're about to manually create a buffer. It is unpleasant.
|
||||
const auto ch{ til::at(testRow.text, j) };
|
||||
if (IsGlyphFullWidth(ch))
|
||||
{
|
||||
// Char is full width in test buffer, so
|
||||
// ensure that real buffer is LEAD, TRAIL (ch)
|
||||
VERIFY_IS_TRUE(it->DbcsAttr().IsLeading(), indexString);
|
||||
VERIFY_ARE_EQUAL(ch, it->Char(), indexString);
|
||||
|
||||
it++;
|
||||
VERIFY_IS_TRUE(it->DbcsAttr().IsTrailing(), indexString);
|
||||
}
|
||||
else
|
||||
{
|
||||
VERIFY_IS_TRUE(it->DbcsAttr().IsSingle(), indexString);
|
||||
}
|
||||
|
||||
VERIFY_ARE_EQUAL(ch, it->Char(), indexString);
|
||||
j++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD(TestReflowCases)
|
||||
{
|
||||
BEGIN_TEST_METHOD_PROPERTIES()
|
||||
TEST_METHOD_PROPERTY(L"DataSource", L"Export:ReflowTestDataSource")
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
WEX::TestExecution::DisableVerifyExceptions disableVerifyExceptions{};
|
||||
WEX::TestExecution::SetVerifyOutput verifyOutputScope{ WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures };
|
||||
|
||||
unsigned int i{};
|
||||
TestData::TryGetValue(L"index", i); // index is produced by the ArrayIndexTaefAdapterSource above
|
||||
const auto& testCase{ testCases[i] };
|
||||
Log::Comment(NoThrowString().Format(L"[%zu.0] Test case \"%.*s\"", i, testCase.name.size(), testCase.name.data()));
|
||||
|
||||
// Create initial text buffer from Buffer 0
|
||||
auto textBuffer{ _textBufferFromTestBuffer(testCase.buffers.front()) };
|
||||
for (size_t bufferIndex{ 1 }; bufferIndex < testCase.buffers.size(); ++bufferIndex)
|
||||
{
|
||||
const auto& testBuffer{ til::at(testCase.buffers, bufferIndex) };
|
||||
Log::Comment(NoThrowString().Format(L"[%zu.%zu] Resizing to %dx%d", i, bufferIndex, testBuffer.size.X, testBuffer.size.Y));
|
||||
|
||||
auto newBuffer{ _textBufferByReflowingTextBuffer(*textBuffer, testBuffer.size) };
|
||||
|
||||
// All future operations are based on the new buffer
|
||||
std::swap(textBuffer, newBuffer);
|
||||
|
||||
_compareTextBufferAgainstTestBuffer(*textBuffer, testBuffer);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
DummyRenderTarget ReflowTests::target{};
|
||||
@@ -10,6 +10,8 @@
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SolutionDir)src\common.build.pre.props" />
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AttrRowTests.cpp" />
|
||||
<ClCompile Include="ReflowTests.cpp" />
|
||||
<ClCompile Include="TextColorTests.cpp" />
|
||||
<ClCompile Include="TextAttributeTests.cpp" />
|
||||
<ClCompile Include="UnicodeStorageTests.cpp" />
|
||||
@@ -18,6 +20,9 @@
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\types\lib\types.vcxproj">
|
||||
<Project>{18d09a24-8240-42d6-8cb6-236eee820263}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\lib\bufferout.vcxproj">
|
||||
<Project>{0cf235bd-2da0-407e-90ee-c467e8bbc714}</Project>
|
||||
</ProjectReference>
|
||||
|
||||
@@ -14,12 +14,15 @@ DLLDEF =
|
||||
|
||||
SOURCES = \
|
||||
$(SOURCES) \
|
||||
AttrRowTests.cpp \
|
||||
ReflowTests.cpp \
|
||||
TextColorTests.cpp \
|
||||
TextAttributeTests.cpp \
|
||||
DefaultResource.rc \
|
||||
|
||||
TARGETLIBS = \
|
||||
$(CONSOLE_OBJ_PATH)\buffer\out\lib\$(O)\ConBufferOut.lib \
|
||||
$(CONSOLE_OBJ_PATH)\types\lib\$(O)\ConTypes.lib \
|
||||
$(TARGETLIBS) \
|
||||
|
||||
# -------------------------------------
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
<Import Project="..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
|
||||
<Import Project="$(OpenConsoleDir)src\wap-common.build.pre.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<!-- This is necessary so the build system doesn't think we're a .NET project... -->
|
||||
<TargetRuntime>Native</TargetRuntime>
|
||||
|
||||
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion>
|
||||
<!--
|
||||
@@ -17,6 +16,10 @@
|
||||
<AppxOSMaxVersionTestedReplaceManifestVersion>false</AppxOSMaxVersionTestedReplaceManifestVersion>
|
||||
<OCExecutionAliasName Condition="'$(WindowsTerminalBranding)'==''">wtd</OCExecutionAliasName>
|
||||
<OCExecutionAliasName Condition="'$(OCExecutionAliasName)'==''">wt</OCExecutionAliasName>
|
||||
<!-- VS 16.8 causes WAP projects to accidentally package System.Core.dll (from the CLR).
|
||||
This has been fixed in VS 16.9 using the property below. It's safe for us to include
|
||||
it here, even after 16.9 comes out. -->
|
||||
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>CA5CAD1A-224A-4171-B13A-F16E576FDD12</ProjectGuid>
|
||||
|
||||
@@ -82,14 +82,9 @@
|
||||
<desktop5:ItemType Type="Directory">
|
||||
<desktop5:Verb Id="Command1" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
</desktop5:ItemType>
|
||||
<!-- Due to a bug in the OS, this doesn't actually work right -
|
||||
we'll get a nullptr in our implementation. So this is disabled
|
||||
temporarily. See MSFT:24623699 for more details.
|
||||
|
||||
<desktop5:ItemType Type="Directory\Background">
|
||||
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
</desktop5:ItemType>
|
||||
-->
|
||||
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
</desktop5:ItemType>
|
||||
</desktop4:FileExplorerContextMenus>
|
||||
</desktop4:Extension>
|
||||
|
||||
|
||||
@@ -82,15 +82,9 @@
|
||||
<desktop5:ItemType Type="Directory">
|
||||
<desktop5:Verb Id="Command1" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
</desktop5:ItemType>
|
||||
<!-- Due to a bug in the OS, this doesn't actually work right -
|
||||
we'll get a nullptr in our implementation. So this is disabled
|
||||
temporarily. See MSFT:24623699 for more details.
|
||||
|
||||
<desktop5:ItemType Type="Directory\Background">
|
||||
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
</desktop5:ItemType>
|
||||
-->
|
||||
|
||||
</desktop4:FileExplorerContextMenus>
|
||||
</desktop4:Extension>
|
||||
|
||||
|
||||
@@ -83,14 +83,9 @@
|
||||
<desktop5:ItemType Type="Directory">
|
||||
<desktop5:Verb Id="Command1" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
</desktop5:ItemType>
|
||||
<!-- Due to a bug in the OS, this doesn't actually work right -
|
||||
we'll get a nullptr in our implementation. So this is disabled
|
||||
temporarily. See MSFT:24623699 for more details.
|
||||
|
||||
<desktop5:ItemType Type="Directory\Background">
|
||||
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
</desktop5:ItemType>
|
||||
-->
|
||||
</desktop4:FileExplorerContextMenus>
|
||||
</desktop4:Extension>
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace SettingsModelLocalTests
|
||||
TEST_METHOD(CanLayerColorScheme);
|
||||
TEST_METHOD(LayerColorSchemeProperties);
|
||||
TEST_METHOD(LayerColorSchemesOnArray);
|
||||
TEST_METHOD(UpdateSchemeReferences);
|
||||
|
||||
TEST_CLASS_SETUP(ClassSetup)
|
||||
{
|
||||
@@ -290,4 +291,81 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_ARE_EQUAL(ARGB(0, 7, 7, 7), scheme2->_Background);
|
||||
}
|
||||
}
|
||||
|
||||
void ColorSchemeTests::UpdateSchemeReferences()
|
||||
{
|
||||
const std::string settingsString{ R"json({
|
||||
"defaultProfile": "Inherited reference",
|
||||
"profiles": {
|
||||
"defaults": {
|
||||
"colorScheme": "Scheme 1"
|
||||
},
|
||||
"list": [
|
||||
{
|
||||
"name": "Explicit scheme reference",
|
||||
"colorScheme": "Scheme 1"
|
||||
},
|
||||
{
|
||||
"name": "Explicit reference; hidden",
|
||||
"colorScheme": "Scheme 1",
|
||||
"hidden": true
|
||||
},
|
||||
{
|
||||
"name": "Inherited reference"
|
||||
},
|
||||
{
|
||||
"name": "Different reference",
|
||||
"colorScheme": "Scheme 2"
|
||||
}
|
||||
]
|
||||
},
|
||||
"schemes": [
|
||||
{ "name": "Scheme 1" },
|
||||
{ "name": "Scheme 2" },
|
||||
{ "name": "Scheme 1 (renamed)" }
|
||||
]
|
||||
})json" };
|
||||
|
||||
auto settings{ winrt::make_self<CascadiaSettings>(false) };
|
||||
settings->_ParseJsonString(settingsString, false);
|
||||
settings->_ApplyDefaultsFromUserSettings();
|
||||
settings->LayerJson(settings->_userSettings);
|
||||
settings->_ValidateSettings();
|
||||
|
||||
// update all references to "Scheme 1"
|
||||
const auto newName{ L"Scheme 1 (renamed)" };
|
||||
settings->UpdateColorSchemeReferences(L"Scheme 1", newName);
|
||||
|
||||
// verify profile defaults
|
||||
Log::Comment(L"Profile Defaults");
|
||||
VERIFY_ARE_EQUAL(newName, settings->ProfileDefaults().ColorSchemeName());
|
||||
VERIFY_IS_TRUE(settings->ProfileDefaults().HasColorSchemeName());
|
||||
|
||||
// verify all other profiles
|
||||
const auto& profiles{ settings->AllProfiles() };
|
||||
{
|
||||
const auto& prof{ profiles.GetAt(0) };
|
||||
Log::Comment(prof.Name().c_str());
|
||||
VERIFY_ARE_EQUAL(newName, prof.ColorSchemeName());
|
||||
VERIFY_IS_TRUE(prof.HasColorSchemeName());
|
||||
}
|
||||
{
|
||||
const auto& prof{ profiles.GetAt(1) };
|
||||
Log::Comment(prof.Name().c_str());
|
||||
VERIFY_ARE_EQUAL(newName, prof.ColorSchemeName());
|
||||
VERIFY_IS_TRUE(prof.HasColorSchemeName());
|
||||
}
|
||||
{
|
||||
const auto& prof{ profiles.GetAt(2) };
|
||||
Log::Comment(prof.Name().c_str());
|
||||
VERIFY_ARE_EQUAL(newName, prof.ColorSchemeName());
|
||||
VERIFY_IS_FALSE(prof.HasColorSchemeName());
|
||||
}
|
||||
{
|
||||
const auto& prof{ profiles.GetAt(3) };
|
||||
Log::Comment(prof.Name().c_str());
|
||||
VERIFY_ARE_EQUAL(L"Scheme 2", prof.ColorSchemeName());
|
||||
VERIFY_IS_TRUE(prof.HasColorSchemeName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace SettingsModelLocalTests
|
||||
TEST_METHOD(ManyCommandsSameAction);
|
||||
TEST_METHOD(LayerCommand);
|
||||
TEST_METHOD(TestSplitPaneArgs);
|
||||
TEST_METHOD(TestSplitPaneBadSize);
|
||||
TEST_METHOD(TestResourceKeyName);
|
||||
TEST_METHOD(TestAutogeneratedName);
|
||||
TEST_METHOD(TestLayerOnAutogeneratedName);
|
||||
@@ -147,7 +148,8 @@ namespace SettingsModelLocalTests
|
||||
{ "name": "command1", "command": { "action": "splitPane", "split": "vertical" } },
|
||||
{ "name": "command2", "command": { "action": "splitPane", "split": "horizontal" } },
|
||||
{ "name": "command4", "command": { "action": "splitPane" } },
|
||||
{ "name": "command5", "command": { "action": "splitPane", "split": "auto" } }
|
||||
{ "name": "command5", "command": { "action": "splitPane", "split": "auto" } },
|
||||
{ "name": "command6", "command": { "action": "splitPane", "size": 0.25 } },
|
||||
])" };
|
||||
|
||||
const auto commands0Json = VerifyParseSucceeded(commands0String);
|
||||
@@ -156,7 +158,7 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
VERIFY_ARE_EQUAL(0u, warnings.size());
|
||||
VERIFY_ARE_EQUAL(4u, commands.Size());
|
||||
VERIFY_ARE_EQUAL(5u, commands.Size());
|
||||
|
||||
{
|
||||
auto command = commands.Lookup(L"command1");
|
||||
@@ -167,6 +169,7 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_IS_NOT_NULL(realArgs);
|
||||
// Verify the args have the expected value
|
||||
VERIFY_ARE_EQUAL(SplitState::Vertical, realArgs.SplitStyle());
|
||||
VERIFY_ARE_EQUAL(0.5, realArgs.SplitSize());
|
||||
}
|
||||
{
|
||||
auto command = commands.Lookup(L"command2");
|
||||
@@ -177,6 +180,7 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_IS_NOT_NULL(realArgs);
|
||||
// Verify the args have the expected value
|
||||
VERIFY_ARE_EQUAL(SplitState::Horizontal, realArgs.SplitStyle());
|
||||
VERIFY_ARE_EQUAL(0.5, realArgs.SplitSize());
|
||||
}
|
||||
{
|
||||
auto command = commands.Lookup(L"command4");
|
||||
@@ -187,6 +191,7 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_IS_NOT_NULL(realArgs);
|
||||
// Verify the args have the expected value
|
||||
VERIFY_ARE_EQUAL(SplitState::Automatic, realArgs.SplitStyle());
|
||||
VERIFY_ARE_EQUAL(0.5, realArgs.SplitSize());
|
||||
}
|
||||
{
|
||||
auto command = commands.Lookup(L"command5");
|
||||
@@ -197,8 +202,51 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_IS_NOT_NULL(realArgs);
|
||||
// Verify the args have the expected value
|
||||
VERIFY_ARE_EQUAL(SplitState::Automatic, realArgs.SplitStyle());
|
||||
VERIFY_ARE_EQUAL(0.5, realArgs.SplitSize());
|
||||
}
|
||||
{
|
||||
auto command = commands.Lookup(L"command6");
|
||||
VERIFY_IS_NOT_NULL(command);
|
||||
VERIFY_IS_NOT_NULL(command.Action());
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::SplitPane, command.Action().Action());
|
||||
const auto& realArgs = command.Action().Args().try_as<SplitPaneArgs>();
|
||||
VERIFY_IS_NOT_NULL(realArgs);
|
||||
// Verify the args have the expected value
|
||||
VERIFY_ARE_EQUAL(SplitState::Automatic, realArgs.SplitStyle());
|
||||
VERIFY_ARE_EQUAL(0.25, realArgs.SplitSize());
|
||||
}
|
||||
}
|
||||
|
||||
void CommandTests::TestSplitPaneBadSize()
|
||||
{
|
||||
const std::string commands0String{ R"([
|
||||
{ "name": "command1", "command": { "action": "splitPane", "size": 0.25 } },
|
||||
{ "name": "command2", "command": { "action": "splitPane", "size": 1.0 } },
|
||||
{ "name": "command3", "command": { "action": "splitPane", "size": 0 } },
|
||||
{ "name": "command4", "command": { "action": "splitPane", "size": 50 } },
|
||||
])" };
|
||||
|
||||
const auto commands0Json = VerifyParseSucceeded(commands0String);
|
||||
|
||||
IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
|
||||
VERIFY_ARE_EQUAL(3u, warnings.size());
|
||||
VERIFY_ARE_EQUAL(1u, commands.Size());
|
||||
|
||||
{
|
||||
auto command = commands.Lookup(L"command1");
|
||||
VERIFY_IS_NOT_NULL(command);
|
||||
VERIFY_IS_NOT_NULL(command.Action());
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::SplitPane, command.Action().Action());
|
||||
const auto& realArgs = command.Action().Args().try_as<SplitPaneArgs>();
|
||||
VERIFY_IS_NOT_NULL(realArgs);
|
||||
// Verify the args have the expected value
|
||||
VERIFY_ARE_EQUAL(SplitState::Automatic, realArgs.SplitStyle());
|
||||
VERIFY_ARE_EQUAL(0.25, realArgs.SplitSize());
|
||||
}
|
||||
}
|
||||
|
||||
void CommandTests::TestResourceKeyName()
|
||||
{
|
||||
// This test checks looking up a name from a resource key.
|
||||
|
||||
@@ -79,6 +79,7 @@ namespace SettingsModelLocalTests
|
||||
TEST_METHOD(TestCommandsAndKeybindings);
|
||||
|
||||
TEST_METHOD(TestNestedCommandWithoutName);
|
||||
TEST_METHOD(TestNestedCommandWithBadSubCommands);
|
||||
TEST_METHOD(TestUnbindNestedCommand);
|
||||
TEST_METHOD(TestRebindNestedCommand);
|
||||
|
||||
@@ -1376,7 +1377,7 @@ namespace SettingsModelLocalTests
|
||||
},
|
||||
{
|
||||
"name": "parent",
|
||||
"commands": [
|
||||
"commands": [
|
||||
{ "command": { "action": "setColorScheme", "colorScheme": "invalidScheme" } }
|
||||
]
|
||||
}
|
||||
@@ -1403,11 +1404,11 @@ namespace SettingsModelLocalTests
|
||||
},
|
||||
{
|
||||
"name": "grandparent",
|
||||
"commands": [
|
||||
"commands": [
|
||||
{
|
||||
"name": "parent",
|
||||
"commands": [
|
||||
{
|
||||
{
|
||||
"command": { "action": "setColorScheme", "colorScheme": "invalidScheme" }
|
||||
}
|
||||
]
|
||||
@@ -1909,7 +1910,8 @@ namespace SettingsModelLocalTests
|
||||
"keybindings": [
|
||||
{ "command": { "action": "splitPane", "split":"auto" }, "keys": [ "ctrl+alt+t", "ctrl+a" ] },
|
||||
{ "command": { "action": "moveFocus" }, "keys": [ "ctrl+a" ] },
|
||||
{ "command": { "action": "resizePane" }, "keys": [ "ctrl+b" ] }
|
||||
{ "command": { "action": "resizePane" }, "keys": [ "ctrl+b" ] },
|
||||
{ "name": "invalid nested", "commands":[ { "name" : "hello" }, { "name" : "world" } ] }
|
||||
]
|
||||
})" };
|
||||
|
||||
@@ -1918,18 +1920,20 @@ namespace SettingsModelLocalTests
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings->_globals->_keymap->_keyShortcuts.size());
|
||||
|
||||
VERIFY_ARE_EQUAL(3u, settings->_globals->_keybindingsWarnings.size());
|
||||
VERIFY_ARE_EQUAL(4u, settings->_globals->_keybindingsWarnings.size());
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::TooManyKeysForChord, settings->_globals->_keybindingsWarnings.at(0));
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::MissingRequiredParameter, settings->_globals->_keybindingsWarnings.at(1));
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::MissingRequiredParameter, settings->_globals->_keybindingsWarnings.at(2));
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::FailedToParseSubCommands, settings->_globals->_keybindingsWarnings.at(3));
|
||||
|
||||
settings->_ValidateKeybindings();
|
||||
|
||||
VERIFY_ARE_EQUAL(4u, settings->_warnings.Size());
|
||||
VERIFY_ARE_EQUAL(5u, settings->_warnings.Size());
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::AtLeastOneKeybindingWarning, settings->_warnings.GetAt(0));
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::TooManyKeysForChord, settings->_warnings.GetAt(1));
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::MissingRequiredParameter, settings->_warnings.GetAt(2));
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::MissingRequiredParameter, settings->_warnings.GetAt(3));
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::FailedToParseSubCommands, settings->_warnings.GetAt(4));
|
||||
}
|
||||
|
||||
void DeserializationTests::ValidateExecuteCommandlineWarning()
|
||||
@@ -2316,6 +2320,53 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
}
|
||||
|
||||
void DeserializationTests::TestNestedCommandWithBadSubCommands()
|
||||
{
|
||||
// This test tests a nested command without a name specified. This type
|
||||
// of command should just be ignored, since we can't auto-generate names
|
||||
// for nested commands, they _must_ have names specified.
|
||||
|
||||
const std::string settingsJson{ R"(
|
||||
{
|
||||
"defaultProfile": "{6239a42c-0000-49a3-80bd-e8fdd045185c}",
|
||||
"profiles": [
|
||||
{
|
||||
"name": "profile0",
|
||||
"guid": "{6239a42c-0000-49a3-80bd-e8fdd045185c}",
|
||||
"historySize": 1,
|
||||
"commandline": "cmd.exe"
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"name": "nested command",
|
||||
"commands": [
|
||||
{
|
||||
"name": "child1"
|
||||
},
|
||||
{
|
||||
"name": "child2"
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
"schemes": [ { "name": "Campbell" } ] // This is included here to prevent settings validation errors.
|
||||
})" };
|
||||
|
||||
VerifyParseSucceeded(settingsJson);
|
||||
|
||||
auto settings = winrt::make_self<implementation::CascadiaSettings>();
|
||||
settings->_ParseJsonString(settingsJson, false);
|
||||
settings->LayerJson(settings->_userSettings);
|
||||
auto commands = settings->_globals->Commands();
|
||||
settings->_ValidateSettings();
|
||||
|
||||
VERIFY_ARE_EQUAL(2u, settings->_warnings.Size());
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::AtLeastOneKeybindingWarning, settings->_warnings.GetAt(0));
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::FailedToParseSubCommands, settings->_warnings.GetAt(1));
|
||||
VERIFY_ARE_EQUAL(0u, commands.Size());
|
||||
}
|
||||
|
||||
void DeserializationTests::TestUnbindNestedCommand()
|
||||
{
|
||||
// Test that layering a command with `"commands": null` set will unbind a command that already exists.
|
||||
|
||||
@@ -226,6 +226,7 @@ namespace SettingsModelLocalTests
|
||||
const std::string settingsString{ R"({
|
||||
"$schema": "https://aka.ms/terminal-profiles-schema",
|
||||
"defaultProfile": "{61c54bbd-1111-5271-96e7-009a87ff44bf}",
|
||||
"disabledProfileSources": [ "Windows.Terminal.Wsl" ],
|
||||
|
||||
"profiles": {
|
||||
"defaults": {
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace TerminalAppLocalTests
|
||||
TEST_METHOD(ParseSplitPaneIntoArgs);
|
||||
TEST_METHOD(ParseComboCommandlineIntoArgs);
|
||||
TEST_METHOD(ParseFocusTabArgs);
|
||||
TEST_METHOD(ParseMoveFocusArgs);
|
||||
TEST_METHOD(ParseArgumentsWithParsingTerminators);
|
||||
|
||||
TEST_METHOD(ParseNoCommandIsNewTab);
|
||||
@@ -61,6 +62,8 @@ namespace TerminalAppLocalTests
|
||||
TEST_METHOD(TestLaunchMode);
|
||||
TEST_METHOD(TestLaunchModeWithNoCommand);
|
||||
|
||||
TEST_METHOD(TestMultipleSplitPaneSizes);
|
||||
|
||||
private:
|
||||
void _buildCommandlinesHelper(AppCommandlineArgs& appArgs,
|
||||
const size_t expectedSubcommands,
|
||||
@@ -76,6 +79,23 @@ namespace TerminalAppLocalTests
|
||||
appArgs.ValidateStartupCommands();
|
||||
}
|
||||
|
||||
void _buildCommandlinesExpectFailureHelper(AppCommandlineArgs& appArgs,
|
||||
const size_t expectedSubcommands,
|
||||
std::vector<const wchar_t*>& rawCommands)
|
||||
{
|
||||
auto commandlines = AppCommandlineArgs::BuildCommands(rawCommands);
|
||||
VERIFY_ARE_EQUAL(expectedSubcommands, commandlines.size());
|
||||
for (auto& cmdBlob : commandlines)
|
||||
{
|
||||
const auto result = appArgs.ParseCommand(cmdBlob);
|
||||
VERIFY_ARE_NOT_EQUAL(0, result);
|
||||
VERIFY_ARE_NOT_EQUAL("", appArgs._exitMessage);
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Exit Message:\n%hs",
|
||||
appArgs._exitMessage.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
void _logCommandline(std::vector<const wchar_t*>& rawCommands)
|
||||
{
|
||||
std::wstring buffer;
|
||||
@@ -995,6 +1015,124 @@ namespace TerminalAppLocalTests
|
||||
}
|
||||
}
|
||||
|
||||
void CommandlineTest::ParseMoveFocusArgs()
|
||||
{
|
||||
BEGIN_TEST_METHOD_PROPERTIES()
|
||||
TEST_METHOD_PROPERTY(L"Data:useShortForm", L"{false, true}")
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortForm, L"If true, use `mf` instead of `move-focus`");
|
||||
const wchar_t* subcommand = useShortForm ? L"mf" : L"move-focus";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", subcommand };
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Just the subcommand, without a direction, should fail."));
|
||||
|
||||
_buildCommandlinesExpectFailureHelper(appArgs, 1u, rawCommands);
|
||||
}
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", subcommand, L"left" };
|
||||
_buildCommandlinesHelper(appArgs, 1u, rawCommands);
|
||||
|
||||
VERIFY_ARE_EQUAL(2u, appArgs._startupActions.size());
|
||||
|
||||
// The first action is going to always be a new-tab action
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::NewTab, appArgs._startupActions.at(0).Action());
|
||||
|
||||
auto actionAndArgs = appArgs._startupActions.at(1);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::MoveFocus, actionAndArgs.Action());
|
||||
VERIFY_IS_NOT_NULL(actionAndArgs.Args());
|
||||
auto myArgs = actionAndArgs.Args().try_as<MoveFocusArgs>();
|
||||
VERIFY_IS_NOT_NULL(myArgs);
|
||||
VERIFY_ARE_EQUAL(FocusDirection::Left, myArgs.FocusDirection());
|
||||
}
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", subcommand, L"right" };
|
||||
_buildCommandlinesHelper(appArgs, 1u, rawCommands);
|
||||
|
||||
VERIFY_ARE_EQUAL(2u, appArgs._startupActions.size());
|
||||
|
||||
// The first action is going to always be a new-tab action
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::NewTab, appArgs._startupActions.at(0).Action());
|
||||
|
||||
auto actionAndArgs = appArgs._startupActions.at(1);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::MoveFocus, actionAndArgs.Action());
|
||||
VERIFY_IS_NOT_NULL(actionAndArgs.Args());
|
||||
auto myArgs = actionAndArgs.Args().try_as<MoveFocusArgs>();
|
||||
VERIFY_IS_NOT_NULL(myArgs);
|
||||
VERIFY_ARE_EQUAL(FocusDirection::Right, myArgs.FocusDirection());
|
||||
}
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", subcommand, L"up" };
|
||||
_buildCommandlinesHelper(appArgs, 1u, rawCommands);
|
||||
|
||||
VERIFY_ARE_EQUAL(2u, appArgs._startupActions.size());
|
||||
|
||||
// The first action is going to always be a new-tab action
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::NewTab, appArgs._startupActions.at(0).Action());
|
||||
|
||||
auto actionAndArgs = appArgs._startupActions.at(1);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::MoveFocus, actionAndArgs.Action());
|
||||
VERIFY_IS_NOT_NULL(actionAndArgs.Args());
|
||||
auto myArgs = actionAndArgs.Args().try_as<MoveFocusArgs>();
|
||||
VERIFY_IS_NOT_NULL(myArgs);
|
||||
VERIFY_ARE_EQUAL(FocusDirection::Up, myArgs.FocusDirection());
|
||||
}
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", subcommand, L"down" };
|
||||
_buildCommandlinesHelper(appArgs, 1u, rawCommands);
|
||||
|
||||
VERIFY_ARE_EQUAL(2u, appArgs._startupActions.size());
|
||||
|
||||
// The first action is going to always be a new-tab action
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::NewTab, appArgs._startupActions.at(0).Action());
|
||||
|
||||
auto actionAndArgs = appArgs._startupActions.at(1);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::MoveFocus, actionAndArgs.Action());
|
||||
VERIFY_IS_NOT_NULL(actionAndArgs.Args());
|
||||
auto myArgs = actionAndArgs.Args().try_as<MoveFocusArgs>();
|
||||
VERIFY_IS_NOT_NULL(myArgs);
|
||||
VERIFY_ARE_EQUAL(FocusDirection::Down, myArgs.FocusDirection());
|
||||
}
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", subcommand, L"badDirection" };
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"move-focus with an invalid direction should fail."));
|
||||
_buildCommandlinesExpectFailureHelper(appArgs, 1u, rawCommands);
|
||||
}
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", subcommand, L"left", L";", subcommand, L"right" };
|
||||
_buildCommandlinesHelper(appArgs, 2u, rawCommands);
|
||||
|
||||
VERIFY_ARE_EQUAL(3u, appArgs._startupActions.size());
|
||||
|
||||
// The first action is going to always be a new-tab action
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::NewTab, appArgs._startupActions.at(0).Action());
|
||||
|
||||
auto actionAndArgs = appArgs._startupActions.at(1);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::MoveFocus, actionAndArgs.Action());
|
||||
VERIFY_IS_NOT_NULL(actionAndArgs.Args());
|
||||
auto myArgs = actionAndArgs.Args().try_as<MoveFocusArgs>();
|
||||
VERIFY_IS_NOT_NULL(myArgs);
|
||||
VERIFY_ARE_EQUAL(FocusDirection::Left, myArgs.FocusDirection());
|
||||
|
||||
actionAndArgs = appArgs._startupActions.at(2);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::MoveFocus, actionAndArgs.Action());
|
||||
VERIFY_IS_NOT_NULL(actionAndArgs.Args());
|
||||
myArgs = actionAndArgs.Args().try_as<MoveFocusArgs>();
|
||||
VERIFY_IS_NOT_NULL(myArgs);
|
||||
VERIFY_ARE_EQUAL(FocusDirection::Right, myArgs.FocusDirection());
|
||||
}
|
||||
}
|
||||
|
||||
void CommandlineTest::ValidateFirstCommandIsNewTab()
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
@@ -1325,4 +1463,119 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(L"powershell.exe", myArgs.TerminalArgs().Commandline());
|
||||
}
|
||||
}
|
||||
|
||||
void CommandlineTest::TestMultipleSplitPaneSizes()
|
||||
{
|
||||
BEGIN_TEST_METHOD_PROPERTIES()
|
||||
TEST_METHOD_PROPERTY(L"Data:useShortForm", L"{false, true}")
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
INIT_TEST_PROPERTY(bool, useShortForm, L"If true, use `sp` instead of `split-pane`");
|
||||
const wchar_t* subcommand = useShortForm ? L"sp" : L"split-pane";
|
||||
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", subcommand };
|
||||
_buildCommandlinesHelper(appArgs, 1u, rawCommands);
|
||||
|
||||
VERIFY_ARE_EQUAL(2u, appArgs._startupActions.size());
|
||||
|
||||
// The first action is going to always be a new-tab action
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::NewTab, appArgs._startupActions.at(0).Action());
|
||||
|
||||
// The one we actually want to test here is the SplitPane action we created
|
||||
auto actionAndArgs = appArgs._startupActions.at(1);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::SplitPane, actionAndArgs.Action());
|
||||
VERIFY_IS_NOT_NULL(actionAndArgs.Args());
|
||||
auto myArgs = actionAndArgs.Args().try_as<SplitPaneArgs>();
|
||||
VERIFY_IS_NOT_NULL(myArgs);
|
||||
VERIFY_ARE_EQUAL(SplitState::Automatic, myArgs.SplitStyle());
|
||||
VERIFY_ARE_EQUAL(0.5f, myArgs.SplitSize());
|
||||
VERIFY_IS_NOT_NULL(myArgs.TerminalArgs());
|
||||
}
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", subcommand, L"-s", L".3" };
|
||||
_buildCommandlinesHelper(appArgs, 1u, rawCommands);
|
||||
|
||||
VERIFY_ARE_EQUAL(2u, appArgs._startupActions.size());
|
||||
|
||||
// The first action is going to always be a new-tab action
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::NewTab, appArgs._startupActions.at(0).Action());
|
||||
|
||||
// The one we actually want to test here is the SplitPane action we created
|
||||
auto actionAndArgs = appArgs._startupActions.at(1);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::SplitPane, actionAndArgs.Action());
|
||||
VERIFY_IS_NOT_NULL(actionAndArgs.Args());
|
||||
auto myArgs = actionAndArgs.Args().try_as<SplitPaneArgs>();
|
||||
VERIFY_IS_NOT_NULL(myArgs);
|
||||
VERIFY_ARE_EQUAL(SplitState::Automatic, myArgs.SplitStyle());
|
||||
VERIFY_ARE_EQUAL(0.3f, myArgs.SplitSize());
|
||||
VERIFY_IS_NOT_NULL(myArgs.TerminalArgs());
|
||||
}
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", subcommand, L"-s", L".3", L";", subcommand };
|
||||
_buildCommandlinesHelper(appArgs, 2u, rawCommands);
|
||||
|
||||
VERIFY_ARE_EQUAL(3u, appArgs._startupActions.size());
|
||||
|
||||
// The first action is going to always be a new-tab action
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::NewTab, appArgs._startupActions.at(0).Action());
|
||||
|
||||
{
|
||||
// The one we actually want to test here is the SplitPane action we created
|
||||
auto actionAndArgs = appArgs._startupActions.at(1);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::SplitPane, actionAndArgs.Action());
|
||||
VERIFY_IS_NOT_NULL(actionAndArgs.Args());
|
||||
auto myArgs = actionAndArgs.Args().try_as<SplitPaneArgs>();
|
||||
VERIFY_IS_NOT_NULL(myArgs);
|
||||
VERIFY_ARE_EQUAL(SplitState::Automatic, myArgs.SplitStyle());
|
||||
VERIFY_ARE_EQUAL(0.3f, myArgs.SplitSize());
|
||||
VERIFY_IS_NOT_NULL(myArgs.TerminalArgs());
|
||||
}
|
||||
{
|
||||
auto actionAndArgs = appArgs._startupActions.at(2);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::SplitPane, actionAndArgs.Action());
|
||||
VERIFY_IS_NOT_NULL(actionAndArgs.Args());
|
||||
auto myArgs = actionAndArgs.Args().try_as<SplitPaneArgs>();
|
||||
VERIFY_IS_NOT_NULL(myArgs);
|
||||
VERIFY_ARE_EQUAL(SplitState::Automatic, myArgs.SplitStyle());
|
||||
VERIFY_ARE_EQUAL(0.5f, myArgs.SplitSize());
|
||||
VERIFY_IS_NOT_NULL(myArgs.TerminalArgs());
|
||||
}
|
||||
}
|
||||
{
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", subcommand, L"-s", L".3", L";", subcommand, L"-s", L".7" };
|
||||
_buildCommandlinesHelper(appArgs, 2u, rawCommands);
|
||||
|
||||
VERIFY_ARE_EQUAL(3u, appArgs._startupActions.size());
|
||||
|
||||
// The first action is going to always be a new-tab action
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::NewTab, appArgs._startupActions.at(0).Action());
|
||||
|
||||
{
|
||||
// The one we actually want to test here is the SplitPane action we created
|
||||
auto actionAndArgs = appArgs._startupActions.at(1);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::SplitPane, actionAndArgs.Action());
|
||||
VERIFY_IS_NOT_NULL(actionAndArgs.Args());
|
||||
auto myArgs = actionAndArgs.Args().try_as<SplitPaneArgs>();
|
||||
VERIFY_IS_NOT_NULL(myArgs);
|
||||
VERIFY_ARE_EQUAL(SplitState::Automatic, myArgs.SplitStyle());
|
||||
VERIFY_ARE_EQUAL(0.3f, myArgs.SplitSize());
|
||||
VERIFY_IS_NOT_NULL(myArgs.TerminalArgs());
|
||||
}
|
||||
{
|
||||
auto actionAndArgs = appArgs._startupActions.at(2);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::SplitPane, actionAndArgs.Action());
|
||||
VERIFY_IS_NOT_NULL(actionAndArgs.Args());
|
||||
auto myArgs = actionAndArgs.Args().try_as<SplitPaneArgs>();
|
||||
VERIFY_IS_NOT_NULL(myArgs);
|
||||
VERIFY_ARE_EQUAL(SplitState::Automatic, myArgs.SplitStyle());
|
||||
VERIFY_ARE_EQUAL(0.7f, myArgs.SplitSize());
|
||||
VERIFY_IS_NOT_NULL(myArgs.TerminalArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ namespace TerminalAppLocalTests
|
||||
|
||||
Log::Comment(NoThrowString().Format(L"Duplicate the first pane"));
|
||||
result = RunOnUIThread([&page]() {
|
||||
page->_SplitPane(SplitState::Automatic, SplitType::Duplicate, nullptr);
|
||||
page->_SplitPane(SplitState::Automatic, SplitType::Duplicate, 0.5f, nullptr);
|
||||
|
||||
VERIFY_ARE_EQUAL(1u, page->_tabs.Size());
|
||||
auto tab = page->_GetTerminalTabImpl(page->_tabs.GetAt(0));
|
||||
@@ -504,7 +504,7 @@ namespace TerminalAppLocalTests
|
||||
|
||||
Log::Comment(NoThrowString().Format(L"Duplicate the pane, and don't crash"));
|
||||
result = RunOnUIThread([&page]() {
|
||||
page->_SplitPane(SplitState::Automatic, SplitType::Duplicate, nullptr);
|
||||
page->_SplitPane(SplitState::Automatic, SplitType::Duplicate, 0.5f, nullptr);
|
||||
|
||||
VERIFY_ARE_EQUAL(1u, page->_tabs.Size());
|
||||
auto tab = page->_GetTerminalTabImpl(page->_tabs.GetAt(0));
|
||||
|
||||
25
src/cascadia/Remoting/CommandlineArgs.cpp
Normal file
25
src/cascadia/Remoting/CommandlineArgs.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include "CommandlineArgs.h"
|
||||
#include "CommandlineArgs.g.cpp"
|
||||
using namespace winrt;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
{
|
||||
// LOAD BEARING CODE
|
||||
// If you try to move this into the header, you will experience P A I N
|
||||
// It must be defined after CommandlineArgs.g.cpp, otherwise the compiler
|
||||
// will give you just the most impossible template errors to try and
|
||||
// decipher.
|
||||
void CommandlineArgs::Args(winrt::array_view<const winrt::hstring> const& value)
|
||||
{
|
||||
_args = { value.begin(), value.end() };
|
||||
}
|
||||
|
||||
winrt::com_array<winrt::hstring> CommandlineArgs::Args()
|
||||
{
|
||||
return winrt::com_array<winrt::hstring>{ _args.begin(), _args.end() };
|
||||
}
|
||||
}
|
||||
39
src/cascadia/Remoting/CommandlineArgs.h
Normal file
39
src/cascadia/Remoting/CommandlineArgs.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "CommandlineArgs.g.h"
|
||||
#include "../cascadia/inc/cppwinrt_utils.h"
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
{
|
||||
struct CommandlineArgs : public CommandlineArgsT<CommandlineArgs>
|
||||
{
|
||||
public:
|
||||
CommandlineArgs() :
|
||||
_args{},
|
||||
_cwd{ L"" }
|
||||
{
|
||||
}
|
||||
|
||||
CommandlineArgs(const winrt::array_view<const winrt::hstring>& args,
|
||||
winrt::hstring currentDirectory) :
|
||||
_args{ args.begin(), args.end() },
|
||||
_cwd{ currentDirectory }
|
||||
{
|
||||
}
|
||||
|
||||
winrt::hstring CurrentDirectory() { return _cwd; };
|
||||
|
||||
void Args(winrt::array_view<const winrt::hstring> const& value);
|
||||
winrt::com_array<winrt::hstring> Args();
|
||||
|
||||
private:
|
||||
winrt::com_array<winrt::hstring> _args;
|
||||
winrt::hstring _cwd;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::factory_implementation
|
||||
{
|
||||
BASIC_FACTORY(CommandlineArgs);
|
||||
}
|
||||
97
src/cascadia/Remoting/Microsoft.Terminal.RemotingLib.vcxproj
Normal file
97
src/cascadia/Remoting/Microsoft.Terminal.RemotingLib.vcxproj
Normal file
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{43ce4ce5-0010-4b99-9569-672670d26e26}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectName>Microsoft.Terminal.Remoting.Lib</ProjectName>
|
||||
<RootNamespace>Microsoft.Terminal.Remoting</RootNamespace>
|
||||
<TargetName>Microsoft.Terminal.Remoting.Lib</TargetName>
|
||||
<WindowsTargetPlatformMinVersion>10.0.17763.0</WindowsTargetPlatformMinVersion>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OpenConsoleUniversalApp>true</OpenConsoleUniversalApp>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
|
||||
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.pre.props" />
|
||||
|
||||
<!-- ========================= Headers ======================== -->
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Monarch.h">
|
||||
<DependentUpon>Monarch.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="MonarchFactory.h" />
|
||||
<ClInclude Include="Peasant.h">
|
||||
<DependentUpon>Peasant.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WindowManager.h">
|
||||
<DependentUpon>WindowManager.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CommandlineArgs.h">
|
||||
<DependentUpon>Peasant.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<!-- ========================= Cpp Files ======================== -->
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Monarch.cpp">
|
||||
<DependentUpon>Monarch.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Peasant.cpp">
|
||||
<DependentUpon>Peasant.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="WindowManager.cpp">
|
||||
<DependentUpon>WindowManager.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CommandlineArgs.cpp">
|
||||
<DependentUpon>Peasant.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
||||
</ItemGroup>
|
||||
<!-- ========================= idl Files ======================== -->
|
||||
<ItemGroup>
|
||||
<Midl Include="Monarch.idl" />
|
||||
<Midl Include="Peasant.idl" />
|
||||
<Midl Include="WindowManager.idl" />
|
||||
</ItemGroup>
|
||||
<!-- ========================= Misc Files ======================== -->
|
||||
<ItemGroup>
|
||||
<PRIResource Include="Resources\en-US\Resources.resw" />
|
||||
<OCResourceDirectory Include="Resources" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<!-- ========================= Project References ======================== -->
|
||||
<ItemGroup>
|
||||
<!--
|
||||
the packaging project won't recurse through our dependencies, you have to
|
||||
make sure that if you add a cppwinrt dependency to any of these projects,
|
||||
you also update all the consumers
|
||||
-->
|
||||
<ProjectReference Include="$(OpenConsoleDir)src\types\lib\types.vcxproj" />
|
||||
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\WinRTUtils\WinRTUtils.vcxproj">
|
||||
<Project>{CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<!-- For whatever reason, we can't include the TerminalControl and
|
||||
TerminalSettings projects' winmds via project references. So we'll have to
|
||||
manually include the winmds as References below -->
|
||||
</ItemGroup>
|
||||
<!-- ====================== Compiler & Linker Flags ===================== -->
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>WindowsApp.lib;user32.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<Reference>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- ========================= Globals ======================== -->
|
||||
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.post.props" />
|
||||
|
||||
<Import Project="$(SolutionDir)build\rules\CollectWildcardResources.targets" />
|
||||
</Project>
|
||||
137
src/cascadia/Remoting/Monarch.cpp
Normal file
137
src/cascadia/Remoting/Monarch.cpp
Normal file
@@ -0,0 +1,137 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "pch.h"
|
||||
#include "Monarch.h"
|
||||
#include "CommandlineArgs.h"
|
||||
|
||||
#include "Monarch.g.cpp"
|
||||
#include "../../types/inc/utils.hpp"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace ::Microsoft::Console;
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
{
|
||||
Monarch::Monarch() :
|
||||
_ourPID{ GetCurrentProcessId() }
|
||||
{
|
||||
}
|
||||
|
||||
// This is a private constructor to be used in unit tests, where we don't
|
||||
// want each Monarch to necessarily use the current PID.
|
||||
Monarch::Monarch(const uint64_t testPID) :
|
||||
_ourPID{ testPID }
|
||||
{
|
||||
}
|
||||
|
||||
Monarch::~Monarch()
|
||||
{
|
||||
}
|
||||
|
||||
uint64_t Monarch::GetPID()
|
||||
{
|
||||
return _ourPID;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Add the given peasant to the list of peasants we're tracking. This Peasant may have already been assigned an ID. If it hasn't, then give it an ID.
|
||||
// Arguments:
|
||||
// - peasant: the new Peasant to track.
|
||||
// Return Value:
|
||||
// - the ID assigned to the peasant.
|
||||
uint64_t Monarch::AddPeasant(Remoting::IPeasant peasant)
|
||||
{
|
||||
// TODO:projects/5 This is terrible. There's gotta be a better way
|
||||
// of finding the first opening in a non-consecutive map of int->object
|
||||
const auto providedID = peasant.GetID();
|
||||
|
||||
if (providedID == 0)
|
||||
{
|
||||
// Peasant doesn't currently have an ID. Assign it a new one.
|
||||
peasant.AssignID(_nextPeasantID++);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Peasant already had an ID (from an older monarch). Leave that one
|
||||
// be. Make sure that the next peasant's ID is higher than it.
|
||||
_nextPeasantID = providedID >= _nextPeasantID ? providedID + 1 : _nextPeasantID;
|
||||
}
|
||||
|
||||
auto newPeasantsId = peasant.GetID();
|
||||
_peasants[newPeasantsId] = peasant;
|
||||
|
||||
// Add an event listener to the peasant's WindowActivated event.
|
||||
peasant.WindowActivated({ this, &Monarch::_peasantWindowActivated });
|
||||
|
||||
// TODO:projects/5 Wait on the peasant's PID, and remove them from the
|
||||
// map if they die. This won't work great in tests though, with fake
|
||||
// PIDs.
|
||||
|
||||
return newPeasantsId;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Event handler for the Peasant::WindowActivated event. Used as an
|
||||
// opportunity for us to update our internal stack of the "most recent
|
||||
// window".
|
||||
// Arguments:
|
||||
// - sender: the Peasant that raised this event. This might be out-of-proc!
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void Monarch::_peasantWindowActivated(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::Foundation::IInspectable& /*args*/)
|
||||
{
|
||||
// TODO:projects/5 Pass the desktop and timestamp of when the window was
|
||||
// activated in `args`.
|
||||
|
||||
if (auto peasant{ sender.try_as<Remoting::Peasant>() })
|
||||
{
|
||||
auto theirID = peasant.GetID();
|
||||
_setMostRecentPeasant(theirID);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Lookup a peasant by its ID.
|
||||
// Arguments:
|
||||
// - peasantID: The ID Of the peasant to find
|
||||
// Return Value:
|
||||
// - the peasant if it exists in our map, otherwise null
|
||||
Remoting::IPeasant Monarch::_getPeasant(uint64_t peasantID)
|
||||
{
|
||||
auto peasantSearch = _peasants.find(peasantID);
|
||||
return peasantSearch == _peasants.end() ? nullptr : peasantSearch->second;
|
||||
}
|
||||
|
||||
void Monarch::_setMostRecentPeasant(const uint64_t peasantID)
|
||||
{
|
||||
// TODO:projects/5 Use a heap/priority queue per-desktop to track which
|
||||
// peasant was the most recent per-desktop. When we want to get the most
|
||||
// recent of all desktops (WindowingBehavior::UseExisting), then use the
|
||||
// most recent of all desktops.
|
||||
_mostRecentPeasant = peasantID;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Try to handle a commandline from a new WT invocation. We might need to
|
||||
// hand the commandline to an existing window, or we might need to tell
|
||||
// the caller that they need to become a new window to handle it themselves.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
bool Monarch::ProposeCommandline(const Remoting::CommandlineArgs& /*args*/)
|
||||
{
|
||||
// TODO:projects/5
|
||||
// The branch dev/migrie/f/remote-commandlines has a more complete
|
||||
// version of this function, with a naive implementation. For now, we
|
||||
// always want to create a new window, so we'll just return true. This
|
||||
// will tell the caller that we didn't handle the commandline, and they
|
||||
// should open a new window to deal with it themselves.
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
80
src/cascadia/Remoting/Monarch.h
Normal file
80
src/cascadia/Remoting/Monarch.h
Normal file
@@ -0,0 +1,80 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Monarch.g.h"
|
||||
#include "Peasant.h"
|
||||
#include "../cascadia/inc/cppwinrt_utils.h"
|
||||
|
||||
// We sure different GUIDs here depending on whether we're running a Release,
|
||||
// Preview, or Dev build. This ensures that different installs don't
|
||||
// accidentally talk to one another.
|
||||
//
|
||||
// * Release: {06171993-7eb1-4f3e-85f5-8bdd7386cce3}
|
||||
// * Preview: {04221993-7eb1-4f3e-85f5-8bdd7386cce3}
|
||||
// * Dev: {08302020-7eb1-4f3e-85f5-8bdd7386cce3}
|
||||
constexpr GUID Monarch_clsid
|
||||
{
|
||||
#if defined(WT_BRANDING_RELEASE)
|
||||
0x06171993,
|
||||
#elif defined(WT_BRANDING_PREVIEW)
|
||||
0x04221993,
|
||||
#else
|
||||
0x08302020,
|
||||
#endif
|
||||
0x7eb1,
|
||||
0x4f3e,
|
||||
{
|
||||
0x85, 0xf5, 0x8b, 0xdd, 0x73, 0x86, 0xcc, 0xe3
|
||||
}
|
||||
};
|
||||
|
||||
enum class WindowingBehavior : uint64_t
|
||||
{
|
||||
UseNew = 0,
|
||||
UseExisting = 1,
|
||||
};
|
||||
|
||||
namespace RemotingUnitTests
|
||||
{
|
||||
class RemotingTests;
|
||||
};
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
{
|
||||
struct Monarch : public MonarchT<Monarch>
|
||||
{
|
||||
Monarch();
|
||||
~Monarch();
|
||||
|
||||
uint64_t GetPID();
|
||||
|
||||
uint64_t AddPeasant(winrt::Microsoft::Terminal::Remoting::IPeasant peasant);
|
||||
|
||||
bool ProposeCommandline(const winrt::Microsoft::Terminal::Remoting::CommandlineArgs& args);
|
||||
|
||||
private:
|
||||
Monarch(const uint64_t testPID);
|
||||
uint64_t _ourPID;
|
||||
|
||||
uint64_t _nextPeasantID{ 1 };
|
||||
uint64_t _thisPeasantID{ 0 };
|
||||
uint64_t _mostRecentPeasant{ 0 };
|
||||
WindowingBehavior _windowingBehavior{ WindowingBehavior::UseNew };
|
||||
std::unordered_map<uint64_t, winrt::Microsoft::Terminal::Remoting::IPeasant> _peasants;
|
||||
|
||||
winrt::Microsoft::Terminal::Remoting::IPeasant _getPeasant(uint64_t peasantID);
|
||||
void _setMostRecentPeasant(const uint64_t peasantID);
|
||||
|
||||
void _peasantWindowActivated(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::Foundation::IInspectable& args);
|
||||
|
||||
friend class RemotingUnitTests::RemotingTests;
|
||||
};
|
||||
}
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::factory_implementation
|
||||
{
|
||||
BASIC_FACTORY(Monarch);
|
||||
}
|
||||
15
src/cascadia/Remoting/Monarch.idl
Normal file
15
src/cascadia/Remoting/Monarch.idl
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import "Peasant.idl";
|
||||
|
||||
namespace Microsoft.Terminal.Remoting
|
||||
{
|
||||
[default_interface] runtimeclass Monarch {
|
||||
Monarch();
|
||||
|
||||
UInt64 GetPID();
|
||||
UInt64 AddPeasant(IPeasant peasant);
|
||||
Boolean ProposeCommandline(CommandlineArgs args);
|
||||
};
|
||||
}
|
||||
49
src/cascadia/Remoting/MonarchFactory.h
Normal file
49
src/cascadia/Remoting/MonarchFactory.h
Normal file
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include "Monarch.h"
|
||||
|
||||
// This seems like a hack, but it works.
|
||||
//
|
||||
// This class factory works so that there's only ever one instance of a Monarch
|
||||
// per-process. Once the first monarch is created, we'll stash it in g_weak.
|
||||
// Future callers who try to instantiate a Monarch will get the one that's
|
||||
// already been made.
|
||||
|
||||
struct MonarchFactory : winrt::implements<MonarchFactory, ::IClassFactory>
|
||||
{
|
||||
MonarchFactory() = default;
|
||||
|
||||
HRESULT __stdcall CreateInstance(IUnknown* outer, GUID const& iid, void** result) noexcept
|
||||
{
|
||||
static winrt::weak_ref<winrt::Microsoft::Terminal::Remoting::implementation::Monarch> g_weak{ nullptr };
|
||||
|
||||
*result = nullptr;
|
||||
if (outer)
|
||||
{
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
}
|
||||
|
||||
// Lock the ref immediately. We don't want it freed from out beneath us
|
||||
auto strong = g_weak.get();
|
||||
if (!strong)
|
||||
{
|
||||
// Create a new Monarch instance
|
||||
strong = winrt::make_self<winrt::Microsoft::Terminal::Remoting::implementation::Monarch>();
|
||||
g_weak = (*strong).get_weak();
|
||||
return strong.as(iid, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We already instantiated one Monarch, let's just return that one!
|
||||
return strong.as(iid, result);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT __stdcall LockServer(BOOL) noexcept
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
};
|
||||
66
src/cascadia/Remoting/Peasant.cpp
Normal file
66
src/cascadia/Remoting/Peasant.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "pch.h"
|
||||
#include "Peasant.h"
|
||||
#include "CommandlineArgs.h"
|
||||
#include "Peasant.g.cpp"
|
||||
#include "../../types/inc/utils.hpp"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace ::Microsoft::Console;
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
{
|
||||
Peasant::Peasant() :
|
||||
_ourPID{ GetCurrentProcessId() }
|
||||
{
|
||||
}
|
||||
|
||||
// This is a private constructor to be used in unit tests, where we don't
|
||||
// want each Peasant to necessarily use the current PID.
|
||||
Peasant::Peasant(const uint64_t testPID) :
|
||||
_ourPID{ testPID }
|
||||
{
|
||||
}
|
||||
|
||||
void Peasant::AssignID(uint64_t id)
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
uint64_t Peasant::GetID()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
uint64_t Peasant::GetPID()
|
||||
{
|
||||
return _ourPID;
|
||||
}
|
||||
|
||||
bool Peasant::ExecuteCommandline(const Remoting::CommandlineArgs& args)
|
||||
{
|
||||
// If this is the first set of args we were ever told about, stash them
|
||||
// away. We'll need to get at them later, when we setup the startup
|
||||
// actions for the window.
|
||||
if (_initialArgs == nullptr)
|
||||
{
|
||||
_initialArgs = args;
|
||||
}
|
||||
|
||||
// Raise an event with these args. The AppHost will listen for this
|
||||
// event to know when to take these args and dispatch them to a
|
||||
// currently-running window.
|
||||
_ExecuteCommandlineRequestedHandlers(*this, args);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Remoting::CommandlineArgs Peasant::InitialArgs()
|
||||
{
|
||||
return _initialArgs;
|
||||
}
|
||||
|
||||
}
|
||||
44
src/cascadia/Remoting/Peasant.h
Normal file
44
src/cascadia/Remoting/Peasant.h
Normal file
@@ -0,0 +1,44 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Peasant.g.h"
|
||||
#include "../cascadia/inc/cppwinrt_utils.h"
|
||||
|
||||
namespace RemotingUnitTests
|
||||
{
|
||||
class RemotingTests;
|
||||
};
|
||||
namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
{
|
||||
struct Peasant : public PeasantT<Peasant>
|
||||
{
|
||||
Peasant();
|
||||
|
||||
void AssignID(uint64_t id);
|
||||
uint64_t GetID();
|
||||
uint64_t GetPID();
|
||||
|
||||
bool ExecuteCommandline(const winrt::Microsoft::Terminal::Remoting::CommandlineArgs& args);
|
||||
|
||||
winrt::Microsoft::Terminal::Remoting::CommandlineArgs InitialArgs();
|
||||
TYPED_EVENT(WindowActivated, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(ExecuteCommandlineRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::CommandlineArgs);
|
||||
|
||||
private:
|
||||
Peasant(const uint64_t testPID);
|
||||
uint64_t _ourPID;
|
||||
|
||||
uint64_t _id{ 0 };
|
||||
|
||||
winrt::Microsoft::Terminal::Remoting::CommandlineArgs _initialArgs{ nullptr };
|
||||
|
||||
friend class RemotingUnitTests::RemotingTests;
|
||||
};
|
||||
}
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::factory_implementation
|
||||
{
|
||||
BASIC_FACTORY(Peasant);
|
||||
}
|
||||
32
src/cascadia/Remoting/Peasant.idl
Normal file
32
src/cascadia/Remoting/Peasant.idl
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Microsoft.Terminal.Remoting
|
||||
{
|
||||
|
||||
runtimeclass CommandlineArgs
|
||||
{
|
||||
CommandlineArgs();
|
||||
CommandlineArgs(String[] args, String cwd);
|
||||
|
||||
String[] Args { get; set; };
|
||||
String CurrentDirectory();
|
||||
};
|
||||
|
||||
interface IPeasant
|
||||
{
|
||||
CommandlineArgs InitialArgs { get; };
|
||||
|
||||
void AssignID(UInt64 id);
|
||||
UInt64 GetID();
|
||||
UInt64 GetPID();
|
||||
Boolean ExecuteCommandline(CommandlineArgs args);
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> WindowActivated;
|
||||
event Windows.Foundation.TypedEventHandler<Object, CommandlineArgs> ExecuteCommandlineRequested;
|
||||
};
|
||||
|
||||
[default_interface] runtimeclass Peasant : IPeasant
|
||||
{
|
||||
Peasant();
|
||||
};
|
||||
}
|
||||
120
src/cascadia/Remoting/Resources/en-US/Resources.resw
Normal file
120
src/cascadia/Remoting/Resources/en-US/Resources.resw
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
109
src/cascadia/Remoting/WindowManager.cpp
Normal file
109
src/cascadia/Remoting/WindowManager.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "pch.h"
|
||||
#include "WindowManager.h"
|
||||
#include "MonarchFactory.h"
|
||||
#include "CommandlineArgs.h"
|
||||
|
||||
#include "WindowManager.g.cpp"
|
||||
#include "../../types/inc/utils.hpp"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace ::Microsoft::Console;
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
{
|
||||
WindowManager::WindowManager()
|
||||
{
|
||||
// Register with COM as a server for the Monarch class
|
||||
_registerAsMonarch();
|
||||
// Instantiate an instance of the Monarch. This may or may not be in-proc!
|
||||
_createMonarch();
|
||||
}
|
||||
|
||||
WindowManager::~WindowManager()
|
||||
{
|
||||
// IMPORTANT! Tear down the registration as soon as we exit. If we're not a
|
||||
// real peasant window (the monarch passed our commandline to someone else),
|
||||
// then the monarch dies, we don't want our registration becoming the active
|
||||
// monarch!
|
||||
CoRevokeClassObject(_registrationHostClass);
|
||||
_registrationHostClass = 0;
|
||||
}
|
||||
|
||||
void WindowManager::ProposeCommandline(const Remoting::CommandlineArgs& args)
|
||||
{
|
||||
const bool isKing = _areWeTheKing();
|
||||
// If we're the king, we _definitely_ want to process the arguments, we were
|
||||
// launched with them!
|
||||
//
|
||||
// Otherwise, the King will tell us if we should make a new window
|
||||
_shouldCreateWindow = isKing ||
|
||||
_monarch.ProposeCommandline(args);
|
||||
|
||||
if (_shouldCreateWindow)
|
||||
{
|
||||
// If we should create a new window, then instantiate our Peasant
|
||||
// instance, and tell that peasant to handle that commandline.
|
||||
_createOurPeasant();
|
||||
|
||||
_peasant.ExecuteCommandline(args);
|
||||
}
|
||||
// Otherwise, we'll do _nothing_.
|
||||
}
|
||||
|
||||
bool WindowManager::ShouldCreateWindow()
|
||||
{
|
||||
return _shouldCreateWindow;
|
||||
}
|
||||
|
||||
void WindowManager::_registerAsMonarch()
|
||||
{
|
||||
winrt::check_hresult(CoRegisterClassObject(Monarch_clsid,
|
||||
winrt::make<::MonarchFactory>().get(),
|
||||
CLSCTX_LOCAL_SERVER,
|
||||
REGCLS_MULTIPLEUSE,
|
||||
&_registrationHostClass));
|
||||
}
|
||||
|
||||
void WindowManager::_createMonarch()
|
||||
{
|
||||
// Heads up! This only works because we're using
|
||||
// "metadata-based-marshalling" for our WinRT types. That means the OS is
|
||||
// using the .winmd file we generate to figure out the proxy/stub
|
||||
// definitions for our types automatically. This only works in the following
|
||||
// cases:
|
||||
//
|
||||
// * If we're running unpackaged: the .winmd must be a sibling of the .exe
|
||||
// * If we're running packaged: the .winmd must be in the package root
|
||||
_monarch = create_instance<Remoting::Monarch>(Monarch_clsid,
|
||||
CLSCTX_LOCAL_SERVER);
|
||||
}
|
||||
|
||||
bool WindowManager::_areWeTheKing()
|
||||
{
|
||||
const auto kingPID{ _monarch.GetPID() };
|
||||
const auto ourPID{ GetCurrentProcessId() };
|
||||
return (ourPID == kingPID);
|
||||
}
|
||||
|
||||
Remoting::IPeasant WindowManager::_createOurPeasant()
|
||||
{
|
||||
auto p = winrt::make_self<Remoting::implementation::Peasant>();
|
||||
_peasant = *p;
|
||||
_monarch.AddPeasant(_peasant);
|
||||
|
||||
// TODO:projects/5 Spawn a thread to wait on the monarch, and handle the election
|
||||
|
||||
return _peasant;
|
||||
}
|
||||
|
||||
Remoting::Peasant WindowManager::CurrentWindow()
|
||||
{
|
||||
return _peasant;
|
||||
}
|
||||
|
||||
}
|
||||
39
src/cascadia/Remoting/WindowManager.h
Normal file
39
src/cascadia/Remoting/WindowManager.h
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "WindowManager.g.h"
|
||||
#include "Peasant.h"
|
||||
#include "Monarch.h"
|
||||
#include "../cascadia/inc/cppwinrt_utils.h"
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
{
|
||||
struct WindowManager final : public WindowManagerT<WindowManager>
|
||||
{
|
||||
WindowManager();
|
||||
~WindowManager();
|
||||
|
||||
void ProposeCommandline(const winrt::Microsoft::Terminal::Remoting::CommandlineArgs& args);
|
||||
bool ShouldCreateWindow();
|
||||
|
||||
winrt::Microsoft::Terminal::Remoting::Peasant CurrentWindow();
|
||||
|
||||
private:
|
||||
bool _shouldCreateWindow{ false };
|
||||
DWORD _registrationHostClass{ 0 };
|
||||
winrt::Microsoft::Terminal::Remoting::Monarch _monarch{ nullptr };
|
||||
winrt::Microsoft::Terminal::Remoting::Peasant _peasant{ nullptr };
|
||||
|
||||
void _registerAsMonarch();
|
||||
void _createMonarch();
|
||||
bool _areWeTheKing();
|
||||
winrt::Microsoft::Terminal::Remoting::IPeasant _createOurPeasant();
|
||||
};
|
||||
}
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Remoting::factory_implementation
|
||||
{
|
||||
BASIC_FACTORY(WindowManager);
|
||||
}
|
||||
13
src/cascadia/Remoting/WindowManager.idl
Normal file
13
src/cascadia/Remoting/WindowManager.idl
Normal file
@@ -0,0 +1,13 @@
|
||||
import "Peasant.idl";
|
||||
|
||||
|
||||
namespace Microsoft.Terminal.Remoting
|
||||
{
|
||||
[default_interface] runtimeclass WindowManager
|
||||
{
|
||||
WindowManager();
|
||||
void ProposeCommandline(CommandlineArgs args);
|
||||
Boolean ShouldCreateWindow { get; };
|
||||
IPeasant CurrentWindow();
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
EXPORTS
|
||||
DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
|
||||
DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{27b5aaeb-a548-44cf-9777-f8baa32af7ae}</ProjectGuid>
|
||||
<ProjectName>Microsoft.Terminal.Remoting</ProjectName>
|
||||
<RootNamespace>Microsoft.Terminal.Remoting</RootNamespace>
|
||||
<!-- cppwinrt.build.pre.props depends on these settings: -->
|
||||
<!-- build a dll, not exe (Application) -->
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<!-- sets a bunch of Windows Universal properties -->
|
||||
<OpenConsoleUniversalApp>true</OpenConsoleUniversalApp>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
|
||||
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.pre.props" />
|
||||
<!-- ========================= XAML files ======================== -->
|
||||
<ItemGroup>
|
||||
<!-- DON'T PUT XAML FILES HERE! Put them in TerminalAppLib.vcxproj -->
|
||||
</ItemGroup>
|
||||
<!-- ========================= Headers ======================== -->
|
||||
<ItemGroup>
|
||||
<!-- Only put headers for winrt types in here. Don't put other header files
|
||||
in here - put them in the lib's vcxproj instead! -->
|
||||
<ClInclude Include="../Monarch.h" />
|
||||
<ClInclude Include="../Peasant.h" />
|
||||
</ItemGroup>
|
||||
<!-- ========================= Cpp Files ======================== -->
|
||||
<!-- Don't put source files in here - put them in the lib's vcxproj instead! -->
|
||||
<!-- ========================= idl Files ======================== -->
|
||||
<ItemGroup>
|
||||
<!-- DON'T PUT IDL FILES HERE! Put them in the lib's vcxproj -->
|
||||
</ItemGroup>
|
||||
<!-- ========================= Misc Files ======================== -->
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Microsoft.Terminal.Remoting.def" />
|
||||
</ItemGroup>
|
||||
<!-- ========================= Project References ======================== -->
|
||||
<ItemGroup>
|
||||
<!--
|
||||
the packaging project won't recurse through our dependencies, you have to
|
||||
make sure that if you add a cppwinrt dependency to any of these projects,
|
||||
you also update all the consumers
|
||||
-->
|
||||
<ProjectReference Include="$(OpenConsoleDir)src\types\lib\types.vcxproj">
|
||||
<Project>{18D09A24-8240-42D6-8CB6-236EEE820263}</Project>
|
||||
</ProjectReference>
|
||||
<!-- Reference Microsoft.Terminal.RemotingLib here, so we can use it's winmd as
|
||||
our winmd. This didn't work correctly in VS2017, you'd need to
|
||||
manually reference the lib -->
|
||||
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\Remoting\Microsoft.Terminal.RemotingLib.vcxproj">
|
||||
<Private>true</Private>
|
||||
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(OpenConsoleDir)\dep\jsoncpp\json;%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>User32.lib;WindowsApp.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<!-- Our lib contains a DllMain that we need to force the use of. -->
|
||||
<AdditionalOptions Condition="'$(Platform)'=='Win32'">/INCLUDE:_DllMain@12</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Platform)'!='Win32'">/INCLUDE:DllMain</AdditionalOptions>
|
||||
</Link>
|
||||
<Reference>
|
||||
<!-- Do not propagate microsoft.ui.xaml upwards as a private dependency. -->
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.post.props" />
|
||||
</Project>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user