Commit Graph

69 Commits

Author SHA1 Message Date
Kaiyu Wang
ebdcfbd940 Migrate Search module as a shared component for Terminal Search (#3279)
* Make search a shared component for conhost and terminal

* Remove inclusion of deprecated interface file

* Code review changes, remove text buffer modification in Terminal

* remove unreferenced objects to fix build errors

* Fix test failure, guarantee uiaData object is correctly initialized in Search

* minor comment typo fix and format fix

* minor PR comments change

* ColorSeclection directly throw and return

* remove coordAnchor initialization

* minor method signature change
2019-11-14 14:36:41 -08:00
Dustin L. Howett (MSFT)
357e835f5d Replace ConhostConnection with ConptyConnection (#3461)
This commit deletes ConhostConnection and replaces it with
ConptyConnection. The ConptyConnection uses CreatePseudoConsole and
depends on winconpty to override the one from kernel32.

* winconpty must be packageable, so I've added GetPackagingOutputs.
   * To validate this, I added conpty.dll to the MSIX regression script.
* I moved the code from conpty-universal that deals with environment
  strings into the types library.

This puts us in a way better place to implement #2563, as we can now
separately detect a failure to launch a pseudoconsole, a failure to
CreateProcess, and an unexpected termination of the launched process.

Fixes #1131.
2019-11-06 15:09:01 -08:00
Dustin L. Howett (MSFT)
9dc922fc37 Unify and clean up the common build properties (#3429)
This commit cleans up and deduplicates all of the common build
preamble/postamble across exe, dll, lib and c++/winrt projects.

The following specific changes have been made:
* All projects now define their ConfigurationType
* All projects now set all their properties *before* including a common
  build file (or any other build files)
* cppwinrt.pre and cppwinrt.post now delegate most of their
  configuration to common.pre and common.post
* (becuase of the above,) all build options are conserved between
  console and c++/winrt components, including specific warnings and
  preprocessor definitions.
* More properties that are configurable per-project are now
  conditioned so the common props don't override them.
* The exe, dll, exe.or.dll, and lib postincludes have been merged into
  pre or post and switched based on condition as required
* Shared items (-shared, -common) are now explicitly vcxitems instead of
  vcxproj files.
* The link line is now manipulated after Microsoft.Cpp sets it, so the
  libraries we specify "win". All console things link first against
  onecore_apiset.lib.
* Fix all compilation errors caused by build unification
* Move CascadiaPackage's resources into a separate item file

Fixes #922.
2019-11-05 14:29:11 -08:00
greg904
5dfc021d8e Use standard 1px window borders on NC Island Window (#3394)
We take the standard window frame except that we remove the top part
(see `NonClientIslandWindow::_OnNcCalcSize`), then we put little 1 pixel
wide top border back in the client area using
`DwmExtendFrameIntoClientArea` and then we put the XAML island and the
drag bar on top.

Most of this PR is comments to explain how the code works and also
removing complex code that was needed to handle the weird cases when the
borders were custom.

I've also refactored a little bit the `NonClientIslandWindow` class.

* Fix DwmExtendFrameIntoClientArea values
* Fix WM_NCHITTEST handling
* Position the XAML island window correctly
* Fix weird colors in drag bar and hide old title bar buttons
* Fix the window's position when maximized
* Add support for dark theme on the frame
* DRY shared code between conhost and new terminal
* Fix drag bar and remove dead code
* Remove dead code and use cached DPI
* Refactor code
* Remove impossible TODO
* Use system metrics instead of hardcoding resize border height
* Use theme from app settings instead of system theme. Improve comments. Remove unused DWM frame on maximize.
* Fix initial position DPI handling bug and apply review changes
* Fix thick borders with DPI > 96

Closes #3064.
Closes #1307.
Closes #3136.
Closes #1897.
Closes #3222.
Closes #1859.
2019-11-04 15:45:40 -08:00
Dustin L. Howett (MSFT)
4991b9f1b2 Switch all of the UIA providers to WRL::RuntimeClass (#3213)
* Switch all of the UIA providers to WRL::RuntimeClass
Fixes #3209.
References #3051.

Co-authored-by: Carlos Zamora <cazamor@microsoft.com>
Co-authored-by: Dustin Howett <duhowett@microsoft.com>
2019-10-17 15:32:30 -07:00
Dustin L. Howett (MSFT)
9e5792ba51 Always use a VK in MapVirtualKeyW(..., MAPVK_VK_TO_VSC) (#3199)
Fixes #2873.
2019-10-17 14:58:41 -07:00
Dustin L. Howett (MSFT)
cd40faa88f Get rid of our hand-rolled sprintf->wstring helpers, prefer WIL (#3106) 2019-10-08 12:04:18 -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
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
Dustin L. Howett (MSFT)
2d0608d8c0 utils: prevent the corruption of GUID strings (#2765) 2019-09-16 15:01:47 -07:00
Michael Niksa
18bacfe973 A few PR comments. A constexpr here, a misleading comment there, and an extraneous local. 2019-09-09 16:01:28 -07:00
Michael Niksa
d8ff47a0d3 Some of the PR feedback. 2019-09-05 17:21:54 -07:00
Michael Niksa
fc81adf32f use the array size for the read bounds. using extent on the newly-converted-to-array type doesn't give the correct value. 2019-09-05 13:09:36 -07:00
Michael Niksa
689c21e802 PR feedback. 2019-09-05 11:17:13 -07:00
Michael Niksa
96cc7727bc Add GH issue IDs to all the suppress/disables that I left behind as they were a bit too challenging to solve with this giant PR 2019-09-05 11:14:43 -07:00
Michael Niksa
d0c207bc9c fix remaining issues that appeared on merge. 2019-09-04 15:45:22 -07:00
Michael Niksa
b7c1e05060 code formatter, you're killing me. 2019-09-04 13:40:10 -07:00
Michael Niksa
3bff2a3eb0 fix merge conflict with master 2019-09-04 13:35:31 -07:00
Michael Niksa
7c66e66ca1 Fix redefinition of class name for constexpr method I moved from CPP to HPP. 2019-09-04 12:49:15 -07:00
Konstantin Yakushev
51f53535d1 Add support for short hex color codes like #CCC (#2658)
This adds a few lines to support shorthand color hex codes like #ABC. They are treated as equivalent of #AABBCC.

Fixes #2639.
2019-09-04 11:45:35 -07:00
Michael Niksa
7d9534bfa8 constexprs have to go into the headers or other usages can't find them. Imagine that. 2019-09-04 10:59:18 -07:00
Michael Niksa
6735311fc9 Suppress last two errors (C26455 default constructor throw in DxEngine because it's due for refactoring soon anyway & C26444 custom construction/destruction on OutputCellIterator because I can't see what's going on and it needs more investigation and shouldn't hold this up). Also run codeformat. 2019-09-03 16:18:19 -07:00
Michael Niksa
ae25a32913 C26497, you can mark this thing as constexpr. 2019-09-03 15:18:01 -07:00
Michael Niksa
93aa9455e2 C26429, test for nullness or mark as not_null (and a few cascading warnings. 2019-09-03 15:14:44 -07:00
Michael Niksa
41f209f6d3 C26440, default constructors should be noexcept. 2019-09-03 15:10:33 -07:00
Michael Niksa
87f5852a72 Define actual constructor for CodepointWidthDetector as default isn't cutting it. 2019-09-03 15:03:54 -07:00
Michael Niksa
e14a59a1b6 C26455, default constructor may not throw. Mark noexcept. (Trivial cases.) 2019-09-03 14:57:14 -07:00
Michael Niksa
cd144e98c6 C26436, destructor definition required for class with virtual methods. 2019-09-03 14:52:00 -07:00
Michael Niksa
c7f0a3439d C26490, don't reinterpret_cast. It looks like the buffer can easily be char. Also use brace initialization per feedback. 2019-09-03 14:39:23 -07:00
Michael Niksa
072bbfd09d C26426, global initializer calls non-constexpr. This needs further consideration. I brifely tried to turn GlyphWidth into a singleton class but it cascaded into interesting far corners of the code because IsGlyphFullWidth was liberally used everywhere for a long time. I'm punting here to a future work item. 2019-09-03 14:32:44 -07:00
Michael Niksa
3bbd8f4c97 C26443, overriding destructors shouldn't declare virtual nor override. 2019-09-03 14:14:07 -07:00
Michael Niksa
2d3f285894 C26432, rule-of-five (if you define one of destruct/copy/move, then define them all) 2019-09-03 13:45:16 -07:00
Michael Niksa
dd49c3ed51 C26460, use const on params that are unchanged (and remove some unnecessary span refs). 2019-09-03 13:02:09 -07:00
Michael Niksa
9678dd894c C26414, don't use smart pointers for locals 2019-09-03 11:27:43 -07:00
Michael Niksa
45e599368f C26430, not tested for nullness on all paths. I will just always check for null as a defense against a bad QI implementation. 2019-09-03 11:20:27 -07:00
Michael Niksa
594dca993b C26429, mark gsl::not_null on places where we don't test for null (shouldn't need to, internal methods only. 2019-09-03 11:18:28 -07:00
Michael Niksa
c956913a28 C26497, use constexpr for functions that could be evaluated at compile time. 2019-09-03 10:30:06 -07:00
Michael Niksa
bbdfdf91eb C26462, const local variables that are unchanged. 2019-09-03 10:04:30 -07:00
Michael Niksa
d5d7cf420d C26494, uninitalized local variables 2019-09-03 10:02:18 -07:00
Michael Niksa
7d4096bbbf C26485, refactor to avoid array-to-pointer decay. 2019-09-03 09:40:31 -07:00
Michael Niksa
cdfbf8f106 C26474, don't use static_cast when an implicit cast is acceptable. 2019-09-03 08:53:54 -07:00
Michael Niksa
30e8e7f3a3 C26429, symbols not tested for nullness. 2019-09-03 08:46:24 -07:00
Michael Niksa
4f1157c044 C26447,C26440 - is noexcept but can throw or doesn't throw but not noexcept 2019-08-29 15:23:07 -07:00
Michael Niksa
8c3a629b52 C26481, don't use pointer arithemetic. use span. 2019-08-29 14:08:47 -07:00
Michael Niksa
8579d8905a C26451, promote before arithmetic if storing in larger result size (or use safe math) 2019-08-29 13:41:51 -07:00
Michael Niksa
50e2d0c433 C26433, overrides should be explicit. 2019-08-29 13:23:32 -07:00
Michael Niksa
8ea7401dc9 C26472, no static_cast for arithmetic conversions. narrow or narrow_cast 2019-08-29 13:19:01 -07:00
Michael Niksa
b33a59816e C26496, mark const if it's never written after creation 2019-08-29 11:27:39 -07:00
Michael Niksa
bd2d5ddb4b C26477, don't use 0 or NULL, use nullptr. 2019-08-29 11:12:55 -07:00
Michael Niksa
23897b1bd4 [Complex] C26446, Use .at instead of array indices - Reword UTF8OutPipeReader to use std::array so we can use .at and move some pointers to iterators. 2019-08-29 11:09:44 -07:00