Commit graph

653 commits

Author SHA1 Message Date
Mike Griese 646d8f91b9 Fix the ut_app build for VS 16.2, 16.3 (#2347)
Move the hack from TerminalApp.vcxproj to a .targets file to be used by the ut_app project too.

Fixes #2143
2019-08-09 13:21:45 -07:00
toby eac29d2c67 Add list of keybindings to SettingsSchema.md (#2335)
* Add list of keybindings to

* Add missed copy bindings
2019-08-09 09:33:01 -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
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