Commit graph

434 commits

Author SHA1 Message Date
Leonard Hecker 6e9b53750d 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.

(cherry picked from commit 4529e46d3e)
2019-08-05 15:05:01 -07:00
PankajBhojwani 2096fa5e1f Use ROW.Reset in EraseInDisplay instead of printing millions of spaces per line #2197 2019-08-01 13:48:51 -07:00
Carlos Zamora a08666b58e Accessibility: TermControl Automation Peer (#2083)
Builds on the work of #1691 and #1915 

Let's start with the easy change:
- `TermControl`'s `controlRoot` was removed. `TermControl` is a `UserControl`
  now.

Ok. Now we've got a story to tell here....

### TermControlAP - the Automation Peer
Here's an in-depth guide on custom automation peers:
https://docs.microsoft.com/en-us/windows/uwp/design/accessibility/custom-automation-peers

We have a custom XAML element (TermControl). So XAML can't really hold our
hands and determine an accessible behavior for us. So this automation peer is
responsible for enabling that interaction.

We made it a FrameworkElementAutomationPeer to get as much accessibility as
possible from it just being a XAML element (i.e.: where are we on the screen?
what are my dimensions?). This is recommended. Any functions with "Core" at the
end, are overwritten here to tweak this automation peer into what we really
need.

But what kind of interactions can a user expect from this XAML element?
Introducing ControlPatterns! There's a ton of interfaces that just define "what
can I do". Thankfully, we already know that we're supposed to be
`ScreenInfoUiaProvider` and that was an `ITextProvider`, so let's just make the
TermControlAP an `ITextProvider` too.

So now we have a way to define what accessible actions can be performed on us,
but what should those actions do? Well let's just use the automation providers
from ConHost that are now in a shared space! (Note: this is a great place to
stop and get some coffee. We're about to hop into the .cpp file in the next
section)


### Wrapping our shared Automation Providers

Unfortunately, we can't just use the automation providers from ConHost. Or, at
least not just hook them up as easily as we wish. ConHost's UIA Providers were
written using UIAutomationCore and ITextRangeProiuder. XAML's interfaces
ITextProvider and ITextRangeProvider are lined up to be exactly the same.

So we need to wrap our ConHost UIA Providers (UIAutomationCore) with the XAML
ones. We had two providers, so that means we have two wrappers.

#### TermControlAP (XAML) <----> ScreenInfoUiaProvider (UIAutomationCore)
Each of the functions in the pragma region `ITextProvider` for
TermControlAP.cpp is just wrapping what we do in `ScreenInfoUiaProvider`, and
returning an acceptable version of it.

Most of `ScreenInfoUiaProvider`'s functions return `UiaTextRange`s. So we need
to wrap that too. That's this next section...

#### XamlUiaTextRange (XAML) <----> UiaTextRange (UIAutomationCore)
Same idea.  We're wrapping everything that we could do with `UiaTextRange` and
putting it inside of `XamlUiaTextRange`.


### Additional changes to `UiaTextRange` and `ScreenInfoUiaProvider`
If you don't know what I just said, please read this background:
- #1691: how accessibility works and the general responsibility of these two
  classes
- #1915: how we pulled these Accessibility Providers into a shared area

TL;DR: `ScreenInfoUiaProvider` lets you interact with the displayed text.
`UiaTextRange` is specific ranges of text in the display and navigate the text.

Thankfully, we didn't do many changes here. I feel like some of it is hacked
together but now that we have a somewhat working system, making changes
shouldn't be too hard...I hope.

#### UiaTextRange
We don't have access to the window handle. We really only need it to draw the
bounding rects using WinUser's `ScreenToClient()` and `ClientToScreen()`. I
need to figure out how to get around this.

In the meantime, I made the window handle optional. And if we don't have
one....well, we need to figure that out. But other than that, we have a
`UiaTextRange`.

#### ScreenInfoUiaProvider
At some point, we need to hook up this automation provider to the
WindowUiaProvider. This should help with navigation of the UIA Tree and make
everything just look waaaay better. For now, let's just do the same approach
and make the pUiaParent optional.

This one's the one I'm not that proud of, but it works. We need the parent to
get a bounding rect of the terminal. While we figure out how to attach the
WindowUiaProvider, we should at the very least be able to get a bunch of info
from our xaml automation peer. So, I've added a _getBoundingRect optional
function. This is what's called when we don't have a WindowUiaProvider as our
parent.


## Validation Steps Performed
I've been using inspect.exe to see the UIA tree.
I was able to interact with the terminal mostly fine. A few known issues below.

Unfortunately, I tried running Narrator on this and it didn't seem to like it
(by that I mean WT crashed). Then again, I don't really know how to use
narrator other than "click on object" --> "listen voice". I feel like there's a
way to get the other interactions with narrator, but I'll be looking into more
of that soon. I bet if I fix the two issues below, Narrator will be happy.

## Miscellaneous Known Issues
- `GetSelection()` and `GetVisibleRanges()` crashes. I need to debug through
  these. I want to include them in this PR.

Fixes #1353.
2019-07-30 16:43:10 -07:00
Dustin L. Howett (MSFT) 1afab788ab
Update the package version to v0.3
Acked-by: Pankaj Bhojwani <t-pabhoj@microsoft.com>
Acked-by: Carlos Zamora <cazamor@microsoft.com>
2019-07-30 16:35:08 -07:00
PankajBhojwani 63df881f31
VT sequence support for EraseInLine, EraseInDisplay, DeleteCharacter and InsertCharacter (#2144)
* We now support EraseInLine, EraseInDisplay, DeleteCharacter and InsertCharacter
2019-07-30 16:28:28 -07:00
Mike Griese 2d3e271a4f Fix the terminal snapping across DPI boundaries strangely
When we snap across a DPI boundary, we'll get the DPI changed message _after_ the resize message. So when we try to calculate the new terminal position, we'll use the _old_ DPI to calculate the size. When snapping to a lower DPI, this means the terminal will be smaller, with "padding" all around the actual app. 

Instead, when we get a new DPI, force us to update out UI layout for the new DPI.

Closes #2057
2019-07-30 15:04:48 -07:00
Mike Griese 7abcc35fdf
Fix a crash on restore down (#2149)
* Don't trigger a frame due to circling when in the middle of a resize operation

  This fixes #1795, and shined quite a bit of light on the whole conpty resize process.

* Move the Begin/End to ResizeScreenBuffer, to catch more cases.
2019-07-30 17:01:27 -05:00
Dustin L. Howett (MSFT) c6c51fbb0e Change our manifest from depending on Windows.Universal to Windows.Desktop (#2155) 2019-07-30 14:36:15 -07:00
Michael Niksa 56589c0aac
Fixes crash when specifying invalid font (#2153)
* Stop the crash with fonts by trying a few fallback/backup fonts if we can't find what was selected.
* Create fallback pattern for finding a font. Resolve and pass the locale name. Retrieve the font name while retrieving the font object. Use retrieved data in the _GetProposedFont methods instead of re-resolving it.
* Add details to schema about fallback. Finish comment explaining fallback pattern to doc comment on method.
2019-07-30 14:32:23 -07:00
Dustin L. Howett (MSFT) 3f62c8b470
Add some ETL around profile, control and connection creation (#2125)
This commit adds some tracelogging (and telemetry) to answer the following questions:
* Do people use padding? If so, what is the common range of values?
* Are people turning off showTabsInTitlebar?
* How many different profiles are in use, and how do they break down between custom and default?
* Are people manually launching specific profiles, or using "default" fairly often?
* Are people using the Azure Cloud Shell connection?
* Are people leveraging the feature added in #2108 (autogenerating GUIDs)?
2019-07-29 17:24:20 -07:00
Carlos Zamora 96496d8154
Accessibility: Set-up UIA Tree (#1691)
**The Basics of Accessibility**
- [What is a User Interaction Automation (UIA) Tree?](https://docs.microsoft.com/en-us/dotnet/framework/ui-automation/ui-automation-tree-overview)
- Other projects (i.e.: Narrator) can take advantage of this UIA tree and are used to present information within it.
- Some things like XAML already have a UIA Tree. So some UIA tree navigation and features are already there. It's just a matter of getting them hooked up and looking right.

**Accessibility in our Project**
There's a few important classes...
regarding Accessibility...
- **WindowUiaProvider**: This sets up the UIA tree for a window. So this is the top-level for the UIA tree.
- **ScreenInfoUiaProvider**: This sets up the UIA tree for a terminal buffer.
- **UiaTextRange**: This is essential to interacting with the UIA tree for the terminal buffer. Actually gets portions of the buffer and presents them.

regarding the Windows Terminal window...
- **BaseWindow**: The foundation to a window. Deals with HWNDs and that kind of stuff.
- **IslandWindow**: This extends `BaseWindow` and is actually what holds our Windows Terminal
- **NonClientIslandWindow**: An extension of the `IslandWindow`

regarding ConHost...
- **IConsoleWindow**: This is an interface for the console window.
- **Window**: This is the actual window for ConHost. Extends `IConsoleWindow`

- `IConsoleWindow` changes:
  - move into `Microsoft::Console::Types` (a shared space)
  - Have `IslandWindow` extend it
- `WindowUiaProvider` changes:
  - move into `Microsoft::Console::Types` (a shared space)
- Hook up `WindowUiaProvider` to IslandWindow (yay! we now have a tree)

### Changes to the WindowUiaProvider
As mentioned earlier, the WindowUiaProvider is the top-level UIA provider for our projects. To reuse as much code as possible, I created `Microsoft::Console::Types::WindowUiaProviderBase`. Any existing functions that reference a `ScreenInfoUiaProvider` were virtual-ized.

In each project, a `WindowUiaProvider : WindowUiaProviderBase` was created to define those virtual functions. Note that that will be the main difference between ConHost and Windows Terminal moving forward: how many TextBuffers are on the screen.

So, ConHost should be the same as before, with only one `ScreenInfoUiaProvider`, whereas Windows Terminal needs to (1) update which one is on the screen and (2) may have multiple on the screen.

🚨 Windows Terminal doesn't have the `ScreenInfoUiaProvider` hooked up yet. We'll have all the XAML elements in the UIA tree. But, since `TermControl` is a custom XAML Control, I need to hook up the `ScreenInfoUiaProvider` to it. This work will be done in a new PR and resolve GitHub Issue #1352.


### Moved to `Microsoft::Console::Types`
These files got moved to a shared area so that they can be used by both ConHost and Windows Terminal.
This means that any references to the `ServiceLocator` had to be removed.

- `IConsoleWindow`
  - Windows Terminal: `IslandWindow : IConsoleWindow`
- `ScreenInfoUiaProvider`
  - all references to `ServiceLocator` and `SCREEN_INFORMATION` were removed. `IRenderData` was used to accomplish this. Refer to next section for more details.
- `UiaTextRange`
  - all references to `ServiceLocator` and `SCREEN_INFORMATION` were removed. `IRenderData` was used to accomplish this. Refer to next section for more details.
  - since most of the functions were `static`, that means that an `IRenderData` had to be added into most of them.


### Changes to IRenderData
Since `IRenderData` is now being used to abstract out `ServiceLocator` and `SCREEN_INFORMATION`, I had to add a few functions here:
- `bool IsAreaSelected()`
- `void ClearSelection()`
- `void SelectNewRegion(...)`
- `HRESULT SearchForText(...)`

`SearchForText()` is a problem here. The overall new design is great! But Windows Terminal doesn't have a way to search for text in the buffer yet, whereas ConHost does. So I'm punting on this issue for now. It looks nasty, but just look at all the other pretty things here. :)
2019-07-29 15:21:15 -07:00
Mike Griese ed18c1e8c1 Fix the About Dialog II: This Time it's Optional (#2122)
* Get rid of this unused variable
* This is the actual fix to the about dialog crashing: an unchecked optional variable
2019-07-29 09:46:32 -07:00
Dustin L. Howett (MSFT) 10c599eb17 Update SettingsSchema.md to fix #2121 (#2123)
* Update SettingsSchema.md to fix #2121
Fixes #2121.
* Update doc/cascadia/SettingsSchema.md
2019-07-29 09:45:11 -07:00
Mike Griese bd5cae1328
Change "Summary"->"Description" (#2115) 2019-07-26 11:16:53 -05:00
Mike Griese dd1f8a8245
Prevent a crash on resizing too small caused by the Titlebar (#2118)
Only set the MaxWidth of the TitlebarControl's Content when the value is
  positive. Any smaller will crash the app.
2019-07-26 11:16:13 -05:00
Mike Griese 644ac56fdb
If a profile did not have a GUID, generate one (#2117)
Fixes #2108
  Adds tests too!
2019-07-26 11:11:26 -05:00
mervynzhang 83a4c22919 Set Starting Directory for WSL profile (#2033) 2019-07-26 09:02:07 -07:00
Kayla Cinnamon 09e828fa49 shrunk + icon (#2109) 2019-07-26 07:06:28 -05:00
Mike Griese c97cccb55c Initializes conhost's Campbell color scheme in conhost order instead of ANSI/VT order (#1237)
* Fix this

* Swap the elements instead of having two whole tables

* Add a unittest to make @miniksa happy
2019-07-25 22:03:00 +00:00
PankajBhojwani 63347f47fb
The Azure cloud shell connector (#1808)
* We can now connect to the Azure cloud shell #1235
2019-07-25 13:31:41 -07:00
Mike Griese a5746850f9 Make sure to apply the theme on load of the application (#2107)
Fixes #1913.

  _AplyTheme raises an event for the IslandWindow to handle and actually apply
  the theme, so we don't _really_ need to worry about it, but we do need to
  worry for ContentDialogs.
2019-07-25 13:25:38 -07:00
Mike Griese a2744529e6 Fixes #2090 (#2094) 2019-07-25 11:01:03 -07:00
Maurice Kevenaar 577da7441e (GH-2044) Updated readme to include Chocolatey package (#2084)
* (GH-2044) Updated readme to include Chocolatey package
Co-Authored-By: Mike Griese <migrie@microsoft.com>
2019-07-25 10:50:57 -07:00
Michael Ratanapintha 66d46ed8ed Allow empty strings and env vars in profile "icon" settings - fixes #1468, #1867 (#2050)
First, I tried reusing the existing ExpandEnvironmentVariableStrings()
helper in TerminalApp/CascadiaSettings.cpp, but then I realized that
WIL already provides its own wrapper for ExpandEnvironmentStrings(),
so instead I deleted ExpandEnvironmentVariableStrings() and replaced
its usages with wil::ExpandEnvironmentStringsW().

I then used wil::ExpandEnvironmentStringsW() when resolving the
icon path as well. In addition, to allow empty strings,
I made changes to treat empty strings for "icon" the same
as JSON `null` or not setting the property at all.

Co-Authored-By: Michael Niksa <miniksa@microsoft.com>
2019-07-25 10:44:58 -07:00
Michael Niksa 8ae4f2fc1b
The spice must flow. (#2096) 2019-07-25 10:44:12 -07:00
James Holderness 2febe1fa2b Fix a couple of the DEC Special Graphics characters (#2081)
* Map the code point 0x5F to a blank glyph in the Special Graphics character set.

* Map code point 0x60 in the Special Graphics character set to the Unicode "black diamond suite", rather than the "black diamond", since the latter is currently rendered as a double width glyph.

* Correct a couple of the comments on the Special Graphics translation table to match the DEC documentation.

* Make hex values consistently lowercase for the Unicode characters in the Special Graphics translation table.
2019-07-24 21:55:59 -07:00
Robert Jordan 89190c6e6c Add support for background image alignment (as one setting) (#1959)
* Implement base background image alignment settings

TerminalSettings now has two new properties:
* BackgroundImageHorizontalAlignment
* BackgroundImageVerticalAlignment

These properties are used in TermControl::_InitializeBackgroundBrush to specify the alignment for TermControl::_bgImageLayer.

This is a base commit that will split into two possible branches:
* Use one setting in profiles.json: "backgroundImageAlignment"
* Use two settings in profiles.json: "backgroundImageHorizontal/VerticalAlignment"

* Implement background image alignment profile setting

Implement background image alignment as one profile setting.
* This has the benefit of acting as a single setting when the user would likely want to change both horizontal and vertical alignment.
* HorizontalAlignment and VerticalAlignment are still stored as a tuple in Profile because they are an optional field. And thus, it would not make sense for one of the alignments to be left unused while the other is not.
* Cons are that the tuple signature is quite long, but it is only used in a small number of locations. The Serialize method is also a little mishapen with the nested switch statements. Empty lines have been added between base-level cases to improve readability.

* Fix capitalization typo for BackgroundImageStretchModeKey

In Profiles.cpp, the key for the image stretch mode json property had a lowercase 'i' in "Backgroundimage", not following proper UpperCamelCase.
The "i" has been capitalized and the two usages of the constant have been updated as well.

* Document Background Image settings

* Adds entries SettingsSchema.md for the original 3 backgroundImage settings in addition to the new backgroundImageAlignment setting.

* Fix setting capitalization error in UsingJsonSettings.md

* The background image example in UsingJsonSettings.md listing a backgroundImageStretchMode of "Fill" has been corrected to "fill".


Fixes #1949.
2019-07-24 21:47:06 -07:00
Michael Niksa 2c3e175f62
Doc of stuff I've explained. (#1942)
* Doc of stuff I've explained.

* add a few more

* archive fulltext of comments and link back to originals, attempt to make relative anchor links for jumping.
2019-07-24 14:10:33 -07:00
Force Charlie 9d36b08b82 Switch away from OS version detection for DirectWrite things (#2065)
* If IDWriteTextFormat1 does not exist, return directly
* We use DXGI_SCALING_NONE create SwapChain first, if failed switch to DXGI_SCALING_STRETCH

Co-Authored-By: Michael Niksa <miniksa@microsoft.com>
Co-Authored-By: Dustin L. Howett (MSFT) <duhowett@microsoft.com>
2019-07-24 09:57:13 -07:00
mcpiroman 5da2ab1a86 Scroll from selection dragging out of window (#1247) (#1523)
* Scroll from selection dragging out of window
* Review changes, dynamic dt measurement, function separation
2019-07-24 09:37:17 -07:00
Scott Hanselman e662277cb0 TAKE ME TO THE DOWNLOADS (#2070)
* TAKE ME TO THE DOWNLOADS
* Update README.md
Added store badge and reader and alternate release suggestion
2019-07-24 09:31:56 -07:00
Dustin L. Howett (MSFT) 2407828d03
Allow the mapping of OEM keys ({}|\<>/_-=+) in key bindings (#2067)
This commit introduces support for key bindings containing keys
traditionally classified as "OEM" keys. It uses VkKeyScanW and
MapVirtualKeyW, and translates the modifiers that come out of
VkKeyScanW to key chord modifiers.

The net result of this is that you can use bindings like "ctrl+|" in
your settings. That one in particular will be reserialized (and
displayed in any menus) as "ctrl+shift+\". Admittedly, this is not
clear, but it _is_ the truest representation of the key.

This commit also moves the Xaml key chord name override generator into
App as a static function, *AND* it forces its use for all modifier
names. This will present a localization issue, which will be helped in
part by #1972. This is required to work around
microsoft/microsoft-ui-xaml#708. I've kept the original code around
guarded by a puzzling ifdef, because it absolutely has value.

Fixes #1212.
2019-07-23 14:05:07 -07:00
Dustin L. Howett (MSFT) 69c67f8a8e
Move TerminalApp's resources into the TerminalApp project (#1972)
* Move TerminalApp's resources into the TerminalApp project

This commit also introduces a scoped resource accessor, lightly taken
from microsoft-ui-xaml. It also moves all static UI strings out of
App.cpp and into localizable resources.

Fixes #792.
2019-07-23 11:29:38 -07:00
Mike Griese 260d095f94 Change some default keybindings (#2014)
Closes #1417.

  Changes New Tab to Ctrl+Shift+t (from Ctrl+t)
  Changes SwitchToTabN to Ctrl+Alt+<number> (from Alt+<number>)
2019-07-22 17:53:10 -07:00
Dustin L. Howett (MSFT) a6ab075a62 Automatically generate an SxS manifest for WindowsTerminal's winmds (#2043)
Fixes #1987.
2019-07-22 17:51:37 -07:00
Force Charlie 3b96a84261 Fix conhost.exe detect os version (#2059)
* add openconsole.exe.manifest to fix detecting of os version
2019-07-22 17:49:35 -07:00
WSLUser dca0ffe6dd Changes link to go to latest ColorTool release (#2027)
Since ColorTool shares the same Release page as Windows Terminal, it is more difficult to navigate to it. So whenever ColorTool is updated with a new release, we will update the link to the latest release. The link I changed to is the latest available from April 2019.
2019-07-19 12:11:58 -07:00
Mike Griese 5074335392 Add a keybinding for ClosePane (#2012)
Closes #993
  When the last pane in a tab is closed, the tab will close.
  Bound to Ctrl+Shift+W by default. See #1417 for discussion on the default
  keybindings. The Ctrl+W->CloseTab keybinding is being removed in favor of
  ClosePane.
2019-07-18 17:23:40 -07:00
Mike Griese 8ffff8ea37
Enable dragging with the entire titlebar (#1948)
* This definitely works for getting shadow, pointy corners back

  Don't do anything in NCPAINT. If you do, you have to do everything. But the
  whole point of DwmExtendFrameIntoClientArea is to let you paint the NC area in
  your normal paint. So just do that dummy.

  * This doesn't transition across monitors.
  * This has a window style change I think is wrong.
  * I'm not sure the margins change is important.

* The window style was _not_ important

* Still getting a black xaml islands area (the HRGN) when we switch to high DPI

* I don't know if this affects anything.

* heyo this works.

  I'm not entirely sure why. But if we only update the titlebar drag region when
  that actually changes, it's a _lot_ smoother. I'm not super happy with the
  duplicated work in _UpdateDragRegion and OnSize, but checking this in in case
  I can't figure that out.

* Add more comments and cleanup

* Try making the button RightCustomContent

* * Make the MinMaxClose's drag bar's min size the same as a caption button
* Make the new tab button transparent, to see how that looks
* Make sure the TabView doesn't push the MMC off the window

* Create a TitlebarControl

  * The TitlebarControl is owned by the NCIW. It consists of a Content, DragBar,
    and MMCControl.
  * The App instatntiates a TabRowControl at runtime, and either places it in
    the UI (for tabs below titlebar) or hangs on to it, and gives it to the NCIW
    when the NCIW creates its UI.
  * When the NCIW is created, it creates a grid with two rows, one for the
    titlebar and one for the app content.
  * The MMCControl is only responsible for Min Max Close now, and is closer to
    the window implementation.
  * The drag bar takes up all the space from the right of the TabRow to the left
    of the MMC
  * Things that **DON'T** work:
    - When you add tabs, the drag bar doesn't update it's size. It only updates
      OnSize
    - The MMCControl's Min and Max buttons don't seem to work anymore.
      - They should probably just expose their OnMinimizeClick and
        OnMaximizeClick events for the Titlebar to handle minimizing and
        maximizing.
    - The drag bar is Magenta (#ff00ff) currently.
    - I'm not _sure_ we need a TabRowControl. We could probably get away with
      removing it from the UI tree, I was just being dumb before.

* Fix the MMC buttons not working

  I forgot to plumb the window handle through

* Make the titlebar less magenta

* Resize the drag region as we add/remove tabs

* Move the actual MMC handling to the TitlebarControl

* Some PR nits, fix the titlebar painting on maximize

* Put the TabRow in our XAML

* Remove dead code in preparation for review

* Horrifyingly try Gdi Plus as a solution, that is _wrong_ though

* Revert "Horrifyingly try Gdi Plus as a solution, that is _wrong_ though"

This reverts commit e038b5d921.

* This fixes the bottom border but breaks the titlebar painting

* Fix the NC bottom border

* A bunch of the more minor PR nits

* Add a MinimizeClick event to the MMCControl

  This works for Minimize. This is what I wanted to do originally.

* Add events for _all_ of the buttons, not just the Minimize btn

* Change hoe setting the titlebar content works

  Now the app triggers a callcack on the host to set the content, instead of the host querying the app.

* Move the tab row to the bottom of it's available space

* Fix the theme reloading

* PR nits from @miniksa

* Update src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp

Co-Authored-By: Michael Niksa <miniksa@microsoft.com>

* This needed to be fixed, was missed in other PR nits

* runformat

  wait _what_

* Does this fix the CI build?
2019-07-18 17:21:33 -05:00
Dustin L. Howett (MSFT) 57ad2d57fd
Roll up dependencies through TerminalApp so the package is right (#2018)
This commit includes a script and build step to make sure the MSIX doesn't continue to regress
2019-07-18 11:23:34 -07:00
Michael Ratanapintha f1441a589c Fix test runner commands (runut.cmd and friends; Invoke-OpenConsoleTests) (#2020)
In commit 0905140955 (PR #1164),
we updated the version of the Taef.Redist.Wlk NuGet package
for the TAEF test harness and framework. However, the helper commands
to run the various test cases hard-code the path to the TAEF executable,
which because of NuGet's design includes the TAEF NuGet package version.
These commands weren't updated to reflect the new TAEF version
and so have been broken since then.

This commit fixes the issue and makes running tests possible again.
2019-07-18 09:31:25 -07:00
Dustin L. Howett (MSFT) 988fe0ba60
Fix the static UTF8OutPipeReader & tests (#1998)
This commit addresses some lingering issues in UTF8OutPipeReader and cleans up its termination logic. It also fixes some issues exposed in the test.

Fixes #1997.
2019-07-17 16:27:09 -07:00
Dustin L. Howett (MSFT) de1de4425e
Roll up WindowsTerminal's subprojects into packaging outputs (#2007)
This commit introduces a GetPackagingOutputs override to WindowsTerminal that
rolls up its child projects' outputs.

It also introduces an atrocity that fixes a new regression in VS 16.2/16.3.
2019-07-17 14:02:20 -07:00
Mike Griese 8d52ba0990
Add support for moving focus between panes with the keyboard (#1910)
Enables the user to set keybindings to move focus between panes with the keyboard. 
This is highly based off the work done for resizing panes. Same logic applies - 
  moving focus will move up the panes tree until we find a pane to move the focus to.
2019-07-17 09:30:15 -05:00
Dustin L. Howett a0782bfd6c Mark ESC as handled so that it doesn't come back in CharacterHandler (#1974) 2019-07-16 13:56:46 -07:00
Steffen fa5b9b06bd Fix for UTF-8 partials in function ConhostConnection::_OutputThread. (#1850)
* Fix for UTF-8 partials in functions `ConhostConnection::_OutputThread` and `ApiRoutines::WriteConsoleOutputCharacterAImpl`

The implementation needs to check whether or not the buffer ends with a partial character. If so, only convert the code points which are complete, and save the partial code units in a cache that gets prepended to the next chunk of text.

* Utf8OutPipeReader class added
* Unit Test added
* use specific macros and WIL classes
* avoid possible deadlock caused by unclosed pipe handle
2019-07-16 11:14:07 -07:00
Leonard Hecker 7067910862 Add a ControlKeyStates wrapper class (#1718)
* Fixed a minor build warning
* Removed an unimplemented method declaration
* Added Microsoft::Terminal::Core::ControlKeyStates
// This class will act as a safe wrapper for the ControlKeyState enum,
// found in the NT console subsystem (<um/wincon.h>).
2019-07-16 11:09:29 -07:00
Mike Griese 0905140955
Refactor TerminalApp and Add Tests for Xaml Content (#1164)
* Refactors TerminalApp into two projects: 
  - TerminalAppLib, which builds a .lib, and includes all the code
  - TerminalApp, which builds a dll by linking the lib
* Adds a TerminalApp.Unit.Tests project
  - Includes the ability to test cppwinrt types we've authored using a SxS manifest for unpackaged winrt activation
  - includes the ability to test types with XAML content using an appxmanifest
* Adds a giant doc explaining how this was all done. Really, just go read that doc, it'll really help you understand what's going on in this PR.

-------------------------
These are some previous commit messages. They may be helpful to future readers.

* Start adding unittests for json parsing, end up creating a TerminalAppLib project to make a lib. See #1042

* VS automatically did this for me

* This is a dead end

  I tried including the idl-y things into the lib, but that way leads insanity

  If you want to make a StaticLibrary, then suddenly the winrt toolchain forgets
  that ProjectReferences can have winmd's in them, so it won't be able to
  compile any types from the referenced projects. If you instead try to manually
  reference the types, you'll get duplicate types up the wazoo, which of course
  is insane, since we're referencing them the _one_ time

* Yea just follow #1042 on github for status

  So current state:

  1. If you try to add a `Reference` to all of MUX.Markup, TerminalControl and
     TerminalSettings, then mdmerge will complain about all   the types from
     TerminalSettings being defined twice. In this magic scenario, the
     dependencies of TerminalControl are used directly   for some reason:

```
  12>    Load input metadata file ...OpenConsole\x64\Debug\TerminalSettings\Microsoft.Terminal.Settings.winmd.
  12>    Load input metadata file ...OpenConsole\x64\Debug\TerminalControl\Microsoft.Terminal.Settings.winmd.
  12>    Load input metadata file ...OpenConsole\x64\Debug\TerminalControl\Microsoft.Terminal.TerminalConnection.winmd.
  12>    Load input metadata file ...OpenConsole\x64\Debug\TerminalControl\Microsoft.Terminal.TerminalControl.winmd.
  12>    Load input metadata file ...OpenConsole\x64\Debug\Microsoft.UI.Xaml.Markup\Microsoft.UI.Xaml.Markup.winmd.
```

  2. If you don't add a `Reference` TerminalControl, then it'll complain about
     being unable to find the type TitleChangedEventArgs,   which is defined in
     TerminalControl.

  3. If you don't add a `Reference` TerminalSettings, then it'll complain about
     being unable to find the type KeyChord and other   types from
     TerminalSettings. In this scenario, it doesn't recurse on the other
     dependencies from TerminalControl for whatever   reason.

  4. If you instead try to add all 3 as a `ProjectReference`, then it'll
     complain about being unable to find TitleChangedEventArgs,   as in 2.
     Presumably, it;ll have troubles with the other types too, as none of the 3
     are actually included in the midlrt.rsp file.

  5. If you add all 3 as a `ProjectReference`, then also add TerminalControl as
     a `Reference`, you'll get a `MIDL2011: [msg]  unresolved type declaration
     Microsoft.UI.Xaml.Markup.XamlApplication`

  6. If you add all 3 as a `ProjectReference`, then also add TerminalControl AND
     MUX.Markup as a `Reference`, you'll get the same   result as 3.

* what if we just don't idl

  This seems to compile

* This compiles but I broke the MUX resources

  look at the App.xaml change. in this changelist. That's what's broken right now. Lets fix that!

* lets do this

    If I leave the MUX nuget out of the project, I'll get a compile error in
    App.xaml:

    ```
    ...OpenConsole\src\cascadia\TerminalApp\App.xaml(21,40): XamlCompiler error WMC0001: Unknown type 'XamlControlsResources' in XML namespace 'using:Microsoft.UI.Xaml.Controls'
    ```

    If I add it back to the project, it works

* Some cleanup from the previous commit

* This is busted again.

  Doing a clean build didn't work.

    A clean rebuild of the project, paired with some removal of dead code
    revealed a problem with what I have so far.

    TerminalAppLib depends on the generation of two headers,
    `AppKeyBindings.g.h` and `App.g.h`, as those define some of bits of the
    winrt types. They're needed to be able to compile the implementations.
    Presumably that's not getting generated by the lib project, because the dll
    project is the one to generate that file.

    So we need to move the idl's to the lib project. This created maddness,
    because of course the Duplicate Type thing. The solution to that is to
    actually mark the winrt DLLs that we're chaining up through us as

    ```
        <Private>false</Private>
        <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
    ```

    This will prevent them from getting double-included.

    This still doesn't work however, since
    ```
    app.cpp(40): error C2039: 'XamlMetaDataProvider': is not a member of 'winrt::TerminalApp'
    error C3861: 'XamlMetaDataProvider': identifier not found
    ```

    So we need to figure that out. The dll project is still generating the right
    header, so lets look there.

* Move the xaml stuff to the lib

  This compiles, but when we launch, we fail to load the tabviewcontrol
  resources again. So that's not what you want. Why is it not included?

* It works again!

  * Use the pri, xbf files from TerminalAppLib, not TerminalApp
  * Manually make TerminalApp include a reference to TerminalAppLib's
    TerminalApp.winmd. This will force the build to copy TerminalApp.winmd to
    TerminalApp/, which WindowsTerminal needs to be able to ProjectReference the
    TerminalApp project (it's expecting it to have a winmd)
  * Remove the module.g.cpp from TerminalApp, and move to TerminalAppLib. The
    dll doesn't do any codegen anymore.

* Agressively clean up these files

* Clean up unnecessary includes in the dll pch.h

* This does NOT work.

  The WindowsxamlManager call crashes. I'm thinking it has to do with activation
  of winrt types from a dll.

  Email out to @Austin-Lamb to see if he can assist

* This gets our cppwinrt types working, but xaml islands is still broken

* Split the tests apart, so they aren't insane

* These are the magic words to make xaml islands work

* All this witchcraft is necessary to make XAML+MUX work right

* Clean this up a bit and add comments

* Create an enormous doc explaining this madness

* Unsure how this got changed.

* Trying to get the CI build to work again.

  This resolves the MUX issue. We need to manually include it, because their package's target doesn't mark it as CopyLocalSatelliteAssemblies=false, Private=false.

  However, the TerminalApp project is still able to magically reason that the TerminalAppLib project should be included in the MdMerge step, because it think's it's a `GetCppWinRTStaticProjectReferences` reference.

* Update cppwinrt to the latest version - this fixes the MSBuild

  * I still need to re-add the KeyModifiers checks from TermControl. I think
    this update broke `operator&` for that enum.
  * There needs to be some cleanup obviously
  * The doc should be updated as well

* Clean up changes from cppwinrt update

* Try doing this, even though it seems wrong

* Lets try this (press x to doubt)

* Clean up vcxproj file, and remove appxmanifest change from previous commit

* Update to the latest TAEF release, maybe that'll work

* Let's try a prerelease version, shall we?

* Add notes about TAEF package, comment out tests

* Format the code

* Hopefully fix the arm64 and x86 builds

  also a typo

* Fix PR nits

* Fix some bad merge conflicts

* Some cleanup from the merge

* Well I was close to getting the merge right

* I believe this will fix CI

* Apply suggestions from code review

Co-Authored-By: Carlos Zamora <carlos.zamora@microsoft.com>

* These definitely need to be fixed

* Try version detecting in the test

  IDK if this will build, I'm letting the CI try while I clean rebuild locally

* Try blindly updating to the newest nuget version

* Revert "Try blindly updating to the newest nuget version"

This reverts commit b72bd9eb73.

* We're just going to see if these work in CI with this change

* Comment the tests back out. Windows Server 2019 is 10.0.17763.557

* Remove the nuget package

  We don't need this package anymore now that we're hosting it

* Okay this _was_ important
2019-07-15 14:27:56 -05:00
ksyx fad7638bb3 user docs: Fix the capitalization on “Color Schemes” (#1953) 2019-07-13 11:17:11 -07:00
Michael Niksa 3377f06e52 Host our own NuGet feed for packages that we need that aren't elsewhere yet (#1951)
* Stop hosting packages inside of here. Put them on a blob storage account instead.
2019-07-12 15:22:03 -07:00