Commit graph

653 commits

Author SHA1 Message Date
Moritz Glöckl 94fc40ed31 doc: fix a small issue for #hacktoberfest (#3057)
[skip ci]
2019-10-04 13:54:13 -07:00
Mike Griese dec5c11e19
Add support for passing through extended text attributes, like… (#2917)
## Summary of the Pull Request
Adds support for Italics, Blinking, Invisible, CrossedOut text, THROUGH CONPTY. This does **NOT** add support for those styles to conhost or the terminal.

We will store these "Extended Text Attributes" in a `TextAttribute`. When we go to render a line, we'll see if the state has changed from our previous state, and if so, we'll appropriately toggle that state with VT. Boldness has been moved from a `bool` to a single bit in these flags.

Technically, now that these are stored in the buffer, we only need to make changes to the renderers to be able to support them. That's not being done as a part of this PR however.

## References
See also #2915 and #2916, which are some follow-up tasks from this fix. I thought them too risky for 20H1.

## PR Checklist
* [x] Closes #2554
* [x] I work here
* [x] Tests added/passed
* [n/a] Requires documentation to be updated


<hr>

* store text with extended attributes too

* Plumb attributes through all the renderers

* parse extended attrs, though we're not renderering them right

* Render these states correctly

* Add a very extensive test

* Cleanup for PR

* a block of PR feedback

* add 512 test cases

* Fix the build

* Fix @carlos-zamora's suggestions

* @miniksa's PR feedback
2019-10-04 15:53:54 -05:00
Mike Griese 53c81a08f8
Return to ground when we flush the last char (#2823)
## Summary of the Pull Request
The InputStateMachineEngine was incorrectly not returning to the ground state after flushing the last sequence. That means that something like alt+backspace would leave us in the Escape state, not the ground state. This makes sure we return to ground.

Additionally removes the "Parser.UnitTests-common.vcxproj" file, which was originally used for a theoretical time when we only open-sourced the parser. It's unnecessary now, and we can get rid of it.

Also includes a small patch to bcz.cmd, to make sure bx works with projects with a space in their name.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
* [x] Closes #2746
* [x] I work here
* [x] Tests added/passed
* [n/a] Requires documentation to be updated


<hr>

* Return to ground when we flush the last char

  The InputStateMachineEngine was incorrectly not returning to the ground state
  after flushing the last sequence. That means that something like alt+backspace
  would leave us in the Escape state, not the ground state. This makes sure we
  return to ground.

  Fixes #2746.

  Additionally removes the "Parser.UnitTests-common.vcxproj" file, which was
  originally used for a theoretical time when we only open-sourced the parser.
  It's unnecessary now, and we can get rid of it.

  Also includes a small patch to bcz.cmd, to make sure bx works with projects
  with a space in their name.

* Update src/terminal/parser/stateMachine.cpp

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

* add the comment @miniksa wanted
2019-10-04 10:47:39 -05:00
Xiaoyin Liu 505ceaccf6 [contributing.md] add how to report security bugs (#3005)
* [contributing.md] add how to report security bugs

I think it's a good idea mentioning how to report vulnerabilities in contributing.md, by pointing them to SECURITY.md. This is useful in case people only read contributing.md but not security.md, and incorrectly believe that your team prefers discussing security issues on GitHub.

* Use full name of MSRC

As suggested by miniksa, change "MSRC" to "Microsoft Security Response Center (MSRC)"
2019-10-04 08:35:55 -05:00
Dustin L. Howett (MSFT) 8ae65f5444
res: check in the right font file for 1910.04 (#3050) 2019-10-03 17:24:30 -07:00
Martin Lopes 9756c7c3f7 doc: update section Starting Windows Terminal (#2998)
* Edits doc section: Starting Windows Terminal
* Proposes using the search function to locate the app.
* Restructures as a procedure.
* Adds misc edits.
* Made step 1 more generic, rather than prescribing the search method.
* Added tip about shortcut for elevated app

[skip ci]
2019-10-03 16:33:02 -07:00
Kayla Cinnamon de7a0686b3 Update Cascadia Code to v1910.04 (#3048)
Updates the font to microsoft/cascadia-code@d3b1adacf2
2019-10-03 15:46:07 -07:00
Mike Griese a82d6b8c69
Don't put NUL in the buffer in VT mode (#3015)
* Potentially fixes #1825

  I haven't had a chance to test this fix on my machine with a CentOS VM quite yet, but this _should_ work

  Also adds a test

* add a comment

* woah hey this test was wrong

* Revert bx.ps1
2019-10-03 16:04:48 -05:00
Mike Griese a9f384931e Render the cursor state to VT (#2829)
* Render the cursor state to VT
* Remove TestPaintXterm entirely, as it's unused now
2019-10-02 16:11:27 -07:00
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