Compare commits

...

21 Commits

Author SHA1 Message Date
Dustin Howett
b746661809 HAX: conpty flags 2019-11-30 10:50:03 -08:00
Dustin Howett
50dcfe1919 Replace CodepointWidthDetector's runtime table with a static one
This commit request replaces CodepointWidthDetector's
dynamically-generated map with a static constexpr one that's compiled
into the binary.

It also almost totally removes the notion of an `Invalid` width. We
definitely had gaps in our character coverage where we'd report a
character as invalid, but we'd then flatten that down to `Narrow` when
asked. By combining the not-present state and the narrow state, we get
to save a significant chunk of data.

I've tested this by feeding it all 0x10FFFF codepoints (and then some)
and making sure they 100% match the old code's outputs.

|------------------------------|---------------|----------------|
| Metric                       | Then          | Now            |
|------------------------------|---------------|----------------|
| disk space                   | 56k (`.text`) | 3k (`.rdata`)  |
| runtime memory (allocations) | 1088          | 0              |
| runtime memory (bytes)       | 51k           | ~0             |
| memory behavior              | not shared    | fully shared   |
| lookup time                  | ~31ns         | ~9ns           |
| first hit penalty            | ~170000ns     | 0ns            |
| lines of code                | 1088          | 285            |
| clarity                      | extreme       | slightly worse |
|------------------------------|---------------|----------------|

I also took a moment and cleaned up a stray boolean that we didn't need.
2019-08-08 15:51:05 -07:00
Mike Griese
1e4e12507d Stop Roaming settings (#2298)
* Stop Roaming settings

  Also migrate existing settings from RoamingState to LocalState.

  Fixes #1770.

* * de-dupe these functions
* const a pair of things

* This should be in the previous commit

* use `unique_hfile`'s

* Make some of these wil things cleaner
2019-08-08 17:02:34 -05:00
Dustin L. Howett (MSFT)
6c747c565b Update a number of our dependencies (#2301)
Microsoft.VCRTForwarders.140 1.0.0-rc -> 1.0.1-rc
Microsoft.Toolkit.Win32.UI.XamlApplication 6.0.0-preview6.* -> 6.0.0-preview7
Microsoft.Windows.CppWinRT 2.0.190605.7 -> 2.0.190730.2

wil fbcd1d2a -> e8c599bc
gsl b74b286d -> 1212beae

We're skipping the following update:
Microsoft.UI.Xaml 2.2.190611001-prerelease -> 2.2.190731001-prerelease
2019-08-07 16:43:49 -07:00
Dustin L. Howett (MSFT)
89925ebe44 inbox: reflect changes from 20h1 branch (#2310) 2019-08-07 10:58:53 -07:00
Mike Griese
8fa42e09df Add a note about the build required to the README (#2291) 2019-08-06 13:25:43 -07:00
Carlos Zamora
94e5d545aa skip a few failing tests for x86 (#2262) 2019-08-06 13:16:19 -07:00
Yves Dolce
dfb853644a use std::move() on a few more strings, other general code tidying (#1899)
* -  moving string parameter into data member instead of copying it.
-  removing noexcept from methods where an exception could be raised.
   If std::terminate() call is desired instead, I guess those should be
   left and std::move_if_noexcept() used to document the fact that it's
   on purpose.
- std::moving local variable into argument when possible.
- change maxversiontested XML element to maxVersionTested.
- used of gsl::narrow_cast where appropriate to prevent warnings.
- fixed bug in TerminalSettings::SetColorTableEntry()

Fixes #1844
2019-08-06 11:33:32 -07:00
James Holderness
ff7fdbeab4 Don't log an error message when _DoGetConsoleInput returns CONSOLE_STATUS_WAIT. (#2244) 2019-08-06 17:24:00 +00:00
Michael Niksa
a7877558f2 add exclusion directories to PR builds, not just rolling builds. (#2272) 2019-08-06 09:46:43 -07:00
Michael Niksa
aae938fc33 Attempt to clean up PCHs as we build to leave more Hosted Agent disk space (#2271)
* Cleanup PCHs as the build rolls along to leave enough space on CI agents.

* Attempt to restrict pch cleanup to only CI agents.

* Write message when objects are deleted.
2019-08-06 06:51:50 -05:00
Mike Griese
b495ad255f Create bx.cmd (#2168)
* Try createing a script to only build the current working directory

  Inspired by #2078.

  I wanted to use this for WindowsTerminal, but I can't generate the
  resources.pri from just building WindowsTerminal. Maybe @dhowett-msft has
  some ideas.

* Cleanup for PR

* fix some bugs with building outside a project directory.

* PR nits
2019-08-05 20:18:40 -05:00
Leonard Hecker
4529e46d3e Fixed Ctrl+Alt shortcuts conflicting with AltGr (#2235)
This moves the detection of AltGr keypresses in front of the shortcut
handling. This allows one to have Ctrl+Alt shortcuts, while
simultaneously being able to use the AltGr key for special characters.
2019-08-05 16:58:48 -05:00
Michael Niksa
3086671bc7 Update bot with new rules (#2259)
We added a few more rules. Update the bot doc description.
2019-08-05 11:28:05 -07:00
Michael Niksa
1b33d186f3 Update bug template with crash instructions (#2257)
It's a doc change and the x86 CI is cranky. We're looking into it.
2019-08-05 10:09:56 -07:00
PankajBhojwani
0d8f2998d6 Azure connector only shows up if available (#2195)
The default azure connector profile only shows up if a) its a release build and b) its non-ARM64

Co-Authored-By: Dustin L. Howett (MSFT) <duhowett@microsoft.com>
2019-08-02 14:41:46 -07:00
Michael Niksa
42c1e58966 Remove job object and startup suspended behavior because conhosts should clean themselves up. (#2198) 2019-08-02 13:27:34 -07:00
PankajBhojwani
0da13cdf2d Use ROW.Reset in EraseInDisplay instead of printing millions of spaces per line #2197 2019-08-01 13:19:22 -07:00
Tapasweni Pathak
f8f0798826 Added information on WxH character (#2104)
* Add information on WxH character

* Add line and separate footnote
2019-08-01 08:34:18 -05:00
James Holderness
6749ab03b8 First draft of a spec for VT52 escape sequences (#2017)
* First draft of a spec for splitting off the existing VT52 escape sequences, and extending the VT52 support.

* Make the issue ID visible on GitHub.

* Added suggested mappings for the Graphics Mode character set.

* Add escape sequences for all the commands and clarify the use of the ESC < sequence when switching back to ANSI mode.

* Add details about the differing boundary rules of the VT100 CUP command and the VT52 Direct Cursor Address command.

* Specify the identifying sequence that the Identify command should return.

* Add details of the print commands.

* Add a list of keyboard sequences that are different in the VT52 mode, and make the description of the Keypad Mode commands a little clearer.

* Add a section describing the testing needed to cover the new functionality.
2019-08-01 08:23:10 -05:00
Michael Niksa
66044ca605 Try to turn audit mode back on without building test/utilities (#2179)
* Attempt to remove all test and utility projects from audit mode (and turn it back on) to see if that keeps it within the disk space boundaries.
* drop x86 and arm configs for the test projects too.
2019-07-31 16:58:16 -07:00
65 changed files with 1205 additions and 1514 deletions

View File

@@ -26,6 +26,8 @@ This bug tracker is monitored by Windows Terminal development team and other tec
**Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**.
Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue.
If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link.
Please use this form and describe your issue, concisely but precisely, with as much detail as possible.
-->

View File

@@ -464,11 +464,8 @@ Global
{06EC74CB-9A12-429C-B551-8562EC954747}.Release|x86.ActiveCfg = Release|Win32
{06EC74CB-9A12-429C-B551-8562EC954747}.Release|x86.Build.0 = Release|Win32
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.AuditMode|ARM64.Build.0 = Release|ARM64
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.AuditMode|x64.ActiveCfg = Release|x64
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.AuditMode|x64.Build.0 = Release|x64
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.AuditMode|x86.ActiveCfg = Release|Win32
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.AuditMode|x86.Build.0 = Release|Win32
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.Debug|ARM64.ActiveCfg = Debug|ARM64
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.Debug|ARM64.Build.0 = Debug|ARM64
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.Debug|x64.ActiveCfg = Debug|x64
@@ -482,11 +479,8 @@ Global
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.Release|x86.ActiveCfg = Release|Win32
{531C23E7-4B76-4C08-8AAD-04164CB628C9}.Release|x86.Build.0 = Release|Win32
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.AuditMode|ARM64.Build.0 = Release|ARM64
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.AuditMode|x64.ActiveCfg = Release|x64
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.AuditMode|x64.Build.0 = Release|x64
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.AuditMode|x86.ActiveCfg = Release|Win32
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.AuditMode|x86.Build.0 = Release|Win32
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.Debug|ARM64.ActiveCfg = Debug|ARM64
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.Debug|ARM64.Build.0 = Debug|ARM64
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.Debug|x64.ActiveCfg = Debug|x64
@@ -500,11 +494,8 @@ Global
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.Release|x86.ActiveCfg = Release|Win32
{531C23E7-4B76-4C08-8BBD-04164CB628C9}.Release|x86.Build.0 = Release|Win32
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.AuditMode|ARM64.Build.0 = Release|ARM64
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.AuditMode|x64.ActiveCfg = Release|x64
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.AuditMode|x64.Build.0 = Release|x64
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.AuditMode|x86.ActiveCfg = Release|Win32
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.AuditMode|x86.Build.0 = Release|Win32
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.Debug|ARM64.ActiveCfg = Debug|ARM64
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.Debug|ARM64.Build.0 = Debug|ARM64
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.Debug|x64.ActiveCfg = Debug|x64
@@ -516,11 +507,8 @@ Global
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.Release|x64.Build.0 = Release|x64
{8CDB8850-7484-4EC7-B45B-181F85B2EE54}.Release|x86.ActiveCfg = Release|Win32
{12144E07-FE63-4D33-9231-748B8D8C3792}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{12144E07-FE63-4D33-9231-748B8D8C3792}.AuditMode|ARM64.Build.0 = Release|ARM64
{12144E07-FE63-4D33-9231-748B8D8C3792}.AuditMode|x64.ActiveCfg = Release|x64
{12144E07-FE63-4D33-9231-748B8D8C3792}.AuditMode|x64.Build.0 = Release|x64
{12144E07-FE63-4D33-9231-748B8D8C3792}.AuditMode|x86.ActiveCfg = Release|Win32
{12144E07-FE63-4D33-9231-748B8D8C3792}.AuditMode|x86.Build.0 = Release|Win32
{12144E07-FE63-4D33-9231-748B8D8C3792}.Debug|ARM64.ActiveCfg = Debug|ARM64
{12144E07-FE63-4D33-9231-748B8D8C3792}.Debug|ARM64.Build.0 = Debug|ARM64
{12144E07-FE63-4D33-9231-748B8D8C3792}.Debug|x64.ActiveCfg = Debug|x64
@@ -534,11 +522,8 @@ Global
{12144E07-FE63-4D33-9231-748B8D8C3792}.Release|x86.ActiveCfg = Release|Win32
{12144E07-FE63-4D33-9231-748B8D8C3792}.Release|x86.Build.0 = Release|Win32
{6AF01638-84CF-4B65-9870-484DFFCAC772}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{6AF01638-84CF-4B65-9870-484DFFCAC772}.AuditMode|ARM64.Build.0 = Release|ARM64
{6AF01638-84CF-4B65-9870-484DFFCAC772}.AuditMode|x64.ActiveCfg = Release|x64
{6AF01638-84CF-4B65-9870-484DFFCAC772}.AuditMode|x64.Build.0 = Release|x64
{6AF01638-84CF-4B65-9870-484DFFCAC772}.AuditMode|x86.ActiveCfg = Release|Win32
{6AF01638-84CF-4B65-9870-484DFFCAC772}.AuditMode|x86.Build.0 = Release|Win32
{6AF01638-84CF-4B65-9870-484DFFCAC772}.Debug|ARM64.ActiveCfg = Debug|ARM64
{6AF01638-84CF-4B65-9870-484DFFCAC772}.Debug|ARM64.Build.0 = Debug|ARM64
{6AF01638-84CF-4B65-9870-484DFFCAC772}.Debug|x64.ActiveCfg = Debug|x64
@@ -552,11 +537,8 @@ Global
{6AF01638-84CF-4B65-9870-484DFFCAC772}.Release|x86.ActiveCfg = Release|Win32
{6AF01638-84CF-4B65-9870-484DFFCAC772}.Release|x86.Build.0 = Release|Win32
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.AuditMode|ARM64.Build.0 = Release|ARM64
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.AuditMode|x64.ActiveCfg = Release|x64
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.AuditMode|x64.Build.0 = Release|x64
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.AuditMode|x86.ActiveCfg = Release|Win32
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.AuditMode|x86.Build.0 = Release|Win32
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.Debug|ARM64.ActiveCfg = Debug|ARM64
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.Debug|ARM64.Build.0 = Debug|ARM64
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.Debug|x64.ActiveCfg = Debug|x64
@@ -570,11 +552,8 @@ Global
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.Release|x86.ActiveCfg = Release|Win32
{96927B31-D6E8-4ABD-B03E-A5088A30BEBE}.Release|x86.Build.0 = Release|Win32
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.AuditMode|ARM64.Build.0 = Release|ARM64
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.AuditMode|x64.ActiveCfg = Release|x64
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.AuditMode|x64.Build.0 = Release|x64
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.AuditMode|x86.ActiveCfg = Release|Win32
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.AuditMode|x86.Build.0 = Release|Win32
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.Debug|ARM64.ActiveCfg = Debug|ARM64
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.Debug|ARM64.Build.0 = Debug|ARM64
{F210A4AE-E02A-4BFC-80BB-F50A672FE763}.Debug|x64.ActiveCfg = Debug|x64
@@ -624,11 +603,8 @@ Global
{18D09A24-8240-42D6-8CB6-236EEE820262}.Release|x86.ActiveCfg = Release|Win32
{18D09A24-8240-42D6-8CB6-236EEE820262}.Release|x86.Build.0 = Release|Win32
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.AuditMode|ARM64.ActiveCfg = Debug|Win32
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.AuditMode|ARM64.Build.0 = Debug|Win32
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.AuditMode|x64.ActiveCfg = Release|x64
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.AuditMode|x64.Build.0 = Release|x64
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.AuditMode|x86.ActiveCfg = Release|Win32
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.AuditMode|x86.Build.0 = Release|Win32
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.Debug|ARM64.ActiveCfg = Debug|Win32
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.Debug|x64.ActiveCfg = Debug|x64
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.Debug|x64.Build.0 = Debug|x64
@@ -640,11 +616,8 @@ Global
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.Release|x86.ActiveCfg = Release|Win32
{C17E1BF3-9D34-4779-9458-A8EF98CC5662}.Release|x86.Build.0 = Release|Win32
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.AuditMode|ARM64.ActiveCfg = Debug|Win32
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.AuditMode|ARM64.Build.0 = Debug|Win32
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.AuditMode|x64.ActiveCfg = Release|x64
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.AuditMode|x64.Build.0 = Release|x64
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.AuditMode|x86.ActiveCfg = Release|Win32
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.AuditMode|x86.Build.0 = Release|Win32
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.Debug|ARM64.ActiveCfg = Debug|Win32
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.Debug|x64.ActiveCfg = Debug|x64
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.Debug|x64.Build.0 = Debug|x64
@@ -656,11 +629,8 @@ Global
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.Release|x86.ActiveCfg = Release|Win32
{099193A0-1E43-4BBC-BA7F-7B351E1342DF}.Release|x86.Build.0 = Release|Win32
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.AuditMode|ARM64.Build.0 = Release|ARM64
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.AuditMode|x64.ActiveCfg = Release|x64
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.AuditMode|x64.Build.0 = Release|x64
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.AuditMode|x86.ActiveCfg = Release|Win32
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.AuditMode|x86.Build.0 = Release|Win32
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.Debug|ARM64.ActiveCfg = Debug|ARM64
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.Debug|ARM64.Build.0 = Debug|ARM64
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.Debug|x64.ActiveCfg = Debug|x64
@@ -674,11 +644,8 @@ Global
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.Release|x86.ActiveCfg = Release|Win32
{FC802440-AD6A-4919-8F2C-7701F2B38D79}.Release|x86.Build.0 = Release|Win32
{919544AC-D39B-463F-8414-3C3C67CF727C}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{919544AC-D39B-463F-8414-3C3C67CF727C}.AuditMode|ARM64.Build.0 = Release|ARM64
{919544AC-D39B-463F-8414-3C3C67CF727C}.AuditMode|x64.ActiveCfg = Release|x64
{919544AC-D39B-463F-8414-3C3C67CF727C}.AuditMode|x64.Build.0 = Release|x64
{919544AC-D39B-463F-8414-3C3C67CF727C}.AuditMode|x86.ActiveCfg = Release|Win32
{919544AC-D39B-463F-8414-3C3C67CF727C}.AuditMode|x86.Build.0 = Release|Win32
{919544AC-D39B-463F-8414-3C3C67CF727C}.Debug|ARM64.ActiveCfg = Debug|ARM64
{919544AC-D39B-463F-8414-3C3C67CF727C}.Debug|ARM64.Build.0 = Debug|ARM64
{919544AC-D39B-463F-8414-3C3C67CF727C}.Debug|x64.ActiveCfg = Debug|x64
@@ -692,11 +659,8 @@ Global
{919544AC-D39B-463F-8414-3C3C67CF727C}.Release|x86.ActiveCfg = Release|Win32
{919544AC-D39B-463F-8414-3C3C67CF727C}.Release|x86.Build.0 = Release|Win32
{ED82003F-FC5D-4E94-8B36-F480018ED064}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{ED82003F-FC5D-4E94-8B36-F480018ED064}.AuditMode|ARM64.Build.0 = Release|ARM64
{ED82003F-FC5D-4E94-8B36-F480018ED064}.AuditMode|x64.ActiveCfg = Release|x64
{ED82003F-FC5D-4E94-8B36-F480018ED064}.AuditMode|x64.Build.0 = Release|x64
{ED82003F-FC5D-4E94-8B36-F480018ED064}.AuditMode|x86.ActiveCfg = Release|Win32
{ED82003F-FC5D-4E94-8B36-F480018ED064}.AuditMode|x86.Build.0 = Release|Win32
{ED82003F-FC5D-4E94-8B36-F480018ED064}.Debug|ARM64.ActiveCfg = Debug|ARM64
{ED82003F-FC5D-4E94-8B36-F480018ED064}.Debug|ARM64.Build.0 = Debug|ARM64
{ED82003F-FC5D-4E94-8B36-F480018ED064}.Debug|x64.ActiveCfg = Debug|x64
@@ -728,11 +692,8 @@ Global
{06EC74CB-9A12-429C-B551-8532EC964726}.Release|x86.ActiveCfg = Release|Win32
{06EC74CB-9A12-429C-B551-8532EC964726}.Release|x86.Build.0 = Release|Win32
{ED82003F-FC5D-4E94-8B47-F480018ED064}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{ED82003F-FC5D-4E94-8B47-F480018ED064}.AuditMode|ARM64.Build.0 = Release|ARM64
{ED82003F-FC5D-4E94-8B47-F480018ED064}.AuditMode|x64.ActiveCfg = Release|x64
{ED82003F-FC5D-4E94-8B47-F480018ED064}.AuditMode|x64.Build.0 = Release|x64
{ED82003F-FC5D-4E94-8B47-F480018ED064}.AuditMode|x86.ActiveCfg = Release|Win32
{ED82003F-FC5D-4E94-8B47-F480018ED064}.AuditMode|x86.Build.0 = Release|Win32
{ED82003F-FC5D-4E94-8B47-F480018ED064}.Debug|ARM64.ActiveCfg = Debug|ARM64
{ED82003F-FC5D-4E94-8B47-F480018ED064}.Debug|ARM64.Build.0 = Debug|ARM64
{ED82003F-FC5D-4E94-8B47-F480018ED064}.Debug|x64.ActiveCfg = Debug|x64
@@ -764,11 +725,8 @@ Global
{06EC74CB-9A12-429C-B551-8562EC964846}.Release|x86.ActiveCfg = Release|Win32
{06EC74CB-9A12-429C-B551-8562EC964846}.Release|x86.Build.0 = Release|Win32
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.AuditMode|ARM64.Build.0 = Release|ARM64
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.AuditMode|x64.ActiveCfg = Release|x64
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.AuditMode|x64.Build.0 = Release|x64
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.AuditMode|x86.ActiveCfg = Release|Win32
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.AuditMode|x86.Build.0 = Release|Win32
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.Debug|ARM64.ActiveCfg = Debug|ARM64
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.Debug|ARM64.Build.0 = Debug|ARM64
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.Debug|x64.ActiveCfg = Debug|x64
@@ -782,11 +740,8 @@ Global
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.Release|x86.ActiveCfg = Release|Win32
{D3B92829-26CB-411A-BDA2-7F5DA3D25DD4}.Release|x86.Build.0 = Release|Win32
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.AuditMode|ARM64.Build.0 = Release|ARM64
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.AuditMode|x64.ActiveCfg = Release|x64
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.AuditMode|x64.Build.0 = Release|x64
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.AuditMode|x86.ActiveCfg = Release|Win32
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.AuditMode|x86.Build.0 = Release|Win32
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.Debug|ARM64.ActiveCfg = Debug|ARM64
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.Debug|ARM64.Build.0 = Debug|ARM64
{C7A6A5D9-60BE-4AEB-A5F6-AFE352F86CBB}.Debug|x64.ActiveCfg = Debug|x64
@@ -818,11 +773,8 @@ Global
{990F2657-8580-4828-943F-5DD657D11842}.Release|x86.ActiveCfg = Release|Win32
{990F2657-8580-4828-943F-5DD657D11842}.Release|x86.Build.0 = Release|Win32
{814DBDDE-894E-4327-A6E1-740504850098}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{814DBDDE-894E-4327-A6E1-740504850098}.AuditMode|ARM64.Build.0 = Release|ARM64
{814DBDDE-894E-4327-A6E1-740504850098}.AuditMode|x64.ActiveCfg = Release|x64
{814DBDDE-894E-4327-A6E1-740504850098}.AuditMode|x64.Build.0 = Release|x64
{814DBDDE-894E-4327-A6E1-740504850098}.AuditMode|x86.ActiveCfg = Release|Win32
{814DBDDE-894E-4327-A6E1-740504850098}.AuditMode|x86.Build.0 = Release|Win32
{814DBDDE-894E-4327-A6E1-740504850098}.Debug|ARM64.ActiveCfg = Debug|ARM64
{814DBDDE-894E-4327-A6E1-740504850098}.Debug|ARM64.Build.0 = Debug|ARM64
{814DBDDE-894E-4327-A6E1-740504850098}.Debug|x64.ActiveCfg = Debug|x64
@@ -836,11 +788,8 @@ Global
{814DBDDE-894E-4327-A6E1-740504850098}.Release|x86.ActiveCfg = Release|Win32
{814DBDDE-894E-4327-A6E1-740504850098}.Release|x86.Build.0 = Release|Win32
{814CBEEE-894E-4327-A6E1-740504850098}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{814CBEEE-894E-4327-A6E1-740504850098}.AuditMode|ARM64.Build.0 = Release|ARM64
{814CBEEE-894E-4327-A6E1-740504850098}.AuditMode|x64.ActiveCfg = Release|x64
{814CBEEE-894E-4327-A6E1-740504850098}.AuditMode|x64.Build.0 = Release|x64
{814CBEEE-894E-4327-A6E1-740504850098}.AuditMode|x86.ActiveCfg = Release|Win32
{814CBEEE-894E-4327-A6E1-740504850098}.AuditMode|x86.Build.0 = Release|Win32
{814CBEEE-894E-4327-A6E1-740504850098}.Debug|ARM64.ActiveCfg = Debug|ARM64
{814CBEEE-894E-4327-A6E1-740504850098}.Debug|ARM64.Build.0 = Debug|ARM64
{814CBEEE-894E-4327-A6E1-740504850098}.Debug|x64.ActiveCfg = Debug|x64
@@ -872,11 +821,8 @@ Global
{18D09A24-8240-42D6-8CB6-236EEE820263}.Release|x86.ActiveCfg = Release|Win32
{18D09A24-8240-42D6-8CB6-236EEE820263}.Release|x86.Build.0 = Release|Win32
{990F2657-8580-4828-943F-5DD657D11843}.AuditMode|ARM64.ActiveCfg = Release|ARM64
{990F2657-8580-4828-943F-5DD657D11843}.AuditMode|ARM64.Build.0 = Release|ARM64
{990F2657-8580-4828-943F-5DD657D11843}.AuditMode|x64.ActiveCfg = Release|x64
{990F2657-8580-4828-943F-5DD657D11843}.AuditMode|x64.Build.0 = Release|x64
{990F2657-8580-4828-943F-5DD657D11843}.AuditMode|x86.ActiveCfg = Release|Win32
{990F2657-8580-4828-943F-5DD657D11843}.AuditMode|x86.Build.0 = Release|Win32
{990F2657-8580-4828-943F-5DD657D11843}.Debug|ARM64.ActiveCfg = Debug|ARM64
{990F2657-8580-4828-943F-5DD657D11843}.Debug|ARM64.Build.0 = Debug|ARM64
{990F2657-8580-4828-943F-5DD657D11843}.Debug|x64.ActiveCfg = Debug|x64
@@ -1061,11 +1007,8 @@ Global
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.Release|x86.Build.0 = Release|x86
{2D310963-F3E0-4EE5-8AC6-FBC94DCC3310}.Release|x86.Deploy.0 = Release|x86
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.AuditMode|ARM64.Build.0 = AuditMode|ARM64
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.AuditMode|x64.ActiveCfg = AuditMode|x64
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.AuditMode|x64.Build.0 = AuditMode|x64
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.AuditMode|x86.ActiveCfg = AuditMode|Win32
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.AuditMode|x86.Build.0 = AuditMode|Win32
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.Debug|ARM64.ActiveCfg = Debug|ARM64
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.Debug|ARM64.Build.0 = Debug|ARM64
{2C2BEEF4-9333-4D05-B12A-1905CBF112F9}.Debug|x64.ActiveCfg = Debug|x64
@@ -1097,11 +1040,8 @@ Global
{EF3E32A7-5FF6-42B4-B6E2-96CD7D033F00}.Release|x86.ActiveCfg = Release|Win32
{EF3E32A7-5FF6-42B4-B6E2-96CD7D033F00}.Release|x86.Build.0 = Release|Win32
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.AuditMode|ARM64.Build.0 = AuditMode|ARM64
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.AuditMode|x64.ActiveCfg = AuditMode|x64
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.AuditMode|x64.Build.0 = AuditMode|x64
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.AuditMode|x86.ActiveCfg = AuditMode|Win32
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.AuditMode|x86.Build.0 = AuditMode|Win32
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.Debug|ARM64.ActiveCfg = Debug|ARM64
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.Debug|ARM64.Build.0 = Debug|ARM64
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.Debug|x64.ActiveCfg = Debug|x64
@@ -1115,11 +1055,8 @@ Global
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.Release|x86.ActiveCfg = Release|Win32
{34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73}.Release|x86.Build.0 = Release|Win32
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.AuditMode|ARM64.Build.0 = AuditMode|ARM64
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.AuditMode|x64.ActiveCfg = AuditMode|x64
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.AuditMode|x64.Build.0 = AuditMode|x64
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.AuditMode|x86.ActiveCfg = AuditMode|Win32
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.AuditMode|x86.Build.0 = AuditMode|Win32
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.Debug|ARM64.ActiveCfg = Debug|ARM64
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.Debug|ARM64.Build.0 = Debug|ARM64
{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}.Debug|x64.ActiveCfg = Debug|x64

View File

@@ -12,6 +12,8 @@
## Installation
_(Note: in order to run the Windows Terminal, you'll need to be running at least Windows build 18362 or higher.)_
### Microsoft Store
Download the Microsoft Terminal free from the Microsoft Store and it'll be continuously updated. Or, feel free to side-load [releases](https://github.com/microsoft/terminal/releases) from GitHub, but note they won't auto-update.

View File

@@ -13,17 +13,20 @@ pr:
branches:
include:
- master
paths:
exclude:
- doc/*
- samples/*
- tools/*
# 0.0.yyMM.dd##
# 0.0.1904.0900
name: 0.0.$(Date:yyMM).$(Date:dd)$(Rev:rr)
jobs:
# This is disabled because the build agents were running out of disk space.
# We're pursuing that in the background, but the spice must flow in the meantime.
# - template: ./templates/build-console-audit-job.yml
# parameters:
# platform: x64
- template: ./templates/build-console-audit-job.yml
parameters:
platform: x64
- template: ./templates/build-console-ci.yml
parameters:

Submodule dep/gsl updated: b74b286d5e...1212beae77

Submodule dep/wil updated: fbcd1d2abb...e8c599bca6

View File

@@ -8,9 +8,9 @@ Settings in the Windows Console Host can be a bit tricky to understand. This is
|---------------------------|-----------------------|--------------------------------------|
|`FontSize` |Coordinate (REG_DWORD) |Size of font in pixels |
|`FontFamily` |REG_DWORD |GDI Font family |
|`ScreenBufferSize` |Coordinate (REG_DWORD) |Size of the screen buffer in WxH characters |
|`ScreenBufferSize` |Coordinate (REG_DWORD) |Size of the screen buffer in WxH characters\*\* |
|`CursorSize` |REG_DWORD |Cursor height as percentage of a single character |
|`WindowSize` |Coordinate (REG_DWORD) |Initial size of the window in WxH characters |
|`WindowSize` |Coordinate (REG_DWORD) |Initial size of the window in WxH characters\*\* |
|`WindowPosition` |Coordinate (REG_DWORD) |Initial position of the window in WxH pixels (if not set, use auto-positioning) |
|`WindowAlpha` |REG_DWORD |Opacity of the window (valid range: 0x4D-0xFF) |
|`ScreenColors` |REG_DWORD |Default foreground and background colors |
@@ -39,6 +39,10 @@ Settings in the Windows Console Host can be a bit tricky to understand. This is
*: Only applies to the improved version of the Windows Console Host
**: WxH stands for Width by Height, it's the fact that things like a Window size
store the Width and Height values in the high and low word in the registry's
double word values.
## The Settings Hierarchy
Settings are persisted to a variety of locations depending on how they are modified and how the Windows Console Host was invoked:

View File

@@ -64,6 +64,12 @@ We'll be using tags, primarily, to help us understand what needs attention, what
- If an issue is filed matching a pattern that happens all the time (common duplicate phrase, obvious multiple-issues-in-one pattern)...
- Then close the issue automatically informing the opener that they can resolve the problem and reopen the issue. (See Bug/Feature templates for example situations.)
#### Help ask for Feedback Hub
- If an issue is tagged `Needs-Feedback-Hub`
- Then reply to the issue with a bit of text on asking the author to send us data with Feedback Hub and give us the link.
- And remove the `Needs-Feedback-Hub` tag
- And add the `Needs-Author-Feedback` tag
### PR Management
#### Codeflow Link *(Disabled)*
@@ -98,5 +104,14 @@ We'll be using tags, primarily, to help us understand what needs attention, what
#### Add committed fix tag for completed PRs
- When a PR is finished and there's no outstanding work left on a linked issue, add the `Resolution-Fix-Committed` label
#### Remove Needs-Second from completed PRs
- If a PR is closed and it has the `Needs-Second` tag, the bot will remove the tag.
### Release Management
When a release is created, if the PR ID number is linked inside the release description, the bot will walk through the related PR and all of its related issues and leave a message.
- PR message: "🎉{release name} {release version} has been released which incorporates this pull request.🎉
- Issue message: 🎉This issue was addressed in #{pull request ID}, which has now been successfully released as {release name} {release version}.🎉"
## Admin Panel
[Here](https://fabric-cp.azurewebsites.net/bot/)

View File

@@ -0,0 +1,255 @@
---
author: James Holderness @j4james
created on: 2019-07-17
last updated: 2019-07-28
issue id: 976
---
# VT52 Escape Sequences
## Abstract
This spec outlines the work required to split off the existing VT52 commands from the VT100 implementation, and extend the VT52 support to cover all of the core commands.
## Inspiration
The existing VT52 commands aren't currently implemented as a separate mode, so they conflict with sequences defined in the VT100 specification. This is blocking us from adding support for the VT100 Index (IND) escape sequence, which is one of the missing commands required to pass the test of cursor movements in Vttest.
## Solution Design
The basic idea is to add support for the [DECANM private mode sequence](https://vt100.net/docs/vt100-ug/chapter3.html#DECANM), which can then be used to switch from the default _ANSI_ mode, to a new _VT52_ mode. Once in _VT52_ mode, there is a separate [_Enter ANSI Mode_ sequence](https://vt100.net/docs/vt100-ug/chapter3.html#VT52ANSI) (`ESC <`) to switch back again.
In terms of implementation, there are a number of areas of the system that would need to be updated.
### The State Machine
In order to implement the VT52 compatibility mode correctly, we'll need to introduce a flag in the `StateMachine` class that indicates the mode that is currently active. When in VT52 mode, certain paths in the state diagram should not be followed - for example, you can't have CSI, OSC, or SS3 escape sequences. There would also need to be an additional state to handle VT52 parameters (for the _Direct Cursor Address_ command). These parameters take a different form to the typical VT100 parameters, as they follow the command character instead of preceding it.
It would probably be best to introduce a new dispatch method in the `IStateMachineEngine` interface to handle the parsed VT52 sequences, since the existing `ActionEscDispatch` does not support parameters (which are required for the _Direct Cursor Address_ command). I think it would also make for a cleaner implementation to have the VT52 commands separate from the VT100 code, and would likely have less impact on the performance that way.
### The Terminal Input
The escape sequences generated by the keyboard for function keys, cursor keys, and the numeric keypad, are not the same in VT52 mode as they are in ANSI mode. So there would need to be a flag in the `TerminalInput` class to keep track of the current mode, and thus be able to generate the appropriate sequences for that mode.
Technically the VT52 keyboard doesn't map directly to a typical PC keyboard, so we can't always work from the specs in deciding what sequences are required for each key. When in doubt, we should probably be trying to match the key sequences generated by XTerm. The sequences below are based on the default XTerm mappings.
**Function Keys**
The functions keys <kbd>F1</kbd> to <kbd>F4</kbd> generate a simple ESC prefix instead of SS3 (or CSI). These correspond with the four function keys on the VT100 keypad. In V52 mode they are not affected by modifiers.
Key | ANSI mode | VT52 mode
---------------|-----------|-----------
<kbd>F1</kbd> | `SS3 P` | `ESC P`
<kbd>F2</kbd> | `SS3 Q` | `ESC Q`
<kbd>F3</kbd> | `SS3 R` | `ESC R`
<kbd>F4</kbd> | `SS3 S` | `ESC S`
The function keys <kbd>F5</kbd> to <kbd>F12</kbd> generate the same sequences as they do in ANSI mode, except that they are not affected by modifiers. These correspond with a subset of the top-row functions keys on the VT220, along with the Windows <kbd>Menu</kbd> key mapping to the VT220 <kbd>DO</kbd> key.
Key | Sequence
----------------|-------------
<kbd>F5</kbd> | `CSI 1 5 ~`
<kbd>F6</kbd> | `CSI 1 7 ~`
<kbd>F7</kbd> | `CSI 1 8 ~`
<kbd>F8</kbd> | `CSI 1 9 ~`
<kbd>F9</kbd> | `CSI 2 0 ~`
<kbd>F10</kbd> | `CSI 2 1 ~`
<kbd>F11</kbd> | `CSI 2 3 ~`
<kbd>F12</kbd> | `CSI 2 4 ~`
<kbd>Menu</kbd> | `CSI 2 9 ~`
**Cursor and Editing Keys**
The cursor keys generate a simple ESC prefix instead of CSI or SS3. These correspond with the cursor keys on the VT100, except for <kbd>Home</kbd> and <kbd>End</kbd>, which are XTerm extensions. In V52 mode, they are not affected by modifiers, nor are they affected by the DECCKM _Cursor Keys_ mode.
Key | ANSI mode | VT52 mode
-----------------|-----------|-----------
<kbd>Up</kbd> | `CSI A` | `ESC A`
<kbd>Down</kbd> | `CSI B` | `ESC B`
<kbd>Right</kbd> | `CSI C` | `ESC C`
<kbd>Left</kbd> | `CSI D` | `ESC D`
<kbd>End</kbd> | `CSI F` | `ESC F`
<kbd>Home</kbd> | `CSI H` | `ESC H`
The "editing" keys generate the same sequences as they do in ANSI mode, except that they are not affected by modifiers. These correspond with a subset of the editing keys on the VT220.
Key | Sequence
----------------|-----------
<kbd>Ins</kbd> | `CSI 2 ~`
<kbd>Del</kbd> | `CSI 3 ~`
<kbd>PgUp</kbd> | `CSI 5 ~`
<kbd>PgDn</kbd> | `CSI 6 ~`
**Numeric Keypad**
With <kbd>Num Lock</kbd> disabled, most of the keys on the numeric keypad function the same as cursor keys or editing keys, but with the addition of a center <kbd>5</kbd> key. As a described above, the cursor keys generate a simple ESC prefix instead of CSI or SS3, while the editing keys remain unchanged (with the exception of modifiers).
In V52 mode, most modifiers are ignored, except for <kbd>Shift</kbd>, which is the equivalent of enabling <kbd>Num Lock</kbd> (i.e. the keys just generate their corresponding digit characters or `.`). With <kbd>Num Lock</kbd> enabled, it's the other way arround - the digits are generated by default, while <kbd>Shift</kbd> enables the cursor/editing functionality.
Key | Alias | ANSI mode | VT52 mode
-------------|-------|-----------|-----------
<kbd>.</kbd> | Del | `CSI 3 ~` | `CSI 3 ~`
<kbd>0</kbd> | Ins | `CSI 2 ~` | `CSI 2 ~`
<kbd>1</kbd> | End | `CSI F` | `ESC F`
<kbd>2</kbd> | Down | `CSI B` | `ESC B`
<kbd>3</kbd> | PgDn | `CSI 6 ~` | `CSI 6 ~`
<kbd>4</kbd> | Left | `CSI D` | `ESC D`
<kbd>4</kbd> | Clear | `CSI E` | `ESC E`
<kbd>6</kbd> | Right | `CSI C` | `ESC C`
<kbd>7</kbd> | Home | `CSI H` | `ESC H`
<kbd>8</kbd> | Up | `CSI A` | `ESC A`
<kbd>9</kbd> | PgUp | `CSI 5 ~` | `CSI 5 ~`
When the DECKPAM _Alternate/Application Keypad Mode_ is set, though, the <kbd>Shift</kbd> modifier has a different affect on the numeric keypad. The sequences generated now correspond with the VT100/V52 numeric keypad keys. In VT52 mode, these sequences are not affected by any other modifiers, and this mode only applies when <kbd>Num Lock</kbd> is disabled.
Key | Alias | ANSI mode | VT52 mode
-------------|-------|-----------|-----------
<kbd>.</kbd> | Del | `SS3 2 n` | `ESC ? n`
<kbd>0</kbd> | Ins | `SS3 2 p` | `ESC ? p`
<kbd>1</kbd> | End | `SS3 2 q` | `ESC ? q `
<kbd>2</kbd> | Down | `SS3 2 r` | `ESC ? r`
<kbd>3</kbd> | PgDn | `SS3 2 s` | `ESC ? s`
<kbd>4</kbd> | Left | `SS3 2 t` | `ESC ? t`
<kbd>4</kbd> | Clear | `SS3 2 u` | `ESC ? u`
<kbd>6</kbd> | Right | `SS3 2 v` | `ESC ? v`
<kbd>7</kbd> | Home | `SS3 2 w` | `ESC ? w`
<kbd>8</kbd> | Up | `SS3 2 x` | `ESC ? x`
<kbd>9</kbd> | PgUp | `SS3 2 y` | `ESC ? y`
When the DECKPAM _Alternate/Application Keypad Mode_ is set, the "arithmetic" keys on the numeric keypad are also affected (this includes the <kbd>Enter</kbd> key). The sequences generated again correspond with the VT100/VT52 numeric keys (more or less), but this mapping is active even without the <kbd>Shift</kbd> modifier (and in VT52 mode all other modifiers are ignored too). As above, the mode only applies when <kbd>Num Lock</kbd> is disabled.
Key | ANSI mode | VT52 mode
-----------------|-----------|-----------
<kbd>*</kbd> | `SS3 j` | `ESC ? j`
<kbd>+</kbd> | `SS3 k` | `ESC ? k`
<kbd>-</kbd> | `SS3 m` | `ESC ? m`
<kbd>/</kbd> | `SS3 o` | `ESC ? o`
<kbd>Enter</kbd> | `SS3 M` | `ESC ? M`
Note that the DECKPAM _Application Keypad Mode_ is not currently implemented in ANSI mode, so perhaps that needs to be addressed first, before trying to add support for the VT52 _Alternate Keypad Mode_.
### Changing Modes
The `_PrivateModeParamsHelper` method in the `AdaptDispatch` class would need to be extended to handle the DECANM mode parameter, and trigger a function to switch to VT52 mode. The typical pattern for this seems to be through a `PrivateXXX` method in the `ConGetSet` interface. Then the `ConhostInternalGetSet` implementation can pass that flag on to the active output buffer's `StateMachine`, and the active input buffer's `TerminalInput` instance.
Changing back from VT52 mode to ANSI mode would need to be achieved with a separate VT52 command (`ESC <`), since the VT100 CSI mode sequences would no longer be active. This would be handled in the same place as the other VT52 commands, in the `OutputStateMachineEngine`, and then passed on to the mode selection method in the `AdaptDispatch` class described above (essentially the equivalent of the DECANM private mode being set).
### Additional VT52 Commands
Most of the missing VT52 functionality can be implemented in terms of existing VT100 methods.
* The _Cursor Up_ (`ESC A`), _Cursor Down_ (`ESC B`), _Cursor Left_ (`ESC D`), and _Cursor Right_ (`ESC C`) commands are already implemented.
* The _Enter Graphics Mode_ (`ESC F`) and _Exit Graphics Mode_ (`ESC G`) commands can probably use the existing `DesignateCharset` method, although this would require a new `VTCharacterSets` option with a corresponding table of characters (see below).
* The _Reverse Line Feed_ (`ESC I`) command can use the existing `ReverseLineFeed` method.
* The _Erase to End of Display_ (`ESC J`) and _Erase to End of Line_ (`ESC K`) commands can use the existing `EraseInDisplay` and `EraseInLine` methods.
* The _Cursor Home_ (`ESC H`) and _Direct Cursor Address_ (`ESC Y`) commands can probably be implemented using the `CursorPosition` method. Technically the _Direct Cursor Address_ has different rules for the boundary conditions (the CUP command clamps out of range coordinates, while the _Direct Cursor Address_ command ignores them, judged individually - one may be ignored while the other is interpreted). Nobody seems to get that right, though, so it's probably not that big a deal.
* The _Identify_ (`ESC Z`) command may be the only one that doesn't build on existing functionality, but it should be a fairly trivial addition to the `AdaptDispatch` class. For a terminal emulating VT52, the identifying sequence should be `ESC / Z`.
* The _Enter Keypad Mode_ (`ESC =`) and _Exit Keypad Mode_ (`ESC >`) commands can use the existing `SetKeypadMode` method, assuming the `TerminalInput` class already knows to generate different sequences when in VT52 mode (as described in the _Terminal Input_ section above).
* The _Enter ANSI Mode_ (`ESC <`) command can just call through to the new mode selection method in the `AdaptDispatch` class as discussed in the _Changing Modes_ section above.
There are also a few VT52 print commands, but those are not technically part of the core command set, and considering we don't yet support any of the VT102 print commands, I think they can probably be considered out of scope for now. Briefly they are:
* _Auto Print_ on (`ESC ^`) and off (`ESC _`) commands. In auto print mode, a display line prints after you move the cursor off the line, or during an auto wrap.
* _Print Controller_ on (`ESC W`) and off (`ESC X`) commands. When enabled, the terminal transmits received characters to the printer without displaying them.
* The _Print Cursor Line_ (`ESC V`) command prints the display line with the cursor.
* The _Print Screen_ (`ESC ]`) command prints the screen (or at least the scrolling region).
I suspect most, if not all of these, would be direct equivalents of the VT102 print commands, if we ever implemented those.
### Graphic Mode Character Set
The table below lists suggested mappings for the _Graphics Mode_ character set, based on the descriptions in the [VT102 User Guide](https://vt100.net/docs/vt102-ug/table5-15.html).
Note that there is only the one _fraction numerator_ character in Unicode, so superscript digits have instead been used for the numerators 3, 5, and 7. There are also not enough _horizontal scan line_ characters (for the _bar at scan x_ characters), so each of them is used twice to cover the full range.
ASCII Character |Mapped Glyph |Unicode Value |Spec Description
----------------|---------------|---------------|----------------
_ | |U+0020 |Blank
` | |U+0020 |Reserved
a |█ |U+2588 |Solid rectangle
b |⅟ |U+215F |1/
c |³ |U+00B3 |3/
d |⁵ |U+2075 |5/
e |⁷ |U+2077 |7/
f |° |U+00B0 |Degrees
g |± |U+00B1 |Plus or minus
h |→ |U+2192 |Right arrow
i |… |U+2026 |Ellipsis (dots)
j |÷ |U+00F7 |Divide by
k |↓ |U+2193 |Down arrow
l |⎺ |U+23BA |Bar at scan 0
m |⎺ |U+23BA |Bar at scan 1
n |⎻ |U+23BB |Bar at scan 2
o |⎻ |U+23BB |Bar at scan 3
p |⎼ |U+23BC |Bar at scan 4
q |⎼ |U+23BC |Bar at scan 5
r |⎽ |U+23BD |Bar at scan 6
s |⎽ |U+23BD |Bar at scan 7
t |₀ |U+2080 |Subscript 0
u |₁ |U+2081 |Subscript 1
v |₂ |U+2082 |Subscript 2
w |₃ |U+2083 |Subscript 3
x |₄ |U+2084 |Subscript 4
y |₅ |U+2085 |Subscript 5
z |₆ |U+2086 |Subscript 6
{ |₇ |U+2087 |Subscript 7
\| |₈ |U+2088 |Subscript 8
} |₉ |U+2089 |Subscript 9
\~ |¶ |U+00B6 |Paragraph
### Testing
A simple unit test will need to be added to the `AdapterTest` class, to confirm that calls to toggle between the ANSI and VT52 modes in the `AdaptDispatch` class are correctly forwarded to the corresponding `PrivateXXX` handler in the `ConGetSet` interface.
The majority of the testing would be handled in the `StateMachineExternalTest` class though. These tests would confirm that the various VT52 sequences trigger the expected methods in the `ITermDispatch` interface when VT52 Mode is enabled, and also that they don't do anything when in ANSI mode.
There shouldn't really be any need for additional tests in the `ScreenBufferTests` class, since we're relying on existing VT100 functionality which should already be tested there.
For fuzzing support, we'll need to add the DECANM option to the `GeneratePrivateModeParamToken` method in the `VTCommandFuzzer` class, and also probably add two additional token generator methods - one specifically for the _Direct Cursor Address_ command, which requires parameters, and another to handle the remaining parameterless commands.
In terms of manual testing, it can be useful to run the _Test of VT52 mode_ option in Vttest, and confirm that everything looks correct there. It's also worth going through some of the options in the The _Test of keyboard_ section, since those tests aren't only intended for the later VT models - they do cover the VT52 keyboard as well.
## UI/UX Design
There is no additional UI associated with this feature.
## Capabilities
### Accessibility
This should not impact accessibility any more than the existing escape sequences.
### Security
This should not introduce any new security issues.
### Reliability
This should not introduce any new reliability issues.
### Compatibility
This could be a breaking change for code that relies on the few existing VT52 commands being available without a mode change. However, that functionality is non-standard, and has not been around for that long. There is almost certainly more benefit in being able to implement the missing VT100 functionality than there is in retaining that non-standard behaviour.
### Performance, Power, and Efficiency
The additional mode flags and associated processing in the `StateMachine` and `TerminalInput` classes could have some performance impact, but that is unlikely to be significant.
## Potential Issues
The only negative impacts I can think of would be the potential for breaking changes, and the possible impact on performance, as discussed in the _Compatibility_ and _Performance_ sections above. But as with any new code, there is always the possibility of new bugs being introduced as well.
## Future considerations
As mentioned in the _Inspiration_ section, having the VT52 functionality isolated with a new mode would enable us to implement the VT100 Index (IND) escape sequence, which currently conflicts with the VT52 _Cursor Left_ command.
## Resources
* [VT52 Mode Control Sequences](https://vt100.net/docs/vt100-ug/chapter3.html#S3.3.5)
* [VT100 ANSI/VT52 Mode (DECANM)](https://vt100.net/docs/vt100-ug/chapter3.html#DECANM)
* [VT100 Index Sequence (IND)](https://vt100.net/docs/vt100-ug/chapter3.html#IND)
* [VTTEST Test Utility](https://invisible-island.net/vttest/)
* [DEC STD 070 Video Systems Reference Manual](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381)

View File

@@ -313,7 +313,8 @@ namespace winrt::TerminalApp::implementation
auto keyBindings = _settings->GetKeybindings();
const GUID defaultProfileGuid = _settings->GlobalSettings().GetDefaultProfile();
for (int profileIndex = 0; profileIndex < _settings->GetProfiles().size(); profileIndex++)
auto const profileCount = gsl::narrow_cast<int>(_settings->GetProfiles().size()); // the number of profiles should not change in the loop for this to work
for (int profileIndex = 0; profileIndex < profileCount; profileIndex++)
{
const auto& profile = _settings->GetProfiles()[profileIndex];
auto profileMenuItem = Controls::MenuFlyoutItem{};
@@ -794,7 +795,7 @@ namespace winrt::TerminalApp::implementation
const auto profiles = _settings->GetProfiles();
// If we don't have that many profiles, then do nothing.
if (realIndex >= profiles.size())
if (realIndex >= gsl::narrow<decltype(realIndex)>(profiles.size()))
{
return;
}
@@ -1082,7 +1083,7 @@ namespace winrt::TerminalApp::implementation
// - Sets focus to the desired tab.
void App::_SelectTab(const int tabIndex)
{
if (tabIndex >= 0 && tabIndex < _tabs.size())
if (tabIndex >= 0 && tabIndex < gsl::narrow_cast<decltype(tabIndex)>(_tabs.size()))
{
_SetFocusedTabIndex(tabIndex);
}
@@ -1224,12 +1225,12 @@ namespace winrt::TerminalApp::implementation
if (tabIndexFromControl == focusedTabIndex)
{
if (focusedTabIndex >= _tabs.size())
auto const tabCount = gsl::narrow_cast<decltype(focusedTabIndex)>(_tabs.size());
if (focusedTabIndex >= tabCount)
{
focusedTabIndex = static_cast<int>(_tabs.size()) - 1;
focusedTabIndex = tabCount - 1;
}
if (focusedTabIndex < 0)
else if (focusedTabIndex < 0)
{
focusedTabIndex = 0;
}
@@ -1461,20 +1462,18 @@ namespace winrt::TerminalApp::implementation
{
const auto* const profile = _settings->FindProfile(profileGuid);
TerminalConnection::ITerminalConnection connection{ nullptr };
// The Azure connection has a boost dependency, and boost does not support ARM64
// so we make sure that we do not try to compile the Azure connection code if we are in ARM64 (we would get build errors otherwise)
GUID connectionType{ 0 };
if (profile->HasConnectionType())
{
connectionType = profile->GetConnectionType();
}
#ifndef _M_ARM64
if (connectionType == AzureConnectionType)
if (profile->HasConnectionType() && profile->GetConnectionType() == AzureConnectionType && TerminalConnection::AzureConnection::IsAzureConnectionAvailable())
{
connection = TerminalConnection::AzureConnection(settings.InitialRows(), settings.InitialCols());
}
else
#endif
{
connection = TerminalConnection::ConhostConnection(settings.Commandline(), settings.StartingDirectory(), settings.InitialRows(), settings.InitialCols(), winrt::guid());
}

View File

@@ -9,6 +9,7 @@
#include "CascadiaSettings.h"
#include "../../types/inc/utils.hpp"
#include "../../inc/DefaultSettings.h"
#include "winrt/Microsoft.Terminal.TerminalConnection.h"
using namespace winrt::Microsoft::Terminal::Settings;
using namespace ::TerminalApp;
@@ -239,26 +240,13 @@ void CascadiaSettings::_CreateDefaultProfiles()
powershellProfile.SetDefaultBackground(POWERSHELL_BLUE);
powershellProfile.SetUseAcrylic(false);
// The Azure connection has a boost dependency, and boost does not support ARM64
// so we don't create a default profile for the Azure cloud shell if we're in ARM64
#ifndef _M_ARM64
auto azureCloudShellProfile{ _CreateDefaultProfile(L"Azure Cloud Shell") };
azureCloudShellProfile.SetCommandline(L"Azure");
azureCloudShellProfile.SetStartingDirectory(DEFAULT_STARTING_DIRECTORY);
azureCloudShellProfile.SetColorScheme({ L"Solarized Dark" });
azureCloudShellProfile.SetAcrylicOpacity(0.85);
azureCloudShellProfile.SetUseAcrylic(true);
azureCloudShellProfile.SetCloseOnExit(false);
azureCloudShellProfile.SetConnectionType(AzureConnectionType);
#endif
// If the user has installed PowerShell Core, we add PowerShell Core as a default.
// PowerShell Core default folder is "%PROGRAMFILES%\PowerShell\[Version]\".
std::filesystem::path psCoreCmdline{};
if (_isPowerShellCoreInstalled(psCoreCmdline))
{
auto pwshProfile{ _CreateDefaultProfile(L"PowerShell Core") };
pwshProfile.SetCommandline(psCoreCmdline);
pwshProfile.SetCommandline(std::move(psCoreCmdline));
pwshProfile.SetStartingDirectory(DEFAULT_STARTING_DIRECTORY);
pwshProfile.SetColorScheme({ L"Campbell" });
@@ -274,9 +262,20 @@ void CascadiaSettings::_CreateDefaultProfiles()
_profiles.emplace_back(powershellProfile);
_profiles.emplace_back(cmdProfile);
#ifndef _M_ARM64
_profiles.emplace_back(azureCloudShellProfile);
#endif
if (winrt::Microsoft::Terminal::TerminalConnection::AzureConnection::IsAzureConnectionAvailable())
{
auto azureCloudShellProfile{ _CreateDefaultProfile(L"Azure Cloud Shell") };
azureCloudShellProfile.SetCommandline(L"Azure");
azureCloudShellProfile.SetStartingDirectory(DEFAULT_STARTING_DIRECTORY);
azureCloudShellProfile.SetColorScheme({ L"Vintage" });
azureCloudShellProfile.SetAcrylicOpacity(0.6);
azureCloudShellProfile.SetUseAcrylic(true);
azureCloudShellProfile.SetCloseOnExit(false);
azureCloudShellProfile.SetConnectionType(AzureConnectionType);
_profiles.emplace_back(azureCloudShellProfile);
}
try
{
_AppendWslProfiles(_profiles);

View File

@@ -47,7 +47,7 @@ public:
Json::Value ToJson() const;
static std::unique_ptr<CascadiaSettings> FromJson(const Json::Value& json);
static std::wstring GetSettingsPath();
static std::wstring GetSettingsPath(const bool useRoamingPath = false);
const Profile* FindProfile(GUID profileGuid) const noexcept;

View File

@@ -261,25 +261,77 @@ void CascadiaSettings::_WriteSettings(const std::string_view content)
// from reading the file
std::optional<std::string> CascadiaSettings::_ReadSettings()
{
auto pathToSettingsFile{ CascadiaSettings::GetSettingsPath() };
const auto hFile = CreateFileW(pathToSettingsFile.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
const auto pathToSettingsFile{ CascadiaSettings::GetSettingsPath() };
wil::unique_hfile hFile{ CreateFileW(pathToSettingsFile.c_str(),
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
nullptr) };
if (!hFile)
{
// If the file doesn't exist, that's fine. Just log the error and return
// nullopt - we'll create the defaults.
LOG_LAST_ERROR();
return std::nullopt;
// GH#1770 - Now that we're _not_ roaming our settings, do a quick check
// to see if there's a file in the Roaming App data folder. If there is
// a file there, but not in the LocalAppData, it's likely the user is
// upgrading from a version of the terminal from before this change.
// We'll try moving the file from the Roaming app data folder to the
// local appdata folder.
const auto pathToRoamingSettingsFile{ CascadiaSettings::GetSettingsPath(true) };
wil::unique_hfile hRoamingFile{ CreateFileW(pathToRoamingSettingsFile.c_str(),
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
nullptr) };
if (hRoamingFile)
{
// Close the file handle, move it, and re-open the file in its new location.
hRoamingFile.reset();
// Note: We're unsure if this is unsafe. Theoretically it's possible
// that two instances of the app will try and move the settings file
// simultaneously. We don't know what might happen in that scenario,
// but we're also not sure how to safely lock the file to prevent
// that from ocurring.
THROW_LAST_ERROR_IF(!MoveFile(pathToRoamingSettingsFile.c_str(),
pathToSettingsFile.c_str()));
hFile.reset(CreateFileW(pathToSettingsFile.c_str(),
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
nullptr));
// hFile shouldn't be INVALID. That's unexpected - We just moved the
// file, we should be able to open it. Throw the error so we can get
// some information here.
THROW_LAST_ERROR_IF(!hFile);
}
else
{
// If the roaming file didn't exist, and the local file doesn't exist,
// that's fine. Just log the error and return nullopt - we'll
// create the defaults.
LOG_LAST_ERROR();
return std::nullopt;
}
}
// fileSize is in bytes
const auto fileSize = GetFileSize(hFile, nullptr);
const auto fileSize = GetFileSize(hFile.get(), nullptr);
THROW_LAST_ERROR_IF(fileSize == INVALID_FILE_SIZE);
auto utf8buffer = std::make_unique<char[]>(fileSize);
DWORD bytesRead = 0;
THROW_LAST_ERROR_IF(!ReadFile(hFile, utf8buffer.get(), fileSize, &bytesRead, nullptr));
CloseHandle(hFile);
THROW_LAST_ERROR_IF(!ReadFile(hFile.get(), utf8buffer.get(), fileSize, &bytesRead, nullptr));
// convert buffer to UTF-8 string
std::string utf8string(utf8buffer.get(), fileSize);
@@ -289,25 +341,27 @@ std::optional<std::string> CascadiaSettings::_ReadSettings()
// function Description:
// - Returns the full path to the settings file, either within the application
// package, or in its unpackaged location.
// package, or in its unpackaged location. This path is under the "Local
// AppData" folder, so it _doesn't_ roam to other machines.
// - If the application is unpackaged,
// the file will end up under e.g. C:\Users\admin\AppData\Roaming\Microsoft\Windows Terminal\profiles.json
// the file will end up under e.g. C:\Users\admin\AppData\Local\Microsoft\Windows Terminal\profiles.json
// Arguments:
// - <none>
// Return Value:
// - the full path to the settings file
std::wstring CascadiaSettings::GetSettingsPath()
std::wstring CascadiaSettings::GetSettingsPath(const bool useRoamingPath)
{
wil::unique_cotaskmem_string roamingAppDataFolder;
wil::unique_cotaskmem_string localAppDataFolder;
// KF_FLAG_FORCE_APP_DATA_REDIRECTION, when engaged, causes SHGet... to return
// the new AppModel paths (Packages/xxx/RoamingState, etc.) for standard path requests.
// Using this flag allows us to avoid Windows.Storage.ApplicationData completely.
if (FAILED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_FORCE_APP_DATA_REDIRECTION, 0, &roamingAppDataFolder)))
const auto knowFolderId = useRoamingPath ? FOLDERID_RoamingAppData : FOLDERID_LocalAppData;
if (FAILED(SHGetKnownFolderPath(knowFolderId, KF_FLAG_FORCE_APP_DATA_REDIRECTION, 0, &localAppDataFolder)))
{
THROW_LAST_ERROR();
}
std::filesystem::path parentDirectoryForSettingsFile{ roamingAppDataFolder.get() };
std::filesystem::path parentDirectoryForSettingsFile{ localAppDataFolder.get() };
if (!_IsPackaged())
{

View File

@@ -66,7 +66,8 @@ void ColorScheme::ApplyScheme(TerminalSettings terminalSettings) const
terminalSettings.DefaultForeground(_defaultForeground);
terminalSettings.DefaultBackground(_defaultBackground);
for (int i = 0; i < _table.size(); i++)
auto const tableCount = gsl::narrow_cast<int>(_table.size());
for (int i = 0; i < tableCount; i++)
{
terminalSettings.SetColorTableEntry(i, _table[i]);
}

View File

@@ -150,7 +150,8 @@ TerminalSettings Profile::CreateTerminalSettings(const std::vector<ColorScheme>&
TerminalSettings terminalSettings{};
// Fill in the Terminal Setting's CoreSettings from the profile
for (int i = 0; i < _colorTable.size(); i++)
auto const colorTableCount = gsl::narrow_cast<int>(_colorTable.size());
for (int i = 0; i < colorTableCount; i++)
{
terminalSettings.SetColorTableEntry(i, _colorTable[i]);
}
@@ -489,12 +490,12 @@ Profile Profile::FromJson(const Json::Value& json)
void Profile::SetFontFace(std::wstring fontFace) noexcept
{
_fontFace = fontFace;
_fontFace = std::move(fontFace);
}
void Profile::SetColorScheme(std::optional<std::wstring> schemeName) noexcept
{
_schemeName = schemeName;
_schemeName = std::move(schemeName);
}
void Profile::SetAcrylicOpacity(double opacity) noexcept
@@ -504,17 +505,17 @@ void Profile::SetAcrylicOpacity(double opacity) noexcept
void Profile::SetCommandline(std::wstring cmdline) noexcept
{
_commandline = cmdline;
_commandline = std::move(cmdline);
}
void Profile::SetStartingDirectory(std::wstring startingDirectory) noexcept
{
_startingDirectory = startingDirectory;
_startingDirectory = std::move(startingDirectory);
}
void Profile::SetName(std::wstring name) noexcept
{
_name = name;
_name = std::move(name);
}
void Profile::SetUseAcrylic(bool useAcrylic) noexcept
@@ -553,15 +554,16 @@ bool Profile::HasIcon() const noexcept
// - tabTitle: the tab title
void Profile::SetTabTitle(std::wstring tabTitle) noexcept
{
_tabTitle = tabTitle;
_tabTitle = std::move(tabTitle);
}
// Method Description:
// - Sets this profile's icon path.
// Arguments:
// - path: the path
void Profile::SetIconPath(std::wstring_view path) noexcept
void Profile::SetIconPath(std::wstring_view path)
{
static_assert(!noexcept(_icon.emplace(path)));
_icon.emplace(path);
}

View File

@@ -56,7 +56,7 @@ public:
bool HasIcon() const noexcept;
std::wstring_view GetIconPath() const noexcept;
void SetIconPath(std::wstring_view path) noexcept;
void SetIconPath(std::wstring_view path);
bool GetCloseOnExit() const noexcept;

View File

@@ -253,7 +253,7 @@
<Native-Platform Condition="'$(Platform)' == 'Win32'">x86</Native-Platform>
<Native-Platform Condition="'$(Platform)' != 'Win32'">$(Platform)</Native-Platform>
<_MUXRoot>$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\</_MUXRoot>
<_MUXAppRoot>$(OpenConsoleDir)\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview6.2\</_MUXAppRoot>
<_MUXAppRoot>$(OpenConsoleDir)\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview7\</_MUXAppRoot>
</PropertyGroup>
<ItemGroup>
<!-- Microsoft.UI.XAML -->
@@ -283,7 +283,7 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\build\native\Microsoft.UI.Xaml.targets'))" />
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview6.2\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview6.2\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets'))" />
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview7\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview7\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets'))" />
</Target>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Toolkit.Win32.UI.XamlApplication" version="6.0.0-preview6.2" targetFramework="native" />
<package id="Microsoft.Toolkit.Win32.UI.XamlApplication" version="6.0.0-preview7" targetFramework="native" />
<package id="Microsoft.UI.Xaml" version="2.2.190611001-prerelease" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.190605.7" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.190730.2" targetFramework="native" />
</packages>

View File

@@ -0,0 +1,50 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "pch.h"
#include "AzureConnection-ARM64.h"
#include "AzureConnection.g.cpp"
namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
{
bool AzureConnection::IsAzureConnectionAvailable()
{
return false;
}
AzureConnection::AzureConnection(uint32_t rows, uint32_t columns)
{
throw hresult_not_implemented();
}
winrt::event_token AzureConnection::TerminalOutput(Microsoft::Terminal::TerminalConnection::TerminalOutputEventArgs const& handler)
{
throw hresult_not_implemented();
}
void AzureConnection::TerminalOutput(winrt::event_token const& token)
{
throw hresult_not_implemented();
}
winrt::event_token AzureConnection::TerminalDisconnected(Microsoft::Terminal::TerminalConnection::TerminalDisconnectedEventArgs const& handler)
{
throw hresult_not_implemented();
}
void AzureConnection::TerminalDisconnected(winrt::event_token const& token)
{
throw hresult_not_implemented();
}
void AzureConnection::Start()
{
throw hresult_not_implemented();
}
void AzureConnection::WriteInput(hstring const& data)
{
throw hresult_not_implemented();
}
void AzureConnection::Resize(uint32_t rows, uint32_t columns)
{
throw hresult_not_implemented();
}
void AzureConnection::Close()
{
throw hresult_not_implemented();
}
}

View File

@@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#pragma once
#include "AzureConnection.g.h"
#include "pch.h"
namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
{
struct AzureConnection : AzureConnectionT<AzureConnection>
{
AzureConnection() = default;
AzureConnection(uint32_t rows, uint32_t columns);
static bool IsAzureConnectionAvailable();
winrt::event_token TerminalOutput(Microsoft::Terminal::TerminalConnection::TerminalOutputEventArgs const& handler);
void TerminalOutput(winrt::event_token const& token);
winrt::event_token TerminalDisconnected(Microsoft::Terminal::TerminalConnection::TerminalDisconnectedEventArgs const& handler);
void TerminalDisconnected(winrt::event_token const& token);
void Start();
void WriteInput(hstring const& data);
void Resize(uint32_t rows, uint32_t columns);
void Close();
};
}
namespace winrt::Microsoft::Terminal::TerminalConnection::factory_implementation
{
struct AzureConnection : AzureConnectionT<AzureConnection, implementation::AzureConnection>
{
};
}

View File

@@ -25,6 +25,15 @@ using namespace winrt::Windows::Security::Credentials;
namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
{
// This file only builds for non-ARM64 so we don't need to check that here
// This function exists because the clientID only gets added by the release pipelines
// and is not available on local builds, so we want to be able to make sure we don't
// try to make an Azure connection if its a local build
bool AzureConnection::IsAzureConnectionAvailable()
{
return (AzureClientID != L"0");
}
AzureConnection::AzureConnection(const uint32_t initialRows, const uint32_t initialCols) :
_initialRows{ initialRows },
_initialCols{ initialCols }

View File

@@ -15,6 +15,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
{
struct AzureConnection : AzureConnectionT<AzureConnection>
{
static bool IsAzureConnectionAvailable();
AzureConnection(const uint32_t rows, const uint32_t cols);
winrt::event_token TerminalOutput(TerminalConnection::TerminalOutputEventArgs const& handler);

View File

@@ -7,6 +7,8 @@ namespace Microsoft.Terminal.TerminalConnection
{
[default_interface] runtimeclass AzureConnection : ITerminalConnection
{
static Boolean IsAzureConnectionAvailable();
AzureConnection(UInt32 rows, UInt32 columns);
};

View File

@@ -79,35 +79,6 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
extraEnvVars.emplace(L"WT_SESSION", pwszGuid);
}
THROW_IF_FAILED(
CreateConPty(cmdline,
startingDirectory,
static_cast<short>(_initialCols),
static_cast<short>(_initialRows),
&_inPipe,
&_outPipe,
&_signalPipe,
&_piConhost,
CREATE_SUSPENDED,
extraEnvVars));
_hJob.reset(CreateJobObjectW(nullptr, nullptr));
THROW_LAST_ERROR_IF_NULL(_hJob);
// We want the conhost and all associated descendant processes
// to be terminated when the tab is closed. GUI applications
// spawned from the shell tend to end up in their own jobs.
JOBOBJECT_EXTENDED_LIMIT_INFORMATION jobExtendedInformation{};
jobExtendedInformation.BasicLimitInformation.LimitFlags =
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
THROW_IF_WIN32_BOOL_FALSE(SetInformationJobObject(_hJob.get(),
JobObjectExtendedLimitInformation,
&jobExtendedInformation,
sizeof(jobExtendedInformation)));
THROW_IF_WIN32_BOOL_FALSE(AssignProcessToJobObject(_hJob.get(), _piConhost.hProcess));
// Create our own output handling thread
// Each connection needs to make sure to drain the output from its backing host.
_hOutputThread.reset(CreateThread(nullptr,
@@ -119,8 +90,17 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
THROW_LAST_ERROR_IF_NULL(_hOutputThread);
// Wind up the conhost! We only do this after we've got everything in place.
THROW_LAST_ERROR_IF(-1 == ResumeThread(_piConhost.hThread));
THROW_IF_FAILED(
CreateConPty(cmdline,
startingDirectory,
static_cast<short>(_initialCols),
static_cast<short>(_initialRows),
&_inPipe,
&_outPipe,
&_signalPipe,
&_piConhost,
0,
extraEnvVars));
_connected = true;
}

View File

@@ -24,6 +24,7 @@
<ItemGroup>
<ClInclude Include="AzureClientID.h" Condition="'$(Platform)'!='ARM64'" />
<ClInclude Include="AzureConnection.h" Condition="'$(Platform)'!='ARM64'" />
<ClInclude Include="AzureConnection-ARM64.h" Condition="'$(Platform)'=='ARM64'" />
<ClInclude Include="AzureConnectionStrings.h" Condition="'$(Platform)'!='ARM64'" />
<ClInclude Include="pch.h" />
<ClInclude Include="ConhostConnection.h">
@@ -35,6 +36,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="AzureConnection.cpp" Condition="'$(Platform)'!='ARM64'" />
<ClCompile Include="AzureConnection-ARM64.cpp" Condition="'$(Platform)'=='ARM64'" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
@@ -50,7 +52,7 @@
<Midl Include="ITerminalConnection.idl" />
<Midl Include="ConhostConnection.idl" />
<Midl Include="EchoConnection.idl" />
<Midl Include="AzureConnection.idl" Condition="'$(Platform)'!='ARM64'" />
<Midl Include="AzureConnection.idl" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.190605.7" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.190730.2" targetFramework="native" />
<package id="vcpkg-cpprestsdk" version="2.10.0" targetFramework="native" />
</packages>

View File

@@ -619,35 +619,41 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
}
const auto modifiers = _GetPressedModifierKeys();
const auto vkey = static_cast<WORD>(e.OriginalKey());
// AltGr key combinations don't always contain any meaningful,
// pretranslated unicode character during WM_KEYDOWN.
// E.g. on a German keyboard AltGr+Q should result in a "@" character,
// but actually results in "Q" with Alt and Ctrl modifier states.
// By returning false though, we can abort handling this WM_KEYDOWN
// event and let the WM_CHAR handler kick in, which will be
// provided with an appropriate unicode character.
//
// GH#2235: Make sure to handle AltGr before trying keybindings,
// so Ctrl+Alt keybindings won't eat an AltGr keypress.
if (modifiers.IsAltGrPressed())
{
_HandleVoidKeyEvent();
e.Handled(false);
return;
}
const auto vkey = static_cast<WORD>(e.OriginalKey());
bool handled = false;
auto bindings = _settings.KeyBindings();
if (bindings)
{
KeyChord chord(
handled = bindings.TryKeyChord({
modifiers.IsCtrlPressed(),
modifiers.IsAltPressed(),
modifiers.IsShiftPressed(),
vkey);
handled = bindings.TryKeyChord(chord);
vkey,
});
}
if (!handled)
{
_terminal->ClearSelection();
// If the terminal translated the key, mark the event as handled.
// This will prevent the system from trying to get the character out
// of it and sending us a CharacterRecieved event.
handled = _terminal->SendKeyEvent(vkey, modifiers);
if (_cursorTimer.has_value())
{
// Manually show the cursor when a key is pressed. Restarting
// the timer prevents flickering.
_terminal->SetCursorVisible(true);
_cursorTimer.value().Start();
}
handled = _TrySendKeyEvent(vkey, modifiers);
}
// Manually prevent keyboard navigation with tab. We want to send tab to
@@ -661,6 +667,45 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
e.Handled(handled);
}
// Method Description:
// - Some key events cannot be handled (e.g. AltGr combinations) and are
// delegated to the character handler. Just like with _TrySendKeyEvent(),
// the character handler counts on us though to:
// - Clears the current selection.
// - Makes the cursor briefly visible during typing.
void TermControl::_HandleVoidKeyEvent()
{
_TrySendKeyEvent(0, {});
}
// Method Description:
// - Send this particular key event to the terminal.
// See Terminal::SendKeyEvent for more information.
// - Clears the current selection.
// - Makes the cursor briefly visible during typing.
// Arguments:
// - vkey: The vkey of the key pressed.
// - states: The Microsoft::Terminal::Core::ControlKeyStates representing the modifier key states.
bool TermControl::_TrySendKeyEvent(WORD vkey, const ControlKeyStates modifiers)
{
_terminal->ClearSelection();
// If the terminal translated the key, mark the event as handled.
// This will prevent the system from trying to get the character out
// of it and sending us a CharacterRecieved event.
const auto handled = vkey ? _terminal->SendKeyEvent(vkey, modifiers) : true;
if (_cursorTimer.has_value())
{
// Manually show the cursor when a key is pressed. Restarting
// the timer prevents flickering.
_terminal->SetCursorVisible(true);
_cursorTimer.value().Start();
}
return handled;
}
// Method Description:
// - handle a mouse click event. Begin selection process.
// Arguments:

View File

@@ -164,6 +164,8 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
static Windows::UI::Xaml::Thickness _ParseThicknessFromPadding(const hstring padding);
::Microsoft::Terminal::Core::ControlKeyStates _GetPressedModifierKeys() const;
void _HandleVoidKeyEvent();
bool _TrySendKeyEvent(WORD vkey, ::Microsoft::Terminal::Core::ControlKeyStates modifiers);
const COORD _GetTerminalPosition(winrt::Windows::Foundation::Point cursorPosition);
const unsigned int _NumberOfClicks(winrt::Windows::Foundation::Point clickPos, Timestamp clickTime);

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.190605.7" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.190730.2" targetFramework="native" />
</packages>

View File

@@ -210,18 +210,6 @@ bool Terminal::SendKeyEvent(const WORD vkey, const ControlKeyStates states)
_NotifyScrollEvent();
}
// AltGr key combinations don't always contain any meaningful,
// pretranslated unicode character during WM_KEYDOWN.
// E.g. on a German keyboard AltGr+Q should result in a "@" character,
// but actually results in "Q" with Alt and Ctrl modifier states.
// By returning false though, we can abort handling this WM_KEYDOWN
// event and let the WM_CHAR handler kick in, which will be
// provided with an appropriate unicode character.
if (states.IsAltGrPressed())
{
return false;
}
// Alt key sequences _require_ the char to be in the keyevent. If alt is
// pressed, manually get the character that's being typed, and put it in the
// KeyEvent.

View File

@@ -337,11 +337,9 @@ bool Terminal::EraseInDisplay(const DispatchTypes::EraseType eraseType)
// and we have to make sure we erase that text
auto eraseStart = _mutableViewport.Height();
auto eraseEnd = _buffer->GetLastNonSpaceCharacter(_mutableViewport).Y;
auto eraseIter = OutputCellIterator(UNICODE_SPACE, _buffer->GetCurrentAttributes(), _mutableViewport.RightInclusive() * (eraseEnd - eraseStart + 1));
for (SHORT i = eraseStart; i <= eraseEnd; i++)
{
COORD erasePos{ 0, i };
_buffer->Write(eraseIter, erasePos);
_buffer->GetRowByOffset(i).Reset(_buffer->GetCurrentAttributes());
}
// Reset the scroll offset now because there's nothing for the user to 'scroll' to

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.190605.7" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.190730.2" targetFramework="native" />
</packages>

View File

@@ -64,7 +64,8 @@ namespace winrt::Microsoft::Terminal::Settings::implementation
void TerminalSettings::SetColorTableEntry(int32_t index, uint32_t value)
{
THROW_HR_IF(E_INVALIDARG, index > _colorTable.size());
auto const colorTableCount = gsl::narrow_cast<decltype(index)>(_colorTable.size());
THROW_HR_IF(E_INVALIDARG, index >= colorTableCount);
_colorTable[index] = value;
}

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.190605.7" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.190730.2" targetFramework="native" />
</packages>

View File

@@ -181,6 +181,11 @@ namespace TerminalCoreUnitTests
TEST_METHOD(SelectWideGlyph_Trailing)
{
#ifdef _X86_
Log::Comment(L"This test is unreliable on x86 but is fine elsewhere. Disabled on x86.");
Log::Result(WEX::Logging::TestResults::Skipped);
return;
#else
Terminal term;
DummyRenderTarget emptyRT;
term.Create({ 100, 100 }, 0, emptyRT);
@@ -206,10 +211,16 @@ namespace TerminalCoreUnitTests
auto selection = term.GetViewport().ConvertToOrigin(selectionRects.at(0)).ToInclusive();
VERIFY_ARE_EQUAL(selection, SMALL_RECT({ 4, 10, 5, 10 }));
#endif
}
TEST_METHOD(SelectWideGlyph_Leading)
{
#ifdef _X86_
Log::Comment(L"This test is unreliable on x86 but is fine elsewhere. Disabled on x86.");
Log::Result(WEX::Logging::TestResults::Skipped);
return;
#else
Terminal term;
DummyRenderTarget emptyRT;
term.Create({ 100, 100 }, 0, emptyRT);
@@ -235,10 +246,16 @@ namespace TerminalCoreUnitTests
auto selection = term.GetViewport().ConvertToOrigin(selectionRects.at(0)).ToInclusive();
VERIFY_ARE_EQUAL(selection, SMALL_RECT({ 4, 10, 5, 10 }));
#endif
}
TEST_METHOD(SelectWideGlyphsInBoxSelection)
{
#ifdef _X86_
Log::Comment(L"This test is unreliable on x86 but is fine elsewhere. Disabled on x86.");
Log::Result(WEX::Logging::TestResults::Skipped);
return;
#else
Terminal term;
DummyRenderTarget emptyRT;
term.Create({ 100, 100 }, 0, emptyRT);
@@ -290,6 +307,7 @@ namespace TerminalCoreUnitTests
rowValue++;
}
#endif
}
};
}

View File

@@ -9,7 +9,7 @@
<application>
<!-- Windows 10 1903 -->
<!-- See https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/xaml-islands -->
<maxversiontested Id="10.0.18362.0"/>
<maxVersionTested Id="10.0.18362.0"/>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>

View File

@@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
<Import Project="..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview6.2\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.props" Condition="Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview6.2\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.props')" />
<Import Project="..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview7\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.props" Condition="Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview7\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.props')" />
<PropertyGroup>
<ConfigurationType>Application</ConfigurationType>
@@ -110,17 +110,17 @@
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\build\native\Microsoft.UI.Xaml.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.190521.3\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.190521.3\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview6.2\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview6.2\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview6.2\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview6.2\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.VCRTForwarders.140.1.0.0-rc\build\native\Microsoft.VCRTForwarders.140.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.VCRTForwarders.140.1.0.0-rc\build\native\Microsoft.VCRTForwarders.140.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview7\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview7\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview7\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview7\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.VCRTForwarders.140.1.0.1-rc\build\native\Microsoft.VCRTForwarders.140.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.VCRTForwarders.140.1.0.1-rc\build\native\Microsoft.VCRTForwarders.140.targets'))" />
</Target>
<Import Project="$(OpenConsoleDir)src\common.build.post.props" />
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.post.props" />
<Import Project="..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.190521.3\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.190521.3\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview6.2\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets" Condition="Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview6.2\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" />
<Import Project="..\..\..\packages\Microsoft.VCRTForwarders.140.1.0.0-rc\build\native\Microsoft.VCRTForwarders.140.targets" Condition="Exists('..\..\..\packages\Microsoft.VCRTForwarders.140.1.0.0-rc\build\native\Microsoft.VCRTForwarders.140.targets')" />
<Import Project="..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview7\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets" Condition="Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0-preview7\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" />
<Import Project="..\..\..\packages\Microsoft.VCRTForwarders.140.1.0.1-rc\build\native\Microsoft.VCRTForwarders.140.targets" Condition="Exists('..\..\..\packages\Microsoft.VCRTForwarders.140.1.0.1-rc\build\native\Microsoft.VCRTForwarders.140.targets')" />
<!-- Override GetPackagingOutputs to roll up all our dependencies.
This ensures that when the WAP packaging project asks what files go into

View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.190605.7" targetFramework="native" />
<package id="Microsoft.Toolkit.Win32.UI.XamlApplication" version="6.0.0-preview6.2" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.190730.2" targetFramework="native" />
<package id="Microsoft.Toolkit.Win32.UI.XamlApplication" version="6.0.0-preview7" targetFramework="native" />
<package id="Microsoft.UI.Xaml" version="2.2.190611001-prerelease" targetFramework="native" />
<package id="Microsoft.VCRTForwarders.140" version="1.0.0-rc" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.190521.3" targetFramework="native" />
<package id="Microsoft.VCRTForwarders.140" version="1.0.1-rc" targetFramework="native" />
</packages>

View File

@@ -30,4 +30,12 @@
<PropertyGroup>
<CAExcludePath>$(SolutionDir)\dep\;$(CAExcludePath)</CAExcludePath>
</PropertyGroup>
<Target Name="CleanUpPrecompForSmallCIAgents" AfterTargets="AfterBuild" Condition="'$(AGENT_ID)' != ''">
<ItemGroup>
<FilesToClean Include="$(IntDir)\**\*.pch" />
<FilesToClean Include="$(IntDir)\**\precomp.obj" />
</ItemGroup>
<Delete Files="@(FilesToClean)"/>
<Message Text="PCH and Precomp objects have been deleted for $(ProjectName)." />
</Target>
</Project>

View File

@@ -64,13 +64,13 @@
</ItemDefinitionGroup>
<ImportGroup Label="ExtensionTargets">
<Import Project="$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190605.7\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190605.7\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190605.7\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190605.7\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190605.7\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190605.7\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>

View File

@@ -3,7 +3,7 @@
<Import Project="..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
<Import Project="$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190605.7\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190605.7\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(OpenConsoleDir)\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<!-- 17134 is RS4 -->

View File

@@ -20,6 +20,7 @@ const std::wstring_view ConsoleArguments::HEIGHT_ARG = L"--height";
const std::wstring_view ConsoleArguments::INHERIT_CURSOR_ARG = L"--inheritcursor";
const std::wstring_view ConsoleArguments::FEATURE_ARG = L"--feature";
const std::wstring_view ConsoleArguments::FEATURE_PTY_ARG = L"pty";
const std::wstring_view ConsoleArguments::NARROW_CHARS_ARG = L"--narrow";
std::wstring EscapeArgument(std::wstring_view ac)
{
@@ -106,6 +107,7 @@ ConsoleArguments::ConsoleArguments(const std::wstring& commandline,
{
_clientCommandline = L"";
_vtMode = L"";
_vtNarrowChars = false;
_headless = false;
_createServerHandle = true;
_serverHandle = 0;
@@ -130,6 +132,7 @@ ConsoleArguments& ConsoleArguments::operator=(const ConsoleArguments& other)
_vtInHandle = other._vtInHandle;
_vtOutHandle = other._vtOutHandle;
_vtMode = other._vtMode;
_vtNarrowChars = other._vtNarrowChars;
_headless = other._headless;
_createServerHandle = other._createServerHandle;
_serverHandle = other._serverHandle;
@@ -475,7 +478,13 @@ void ConsoleArguments::s_ConsumeArg(_Inout_ std::vector<std::wstring>& args, _In
}
else if (arg == INHERIT_CURSOR_ARG)
{
_inheritCursor = true;
WI_SetFlag(_vtOptions, VtOption::InheritCursor);
s_ConsumeArg(args, i);
hr = S_OK;
}
else if (arg == NARROW_CHARS_ARG)
{
WI_SetFlag(_vtOptions, VtOption::AmbiguousCharactersNarrow);
s_ConsumeArg(args, i);
hr = S_OK;
}
@@ -592,6 +601,11 @@ std::wstring ConsoleArguments::GetVtMode() const
return _vtMode;
}
bool ConsoleArguments::GetVtNarrowChars() const
{
return _vtNarrowChars;
}
bool ConsoleArguments::GetForceV1() const
{
return _forceV1;

View File

@@ -45,11 +45,11 @@ public:
std::wstring GetClientCommandline() const;
std::wstring GetVtMode() const;
bool GetVtNarrowChars() const;
bool GetForceV1() const;
short GetWidth() const;
short GetHeight() const;
bool GetInheritCursor() const;
void SetExpectedSize(COORD dimensions) noexcept;
@@ -66,6 +66,7 @@ public:
static const std::wstring_view INHERIT_CURSOR_ARG;
static const std::wstring_view FEATURE_ARG;
static const std::wstring_view FEATURE_PTY_ARG;
static const std::wstring_view NARROW_CHARS_ARG;
private:
#ifdef UNIT_TESTING
@@ -82,12 +83,13 @@ private:
const bool createServerHandle,
const DWORD serverHandle,
const DWORD signalHandle,
const bool inheritCursor) :
const VtOption vtOptions) :
_commandline(commandline),
_clientCommandline(clientCommandline),
_vtInHandle(vtInHandle),
_vtOutHandle(vtOutHandle),
_vtMode(vtMode),
_vtOptions(vtOptions),
_width(width),
_height(height),
_forceV1(forceV1),
@@ -95,7 +97,6 @@ private:
_createServerHandle(createServerHandle),
_serverHandle(serverHandle),
_signalHandle(signalHandle),
_inheritCursor(inheritCursor),
_recievedEarlySizeChange{ false },
_originalWidth{ -1 },
_originalHeight{ -1 }
@@ -111,7 +112,9 @@ private:
HANDLE _vtOutHandle;
// Settings that dictate how ConPTY behaves
std::wstring _vtMode;
VtOption _vtOptions;
bool _forceV1;
bool _headless;
@@ -122,7 +125,6 @@ private:
bool _createServerHandle;
DWORD _serverHandle;
DWORD _signalHandle;
bool _inheritCursor;
bool _recievedEarlySizeChange;
short _originalWidth;
@@ -174,7 +176,7 @@ namespace WEX
L"Server Handle: '0x%x'\r\n"
L"Use Signal Handle: '%ws'\r\n"
L"Signal Handle: '0x%x'\r\n",
L"Inherit Cursor: '%ws'\r\n",
L"VT Options: '0x%x'\r\n",
ci.GetClientCommandline().c_str(),
s_ToBoolString(ci.HasVtHandles()),
ci.GetVtInHandle(),
@@ -188,7 +190,7 @@ namespace WEX
ci.GetServerHandle(),
s_ToBoolString(ci.HasSignalHandle()),
ci.GetSignalHandle(),
s_ToBoolString(ci.GetInheritCursor()));
ci.GetVtOptions());
}
private:
@@ -217,7 +219,7 @@ namespace WEX
expected.GetServerHandle() == actual.GetServerHandle() &&
expected.HasSignalHandle() == actual.HasSignalHandle() &&
expected.GetSignalHandle() == actual.GetSignalHandle() &&
expected.GetInheritCursor() == actual.GetInheritCursor();
expected.GetVtOptions() == actual.GetVtOptions();
}
static bool AreSame(const ConsoleArguments& expected, const ConsoleArguments& actual)
@@ -242,7 +244,7 @@ namespace WEX
!object.ShouldCreateServerHandle() &&
object.GetServerHandle() == 0 &&
(object.GetSignalHandle() == 0 || object.GetSignalHandle() == INVALID_HANDLE_VALUE) &&
!object.GetInheritCursor();
object.GetVtOptions() == VtOption::None;
}
};
}

View File

@@ -72,12 +72,13 @@ VtIo::VtIo() :
[[nodiscard]] HRESULT VtIo::Initialize(const ConsoleArguments* const pArgs)
{
_lookingForCursorPosition = pArgs->GetInheritCursor();
auto vtOptions = pArgs->GetVtOptions();
_lookingForCursorPosition = WI_IsFlagSet(vtOptions, VtOption::InheritCursor);
// If we were already given VT handles, set up the VT IO engine to use those.
if (pArgs->InConptyMode())
{
return _Initialize(pArgs->GetVtInHandle(), pArgs->GetVtOutHandle(), pArgs->GetVtMode(), pArgs->GetSignalHandle());
return _Initialize(pArgs->GetVtInHandle(), pArgs->GetVtOutHandle(), pArgs->GetVtMode(), vtOptions, pArgs->GetSignalHandle());
}
// Didn't need to initialize if we didn't have VT stuff. It's still OK, but report we did nothing.
else
@@ -107,6 +108,7 @@ VtIo::VtIo() :
[[nodiscard]] HRESULT VtIo::_Initialize(const HANDLE InHandle,
const HANDLE OutHandle,
const std::wstring& VtMode,
const VtOption Options,
_In_opt_ const HANDLE SignalHandle)
{
FAIL_FAST_IF_MSG(_initialized, "Someone attempted to double-_Initialize VtIo");
@@ -116,6 +118,9 @@ VtIo::VtIo() :
_hInput.reset(InHandle);
_hOutput.reset(OutHandle);
_hSignal.reset(SignalHandle);
_options = Options;
WI_SetFlagIf(_options, VtOption::ForceAsciiOnly, _IoMode == VtIoMode::XTERM_ASCII);
// The only way we're initialized is if the args said we're in conpty mode.
// If the args say so, then at least one of in, out, or signal was specified
@@ -161,30 +166,25 @@ VtIo::VtIo() :
gci,
initialViewport,
gci.GetColorTable(),
static_cast<WORD>(gci.GetColorTableSize()));
static_cast<WORD>(gci.GetColorTableSize()),
_options);
break;
case VtIoMode::XTERM:
_pVtRenderEngine = std::make_unique<XtermEngine>(std::move(_hOutput),
gci,
initialViewport,
gci.GetColorTable(),
static_cast<WORD>(gci.GetColorTableSize()),
false);
break;
case VtIoMode::XTERM_ASCII:
_pVtRenderEngine = std::make_unique<XtermEngine>(std::move(_hOutput),
gci,
initialViewport,
gci.GetColorTable(),
static_cast<WORD>(gci.GetColorTableSize()),
true);
_options);
break;
case VtIoMode::WIN_TELNET:
_pVtRenderEngine = std::make_unique<WinTelnetEngine>(std::move(_hOutput),
gci,
initialViewport,
gci.GetColorTable(),
static_cast<WORD>(gci.GetColorTableSize()));
static_cast<WORD>(gci.GetColorTableSize()),
_options);
break;
default:
return E_FAIL;

View File

@@ -13,6 +13,15 @@ class ConsoleArguments;
namespace Microsoft::Console::VirtualTerminal
{
enum class VtOption
{
None = 0x0,
InheritCursor = 0x1,
ForceAsciiOnly = 0x2,
AmbiguousCharactersNarrow = 0x4,
};
DEFINE_ENUM_FLAG_OPERATORS(VtOption);
class VtIo : public Microsoft::Console::ITerminalOwner
{
public:
@@ -46,6 +55,7 @@ namespace Microsoft::Console::VirtualTerminal
// After CreateAndStartSignalThread is called, this will be invalid.
wil::unique_hfile _hSignal;
VtIoMode _IoMode;
VtOption _options;
bool _initialized;
bool _objectsCreated;
@@ -57,7 +67,7 @@ namespace Microsoft::Console::VirtualTerminal
std::unique_ptr<Microsoft::Console::VtInputThread> _pVtInputThread;
std::unique_ptr<Microsoft::Console::PtySignalInputThread> _pPtySignalInputThread;
[[nodiscard]] HRESULT _Initialize(const HANDLE InHandle, const HANDLE OutHandle, const std::wstring& VtMode, _In_opt_ const HANDLE SignalHandle);
[[nodiscard]] HRESULT _Initialize(const HANDLE InHandle, const HANDLE OutHandle, const std::wstring& VtMode, const VtOption Options, _In_opt_ const HANDLE SignalHandle);
void _ShutdownIfNeeded();

View File

@@ -102,9 +102,9 @@ protected:
CommandLine(CommandLine const&) = delete;
CommandLine& operator=(CommandLine const&) = delete;
[[nodiscard]] NTSTATUS CommandLine::_startCommandListPopup(COOKED_READ_DATA& cookedReadData);
[[nodiscard]] NTSTATUS CommandLine::_startCopyFromCharPopup(COOKED_READ_DATA& cookedReadData);
[[nodiscard]] NTSTATUS CommandLine::_startCopyToCharPopup(COOKED_READ_DATA& cookedReadData);
[[nodiscard]] NTSTATUS _startCommandListPopup(COOKED_READ_DATA& cookedReadData);
[[nodiscard]] NTSTATUS _startCopyFromCharPopup(COOKED_READ_DATA& cookedReadData);
[[nodiscard]] NTSTATUS _startCopyToCharPopup(COOKED_READ_DATA& cookedReadData);
void _processHistoryCycling(COOKED_READ_DATA& cookedReadData, const CommandHistory::SearchDirection searchDirection);
void _setPromptToOldestCommand(COOKED_READ_DATA& cookedReadData);

View File

@@ -273,13 +273,18 @@ void EventsToUnicode(_Inout_ std::deque<std::unique_ptr<IInputEvent>>& inEvents,
{
try
{
RETURN_NTSTATUS(_DoGetConsoleInput(context,
outEvents,
eventsToRead,
readHandleState,
false,
true,
waiter));
NTSTATUS Status = _DoGetConsoleInput(context,
outEvents,
eventsToRead,
readHandleState,
false,
true,
waiter);
if (CONSOLE_STATUS_WAIT == Status)
{
return HRESULT_FROM_NT(Status);
}
RETURN_NTSTATUS(Status);
}
CATCH_RETURN();
}
@@ -308,13 +313,18 @@ void EventsToUnicode(_Inout_ std::deque<std::unique_ptr<IInputEvent>>& inEvents,
{
try
{
RETURN_NTSTATUS(_DoGetConsoleInput(context,
outEvents,
eventsToRead,
readHandleState,
true,
true,
waiter));
NTSTATUS Status = _DoGetConsoleInput(context,
outEvents,
eventsToRead,
readHandleState,
true,
true,
waiter);
if (CONSOLE_STATUS_WAIT == Status)
{
return HRESULT_FROM_NT(Status);
}
RETURN_NTSTATUS(Status);
}
CATCH_RETURN();
}
@@ -343,13 +353,18 @@ void EventsToUnicode(_Inout_ std::deque<std::unique_ptr<IInputEvent>>& inEvents,
{
try
{
RETURN_NTSTATUS(_DoGetConsoleInput(context,
outEvents,
eventsToRead,
readHandleState,
false,
false,
waiter));
NTSTATUS Status = _DoGetConsoleInput(context,
outEvents,
eventsToRead,
readHandleState,
false,
false,
waiter);
if (CONSOLE_STATUS_WAIT == Status)
{
return HRESULT_FROM_NT(Status);
}
RETURN_NTSTATUS(Status);
}
CATCH_RETURN();
}
@@ -378,13 +393,18 @@ void EventsToUnicode(_Inout_ std::deque<std::unique_ptr<IInputEvent>>& inEvents,
{
try
{
RETURN_NTSTATUS(_DoGetConsoleInput(context,
outEvents,
eventsToRead,
readHandleState,
true,
false,
waiter));
NTSTATUS Status = _DoGetConsoleInput(context,
outEvents,
eventsToRead,
readHandleState,
true,
false,
waiter);
if (CONSOLE_STATUS_WAIT == Status)
{
return HRESULT_FROM_NT(Status);
}
RETURN_NTSTATUS(Status);
}
CATCH_RETURN();
}

View File

@@ -32,32 +32,12 @@ class CodepointWidthDetectorTests
{
TEST_CLASS(CodepointWidthDetectorTests);
TEST_METHOD(CodepointWidthDetectDefersMapPopulation)
{
CodepointWidthDetector widthDetector;
VERIFY_IS_TRUE(widthDetector._map.empty());
widthDetector.IsWide(UNICODE_SPACE);
VERIFY_IS_TRUE(widthDetector._map.empty());
// now force checking
widthDetector.GetWidth(emoji);
VERIFY_IS_FALSE(widthDetector._map.empty());
}
TEST_METHOD(CanLookUpEmoji)
{
CodepointWidthDetector widthDetector;
VERIFY_IS_TRUE(widthDetector.IsWide(emoji));
}
TEST_METHOD(TestUnicodeRangeCompare)
{
CodepointWidthDetector::UnicodeRangeCompare compare;
// test comparing 2 search terms
CodepointWidthDetector::UnicodeRange a{ 0x10 };
CodepointWidthDetector::UnicodeRange b{ 0x15 };
VERIFY_IS_TRUE(static_cast<bool>(compare(a, b)));
}
TEST_METHOD(CanExtractCodepoint)
{
CodepointWidthDetector widthDetector;

View File

@@ -98,10 +98,10 @@ public:
} RegPropertyMap;
static const RegPropertyMap s_PropertyMappings[];
static const size_t RegistrySerialization::s_PropertyMappingsSize;
static const size_t s_PropertyMappingsSize;
static const RegPropertyMap s_GlobalPropMappings[];
static const size_t RegistrySerialization::s_GlobalPropMappingsSize;
static const size_t s_GlobalPropMappingsSize;
[[nodiscard]] static NTSTATUS s_LoadRegDword(const HKEY hKey, const _RegPropertyMap* const pPropMap, _In_ Settings* const pSettings);
[[nodiscard]] static NTSTATUS s_LoadRegString(const HKEY hKey, const _RegPropertyMap* const pPropMap, _In_ Settings* const pSettings);

View File

@@ -13,8 +13,9 @@ WinTelnetEngine::WinTelnetEngine(_In_ wil::unique_hfile hPipe,
const IDefaultColorProvider& colorProvider,
const Viewport initialViewport,
_In_reads_(cColorTable) const COLORREF* const ColorTable,
const WORD cColorTable) :
VtEngine(std::move(hPipe), colorProvider, initialViewport),
const WORD cColorTable,
const VtOption vtOptions) :
VtEngine(std::move(hPipe), colorProvider, initialViewport, vtOptions),
_ColorTable(ColorTable),
_cColorTable(cColorTable)
{

View File

@@ -27,7 +27,8 @@ namespace Microsoft::Console::Render
const Microsoft::Console::IDefaultColorProvider& colorProvider,
const Microsoft::Console::Types::Viewport initialViewport,
_In_reads_(cColorTable) const COLORREF* const ColorTable,
const WORD cColorTable);
const WORD cColorTable
const VtOption vtOptions);
virtual ~WinTelnetEngine() override = default;
[[nodiscard]] HRESULT UpdateDrawingBrushes(const COLORREF colorForeground,

View File

@@ -12,8 +12,9 @@ Xterm256Engine::Xterm256Engine(_In_ wil::unique_hfile hPipe,
const IDefaultColorProvider& colorProvider,
const Viewport initialViewport,
_In_reads_(cColorTable) const COLORREF* const ColorTable,
const WORD cColorTable) :
XtermEngine(std::move(hPipe), colorProvider, initialViewport, ColorTable, cColorTable, false)
const WORD cColorTable,
const VtOption vtOptions) :
XtermEngine(std::move(hPipe), colorProvider, initialViewport, ColorTable, cColorTable, vtOptions)
{
}

View File

@@ -27,7 +27,8 @@ namespace Microsoft::Console::Render
const Microsoft::Console::IDefaultColorProvider& colorProvider,
const Microsoft::Console::Types::Viewport initialViewport,
_In_reads_(cColorTable) const COLORREF* const ColorTable,
const WORD cColorTable);
const WORD cColorTable,
const VtOption vtOptions);
virtual ~Xterm256Engine() override = default;

View File

@@ -14,11 +14,11 @@ XtermEngine::XtermEngine(_In_ wil::unique_hfile hPipe,
const Viewport initialViewport,
_In_reads_(cColorTable) const COLORREF* const ColorTable,
const WORD cColorTable,
const bool fUseAsciiOnly) :
VtEngine(std::move(hPipe), colorProvider, initialViewport),
const VtOption vtOptions) :
VtEngine(std::move(hPipe), colorProvider, initialViewport, vtOptions),
_ColorTable(ColorTable),
_cColorTable(cColorTable),
_fUseAsciiOnly(fUseAsciiOnly),
_fUseAsciiOnly(WI_IsFlagSet(vtOptions, VtOption::ForceAsciiOnly)),
_previousLineWrapped(false),
_usingUnderLine(false),
_needToDisableCursor(false)

View File

@@ -32,7 +32,7 @@ namespace Microsoft::Console::Render
const Microsoft::Console::Types::Viewport initialViewport,
_In_reads_(cColorTable) const COLORREF* const ColorTable,
const WORD cColorTable,
const bool fUseAsciiOnly);
const VtOption vtOptions);
virtual ~XtermEngine() override = default;

View File

@@ -38,6 +38,13 @@ SMALL_RECT VtEngine::GetDirtyRectInChars()
[[nodiscard]] HRESULT VtEngine::IsGlyphWideByFont(const std::wstring_view /*glyph*/, _Out_ bool* const pResult) noexcept
{
*pResult = false;
// If we've been told to report ambiguous-width characters as narrow, the <false> we stored in
// pResult is valid.
if (WI_IsFlagSet(_vtOptions, VtOption::AmbiguousCharactersNarrow))
{
return S_OK;
}
return S_FALSE;
}

View File

@@ -35,7 +35,8 @@ namespace Microsoft::Console::Render
VtEngine(_In_ wil::unique_hfile hPipe,
const Microsoft::Console::IDefaultColorProvider& colorProvider,
const Microsoft::Console::Types::Viewport initialViewport);
const Microsoft::Console::Types::Viewport initialViewport,
const VtOption vtOptions);
virtual ~VtEngine() override = default;
@@ -129,6 +130,8 @@ namespace Microsoft::Console::Render
bool _newBottomLine;
COORD _deferredCursorPos;
VtOption _vtOptions;
bool _pipeBroken;
HRESULT _exitResult;
Microsoft::Console::ITerminalOwner* _terminalOwner;

View File

@@ -898,7 +898,7 @@ namespace fuzz
_Type operator->() const throw()
{
return (m_fFuzzed) ? m_t : m_tInit;
return (this->m_fFuzzed) ? this->m_t : m_tInit;
}
// This operator makes it possible to invoke the fuzzing map
@@ -960,7 +960,7 @@ namespace fuzz
__inline virtual _Type** operator&() throw()
{
m_ftEffectiveTraits |= TRAIT_TRANSFER_ALLOCATION;
return (m_fFuzzed) ? &m_t : &m_tInit;
return (this->m_fFuzzed) ? &(this->m_t) : &m_tInit;
}
private:
@@ -978,11 +978,11 @@ namespace fuzz
void OnFuzzedValueFromMap()
{
m_pszFuzzed = nullptr;
m_ftEffectiveTraits = m_traits;
m_pfnOnFuzzedValueFromMap = [&](_Type* psz, std::function<void(_Type*)> dealloc) {
m_ftEffectiveTraits = this->m_traits;
this->m_pfnOnFuzzedValueFromMap = [&](_Type* psz, std::function<void(_Type*)> dealloc) {
FreeFuzzedString();
_Type* pszFuzzed = psz;
if (psz && psz != m_tInit)
if (psz && psz != this->m_tInit)
{
size_t cb = (sizeof(_Type) == sizeof(char)) ?
(strlen(reinterpret_cast<LPSTR>(psz)) + 1) * sizeof(char) :
@@ -1014,8 +1014,8 @@ namespace fuzz
// allocation and deallocation responsibilities.
if (m_ftEffectiveTraits & TRAIT_TRANSFER_ALLOCATION)
{
_Alloc::Free(m_tInit);
m_tInit = nullptr;
_Alloc::Free(this->m_tInit);
this->m_tInit = nullptr;
}
else
{
@@ -1070,11 +1070,11 @@ namespace fuzz
protected:
__inline virtual _Type GetValueFromMap()
{
if (!m_fFuzzed)
if (!this->m_fFuzzed)
{
m_t = 0;
m_fFuzzed = TRUE;
for (auto& r : m_map)
this->m_t = 0;
this->m_fFuzzed = TRUE;
for (auto& r : this->m_map)
{
// Generate a new random value during each map entry
// and use it to evaluate if each individual fuzz map
@@ -1087,12 +1087,12 @@ namespace fuzz
int iLow = iHigh - (r.range.iHigh - r.range.iLow);
if (iLow <= wRandom && wRandom < iHigh)
{
m_t |= CallFuzzMapFunction(r.fte.pfnFuzz, m_tInit, m_tArgs);
this->m_t |= CallFuzzMapFunction(r.fte.pfnFuzz, this->m_tInit, m_tArgs);
}
}
}
return m_t;
return this->m_t;
}
};
}

File diff suppressed because it is too large Load Diff

View File

@@ -22,79 +22,6 @@ static_assert(sizeof(unsigned int) == sizeof(wchar_t) * 2,
// use to measure the width of a codepoint
class CodepointWidthDetector final
{
protected:
// used to store range data in CodepointWidthDetector's internal map
class UnicodeRange final
{
public:
UnicodeRange(const unsigned int lowerBound,
const unsigned int upperBound) :
_lowerBound{ lowerBound },
_upperBound{ upperBound },
_isBounds{ true }
{
}
UnicodeRange(const unsigned int searchTerm) :
_lowerBound{ searchTerm },
_upperBound{ searchTerm },
_isBounds{ false }
{
}
bool IsBounds() const noexcept
{
return _isBounds;
}
unsigned int LowerBound() const
{
FAIL_FAST_IF(!_isBounds);
return _lowerBound;
}
unsigned int UpperBound() const
{
FAIL_FAST_IF(!_isBounds);
return _upperBound;
}
unsigned int SearchTerm() const
{
FAIL_FAST_IF(_isBounds);
return _lowerBound;
}
private:
unsigned int _lowerBound;
unsigned int _upperBound;
bool _isBounds;
};
// used for comparing if we've found the range that a searching UnicodeRange falls into
struct UnicodeRangeCompare final
{
bool operator()(const UnicodeRange& a, const UnicodeRange& b) const
{
if (!a.IsBounds() && b.IsBounds())
{
return a.SearchTerm() < b.LowerBound();
}
else if (a.IsBounds() && !b.IsBounds())
{
return a.UpperBound() < b.SearchTerm();
}
else if (a.IsBounds() && b.IsBounds())
{
return a.LowerBound() < b.LowerBound();
}
else
{
return a.SearchTerm() < b.SearchTerm();
}
}
};
public:
CodepointWidthDetector() = default;
CodepointWidthDetector(const CodepointWidthDetector&) = delete;
@@ -115,11 +42,8 @@ public:
private:
bool _lookupIsWide(const std::wstring_view glyph) const noexcept;
bool _checkFallbackViaCache(const std::wstring_view glyph) const;
unsigned int _extractCodepoint(const std::wstring_view glyph) const noexcept;
void _populateUnicodeSearchMap();
static unsigned int _extractCodepoint(const std::wstring_view glyph) noexcept;
mutable std::map<std::wstring, bool> _fallbackCache;
std::map<UnicodeRange, CodepointWidth, UnicodeRangeCompare> _map;
std::function<bool(std::wstring_view)> _pfnFallbackMethod;
bool _hasFallback = false;
};

7
tools/bcx.cmd Normal file
View File

@@ -0,0 +1,7 @@
@echo off
rem bcx - Build only the project in this directory, cleaning it first.
rem This is another script to help Microsoft developers feel at home working on
rem the terminal project.
call bcz exclusive %*

View File

@@ -1,13 +1,26 @@
@echo off
rem bcz - Clean and build the project
rem This is another script to help Microsoft developers feel at home working on the openconsole project.
rem bcz - Clean and build the solution.
rem This is another script to help Microsoft developers feel at home working on the Terminal project.
rem Args:
rem dbg: manually build the solution in the Debug configuration. If omitted,
rem we'll use whatever the last configuration build was.
rem rel: manually build the solution in the Release configuration. If
rem omitted, we'll use whatever the last configuration build was.
rem no_clean: Don't clean before building. This is a much faster build
rem typically, but leaves artifacts from previous builds around, which
rem can lead to unexpected build failures.
rem exclusive: Only build the project in the cwd. If omitted, we'll try
rem building the entire solution instead.
if (%_LAST_BUILD_CONF%)==() (
set _LAST_BUILD_CONF=%DEFAULT_CONFIGURATION%
)
set _MSBUILD_TARGET=Clean,Build
set _EXCLUSIVE=
set _APPX_ARGS=
:ARGS_LOOP
if (%1) == () goto :POST_ARGS_LOOP
@@ -22,30 +35,43 @@ if (%1) == (rel) (
if (%1) == (no_clean) (
set _MSBUILD_TARGET=Build
)
if (%1) == (exclusive) (
set _EXCLUSIVE=1
)
shift
goto :ARGS_LOOP
:POST_ARGS_LOOP
echo Starting build...
nuget.exe restore %OPENCON%\OpenConsole.sln
rem /p:AppxBundle=Never prevents us from building the appxbundle from the commandline.
rem We don't want to do this from a debug build, because it takes ages, so disable it.
rem if you want the appx, build release
if "%_EXCLUSIVE%" == "1" (
set "PROJECT_NAME="
call :get_project
) else if (%_LAST_BUILD_CONF%) == (Debug) (
set _APPX_ARGS=
rem /p:AppxBundle=Never prevents us from building the appxbundle from the
rem commandline. We don't want to do this from a debug build, because it
rem takes ages, so disable it. if you want the appx, build release
rem Only do this check if we're doing a full solution build. If we're only
rem trying to build the appx, then we obviously want to build the appx.
if (%_LAST_BUILD_CONF%) == (Debug) (
echo Skipping building appx...
set _APPX_ARGS=/p:AppxBundle=false
) else (
echo Building Appx...
)
if "%_EXCLUSIVE%" == "1" (
if "%PROJECT_NAME%" == "" ( goto :eof ) else echo Building only %PROJECT_NAME%
)
echo Performing nuget restore...
nuget.exe restore %OPENCON%\OpenConsole.sln
set _BUILD_CMDLINE="%MSBUILD%" %OPENCON%\OpenConsole.sln /t:%_MSBUILD_TARGET% /m /p:Configuration=%_LAST_BUILD_CONF% /p:Platform=%ARCH% %_APPX_ARGS%
echo %_BUILD_CMDLINE%
echo Starting build...
%_BUILD_CMDLINE%
rem Cleanup unused variables here. Note we cannot use setlocal because we need to pass modified
@@ -53,3 +79,48 @@ rem _LAST_BUILD_CONF out to OpenCon.cmd later.
rem
set _MSBUILD_TARGET=
set _BIN_=%~dp0\bin\%PLATFORM%\%_LAST_BUILD_CONF%
goto :eof
rem ############################################################################
rem The code to figure out what project we're building needs to be in its own
rem function. Otherwise, when cmd evaluates the if statement above `if
rem "%_EXCLUSIVE%" == "1"`, it'll evaluate the entire block with the value of
rem the the variables at the time the if was executed. So instead, make a
rem function here with `enabledelayedexpansion` set.
:get_project
setlocal enabledelayedexpansion
rem TODO:GH#2172 Find a way to only rebuild the metaproj if the sln changed
rem First generate the metaproj file
set MSBuildEmitSolution=1
"%msbuild%" %OPENCON%\OpenConsole.sln /t:ValidateSolutionConfiguration /m > NUL
set MSBuildEmitSolution=
rem Use bx.ps1 to figure out which target we're looking at
set _BX_SCRIPT=powershell bx.ps1
set _OUTPUT=
FOR /F "tokens=* USEBACKQ" %%F IN (`powershell bx.ps1 2^> NUL`) DO (
set _OUTPUT=%%F
)
if "!_OUTPUT!" == "" (
echo Could not find a .vcxproj file in this directory.
echo `bx.cmd` only works in directories with a vcxproj file.
echo Please navigate to directory with a project file in it, or try `bz` to build the entire solution.
goto :eof
)
set "__PROJECT_NAME=!_OUTPUT!"
rem If we're trying to clean build, make sure to update the target here.
if "%_MSBUILD_TARGET%" == "Build" (
set __MSBUILD_TARGET=%__PROJECT_NAME%
) else if "%_MSBUILD_TARGET%" == "Clean,Build" (
set __MSBUILD_TARGET=%__PROJECT_NAME%:Rebuild
)
rem This statement will propogate our internal variables up to the calling
rem scope. Because they're all on one line, the value of our local variables
rem will be evaluated before we endlocal
endlocal & set "PROJECT_NAME=%__PROJECT_NAME%" & set "_MSBUILD_TARGET=%__MSBUILD_TARGET%"
rem ############################################################################
:eof

7
tools/bx.cmd Normal file
View File

@@ -0,0 +1,7 @@
@echo off
rem bx - Build only the project in this directory without cleaning it first.
rem This is another script to help Microsoft developers feel at home working on
rem the terminal project.
call bcz exclusive no_clean %*

28
tools/bx.ps1 Normal file
View File

@@ -0,0 +1,28 @@
# This is a helper script to figure out which target corresponds to the project
# in this directory. Parses the solution's .metaproj file looking for the
# project file in this directory, to be able to get the project's name.
$projects = Get-Childitem -Path .\ -Filter *.vcxproj -File
if ($projects.length -eq 0)
{
exit -1
}
$projectPath = $projects.FullName
$msBuildCondition = "'%(ProjectReference.Identity)' == '$projectPath.metaproj'"
# Parse the solution's metaproj file.
[xml]$Metaproj = Get-Content "$env:OPENCON\OpenConsole.sln.metaproj"
$targets = $Metaproj.Project.Target
# Filter to project targets that match out metaproj file.
# For Conhost\Server, this will match:
# [Conhost\Server, Conhost\Server:Clean, Conhost\Server:Rebuild, Conhost\Server:Publish]
$matchingTargets = $targets | Where-Object { $_.MSBuild.Condition -eq $msBuildCondition }
# Further filter to the targets that dont have a suffix (like ":Clean")
$matchingTargets = $matchingTargets | Where-Object { $hasProperty = $_.MsBuild.PSobject.Properties.name -match "Targets" ; return -Not $hasProperty }
Write-Host $matchingTargets.Name
exit 0

View File

@@ -1,6 +1,7 @@
@echo off
rem bcz - Build the project without clean it first
rem This is another script to help Microsoft developers feel at home working on the openconsole project.
rem bz - Build the entire solution without cleaning it first.
rem This is another script to help Microsoft developers feel at home working on
rem the terminal project.
call bcz no_clean %*