Commit graph

644 commits

Author SHA1 Message Date
Mike Griese b97db63030 Prevent the v1 propsheet from zeroing colors, causing black text on black background. (#2651)
* This fixes the registry path

  What's happening is the console is writing the Forcev2 setting, then the v1
  console is ignoring those settings, then when you check the checkbox to save
  the v2 settings, we'll write the zeros out. That's obviously bad. So we'll
  only write the v2 settings back to the registry if the propsheet was launched
  from a v2 console.

  This does not fix the shortcut path. That'll be the next commit.

* Fix the shortcut loading too

  fixes #2319

* remove the redundant property I added

* add some notes to the bx.ps1 change
2019-10-02 16:04:59 -07:00
Dustin L. Howett (MSFT) 64c98db024 Propagate window style changes to the titlebar and minmax (#3025)
Fixes #1780
2019-10-02 10:27:07 -07:00
Dustin L. Howett (MSFT) 621d841538 Simplify non-client hit testing in NCIslandWindow to fix doubleclick (#3024)
It turns out that our WM_LBUTTONDOWN handler wasn't even necessary, as
our NCHITTEST tells win32 that all of the titlebar is actually
non-client area. This brings the code in line with
NonNonClientIslandWindow.

Fixes #2513
2019-10-02 10:25:10 -07:00
Rich Turner 06bd7e22da Update cmd's default profile to disable acrylic (#3020)
As per prior agreement with WinUI team, disabling acrylic for Cmd (and Windows PowerShell, already complete) by default. 

PowerShell Core/7 and WSL distros allowed to have Acrylic enabled by default.
2019-10-02 10:23:44 -07:00
Dustin L. Howett (MSFT) 17495fcda3 Remove a stray inclusion of an old Windows.ImplementationLibrary package (#3026)
Fixes a build error.
2019-10-02 10:15:12 -07:00
Rich Turner abf3ee5d6e doc: Remove default issue titles (#2999)
* Removes default issue titles as per today's discussion.
* Removed Guidance issue template

[skip ci]
2019-10-01 16:49:30 -07:00
Mike Griese 0ce08aff32 do not allow CUU and CUD to move "across" margins. (#2996)
If we're moving the cursor up, its vertical movement should be stopped
at the top margin. It should not magically jump up to the bottom margin.
Similarly, this applies to moving down and the bottom margin.
Furthermore, this constraint should always apply, not just when the
start position is within BOTH margins

Fixes #2929.
2019-10-01 10:42:33 -07:00
Leonard Hecker 33361698f7 Partially fix mapping of virtual keys to characters (#2836) 2019-10-01 11:15:30 -05:00
Mike Griese 847d6b56ad
When reverse indexing, preserve RGB/256 attributes (#2987) 2019-10-01 10:56:06 -05:00
Nathanael 3294a8f7b1 Fix Typo in README.md (#2972) 2019-10-01 08:15:18 -07:00
Michael Niksa 5d906d9f3e Patch fix for #1360 until WriteStream (#780) can be implemented. (#2924)
* Patch fix for #1360 until WriteStream (#780) can be implemented.

* Add a test that hangs in the broken state and passes in the success stat. Writes a bisecting character to the right most cell in the window.

* Code format! *shakes fist at sky*

* Update src/cascadia/TerminalCore/Terminal.cpp
2019-10-01 01:45:09 +00:00
Carlos Zamora 4dd9f9c180 make filling chars (and, thus, erase line/char) unset wrap (#2831)
EraseInLine calls `FillConsoleOutputCharacterW()`. In filling the row with
chars, we were setting the wrap flag. We need to specifically not do this on
ANY _FILL_ operation. Now a fill operation UNSETS the wrap flag if we fill to
the end of the line.

Originally, we had a boolean `setWrap` that would mean...
- **true**: if writing to the end of the row, SET the wrap value to true
- **false**: if writing to the end of the row, DON'T CHANGE the wrap value

Now we're making this bool a std::optional to allow for a ternary state. This
allows for us to handle the following cases completely. Refer to the table
below:

,- current wrap value
|     ,- are we filling the last cell in the row?
|     |     ,- new wrap value
|     |     |     ,- comments
|--   |--   |--   |
| 0   | 0   | 0   |
| 0   | 1   | 0   |
| 0   | 1   | 1   | THIS CASE WAS HANDLED CORRECTLY
| 1   | 0   | 0   | THIS CASE WAS UNHANDLED
| 1   | 0   | 1   |
| 1   | 1   | 1   |

To handle that special case (1-0-0), we need to UNSET the wrap. So now, we have
~setWrap~ `wrap` mean the following:
- **true**: if writing to the end of the row, SET the wrap value to TRUE
- **false**: if writing to the end of the row, SET the wrap value to FALSE
- **nullopt**: leave the wrap value as it is

Closes #1126
2019-09-30 18:16:31 -07:00
Dustin L. Howett (MSFT) a2f8a943b4
teach wil about c++/winrt exceptions by including cppwinrt.h (#2927)
It turns out that if you CATCH_LOG without including this file, and you
end up catching a C++/WinRT hresult_exception, IT TURNS IT INTO A
FAILFAST.

Fixes #2591.
Fixes #2881.
Fixes #2807.
2019-09-30 15:52:27 -07:00
Xiaoyin Liu 5c4e8f52fb doc: update outdated FAQ regarding 1903 (#2995)
Since version 1903 has been released for long time, let's change "wait for 1903 release" to "version 1903 or later".

[skip ci]
2019-09-30 15:49:06 -07:00
Mike Griese 6831120755 Passthrough BEL in conpty (#2990)
🔔
[insert Chorus of the Bells here -DHowett]

Fixes #2952.
2019-09-30 15:38:52 -07:00
Michael Niksa 52534c94cc Combined changes to make the build work again (see inside) (#2945)
* Revert "Add source linking information during the build (#2857)"

This reverts commit 6b728cd6d0.

* Need reference to renderer base inside UnitTests_TerminalCore
* add dependency for TerminalControl to Types project.
* Set build to single threaded as parallel build is broken by 16.3 build toolchain.
* Disable new rule C26814 as it's breaking builds
   Wrote a follow up task #2941 to roll it out later.
* Add noexcept to dx header.
2019-09-30 10:39:55 -07:00
Brandon 083be43700 Add keyboard shortcuts to increase and decrease font size (#2700)
* Hook up font size key bindings and events

* Combine increase and decrease font size events

* Add zoom keybindings to defaults.json

* Fix whitespace
2019-09-30 08:18:05 -05:00
Mike Griese 1caece74ab Give powershell its own scheme (#2936)
Fixes #2883.
2019-09-27 18:20:03 -07:00
Mike Griese 23bea9e5b5 doc: add note on dynamic profile GUIDs (#2938) 2019-09-27 14:50:02 -07:00
Kayla Cinnamon 258c8b407c
Add profiles.json schema to doc folder (#2704)
* added profiles.json schema to doc folder

* addressed most comments

* addressed most comments

* fixed keybindings regex and color table

* updated schema and settings documentation

* Delete dlfk

* Update doc/cascadia/SettingsSchema.md

Co-Authored-By: Dustin L. Howett (MSFT) <duhowett@microsoft.com>

* Update doc/cascadia/profiles.schema.json

Co-Authored-By: Dustin L. Howett (MSFT) <duhowett@microsoft.com>

* updated schema
2019-09-27 13:38:49 -07:00
Michael Niksa 0dc1c5b163 inbox: console: consolidated build break fixes from vb_release_dep_dev1
- Merged PR 3815980: FIX BUILD BREAK - console: propagate input eventing changes to onecore interactivity
- Merged PR 3816007: FIX BUILD BREAK - console: api_ptytests must use SIZE_T for InitProcThreadAttrList

Retrieved from https://microsoft.visualstudio.com os OS official/rs_onecore_dep_uxp c06af1c985955b67b8b6824e264064a6244f8d34

(cherry picked from commit cc46a618ff27b8fb866be660fcad3b043681e5f8)
2019-09-27 11:24:09 -07:00
Carlos Zamora 0df6415e5b
Update Docs on "Copy" Operation (#2799) 2019-09-27 11:07:59 -07:00
Mike Griese 6f4b98acb4
Fix snapping to the cursor in "Terminal Scrolling" mode (#2705)
fixes #1222

  PSReadline calls SetConsoleCursorPosition on each character they emit (go
  figure). When that function is called, and we set the cursor position, we'll
  try and "snap" the viewport to the location of the cursor, so that the cursor
  remains visible.

  However, we'd only ever do this with the visible viewport, the viewport
  defined by `SCREEN_INFORMATION::_viewport`. When there's a virtual viewport in
  Terminal Scrolling mode, we actually need to snap the virtual viewport, so
  that this behavior looks more regular.
2019-09-27 11:21:37 -05:00
Chester Liu eafa884fc4 Fix double width cursor for CJK characters (#2932) 2019-09-27 07:54:31 -05:00
Michael Niksa 86c9e586fe inbox: merge rs_onecore_dep_uxp b4fc3a535 2019-09-26 11:44:54 -07:00
Michael Niksa 6b728cd6d0
Add source linking information during the build (#2857)
Copies source linking scripts and processes from Microsoft/Microsoft-UI-XAML. This embeds source information inside the PDBs in two formats: One for WinDBG using a PowerShell script that runs during the build, and one for Visual Studio using the Microsoft.SourceLink.GitHub NuGet pacakge. Sources are automatically pulled from raw.githubusercontent.com when debugging a release build inside either of these utilities as of this change.
2019-09-26 09:31:09 -07:00
Rich Turner 2c8b3243dc Fix the link to the Roadmap & improve the Readme (#2903) 2019-09-25 22:00:06 -07:00
Chester Liu 1386148191 Retarget VtPipeTerm & terminalcore-lib to 18362 (#2885) 2019-09-25 15:09:56 -07:00
Rich Turner 275b651c8f Roadmap doc update (#2882)
* Renamed timeline -> roadmap

* Minor doc update
2019-09-25 07:30:33 -05:00
paul cheung 7faf3342e0 minor typo fix (#2863) 2019-09-24 15:34:26 -07:00
Jonas Lomholdt 9ed9e7c8aa doc: fix broken releases link in README.md (#2877) 2019-09-24 13:51:33 -07:00
Michael Niksa 60c6a9fb8f Improve debugging experience of key events (#2872)
... by adding natvis rules for display and by typifying the flags field so the debugger presents it as flags naturally.
2019-09-24 13:50:53 -07:00
Carlos Zamora a862f3196f
Bugfix: EraseInLine off-by-one error (#2879) 2019-09-24 13:05:39 -07:00
Rich Turner f5071439a3
Writeup Terminal milestones & timeline doc (#2821)
First version, including all addressed feedback.
2019-09-24 06:49:34 -07:00
paul cheung a9d57ef9ea doc: minor typo fix (#2860) 2019-09-23 19:58:02 -07:00
Dustin L. Howett (MSFT) a1bd7967e2 conhost: if we start with invalid terminal colors, reset them to sanity (#2855)
* conhost: if we start with invalid terminal colors, reset them to sanity

We've seen a number of cases where the user's settings can get corrupted
and their default foreground/background and cursor color get set to all
black (black on black). This results in a fairly unhappy user and
probably a great number of support incidents.

Let's declare that an invalid state.

* Add some comments to the comments
2019-09-23 18:35:53 -07:00
Dustin L. Howett (MSFT) 90a3d99512
defaults: bind alt+f4 to closeWindow (#2858) 2019-09-23 17:12:00 -07:00
James Holderness 0c8a4df963 Remove unwanted DECSTBM clipping (#2764)
The `DECSTBM` margins are meant to define the range of lines within which
certain vertical scrolling operations take place. However, we were applying
these margin restrictions in the `ScrollRegion` function, which is also used in
a number of places that shouldn't be affected by `DECSTBM`.

This includes the `ICH` and `DCH` escape sequences (which are only affected by
the horizontal margins, which we don't yet support), the
`ScrollConsoleScreenBuffer` API (which is public Console API, not meant to be
affected by the VT terminal emulation), and the `CSI 3 J` erase scrollback
extension (which isn't really scrolling as such, but uses the `ScrollRegion`
function to manipulate the scrollback buffer).

This commit moves the margin clipping out of the `ScrollRegion` function, so it
can be applied exclusively in the places that need it.

With the margin clipping removed from the `ScrollRegion` function, it now had
to be applied manually in the places it was actually required. This included:

* The `DoSrvPrivateReverseLineFeed` function (for the `RI` control): This was
* just a matter of updating the bottom of the scroll rect to the bottom margin
* (at least when the margins were actually set), since the top of the scroll
* rect would always be the top of the viewport.  The
* `DoSrvPrivateModifyLinesImpl` function (for the `IL` and `DL` commands):
* Again this was just a matter of updating the bottom of the scroll rect, since
* the cursor position would always determine the top of the scroll rect.  The
* `AdaptDispatch::_ScrollMovement` method (for the `SU` and `SD` commands):
* This required updating both the top and bottom coordinates of the scroll
* rect, and also a simpler destination Y coordinate (the way the `ScrollRegion`
* function worked before, the caller was expected to take the margins into
* account when determining the destination).

On the plus side, there was now no longer a need to override the margins when
calling `ScrollRegion` in the `AdjustCursorPosition` function. In the first
case, the margins had needed to be cleared (_stream.cpp 143-145), but that is
now the default behaviour. In the second case, there had been a more
complicated adjustment of the margins (_stream.cpp 196-209), but that code was
never actually used so could be removed completely (to get to that point either
_fScrollUp_ was true, so _scrollDownAtTop_ couldn't also be true, or
_fScrollDown_ was true, but in that case there is a check to make sure
_scrollDownAtTop_ is false).

While testing, I also noticed that one of the `ScrollRegion` calls in the
`AdjustCursorPosition` function was not setting the horizontal range correctly
- the scrolling should always affect the full buffer width rather than just the
  viewport width - so I've fixed that now as well.

## Validation Steps Performed

For commands like `RI`, `IL`, `DL`, etc. where we've changed the implementation
but not the behaviour, there were already unit tests that could confirm that
the new implementation was still producing the correct results.

Where there has been a change in behaviour - namely for the `ICH` and `DCH`
commands, and the `ScrollConsoleScreenBuffer` API - I've extended the existing
unit tests to check that they still function correctly even when the `DECSTBM`
margins are set (which would previously have caused them to fail).

I've also tested manually with the test cases in issues #2543 and #2659, and
confirmed that they now work as expected.

Closes #2543
Closes #2659
2019-09-23 16:16:54 -07:00
Mike Griese 1c412d42b3 Enable VT processing by default for ConPTY (#2824)
This change enables VT processing by default for _all_ conpty clients. See #1965 for a discussion on why we believe this is a righteous change.

Also mentioned in the issue was the idea of only checking the `VirtualTerminalLevel` reg key in the conpty startup. I don't think this would be a more difficult change, looks like all we'd need is a simple `reg.LoadGlobalsFromRegistry();` call instead of this change.

# Validation Steps Performed
Manually launched a scratch app in both the terminal and the console. The console launch's output mode was 0x3, and the terminal's was 0x7. 0x4 is the ` ENABLE_VIRTUAL_TERMINAL_PROCESSING` flag, which the client now had by default in the Terminal.

Closes #1965
2019-09-23 15:07:47 -07:00
Dustin L. Howett (MSFT) 277acc3383
Add some retry support to Renderer::PaintFrame (#2830)
If _PaintFrameForEngine returns E_PENDING, we'll give it another two
tries to get itself straight. If it continues to fail, we'll take down
the application.

We observed that the DX renderer was failing to present the swap chain
and failfast'ing when it did so; however, there are some errors from
which DXGI guidance suggests we try to recover. We'll now return
E_PENDING (and destroy our device resources) when we hit those errors.

Fixes #2265.
2019-09-23 15:06:47 -07:00
Carlos Zamora 8afc5b2f59 Bugfix: TextBuffer Line Wrapping from VTRenderer (#2797)
* Bugfix: line selection copy

* Revert clipboard change
Change VT renderer to do erase line instead of a ton of erase chars

* revert TerminalApi change
2019-09-23 09:39:24 -07:00
Gage Ames b096a57387 Update path to profiles.json in documentation (#2843)
The profiles.json file was moved from RoamingState to LocalState in
PR #2298. Update the documentation to reflect this change.
2019-09-23 09:15:47 -07:00
Carlos Zamora 6b415126fd
Improve Accessibility Reliability (#2609)
* Remove WindowUiaProvider entry points
Make TerminalAutomationPeer not crash the app if creation failed.

* code format

* prefer universal initialization

Co-Authored-By: Dustin L. Howett (MSFT) <duhowett@microsoft.com>
2019-09-23 08:59:03 -07:00
Alexander Sklar bfb1484708 Remember last-used string in the Find dialog in conhost (#2845) 2019-09-23 10:16:40 -04:00
Michael Niksa 56c35945b9
Rework locking and eventing during startup and shutdown to alleviate some VT issues (#2525)
Adjusts the startup and shutdown behavior of most threads in the console host to alleviate race conditions that are either exacerbated or introduced by the VT PTY threads.
2019-09-20 15:43:11 -07:00
James Holderness 9102c5d030 Fix display of the "low ASCII" glyphs in PC code pages (#1964)
In the legacy console, it used to be possible to write out characters
from the C0 range of a PC code page (e.g. CP437), and get the actual
glyphs defined for those code points (at least those that weren't
processed as control codes). In the v2 console this stopped working so
you'd get an FFFD replacement glyph (�) for those characters instead.
This PR fixes the issue so the correct glyphs are displayed again.

There was already code in place to achieve this in the
`WriteCharsLegacy` method. It used the `GetStringTypeW` method to
determine the character type of the value being output, and if it was a
`C1_CNTRL` character it performed the appropriate mapping. The problem
was that the test of the character type flag was done as a direct
comparision, when it should have been a bit test, so the condition was
never met.

With this condition fixed, the code also needed to be reordered slightly
to handle the null character. That had a special-case mapping to space,
which was previously performed after the control test, but since a null
character now successfully matches `C1_CNTRL`, it no longer falls
through to that special case. To address that, I've had to move the null
check above the control test.

I've tested this manually, by trying to output all the characters in the
affected range (ASCII values 0 to 31, and 127, excluding the actual
control codes 8,9,10 and 13). In all cases they now match the output
that the legacy console produced.

Note that this only applies to PC code pages that have glyphs defined
for the C0 range, so it won't work with the UTF-8 code page, but that
was to be expected - the legacy console behaved the same way.

Also, note that this only works when the `ENABLE_PROCESSED_OUTPUT`
console mode is set. That seems wrong to me (I'd expect the glyphs to
work in both cases), but that's the way the legacy console behaved as
well, so if that's a bug it's a separate issue.

I haven't added any unit tests, because I expect the behaviour of some
of these characters to change over time (as support is added for more
control codes), which could then cause the tests to fail. But if that's
not a concern, I could probably add something to the ScreenBufferTests
(perhaps with a comment warning that the tests might be expected to fail
in the future).

Closes #166.
2019-09-20 13:42:36 -07:00
Dustin L. Howett (MSFT) b84a073464
Package Cascadia Code with the Terminal (release builds) (#2806)
TTF from microsoft/cascadia-code@5f91b87
2019-09-19 16:35:33 -07:00
Dustin L. Howett (MSFT) b37d6c03ac
Update CascadiaPackage to v0.5 2019-09-19 15:51:53 -07:00
Mike Griese dfaaa44789
Initialize the VT tab stops when a buffer is created in VT mode (#2816)
* fixes #411

* update this comment to actually match

* run this test in isolation so it doesn't break other tests, @dhowett-msft

* This fixes the test that's broken?

  Kinda raises more questions tbh
2019-09-19 15:23:07 -05:00
Mike Griese 7128e873a4 Add validation for hiding all the profiles (#2800)
fixes #2794
2019-09-19 16:54:36 +00:00