diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 580fc04ed..da6f3a476 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -125,7 +125,7 @@ Team members will be happy to help review specs and guide them to completion. ### Help Wanted -Once the team have approved an issue/spec, development can proceed. If no developers are immediately available, the spec can be parked ready for a developer to get started. Parked specs' issues will be labeled "Help Wanted". To find a list of development opportunities waiting for developer involvement, visit the Issues and filter on [the Help-Wanted label](https://github.com/microsoft/terminal/labels/Help%20Wanted). +Once the team has approved an issue/spec, development can proceed. If no developers are immediately available, the spec can be parked ready for a developer to get started. Parked specs' issues will be labeled "Help Wanted". To find a list of development opportunities waiting for developer involvement, visit the Issues and filter on [the Help-Wanted label](https://github.com/microsoft/terminal/labels/Help%20Wanted). --- diff --git a/custom.props b/custom.props index 95b29b746..23f7ff5aa 100644 --- a/custom.props +++ b/custom.props @@ -5,7 +5,7 @@ true 2021 1 - 12 + 13 Windows Terminal diff --git a/doc/EXCEPTIONS.md b/doc/EXCEPTIONS.md index 48a6017ed..d6e90988f 100644 --- a/doc/EXCEPTIONS.md +++ b/doc/EXCEPTIONS.md @@ -4,7 +4,7 @@ Introducing exceptions to an existing non-exception-based codebase can be perilous. The console was originally written in C at a time when C++ was relatively unused in the Windows operating system. As part of our project to modernize the Windows console, we converted to use C++, but still had an aversion to using exception-based error handling in -our code for fear that it introduce unexpected failures. However, the STL and other libraries like it are so useful that +our code for fear that it might introduce unexpected failures. However, the STL and other libraries like it are so useful that sometimes it's significantly simpler to use them. Given that, we have a set of rules that we follow when considering exception use. diff --git a/doc/Niksa.md b/doc/Niksa.md index e543191a6..c4c7e4798 100644 --- a/doc/Niksa.md +++ b/doc/Niksa.md @@ -189,7 +189,7 @@ I think there might be a bit of a misunderstanding here - there are two differen * shell applications, like `cmd.exe`, `powershell`, `zsh`, etc. These are text-only applications that emit streams of characters. They don't care at all about how they're eventually rendered to the user. These are also sometimes referred to as "commandline client" applications. * terminal applications, like the Windows Terminal, gnome-terminal, xterm, iterm2, hyper. These are graphical applications that can be used to render the output of commandline clients. -On Windows, if you just run `cmd.exe` directly, the OS will create an instance of `conhost.exe` as the _terminal_ for `cmd.exe`. The same thing happens for `powershell.exe`, the system will creates a new conhost window for any client that's not already connected to a terminal of some sort. This has lead to an enormous amount of confusion for people thinking that a conhost window is actually a "`cmd` window". `cmd` can't have a window, it's just a commandline application. Its window is always some other terminal. +On Windows, if you just run `cmd.exe` directly, the OS will create an instance of `conhost.exe` as the _terminal_ for `cmd.exe`. The same thing happens for `powershell.exe`, the system will create a new conhost window for any client that's not already connected to a terminal of some sort. This has lead to an enormous amount of confusion for people thinking that a conhost window is actually a "`cmd` window". `cmd` can't have a window, it's just a commandline application. Its window is always some other terminal. Any terminal can run any commandline client application. So you can use the Windows Terminal to run whatever shell you want. I use mine for both `cmd` and `powershell`, and also WSL: diff --git a/doc/cascadia/profiles.schema.json b/doc/cascadia/profiles.schema.json index f61e74f4e..98f3de653 100644 --- a/doc/cascadia/profiles.schema.json +++ b/doc/cascadia/profiles.schema.json @@ -459,7 +459,7 @@ }, "suppressApplicationTitle": { "type": "boolean", - "default": "false", + "default": false, "description": "When set to true, tabTitle overrides the default title of the tab and any title change messages from the application will be suppressed. When set to false, tabTitle behaves as normal" }, "colorScheme": { @@ -506,7 +506,7 @@ "properties": { "action": { "type": "string", - "pattern": "adjustFontSize" + "const": "adjustFontSize" }, "delta": { "type": "integer", @@ -530,7 +530,7 @@ "properties": { "action": { "type": "string", - "pattern": "copy" + "const": "copy" }, "singleLine": { "type": "boolean", @@ -566,7 +566,7 @@ "properties": { "action": { "type": "string", - "pattern": "newTab" + "const": "newTab" } } } @@ -582,7 +582,7 @@ "properties": { "action": { "type": "string", - "pattern": "switchToTab" + "const": "switchToTab" }, "index": { "type": "integer", @@ -606,7 +606,7 @@ "properties": { "action": { "type": "string", - "pattern": "movePane" + "const": "movePane" }, "index": { "type": "integer", @@ -630,7 +630,7 @@ "properties": { "action": { "type": "string", - "pattern": "moveFocus" + "const": "moveFocus" }, "direction": { "$ref": "#/$defs/FocusDirection", @@ -654,7 +654,7 @@ "properties": { "action": { "type": "string", - "pattern": "swapPane" + "const": "swapPane" }, "direction": { "$ref": "#/$defs/FocusDirection", @@ -678,7 +678,7 @@ "properties": { "action": { "type": "string", - "pattern": "resizePane" + "const": "resizePane" }, "direction": { "$ref": "#/$defs/ResizeDirection", @@ -702,7 +702,7 @@ "properties": { "action": { "type": "string", - "pattern": "sendInput" + "const": "sendInput" }, "input": { "type": "string", @@ -729,7 +729,7 @@ "properties": { "action": { "type": "string", - "pattern": "splitPane" + "const": "splitPane" }, "split": { "$ref": "#/$defs/SplitDirection", @@ -761,7 +761,7 @@ "properties": { "action": { "type": "string", - "pattern": "openSettings" + "const": "openSettings" }, "target": { "type": "string", @@ -788,7 +788,7 @@ "properties": { "action": { "type": "string", - "pattern": "setTabColor" + "const": "setTabColor" }, "color": { "$ref": "#/$defs/Color", @@ -809,7 +809,7 @@ "properties": { "action": { "type": "string", - "pattern": "setColorScheme" + "const": "setColorScheme" }, "colorScheme": { "type": "string", @@ -833,7 +833,7 @@ "properties": { "action": { "type": "string", - "pattern": "wt" + "const": "wt" }, "commandline": { "type": "string", @@ -857,7 +857,7 @@ "properties": { "action": { "type": "string", - "pattern": "closeOtherTabs" + "const": "closeOtherTabs" }, "index": { "oneOf": [ @@ -885,7 +885,7 @@ "properties": { "action": { "type": "string", - "pattern": "closeTabsAfter" + "const": "closeTabsAfter" }, "index": { "oneOf": [ @@ -913,7 +913,7 @@ "properties": { "action": { "type": "string", - "pattern": "closeTab" + "const": "closeTab" }, "index": { "oneOf": [ @@ -941,7 +941,7 @@ "properties": { "action": { "type": "string", - "pattern": "scrollUp" + "const": "scrollUp" }, "rowsToScroll": { "type": [ @@ -965,7 +965,7 @@ "properties": { "action": { "type": "string", - "pattern": "scrollDown" + "const": "scrollDown" }, "rowsToScroll": { "type": [ @@ -989,7 +989,7 @@ "properties": { "action": { "type": "string", - "pattern": "moveTab" + "const": "moveTab" }, "direction": { "$ref": "#/$defs/MoveTabDirection", @@ -1012,7 +1012,7 @@ "properties": { "action": { "type": "string", - "pattern": "multipleActions" + "const": "multipleActions" }, "actions": { "$ref": "#/$defs/ShortcutAction", @@ -1037,7 +1037,7 @@ "properties": { "action": { "type": "string", - "pattern": "commandPalette" + "const": "commandPalette" }, "launchMode": { "$ref": "#/$defs/CommandPaletteLaunchMode", @@ -1058,7 +1058,7 @@ "properties": { "action": { "type": "string", - "pattern": "findMatch" + "const": "findMatch" }, "direction": { "$ref": "#/$defs/FindMatchDirection", @@ -1085,7 +1085,7 @@ "properties": { "action": { "type": "string", - "pattern": "newWindow" + "const": "newWindow" } } } @@ -1101,7 +1101,7 @@ "properties": { "action": { "type": "string", - "pattern": "prevTab" + "const": "prevTab" }, "tabSwitcherMode": { "$ref": "#/$defs/SwitchToAdjacentTabArgs", @@ -1122,7 +1122,7 @@ "properties": { "action": { "type": "string", - "pattern": "nextTab" + "const": "nextTab" }, "tabSwitcherMode": { "$ref": "#/$defs/SwitchToAdjacentTabArgs", @@ -1143,7 +1143,7 @@ "properties": { "action": { "type": "string", - "pattern": "renameTab" + "const": "renameTab" }, "title": { "type": "string", @@ -1164,7 +1164,7 @@ "properties": { "action": { "type": "string", - "pattern": "renameWindow" + "const": "renameWindow" }, "name": { "type": "string", @@ -1185,7 +1185,7 @@ "properties": { "action": { "type": "string", - "pattern": "focusPane" + "const": "focusPane" }, "id": { "type": "integer", @@ -1207,7 +1207,7 @@ "properties": { "action": { "type": "string", - "pattern": "globalSummon" + "const": "globalSummon" }, "desktop": { "type": "string", @@ -1258,7 +1258,7 @@ "properties": { "action": { "type": "string", - "pattern": "quakeMode" + "const": "quakeMode" } } } @@ -1333,6 +1333,12 @@ { "$ref": "#/$defs/MoveTabAction" }, + { + "$ref": "#/$defs/MultipleActionsAction" + }, + { + "$ref": "#/$defs/CommandPaletteAction" + }, { "$ref": "#/$defs/FindMatchAction" }, @@ -1575,22 +1581,22 @@ "deprecated": true }, "minimizeToNotificationArea": { - "default": "false", + "default": false, "description": "When set to true, minimizing a Terminal window will no longer appear in the taskbar. Instead, a Terminal icon will appear in the notification area through which the user can access their windows.", "type": "boolean" }, "alwaysShowNotificationIcon": { - "default": "false", + "default": false, "description": "When set to true, the Terminal's notification icon will always be shown in the notification area.", "type": "boolean" }, "showAdminShield": { - "default": "true", + "default": true, "description": "When set to true, the Terminal's tab row will display a shield icon when the Terminal is running with administrator privileges", "type": "boolean" }, "useAcrylicInTabRow": { - "default": "false", + "default": false, "description": "When set to true, the tab row will have an acrylic background with 50% opacity.", "type": "boolean" }, diff --git a/doc/terminal-v2-roadmap.md b/doc/terminal-v2-roadmap.md index 8f4cab235..34fe686ee 100644 --- a/doc/terminal-v2-roadmap.md +++ b/doc/terminal-v2-roadmap.md @@ -31,7 +31,7 @@ Below is the schedule for when milestones will be included in release builds of | 2021-05-31 | [1.9] in Windows Terminal Preview
[1.8] in Windows Terminal | [Windows Terminal Preview 1.9 Release](https://devblogs.microsoft.com/commandline/windows-terminal-preview-1-9-release/) | | 2021-07-14 | [1.10] in Windows Terminal Preview
[1.9] in Windows Terminal | [Windows Terminal Preview 1.10 Release](https://devblogs.microsoft.com/commandline/windows-terminal-preview-1-10-release/) | | 2021-08-31 | [1.11] in Windows Terminal Preview
[1.10] in Windows Terminal | [Windows Terminal Preview 1.11 Release](https://devblogs.microsoft.com/commandline/windows-terminal-preview-1-11-release/) | -| 2021-10-31 | 1.12 in Windows Terminal Preview
1.11 in Windows Terminal | | +| 2021-10-20 | [1.12] in Windows Terminal Preview
[1.11] in Windows Terminal | [Windows Terminal Preview 1.12 Release](https://devblogs.microsoft.com/commandline/windows-terminal-preview-1-12-release/) | | 2021-11-30 | 2.0 RC in Windows Terminal Preview
2.0 RC in Windows Terminal | | | 2021-12-31 | [2.0] in Windows Terminal Preview
[2.0] in Windows Terminal | | @@ -91,6 +91,8 @@ Feature Notes: [1.9]: https://github.com/microsoft/terminal/milestone/34 [1.10]: https://github.com/microsoft/terminal/milestone/35 [1.11]: https://github.com/microsoft/terminal/milestone/36 +[1.12]: https://github.com/microsoft/terminal/milestone/38 +[1.13]: https://github.com/microsoft/terminal/milestone/39 [2.0]: https://github.com/microsoft/terminal/milestone/22 [#1564]: https://github.com/microsoft/terminal/issues/1564 [#6720]: https://github.com/microsoft/terminal/pull/6720 diff --git a/src/Terminal.wprp b/src/Terminal.wprp index 80a6e730b..129d83ca0 100644 --- a/src/Terminal.wprp +++ b/src/Terminal.wprp @@ -13,6 +13,15 @@ + + + + + + + + + @@ -32,5 +41,27 @@ + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/src/cascadia/TerminalConnection/ConptyConnection.cpp b/src/cascadia/TerminalConnection/ConptyConnection.cpp index 3792724d5..9135f8024 100644 --- a/src/cascadia/TerminalConnection/ConptyConnection.cpp +++ b/src/cascadia/TerminalConnection/ConptyConnection.cpp @@ -372,6 +372,16 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation // window is expecting it to be on the first layout. else { +#pragma warning(suppress : 26477 26485 26494 26482 26446) // We don't control TraceLoggingWrite + TraceLoggingWrite( + g_hTerminalConnectionProvider, + "ConPtyConnectedToDefterm", + TraceLoggingDescription("Event emitted when ConPTY connection is started, for a defterm session"), + TraceLoggingGuid(_guid, "SessionGuid", "The WT_SESSION's GUID"), + TraceLoggingWideString(_clientName.c_str(), "Client", "The attached client process"), + TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), + TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance)); + THROW_IF_FAILED(ConptyResizePseudoConsole(_hPC.get(), dimensions)); } diff --git a/src/cascadia/TerminalControl/ControlCore.cpp b/src/cascadia/TerminalControl/ControlCore.cpp index 7f6615f1f..d614023a7 100644 --- a/src/cascadia/TerminalControl/ControlCore.cpp +++ b/src/cascadia/TerminalControl/ControlCore.cpp @@ -615,6 +615,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation // not, but DX doesn't use that info at all. // The Codepage is additionally not actually used by the DX engine at all. _actualFont = { fontFace, 0, fontWeight.Weight, { 0, fontHeight }, CP_UTF8, false }; + _actualFontFaceName = { fontFace }; _desiredFont = { _actualFont }; // Update the terminal core with its new Core settings @@ -766,6 +767,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation const auto fontFace = _settings->FontFace(); const auto fontWeight = _settings->FontWeight(); _actualFont = { fontFace, 0, fontWeight.Weight, { 0, newSize }, CP_UTF8, false }; + _actualFontFaceName = { fontFace }; _desiredFont = { _actualFont }; auto lock = _terminal->LockForWriting(); @@ -1044,7 +1046,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation winrt::Windows::Foundation::Size ControlCore::FontSize() const noexcept { - const auto fontSize = GetFont().GetSize(); + const auto fontSize = _actualFont.GetSize(); return { ::base::saturated_cast(fontSize.X), ::base::saturated_cast(fontSize.Y) @@ -1052,17 +1054,20 @@ namespace winrt::Microsoft::Terminal::Control::implementation } winrt::hstring ControlCore::FontFaceName() const noexcept { - return winrt::hstring{ GetFont().GetFaceName() }; + // This getter used to return _actualFont.GetFaceName(), however GetFaceName() returns a STL + // string and we need to return a WinRT string. This would require an additional allocation. + // This method is called 10/s by TSFInputControl at the time of writing. + return _actualFontFaceName; } uint16_t ControlCore::FontWeight() const noexcept { - return static_cast(GetFont().GetWeight()); + return static_cast(_actualFont.GetWeight()); } til::size ControlCore::FontSizeInDips() const { - const til::size fontSize{ GetFont().GetSize() }; + const til::size fontSize{ _actualFont.GetSize() }; return fontSize.scale(til::math::rounding, 1.0f / ::base::saturated_cast(_compositionScale)); } diff --git a/src/cascadia/TerminalControl/ControlCore.h b/src/cascadia/TerminalControl/ControlCore.h index 5c4f0feff..0bdb27615 100644 --- a/src/cascadia/TerminalControl/ControlCore.h +++ b/src/cascadia/TerminalControl/ControlCore.h @@ -226,6 +226,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation FontInfoDesired _desiredFont; FontInfo _actualFont; + winrt::hstring _actualFontFaceName; // storage location for the leading surrogate of a utf-16 surrogate pair std::optional _leadingSurrogate{ std::nullopt }; diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index caa3e9ec0..c45e100ef 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -297,37 +297,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation return; } - if (!newAppearance.BackgroundImage().empty()) - { - Windows::Foundation::Uri imageUri{ newAppearance.BackgroundImage() }; - - // Check if the image brush is already pointing to the image - // in the modified settings; if it isn't (or isn't there), - // set a new image source for the brush - auto imageSource = BackgroundImage().Source().try_as(); - - if (imageSource == nullptr || - imageSource.UriSource() == nullptr || - imageSource.UriSource().RawUri() != imageUri.RawUri()) - { - // Note that BitmapImage handles the image load asynchronously, - // which is especially important since the image - // may well be both large and somewhere out on the - // internet. - Media::Imaging::BitmapImage image(imageUri); - BackgroundImage().Source(image); - } - - // Apply stretch, opacity and alignment settings - BackgroundImage().Stretch(newAppearance.BackgroundImageStretchMode()); - BackgroundImage().Opacity(newAppearance.BackgroundImageOpacity()); - BackgroundImage().HorizontalAlignment(newAppearance.BackgroundImageHorizontalAlignment()); - BackgroundImage().VerticalAlignment(newAppearance.BackgroundImageVerticalAlignment()); - } - else - { - BackgroundImage().Source(nullptr); - } + _SetBackgroundImage(newAppearance); // Update our control settings const auto bg = newAppearance.DefaultBackground(); @@ -416,6 +386,57 @@ namespace winrt::Microsoft::Terminal::Control::implementation } } + // Method Description: + // - Sets background image and applies its settings (stretch, opacity and alignment) + // - Checks path validity + // Arguments: + // - newAppearance + // Return Value: + // - + void TermControl::_SetBackgroundImage(const IControlAppearance& newAppearance) + { + if (newAppearance.BackgroundImage().empty()) + { + BackgroundImage().Source(nullptr); + return; + } + + Windows::Foundation::Uri imageUri{ nullptr }; + try + { + imageUri = Windows::Foundation::Uri{ newAppearance.BackgroundImage() }; + } + catch (...) + { + LOG_CAUGHT_EXCEPTION(); + BackgroundImage().Source(nullptr); + return; + } + + // Check if the image brush is already pointing to the image + // in the modified settings; if it isn't (or isn't there), + // set a new image source for the brush + auto imageSource = BackgroundImage().Source().try_as(); + + if (imageSource == nullptr || + imageSource.UriSource() == nullptr || + imageSource.UriSource().RawUri() != imageUri.RawUri()) + { + // Note that BitmapImage handles the image load asynchronously, + // which is especially important since the image + // may well be both large and somewhere out on the + // internet. + Media::Imaging::BitmapImage image(imageUri); + BackgroundImage().Source(image); + } + + // Apply stretch, opacity and alignment settings + BackgroundImage().Stretch(newAppearance.BackgroundImageStretchMode()); + BackgroundImage().Opacity(newAppearance.BackgroundImageOpacity()); + BackgroundImage().HorizontalAlignment(newAppearance.BackgroundImageHorizontalAlignment()); + BackgroundImage().VerticalAlignment(newAppearance.BackgroundImageVerticalAlignment()); + } + // Method Description: // - Set up each layer's brush used to display the control's background. // - Respects the settings for acrylic, background image and opacity from diff --git a/src/cascadia/TerminalControl/TermControl.h b/src/cascadia/TerminalControl/TermControl.h index 048ead805..338d69910 100644 --- a/src/cascadia/TerminalControl/TermControl.h +++ b/src/cascadia/TerminalControl/TermControl.h @@ -205,6 +205,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation void _UpdateAppearanceFromUIThread(Control::IControlAppearance newAppearance); void _ApplyUISettings(); winrt::fire_and_forget UpdateAppearance(Control::IControlAppearance newAppearance); + void _SetBackgroundImage(const IControlAppearance& newAppearance); void _InitializeBackgroundBrush(); winrt::fire_and_forget _coreBackgroundColorChanged(const IInspectable& sender, const IInspectable& args); diff --git a/src/cascadia/TerminalSettingsEditor/Appearances.xaml b/src/cascadia/TerminalSettingsEditor/Appearances.xaml index c1f325376..497b7349a 100644 --- a/src/cascadia/TerminalSettingsEditor/Appearances.xaml +++ b/src/cascadia/TerminalSettingsEditor/Appearances.xaml @@ -220,7 +220,7 @@ + Text="{x:Bind local:Converters.StringOrEmptyIfPlaceholder('desktopWallpaper', Appearance.BackgroundImagePath), Mode=TwoWay, BindBack=Appearance.SetBackgroundImagePath}" />