From eaf1a920e1a4d5a4ea349ed0036f3fa520709212 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sat, 23 Jul 2022 11:58:54 -0700 Subject: [PATCH 01/29] okay maybe I have silly free time ideas too --- .../TilWinRtHelpersTests.cpp | 74 +++++++++++++++++++ .../UnitTests_TerminalCore/UnitTests.vcxproj | 1 + src/inc/til/winrt.h | 54 ++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp create mode 100644 src/inc/til/winrt.h diff --git a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp new file mode 100644 index 00000000000..7a5d1e8843f --- /dev/null +++ b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include + +#include + +#include "../renderer/inc/DummyRenderer.hpp" +#include "../renderer/base/Renderer.hpp" +#include "../renderer/dx/DxRenderer.hpp" + +#include "../cascadia/TerminalCore/Terminal.hpp" +#include "MockTermSettings.h" +#include "consoletaeftemplates.hpp" +#include "../../inc/TestUtils.h" + +#include + +using namespace winrt::Microsoft::Terminal::Core; +using namespace Microsoft::Terminal::Core; +using namespace Microsoft::Console::Render; +using namespace ::Microsoft::Console::Types; + +using namespace WEX::Common; +using namespace WEX::Logging; +using namespace WEX::TestExecution; + +namespace TerminalCoreUnitTests +{ + class TilWinRtHelpersTests; +}; +using namespace TerminalCoreUnitTests; + +class TerminalCoreUnitTests::TilWinRtHelpersTests final +{ + TEST_CLASS(TilWinRtHelpersTests); + TEST_METHOD(TestPropertySimple); + TEST_METHOD(TestEvent); +}; + +void TilWinRtHelpersTests::TestPropertySimple() +{ + til::property Foo; + til::property Bar(11); + + VERIFY_ARE_EQUAL(11, Bar()); + + Foo(42); + VERIFY_ARE_EQUAL(42, Foo()); + + Foo = Foo() - 5; // 37 + VERIFY_ARE_EQUAL(37, Foo()); + + Foo() += Bar(); // 48 + VERIFY_ARE_EQUAL(48, Foo()); +} + +void TilWinRtHelpersTests::TestEvent() +{ + bool handledOne = false; + bool handledTwo = false; + auto handler = [&](const int& v) -> void { + VERIFY_ARE_EQUAL(42, v); + handledOne = true; + }; + + til::event> MyEvent; + MyEvent(handler); + MyEvent([&](int) { handledTwo = true; }); + MyEvent.raise(42); + VERIFY_ARE_EQUAL(true, handledOne); + VERIFY_ARE_EQUAL(true, handledTwo); +} diff --git a/src/cascadia/UnitTests_TerminalCore/UnitTests.vcxproj b/src/cascadia/UnitTests_TerminalCore/UnitTests.vcxproj index 42893d18fa4..b8b91b52f2b 100644 --- a/src/cascadia/UnitTests_TerminalCore/UnitTests.vcxproj +++ b/src/cascadia/UnitTests_TerminalCore/UnitTests.vcxproj @@ -26,6 +26,7 @@ + diff --git a/src/inc/til/winrt.h b/src/inc/til/winrt.h new file mode 100644 index 00000000000..e7d483740fb --- /dev/null +++ b/src/inc/til/winrt.h @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +namespace til // Terminal Implementation Library. Also: "Today I Learned" +{ + template + struct property + { + property(){}; + property(T defaultValue) : + _value{ defaultValue } {} + T& operator()() + { + return _value; + } + void operator()(const T& value) + { + _value = value; + } + property& operator=(const property& other) + { + _value = other._value; + return *this; + } + property& operator=(const T& newValue) + { + _value = newValue; + return *this; + } + + private: + T _value; + }; + +#ifdef WINRT_Windows_Foundation_H + + template + struct event + { + winrt::event_token operator()(const ArgsT& handler) { return _handlers.add(handler); } + void operator()(const winrt::event_token& token) { _handlers.remove(token); } + template + void raise(Arg const&... args) + { + _handlers(args...); + } + winrt::event _handlers; + }; + +#endif + +} From 7001e93550ef6ac182b7bb6aaaf3a0acbdbe2b82 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sat, 23 Jul 2022 13:57:26 -0700 Subject: [PATCH 02/29] forwarded_event, string tests --- .../TilWinRtHelpersTests.cpp | 52 +++++++++++++++++++ src/inc/til/winrt.h | 21 +++++++- 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp index 7a5d1e8843f..244ee7e79a3 100644 --- a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp +++ b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp @@ -36,7 +36,9 @@ class TerminalCoreUnitTests::TilWinRtHelpersTests final { TEST_CLASS(TilWinRtHelpersTests); TEST_METHOD(TestPropertySimple); + TEST_METHOD(TestPropertyHString); TEST_METHOD(TestEvent); + TEST_METHOD(TestForwardedEvent); }; void TilWinRtHelpersTests::TestPropertySimple() @@ -56,6 +58,16 @@ void TilWinRtHelpersTests::TestPropertySimple() VERIFY_ARE_EQUAL(48, Foo()); } +void TilWinRtHelpersTests::TestPropertyHString() +{ + til::property Foo{ L"Foo" }; + + VERIFY_ARE_EQUAL(L"Foo", Foo()); + + Foo = L"bar"; + VERIFY_ARE_EQUAL(L"bar", Foo()); +} + void TilWinRtHelpersTests::TestEvent() { bool handledOne = false; @@ -72,3 +84,43 @@ void TilWinRtHelpersTests::TestEvent() VERIFY_ARE_EQUAL(true, handledOne); VERIFY_ARE_EQUAL(true, handledTwo); } + +void TilWinRtHelpersTests::TestForwardedEvent() +{ + using callback = winrt::delegate; + + struct Helper + { + til::event MyEvent; + } helper; + + int handledOne = 0; + int handledTwo = 0; + + auto handler = [&](const int& v) -> void { + VERIFY_ARE_EQUAL(42, v); + handledOne++; + }; + + helper.MyEvent(handler); + + til::forwarded_event ForwardedEvent{ helper.MyEvent }; + + ForwardedEvent([&](int) { handledTwo++; }); + + ForwardedEvent.raise(42); + + VERIFY_ARE_EQUAL(1, handledOne); + VERIFY_ARE_EQUAL(1, handledTwo); + + helper.MyEvent.raise(42); + + VERIFY_ARE_EQUAL(2, handledOne); + VERIFY_ARE_EQUAL(2, handledTwo); + + til::forwarded_event LayersOnLayers{ ForwardedEvent }; + LayersOnLayers.raise(42); + + VERIFY_ARE_EQUAL(3, handledOne); + VERIFY_ARE_EQUAL(3, handledTwo); +} diff --git a/src/inc/til/winrt.h b/src/inc/til/winrt.h index e7d483740fb..c4843169881 100644 --- a/src/inc/til/winrt.h +++ b/src/inc/til/winrt.h @@ -8,7 +8,7 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" template struct property { - property(){}; + property() = default; property(T defaultValue) : _value{ defaultValue } {} T& operator()() @@ -39,6 +39,7 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" template struct event { + event() = default; winrt::event_token operator()(const ArgsT& handler) { return _handlers.add(handler); } void operator()(const winrt::event_token& token) { _handlers.remove(token); } template @@ -49,6 +50,24 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" winrt::event _handlers; }; + template + struct forwarded_event + { + forwarded_event() = delete; + forwarded_event(event& other) : + _origin{ other } {} + forwarded_event(forwarded_event& other) : + _origin{ other._origin } {} + + winrt::event_token operator()(const ArgsT& handler) { return _origin(handler); } + void operator()(const winrt::event_token& token) { _origin(token); } + template + void raise(Arg const&... args) + { + _origin.raise(args...); + } + event& _origin; + }; #endif } From eb88cd3a2d15fbf30af64a70f2ef859173388a40 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sat, 23 Jul 2022 14:12:39 -0700 Subject: [PATCH 03/29] practical use, look --- .../UnitTests_TerminalCore/MockTermSettings.h | 11 +++++++---- .../UnitTests_TerminalCore/TilWinRtHelpersTests.cpp | 2 +- src/cascadia/inc/ControlProperties.h | 2 +- src/inc/til/winrt.h | 10 +++++++++- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/cascadia/UnitTests_TerminalCore/MockTermSettings.h b/src/cascadia/UnitTests_TerminalCore/MockTermSettings.h index 1f3be0be999..650e8c96ab8 100644 --- a/src/cascadia/UnitTests_TerminalCore/MockTermSettings.h +++ b/src/cascadia/UnitTests_TerminalCore/MockTermSettings.h @@ -7,6 +7,7 @@ #include "../../inc/ControlProperties.h" #include +#include using namespace winrt::Microsoft::Terminal::Core; @@ -17,16 +18,18 @@ namespace TerminalCoreUnitTests // Color Table is special because it's an array std::array _ColorTable; -#define SETTINGS_GEN(type, name, ...) WINRT_PROPERTY(type, name, __VA_ARGS__); + public: +#define SETTINGS_GEN(type, name, ...) til::property name{ __VA_ARGS__ }; + // #define SETTINGS_GEN(type, name, ...) WINRT_PROPERTY(type, name, __VA_ARGS__); CORE_SETTINGS(SETTINGS_GEN) CORE_APPEARANCE_SETTINGS(SETTINGS_GEN) #undef SETTINGS_GEN public: MockTermSettings(int32_t historySize, int32_t initialRows, int32_t initialCols) : - _HistorySize(historySize), - _InitialRows(initialRows), - _InitialCols(initialCols) + HistorySize(historySize), + InitialRows(initialRows), + InitialCols(initialCols) { } diff --git a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp index 244ee7e79a3..e32983b8e51 100644 --- a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp +++ b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp @@ -54,7 +54,7 @@ void TilWinRtHelpersTests::TestPropertySimple() Foo = Foo() - 5; // 37 VERIFY_ARE_EQUAL(37, Foo()); - Foo() += Bar(); // 48 + Foo = Foo() + Bar(); // 48 VERIFY_ARE_EQUAL(48, Foo()); } diff --git a/src/cascadia/inc/ControlProperties.h b/src/cascadia/inc/ControlProperties.h index 8c0468b2018..e29da1a62eb 100644 --- a/src/cascadia/inc/ControlProperties.h +++ b/src/cascadia/inc/ControlProperties.h @@ -36,7 +36,7 @@ X(int32_t, InitialCols, 80) \ X(bool, SnapOnInput, true) \ X(bool, AltGrAliasing, true) \ - X(winrt::hstring, WordDelimiters, DEFAULT_WORD_DELIMITERS) \ + X(winrt::hstring, WordDelimiters, DEFAULT_WORD_DELIMITERS.c_str()) \ X(bool, CopyOnSelect, false) \ X(bool, FocusFollowMouse, false) \ X(winrt::Windows::Foundation::IReference, TabColor, nullptr) \ diff --git a/src/inc/til/winrt.h b/src/inc/til/winrt.h index c4843169881..0a4e49e1b8a 100644 --- a/src/inc/til/winrt.h +++ b/src/inc/til/winrt.h @@ -11,7 +11,11 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" property() = default; property(T defaultValue) : _value{ defaultValue } {} - T& operator()() + // T& operator()() + // { + // return _value; + // } + T operator()() { return _value; } @@ -19,6 +23,10 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" { _value = value; } + void operator()(const T&& value) + { + _value = value; + } property& operator=(const property& other) { _value = other._value; From b535a5f3f359b95156119679a144e0f7ada9ce4e Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sat, 23 Jul 2022 14:31:58 -0700 Subject: [PATCH 04/29] I suppose this is what happens when I have four uninterrupted hours away from the kid --- .../TilWinRtHelpersTests.cpp | 22 +++++++++++ src/inc/til/winrt.h | 38 +++++++++++++++++-- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp index e32983b8e51..216b5b8a479 100644 --- a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp +++ b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp @@ -37,8 +37,11 @@ class TerminalCoreUnitTests::TilWinRtHelpersTests final TEST_CLASS(TilWinRtHelpersTests); TEST_METHOD(TestPropertySimple); TEST_METHOD(TestPropertyHString); + TEST_METHOD(TestEvent); TEST_METHOD(TestForwardedEvent); + + TEST_METHOD(TestTypedEvent); }; void TilWinRtHelpersTests::TestPropertySimple() @@ -124,3 +127,22 @@ void TilWinRtHelpersTests::TestForwardedEvent() VERIFY_ARE_EQUAL(3, handledOne); VERIFY_ARE_EQUAL(3, handledTwo); } + +void TilWinRtHelpersTests::TestTypedEvent() +{ + bool handledOne = false; + bool handledTwo = false; + + auto handler = [&](const winrt::hstring sender, const int& v) -> void { + VERIFY_ARE_EQUAL(L"sure", sender); + VERIFY_ARE_EQUAL(42, v); + handledOne = true; + }; + + til::typed_event MyEvent; + MyEvent(handler); + MyEvent([&](winrt::hstring, int) { handledTwo = true; }); + MyEvent.raise(L"sure", 42); + VERIFY_ARE_EQUAL(true, handledOne); + VERIFY_ARE_EQUAL(true, handledTwo); +} diff --git a/src/inc/til/winrt.h b/src/inc/til/winrt.h index 0a4e49e1b8a..35495fcc415 100644 --- a/src/inc/til/winrt.h +++ b/src/inc/til/winrt.h @@ -11,10 +11,7 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" property() = default; property(T defaultValue) : _value{ defaultValue } {} - // T& operator()() - // { - // return _value; - // } + T operator()() { return _value; @@ -76,6 +73,39 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" } event& _origin; }; + + template + struct typed_event + { + typed_event() = default; + winrt::event_token operator()(const winrt::Windows::Foundation::TypedEventHandler& handler) { return _handlers.add(handler); } + void operator()(const winrt::event_token& token) { _handlers.remove(token); } + template + void raise(Arg const&... args) + { + _handlers(args...); + } + winrt::event> _handlers; + }; + + template + struct forwarded_typed_event + { + forwarded_typed_event() = delete; + forwarded_typed_event(typed_event& other) : + _origin{ other } {} + forwarded_typed_event(forwarded_typed_event& other) : + _origin{ other._origin } {} + + winrt::event_token operator()(const winrt::Windows::Foundation::TypedEventHandler& handler) { return _origin(handler); } + void operator()(const winrt::event_token& token) { _origin(token); } + template + void raise(Arg const&... args) + { + _origin.raise(args...); + } + typed_event& _origin; + }; #endif } From 520c89f1fe236c2684f7f2a8434d7e8157e3b597 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sat, 23 Jul 2022 15:07:38 -0700 Subject: [PATCH 05/29] sad beeps --- src/inc/til/winrt.h | 67 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/inc/til/winrt.h b/src/inc/til/winrt.h index 35495fcc415..0e773ad5be6 100644 --- a/src/inc/til/winrt.h +++ b/src/inc/til/winrt.h @@ -107,5 +107,72 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" typed_event& _origin; }; #endif +#ifdef WINRT_Windows_UI_Xaml_DataH + using property_changed_event = event; + + // This unfortunately doesn't seem feasible. It's gonna just result in more + // macros, which no one wants. + // + // Explanation can be found in the operator() below. + + // template + // struct observable_property + // { + // observable_property(property_changed_event e) : + // _event{ e } {}; + // observable_property(property_changed_event e, T defaultValue) : + // _event{ e }, + // _value{ defaultValue } {} + + // T operator()() + // { + // return _value; + // } + // void operator()(const T& value) + // { + // if (_value != value) + // { + // _value = value; + + // // This line right here is why we can't do this. + // _event(*sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L## #name }) + // // 1. We don't know who the sender is, or would require `this` to + // // always be the first parameter to one of these + // // observable_property's. + // // + // // 2. We don't know what our own name is. We need to actually raise + // // an event with the name of the variable as the parameter. Only + // // way to do that is with something dumb like + // // + // // ``` + // // til::observable Foo(this, L"Foo", 42) + // // ``` + // // + // // Which is just dang dumb + // } + // } + // void operator()(const T&& value) + // { + // _value = value; + // } + // property& operator=(const property& other) + // { + // _value = other._value; + // return *this; + // } + // property& operator=(const T& newValue) + // { + // _value = newValue; + // return *this; + // } + + // private: + // T _value; + // property_changed_event& _event; + // }; + + // #define OBSERVABLE(type, name, ...) til::observable_property name{ this, L## #name, this.PropertyChanged, __VA_ARGS__ }; + +#endif } From eb7d2be2e8c7d447b50ea2f4dae277743d4caa3d Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sat, 13 Aug 2022 14:49:38 -0500 Subject: [PATCH 06/29] I am incapable of not making 100 tiny commits, this was already way to friggin big. --- src/cascadia/TerminalApp/TerminalPage.cpp | 46 ++++++++++++++++ src/cascadia/TerminalApp/TerminalPage.h | 2 + src/cascadia/TerminalApp/TerminalPage.xaml | 56 ++++++++++++++++++++ src/cascadia/TerminalControl/EventArgs.cpp | 1 + src/cascadia/TerminalControl/EventArgs.h | 11 ++++ src/cascadia/TerminalControl/EventArgs.idl | 9 ++++ src/cascadia/TerminalControl/TermControl.cpp | 16 +++--- src/cascadia/TerminalControl/TermControl.h | 2 + src/cascadia/TerminalControl/TermControl.idl | 1 + 9 files changed, 138 insertions(+), 6 deletions(-) diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index 2032125d0e4..cc078c77bf7 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -1451,6 +1451,8 @@ namespace winrt::TerminalApp::implementation }); term.ShowWindowChanged({ get_weak(), &TerminalPage::_ShowWindowChangedHandler }); + + term.ContextMenuRequested({ get_weak(), &TerminalPage::_ContextMenuRequestedHandler }); } // Method Description: @@ -4149,4 +4151,48 @@ namespace winrt::TerminalApp::implementation _activated = activated; _updateThemeColors(); } + + void TerminalPage::_ContextMenuRequestedHandler(const IInspectable sender, + const winrt::Microsoft::Terminal::Control::ContextMenuRequestedEventArgs& args) + { + auto text = args.SelectedText(); + text; + // auto newTabFlyout = WUX::Controls::MenuFlyout{}; + // { + // auto menuItem = WUX::Controls::MenuFlyoutItem{}; + // menuItem.Text(L"Copy"); + // menuItem.Click([weakThis{ get_weak() }](auto&&, auto&&) { + // if (auto page{ weakThis.get() }) + // { + // } + // }); + // newTabFlyout.Items().Append(menuItem); + // } + + // auto separatorItem = WUX::Controls::MenuFlyoutSeparator{}; + // newTabFlyout.Items().Append(separatorItem); + + // { + // auto menuItem = WUX::Controls::MenuFlyoutItem{}; + // menuItem.Text(L"Copy"); + // menuItem.Click([weakThis{ get_weak() }](auto&&, auto&&) { + // if (auto page{ weakThis.get() }) + // { + // } + // }); + // newTabFlyout.Items().Append(menuItem); + // } + + // ControlContextMenu().ShowAt(sender.try_as()); + auto fwe = sender.try_as(); + auto transform = fwe.TransformToVisual(*this); + auto absolute = CoreWindow::GetForCurrentThread().PointerPosition(); + auto controlOrigin = transform.TransformPoint(til::point{0, 0}.to_winrt_point()); + til::point relative = til::point{ til::math::rounding, absolute.X, absolute.Y } - til::point{ til::math::rounding, controlOrigin.X, absolute.Y }; + auto flyout = ControlContextMenu(); + ; + flyout.ShowAt(fwe, args.Point()); + + } + } diff --git a/src/cascadia/TerminalApp/TerminalPage.h b/src/cascadia/TerminalApp/TerminalPage.h index 3d5b70efe5e..9cdd45b6fdf 100644 --- a/src/cascadia/TerminalApp/TerminalPage.h +++ b/src/cascadia/TerminalApp/TerminalPage.h @@ -451,6 +451,8 @@ namespace winrt::TerminalApp::implementation winrt::fire_and_forget _ShowWindowChangedHandler(const IInspectable sender, const winrt::Microsoft::Terminal::Control::ShowWindowArgs args); + void _ContextMenuRequestedHandler(const IInspectable sender, const winrt::Microsoft::Terminal::Control::ContextMenuRequestedEventArgs& args); + #pragma region ActionHandlers // These are all defined in AppActionHandlers.cpp #define ON_ALL_ACTIONS(action) DECLARE_ACTION_HANDLER(action); diff --git a/src/cascadia/TerminalApp/TerminalPage.xaml b/src/cascadia/TerminalApp/TerminalPage.xaml index a2f430cfcb1..3aeb701e29c 100644 --- a/src/cascadia/TerminalApp/TerminalPage.xaml +++ b/src/cascadia/TerminalApp/TerminalPage.xaml @@ -225,5 +225,61 @@ Text="{x:Bind WindowName, Mode=OneWay}" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalControl/EventArgs.cpp b/src/cascadia/TerminalControl/EventArgs.cpp index 9f9b41ac1f7..c4089ebd76c 100644 --- a/src/cascadia/TerminalControl/EventArgs.cpp +++ b/src/cascadia/TerminalControl/EventArgs.cpp @@ -5,6 +5,7 @@ #include "EventArgs.h" #include "TitleChangedEventArgs.g.cpp" #include "CopyToClipboardEventArgs.g.cpp" +#include "ContextMenuRequestedEventArgs.g.cpp" #include "PasteFromClipboardEventArgs.g.cpp" #include "OpenHyperlinkEventArgs.g.cpp" #include "NoticeEventArgs.g.cpp" diff --git a/src/cascadia/TerminalControl/EventArgs.h b/src/cascadia/TerminalControl/EventArgs.h index a542e391f63..7444c4a517a 100644 --- a/src/cascadia/TerminalControl/EventArgs.h +++ b/src/cascadia/TerminalControl/EventArgs.h @@ -5,6 +5,7 @@ #include "TitleChangedEventArgs.g.h" #include "CopyToClipboardEventArgs.g.h" +#include "ContextMenuRequestedEventArgs.g.h" #include "PasteFromClipboardEventArgs.g.h" #include "OpenHyperlinkEventArgs.g.h" #include "NoticeEventArgs.g.h" @@ -53,6 +54,16 @@ namespace winrt::Microsoft::Terminal::Control::implementation Windows::Foundation::IReference _formats; }; + struct ContextMenuRequestedEventArgs : public ContextMenuRequestedEventArgsT + { + public: + ContextMenuRequestedEventArgs(const hstring& selectedText, winrt::Windows::Foundation::Point point) : + _SelectedText(selectedText), _Point(point) {} + + WINRT_PROPERTY(winrt::hstring, SelectedText, L""); + WINRT_PROPERTY(winrt::Windows::Foundation::Point, Point); + }; + struct PasteFromClipboardEventArgs : public PasteFromClipboardEventArgsT { public: diff --git a/src/cascadia/TerminalControl/EventArgs.idl b/src/cascadia/TerminalControl/EventArgs.idl index 941384c5b05..34f6f749379 100644 --- a/src/cascadia/TerminalControl/EventArgs.idl +++ b/src/cascadia/TerminalControl/EventArgs.idl @@ -22,6 +22,15 @@ namespace Microsoft.Terminal.Control Windows.Foundation.IReference Formats { get; }; } + runtimeclass ContextMenuRequestedEventArgs + { + String SelectedText { get; }; + Windows.Foundation.Point Point { get; }; + // Ideas: + // String CurrentDirectory { get; }; + // Microsoft.Terminal.TerminalConnection.ConnectionState State { get; }; + } + runtimeclass TitleChangedEventArgs { String Title; diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 943190cfaf2..32be25bbd55 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -1269,12 +1269,16 @@ namespace winrt::Microsoft::Terminal::Control::implementation } else { - const auto cursorPosition = point.Position(); - _interactivity.PointerPressed(TermControl::GetPressedMouseButtons(point), - TermControl::GetPointerUpdateKind(point), - point.Timestamp(), - ControlKeyStates{ args.KeyModifiers() }, - _toTerminalOrigin(cursorPosition).to_core_point()); + auto contextArgs = winrt::make_self(L"foobar", point.Position()); + ; + _ContextMenuRequestedHandlers(*this, *contextArgs); + + // const auto cursorPosition = point.Position(); + // _interactivity.PointerPressed(TermControl::GetPressedMouseButtons(point), + // TermControl::GetPointerUpdateKind(point), + // point.Timestamp(), + // ControlKeyStates{ args.KeyModifiers() }, + // _toTerminalOrigin(cursorPosition).to_core_point()); } args.Handled(true); diff --git a/src/cascadia/TerminalControl/TermControl.h b/src/cascadia/TerminalControl/TermControl.h index 655fce03fdb..fb9a63b46db 100644 --- a/src/cascadia/TerminalControl/TermControl.h +++ b/src/cascadia/TerminalControl/TermControl.h @@ -153,6 +153,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation TYPED_EVENT(FocusFollowMouseRequested, IInspectable, IInspectable); TYPED_EVENT(Initialized, Control::TermControl, Windows::UI::Xaml::RoutedEventArgs); TYPED_EVENT(WarningBell, IInspectable, IInspectable); + TYPED_EVENT(ContextMenuRequested, IInspectable, Control::ContextMenuRequestedEventArgs); + // clang-format on WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Xaml::Media::Brush, BackgroundBrush, _PropertyChangedHandlers, nullptr); diff --git a/src/cascadia/TerminalControl/TermControl.idl b/src/cascadia/TerminalControl/TermControl.idl index 101359b30e9..23f47242746 100644 --- a/src/cascadia/TerminalControl/TermControl.idl +++ b/src/cascadia/TerminalControl/TermControl.idl @@ -41,6 +41,7 @@ namespace Microsoft.Terminal.Control event Windows.Foundation.TypedEventHandler TabColorChanged; event Windows.Foundation.TypedEventHandler ReadOnlyChanged; event Windows.Foundation.TypedEventHandler FocusFollowMouseRequested; + event Windows.Foundation.TypedEventHandler ContextMenuRequested; event Windows.Foundation.TypedEventHandler Initialized; // This is an event handler forwarder for the underlying connection. From e6b33c37400a46bc49fac2a3febbaabd418f12ad Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sun, 14 Aug 2022 12:47:42 -0500 Subject: [PATCH 07/29] yea that's everything --- .../TerminalApp/ColorPickupFlyout.cpp | 3 - .../TerminalApp/ControlContextMenu.cpp | 18 ++++ src/cascadia/TerminalApp/ControlContextMenu.h | 15 ++++ .../TerminalApp/ControlContextMenu.idl | 16 ++++ .../TerminalApp/ControlContextMenu.xaml | 70 ++++++++++++++++ .../TerminalApp/TerminalAppLib.vcxproj | 13 +++ src/cascadia/TerminalApp/TerminalPage.cpp | 83 +++++++++++-------- src/cascadia/TerminalApp/TerminalPage.xaml | 55 +----------- src/cascadia/TerminalControl/TermControl.cpp | 12 ++- .../TerminalSettingsModel/ActionArgs.h | 1 + .../TerminalSettingsModel/ActionArgs.idl | 1 + 11 files changed, 195 insertions(+), 92 deletions(-) create mode 100644 src/cascadia/TerminalApp/ControlContextMenu.cpp create mode 100644 src/cascadia/TerminalApp/ControlContextMenu.h create mode 100644 src/cascadia/TerminalApp/ControlContextMenu.idl create mode 100644 src/cascadia/TerminalApp/ControlContextMenu.xaml diff --git a/src/cascadia/TerminalApp/ColorPickupFlyout.cpp b/src/cascadia/TerminalApp/ColorPickupFlyout.cpp index e582ca7fe6f..f82d86feecc 100644 --- a/src/cascadia/TerminalApp/ColorPickupFlyout.cpp +++ b/src/cascadia/TerminalApp/ColorPickupFlyout.cpp @@ -1,9 +1,6 @@ #include "pch.h" #include "ColorPickupFlyout.h" #include "ColorPickupFlyout.g.cpp" -#include "winrt/Windows.UI.Xaml.Media.h" -#include "winrt/Windows.UI.Xaml.Shapes.h" -#include "winrt/Windows.UI.Xaml.Interop.h" #include namespace winrt::TerminalApp::implementation diff --git a/src/cascadia/TerminalApp/ControlContextMenu.cpp b/src/cascadia/TerminalApp/ControlContextMenu.cpp new file mode 100644 index 00000000000..fce146359ca --- /dev/null +++ b/src/cascadia/TerminalApp/ControlContextMenu.cpp @@ -0,0 +1,18 @@ +#include "pch.h" +#include "ControlContextMenu.h" +#include "ControlContextMenu.g.cpp" +#include + +namespace winrt::TerminalApp::implementation +{ + // Method Description: + // - Default constructor, localizes the buttons and hooks + // up the event fired by the custom color picker, so that + // the tab color is set on the fly when selecting a non-preset color + // Arguments: + // - + ControlContextMenu::ControlContextMenu() + { + InitializeComponent(); + } +} diff --git a/src/cascadia/TerminalApp/ControlContextMenu.h b/src/cascadia/TerminalApp/ControlContextMenu.h new file mode 100644 index 00000000000..01da7a205e3 --- /dev/null +++ b/src/cascadia/TerminalApp/ControlContextMenu.h @@ -0,0 +1,15 @@ +#pragma once +#include "ControlContextMenu.g.h" + +namespace winrt::TerminalApp::implementation +{ + struct ControlContextMenu : ControlContextMenuT + { + ControlContextMenu(); + }; +} + +namespace winrt::TerminalApp::factory_implementation +{ + BASIC_FACTORY(ControlContextMenu); +} diff --git a/src/cascadia/TerminalApp/ControlContextMenu.idl b/src/cascadia/TerminalApp/ControlContextMenu.idl new file mode 100644 index 00000000000..d43da7ba056 --- /dev/null +++ b/src/cascadia/TerminalApp/ControlContextMenu.idl @@ -0,0 +1,16 @@ +namespace TerminalApp +{ + [default_interface] runtimeclass ControlContextMenu : Windows.UI.Xaml.Controls.MenuFlyout + { + ControlContextMenu(); + + Windows.UI.Xaml.Controls.MenuFlyoutItem PasteItem{ get; }; + Windows.UI.Xaml.Controls.MenuFlyoutItem CopyItem{ get; }; + Windows.UI.Xaml.Controls.MenuFlyoutItem FindItem{ get; }; + Windows.UI.Xaml.Controls.MenuFlyoutItem SearchWebItem{ get; }; + Windows.UI.Xaml.Controls.MenuFlyoutItem SplitPaneItem{ get; }; + Windows.UI.Xaml.Controls.MenuFlyoutItem DuplicateTabItem{ get; }; + Windows.UI.Xaml.Controls.MenuFlyoutItem ClosePaneItem{ get; }; + Windows.UI.Xaml.Controls.MenuFlyoutItem CloseTabItem{ get; }; + } +} diff --git a/src/cascadia/TerminalApp/ControlContextMenu.xaml b/src/cascadia/TerminalApp/ControlContextMenu.xaml new file mode 100644 index 00000000000..3db170a7c65 --- /dev/null +++ b/src/cascadia/TerminalApp/ControlContextMenu.xaml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalApp/TerminalAppLib.vcxproj b/src/cascadia/TerminalApp/TerminalAppLib.vcxproj index fbf1e051fd5..986ff998d9f 100644 --- a/src/cascadia/TerminalApp/TerminalAppLib.vcxproj +++ b/src/cascadia/TerminalApp/TerminalAppLib.vcxproj @@ -67,6 +67,9 @@ Designer + + Designer + @@ -146,6 +149,9 @@ AppLogic.idl + + ControlContextMenu.xaml + @@ -240,6 +246,9 @@ + + ControlContextMenu.xaml + @@ -301,6 +310,10 @@ + + ControlContextMenu.xaml + Code + diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index cc078c77bf7..4ed2c8cf7aa 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -4157,42 +4157,57 @@ namespace winrt::TerminalApp::implementation { auto text = args.SelectedText(); text; - // auto newTabFlyout = WUX::Controls::MenuFlyout{}; - // { - // auto menuItem = WUX::Controls::MenuFlyoutItem{}; - // menuItem.Text(L"Copy"); - // menuItem.Click([weakThis{ get_weak() }](auto&&, auto&&) { - // if (auto page{ weakThis.get() }) - // { - // } - // }); - // newTabFlyout.Items().Append(menuItem); - // } - - // auto separatorItem = WUX::Controls::MenuFlyoutSeparator{}; - // newTabFlyout.Items().Append(separatorItem); - - // { - // auto menuItem = WUX::Controls::MenuFlyoutItem{}; - // menuItem.Text(L"Copy"); - // menuItem.Click([weakThis{ get_weak() }](auto&&, auto&&) { - // if (auto page{ weakThis.get() }) - // { - // } - // }); - // newTabFlyout.Items().Append(menuItem); - // } - - // ControlContextMenu().ShowAt(sender.try_as()); + auto fwe = sender.try_as(); - auto transform = fwe.TransformToVisual(*this); - auto absolute = CoreWindow::GetForCurrentThread().PointerPosition(); - auto controlOrigin = transform.TransformPoint(til::point{0, 0}.to_winrt_point()); - til::point relative = til::point{ til::math::rounding, absolute.X, absolute.Y } - til::point{ til::math::rounding, controlOrigin.X, absolute.Y }; - auto flyout = ControlContextMenu(); - ; - flyout.ShowAt(fwe, args.Point()); + auto flyout = TerminalApp::ControlContextMenu(); + + auto weak = get_weak(); + auto makeCallback = [weak](const Microsoft::Terminal::Settings::Model::ActionAndArgs& actionAndArgs) { + return [weak, actionAndArgs](auto&&, auto&&) { + if (auto page{ weak.get() }) + { + page->_actionDispatch->DoAction(actionAndArgs); + } + }; + }; + + flyout.PasteItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::PasteText, + nullptr })); + + if (text.empty()) + { + flyout.CopyItem().IsEnabled(false); + flyout.FindItem().Visibility(Visibility::Collapsed); + flyout.SearchWebItem().Visibility(Visibility::Collapsed); + } + else + { + flyout.CopyItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::CopyText, + CopyTextArgs{} })); + flyout.FindItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::Find, + nullptr })); + // flyout.SearchWebItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::CopyText, nullptr })); + } + + flyout.SplitPaneItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::SplitPane, + SplitPaneArgs{ SplitType::Duplicate } })); + flyout.DuplicateTabItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::DuplicateTab, + nullptr })); + if (_GetFocusedTabImpl()->GetLeafPaneCount() > 1) + { + flyout.ClosePaneItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::ClosePane, + nullptr })); + } + else + { + flyout.ClosePaneItem().Visibility(Visibility::Collapsed); + } + flyout.CloseTabItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::CloseTab, + CloseTabArgs{ _GetFocusedTabIndex().value() } })); + + WUX::Controls::Primitives::FlyoutBase::SetAttachedFlyout(*this, flyout); + flyout.ShowAt(fwe, args.Point()); } } diff --git a/src/cascadia/TerminalApp/TerminalPage.xaml b/src/cascadia/TerminalApp/TerminalPage.xaml index 3aeb701e29c..e935e168a1c 100644 --- a/src/cascadia/TerminalApp/TerminalPage.xaml +++ b/src/cascadia/TerminalApp/TerminalPage.xaml @@ -227,59 +227,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 32be25bbd55..0dbc38f0079 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -1269,7 +1269,17 @@ namespace winrt::Microsoft::Terminal::Control::implementation } else { - auto contextArgs = winrt::make_self(L"foobar", point.Position()); + auto bufferText = _core.SelectedText(true); + std::wstring singleString = L""; + for (const auto& line : bufferText) + { + if (!singleString.empty()) + { + singleString += L"\r\n"; + } + singleString += line; + }; + auto contextArgs = winrt::make_self(winrt::hstring{ singleString }, point.Position()); ; _ContextMenuRequestedHandlers(*this, *contextArgs); diff --git a/src/cascadia/TerminalSettingsModel/ActionArgs.h b/src/cascadia/TerminalSettingsModel/ActionArgs.h index 03f69252561..869f95f670f 100644 --- a/src/cascadia/TerminalSettingsModel/ActionArgs.h +++ b/src/cascadia/TerminalSettingsModel/ActionArgs.h @@ -718,6 +718,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation namespace winrt::Microsoft::Terminal::Settings::Model::factory_implementation { BASIC_FACTORY(ActionEventArgs); + BASIC_FACTORY(CopyTextArgs); BASIC_FACTORY(SwitchToTabArgs); BASIC_FACTORY(NewTerminalArgs); BASIC_FACTORY(NewTabArgs); diff --git a/src/cascadia/TerminalSettingsModel/ActionArgs.idl b/src/cascadia/TerminalSettingsModel/ActionArgs.idl index 77c817315b6..856888096ca 100644 --- a/src/cascadia/TerminalSettingsModel/ActionArgs.idl +++ b/src/cascadia/TerminalSettingsModel/ActionArgs.idl @@ -146,6 +146,7 @@ namespace Microsoft.Terminal.Settings.Model [default_interface] runtimeclass CopyTextArgs : IActionArgs { + CopyTextArgs(); Boolean SingleLine { get; }; Windows.Foundation.IReference CopyFormatting { get; }; }; From 29d454ba4c6d2297726bd2bd1e049aab7a8f1b8b Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sun, 28 Aug 2022 10:21:08 -0500 Subject: [PATCH 08/29] 90% plumbing, 10% bad implementation of making sure we right-clicked then released --- .../TerminalControl/IControlSettings.idl | 1 + src/cascadia/TerminalControl/TermControl.cpp | 57 ++++++++++++------- src/cascadia/TerminalControl/TermControl.h | 2 + .../TerminalSettingsModel/MTSMSettings.h | 1 + .../TerminalSettingsModel/Profile.idl | 2 + .../TerminalSettings.cpp | 2 + .../TerminalSettingsModel/TerminalSettings.h | 1 + src/cascadia/inc/ControlProperties.h | 3 +- 8 files changed, 49 insertions(+), 20 deletions(-) diff --git a/src/cascadia/TerminalControl/IControlSettings.idl b/src/cascadia/TerminalControl/IControlSettings.idl index 66ea5a33625..c20b4f1e3b9 100644 --- a/src/cascadia/TerminalControl/IControlSettings.idl +++ b/src/cascadia/TerminalControl/IControlSettings.idl @@ -58,5 +58,6 @@ namespace Microsoft.Terminal.Control Boolean SoftwareRendering { get; }; Boolean ShowMarks { get; }; Boolean UseBackgroundImageForWindow { get; }; + Boolean RightClickContextMenu { get; }; }; } diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 0dbc38f0079..988184cc39c 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -292,7 +292,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation // - Given Settings having been updated, applies the settings to the current terminal. // Return Value: // - - winrt::fire_and_forget TermControl::UpdateControlSettings(IControlSettings settings, IControlAppearance unfocusedAppearance) + winrt::fire_and_forget TermControl::UpdateControlSettings(IControlSettings settings, + IControlAppearance unfocusedAppearance) { auto weakThis{ get_weak() }; @@ -419,6 +420,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation // settings might be out-of-proc in the future auto settings{ _core.Settings() }; + _useRightClickContextMenu = settings.RightClickContextMenu(); + // Apply padding as swapChainPanel's margin const auto newMargin = ParseThicknessFromPadding(settings.Padding()); SwapChainPanel().Margin(newMargin); @@ -1269,26 +1272,42 @@ namespace winrt::Microsoft::Terminal::Control::implementation } else { - auto bufferText = _core.SelectedText(true); - std::wstring singleString = L""; - for (const auto& line : bufferText) + const auto mouseButtons = TermControl::GetPressedMouseButtons(point); + if (!_rightClickPressed && + WI_IsFlagSet(mouseButtons, Control::MouseButtonState::IsRightButtonDown)) + { + _rightClickPressed = true; + } + + if (_rightClickPressed && + !WI_IsFlagSet(mouseButtons, Control::MouseButtonState::IsRightButtonDown)) { - if (!singleString.empty()) + // TODO! hey idiot, there's PointerReleased where this needs to be. But that also goes straight to interactivity. Sooooo all this should probably be in there. idiot. + _rightClickPressed = false; + // TODO! only do this in VT mouse Mode if shift is pressed too. + auto bufferText = _core.SelectedText(true); + std::wstring singleString = L""; + for (const auto& line : bufferText) { - singleString += L"\r\n"; - } - singleString += line; - }; - auto contextArgs = winrt::make_self(winrt::hstring{ singleString }, point.Position()); - ; - _ContextMenuRequestedHandlers(*this, *contextArgs); - - // const auto cursorPosition = point.Position(); - // _interactivity.PointerPressed(TermControl::GetPressedMouseButtons(point), - // TermControl::GetPointerUpdateKind(point), - // point.Timestamp(), - // ControlKeyStates{ args.KeyModifiers() }, - // _toTerminalOrigin(cursorPosition).to_core_point()); + if (!singleString.empty()) + { + singleString += L"\r\n"; + } + singleString += line; + }; + auto contextArgs = winrt::make_self(winrt::hstring{ singleString }, point.Position()); + + _ContextMenuRequestedHandlers(*this, *contextArgs); + } + else + { + const auto cursorPosition = point.Position(); + _interactivity.PointerPressed(mouseButtons, + TermControl::GetPointerUpdateKind(point), + point.Timestamp(), + ControlKeyStates{ args.KeyModifiers() }, + _toTerminalOrigin(cursorPosition).to_core_point()); + } } args.Handled(true); diff --git a/src/cascadia/TerminalControl/TermControl.h b/src/cascadia/TerminalControl/TermControl.h index fb9a63b46db..aa46fa156c1 100644 --- a/src/cascadia/TerminalControl/TermControl.h +++ b/src/cascadia/TerminalControl/TermControl.h @@ -210,6 +210,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation winrt::Windows::UI::Xaml::Controls::SwapChainPanel::LayoutUpdated_revoker _layoutUpdatedRevoker; bool _showMarksInScrollbar{ false }; + bool _useRightClickContextMenu{ false }; + bool _rightClickPressed{ false }; inline bool _IsClosing() const noexcept { diff --git a/src/cascadia/TerminalSettingsModel/MTSMSettings.h b/src/cascadia/TerminalSettingsModel/MTSMSettings.h index 16c9b8ea52d..42b3dcd190d 100644 --- a/src/cascadia/TerminalSettingsModel/MTSMSettings.h +++ b/src/cascadia/TerminalSettingsModel/MTSMSettings.h @@ -78,6 +78,7 @@ Author(s): X(hstring, TabTitle, "tabTitle") \ X(Model::BellStyle, BellStyle, "bellStyle", BellStyle::Audible) \ X(bool, UseAtlasEngine, "experimental.useAtlasEngine", false) \ + X(bool, RightClickContextMenu, "experimental.rightClickContextMenu", false) \ X(Windows::Foundation::Collections::IVector, BellSound, "bellSound", nullptr) \ X(bool, Elevate, "elevate", false) \ X(bool, VtPassthrough, "experimental.connection.passthroughMode", false) \ diff --git a/src/cascadia/TerminalSettingsModel/Profile.idl b/src/cascadia/TerminalSettingsModel/Profile.idl index 76357b65898..efcdfe34312 100644 --- a/src/cascadia/TerminalSettingsModel/Profile.idl +++ b/src/cascadia/TerminalSettingsModel/Profile.idl @@ -86,5 +86,7 @@ namespace Microsoft.Terminal.Settings.Model INHERITABLE_PROFILE_SETTING(Boolean, Elevate); INHERITABLE_PROFILE_SETTING(Boolean, AutoMarkPrompts); INHERITABLE_PROFILE_SETTING(Boolean, ShowMarks); + + INHERITABLE_PROFILE_SETTING(Boolean, RightClickContextMenu); } } diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp b/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp index 0ba57857303..f6da783b3a9 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp +++ b/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp @@ -283,6 +283,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation _Elevate = profile.Elevate(); _AutoMarkPrompts = Feature_ScrollbarMarks::IsEnabled() && profile.AutoMarkPrompts(); _ShowMarks = Feature_ScrollbarMarks::IsEnabled() && profile.ShowMarks(); + + _RightClickContextMenu = profile.RightClickContextMenu(); } // Method Description: diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettings.h b/src/cascadia/TerminalSettingsModel/TerminalSettings.h index 7647cd477ea..62848a1f34e 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettings.h +++ b/src/cascadia/TerminalSettingsModel/TerminalSettings.h @@ -160,6 +160,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation INHERITABLE_SETTING(Model::TerminalSettings, bool, AutoMarkPrompts, false); INHERITABLE_SETTING(Model::TerminalSettings, bool, ShowMarks, false); + INHERITABLE_SETTING(Model::TerminalSettings, bool, RightClickContextMenu, false); private: std::optional> _ColorTable; diff --git a/src/cascadia/inc/ControlProperties.h b/src/cascadia/inc/ControlProperties.h index e29da1a62eb..4cf73586bc7 100644 --- a/src/cascadia/inc/ControlProperties.h +++ b/src/cascadia/inc/ControlProperties.h @@ -71,4 +71,5 @@ X(bool, SoftwareRendering, false) \ X(bool, UseAtlasEngine, false) \ X(bool, UseBackgroundImageForWindow, false) \ - X(bool, ShowMarks, false) + X(bool, ShowMarks, false) \ + X(bool, RightClickContextMenu, false) From 451d8f360928105823a944258f761541fc6d84fa Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Mon, 19 Sep 2022 07:33:01 -0500 Subject: [PATCH 09/29] move this code to interactivity. Scaling of event is wrong now --- .../TerminalControl/ControlInteractivity.cpp | 36 +++++++++++++---- .../TerminalControl/ControlInteractivity.h | 1 + .../TerminalControl/ControlInteractivity.idl | 1 + src/cascadia/TerminalControl/TermControl.cpp | 40 +++---------------- src/cascadia/TerminalControl/TermControl.h | 2 +- 5 files changed, 37 insertions(+), 43 deletions(-) diff --git a/src/cascadia/TerminalControl/ControlInteractivity.cpp b/src/cascadia/TerminalControl/ControlInteractivity.cpp index 75b8cf5b614..e407ec47753 100644 --- a/src/cascadia/TerminalControl/ControlInteractivity.cpp +++ b/src/cascadia/TerminalControl/ControlInteractivity.cpp @@ -206,7 +206,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation // GH#9396: we prioritize hyper-link over VT mouse events auto hyperlink = _core->GetHyperlink(terminalPosition.to_core_point()); if (WI_IsFlagSet(buttonState, MouseButtonState::IsLeftButtonDown) && - ctrlEnabled && !hyperlink.empty()) + ctrlEnabled && + !hyperlink.empty()) { const auto clickCount = _numberOfClicks(pixelPosition, timestamp); // Handle hyper-link only on the first click to prevent multiple activations @@ -256,14 +257,33 @@ namespace winrt::Microsoft::Terminal::Control::implementation } else if (WI_IsFlagSet(buttonState, MouseButtonState::IsRightButtonDown)) { - // Try to copy the text and clear the selection - const auto successfulCopy = CopySelectionToClipboard(shiftEnabled, nullptr); - _core->ClearSelection(); - if (_core->CopyOnSelect() || !successfulCopy) + if (_core->Settings().RightClickContextMenu()) { - // CopyOnSelect: right click always pastes! - // Otherwise: no selection --> paste - RequestPasteTextFromClipboard(); + auto bufferText = _core->SelectedText(true); + std::wstring singleString = L""; + for (const auto& line : bufferText) + { + if (!singleString.empty()) + { + singleString += L"\r\n"; + } + singleString += line; + }; + auto contextArgs = winrt::make_self(winrt::hstring{ singleString }, til::point{ pixelPosition }.to_winrt_point()); + + _ContextMenuRequestedHandlers(*this, *contextArgs); + } + else + { + // Try to copy the text and clear the selection + const auto successfulCopy = CopySelectionToClipboard(shiftEnabled, nullptr); + _core->ClearSelection(); + if (_core->CopyOnSelect() || !successfulCopy) + { + // CopyOnSelect: right click always pastes! + // Otherwise: no selection --> paste + RequestPasteTextFromClipboard(); + } } } } diff --git a/src/cascadia/TerminalControl/ControlInteractivity.h b/src/cascadia/TerminalControl/ControlInteractivity.h index 3d47ad7c0c9..ae4c44d8cb5 100644 --- a/src/cascadia/TerminalControl/ControlInteractivity.h +++ b/src/cascadia/TerminalControl/ControlInteractivity.h @@ -88,6 +88,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation TYPED_EVENT(OpenHyperlink, IInspectable, Control::OpenHyperlinkEventArgs); TYPED_EVENT(PasteFromClipboard, IInspectable, Control::PasteFromClipboardEventArgs); TYPED_EVENT(ScrollPositionChanged, IInspectable, Control::ScrollPositionChangedArgs); + TYPED_EVENT(ContextMenuRequested, IInspectable, Control::ContextMenuRequestedEventArgs); private: // NOTE: _uiaEngine must be ordered before _core. diff --git a/src/cascadia/TerminalControl/ControlInteractivity.idl b/src/cascadia/TerminalControl/ControlInteractivity.idl index aada01ee0ad..4232afcb8d3 100644 --- a/src/cascadia/TerminalControl/ControlInteractivity.idl +++ b/src/cascadia/TerminalControl/ControlInteractivity.idl @@ -64,6 +64,7 @@ namespace Microsoft.Terminal.Control event Windows.Foundation.TypedEventHandler OpenHyperlink; event Windows.Foundation.TypedEventHandler ScrollPositionChanged; event Windows.Foundation.TypedEventHandler PasteFromClipboard; + event Windows.Foundation.TypedEventHandler ContextMenuRequested; }; diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 988184cc39c..c372582381e 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -1273,41 +1273,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation else { const auto mouseButtons = TermControl::GetPressedMouseButtons(point); - if (!_rightClickPressed && - WI_IsFlagSet(mouseButtons, Control::MouseButtonState::IsRightButtonDown)) - { - _rightClickPressed = true; - } - - if (_rightClickPressed && - !WI_IsFlagSet(mouseButtons, Control::MouseButtonState::IsRightButtonDown)) - { - // TODO! hey idiot, there's PointerReleased where this needs to be. But that also goes straight to interactivity. Sooooo all this should probably be in there. idiot. - _rightClickPressed = false; - // TODO! only do this in VT mouse Mode if shift is pressed too. - auto bufferText = _core.SelectedText(true); - std::wstring singleString = L""; - for (const auto& line : bufferText) - { - if (!singleString.empty()) - { - singleString += L"\r\n"; - } - singleString += line; - }; - auto contextArgs = winrt::make_self(winrt::hstring{ singleString }, point.Position()); - _ContextMenuRequestedHandlers(*this, *contextArgs); - } - else - { - const auto cursorPosition = point.Position(); - _interactivity.PointerPressed(mouseButtons, - TermControl::GetPointerUpdateKind(point), - point.Timestamp(), - ControlKeyStates{ args.KeyModifiers() }, - _toTerminalOrigin(cursorPosition).to_core_point()); - } + const auto cursorPosition = point.Position(); + _interactivity.PointerPressed(mouseButtons, + TermControl::GetPointerUpdateKind(point), + point.Timestamp(), + ControlKeyStates{ args.KeyModifiers() }, + _toTerminalOrigin(cursorPosition).to_core_point()); } args.Handled(true); diff --git a/src/cascadia/TerminalControl/TermControl.h b/src/cascadia/TerminalControl/TermControl.h index aa46fa156c1..ec7dd274198 100644 --- a/src/cascadia/TerminalControl/TermControl.h +++ b/src/cascadia/TerminalControl/TermControl.h @@ -142,6 +142,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation PROJECTED_FORWARDED_TYPED_EVENT(SetTaskbarProgress, IInspectable, IInspectable, _core, TaskbarProgressChanged); PROJECTED_FORWARDED_TYPED_EVENT(ConnectionStateChanged, IInspectable, IInspectable, _core, ConnectionStateChanged); PROJECTED_FORWARDED_TYPED_EVENT(ShowWindowChanged, IInspectable, Control::ShowWindowArgs, _core, ShowWindowChanged); + PROJECTED_FORWARDED_TYPED_EVENT(ContextMenuRequested, IInspectable, Control::ContextMenuRequestedEventArgs, _interactivity, ContextMenuRequested); PROJECTED_FORWARDED_TYPED_EVENT(PasteFromClipboard, IInspectable, Control::PasteFromClipboardEventArgs, _interactivity, PasteFromClipboard); @@ -153,7 +154,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation TYPED_EVENT(FocusFollowMouseRequested, IInspectable, IInspectable); TYPED_EVENT(Initialized, Control::TermControl, Windows::UI::Xaml::RoutedEventArgs); TYPED_EVENT(WarningBell, IInspectable, IInspectable); - TYPED_EVENT(ContextMenuRequested, IInspectable, Control::ContextMenuRequestedEventArgs); // clang-format on From dc2ebaf8061fbc147ec562f86fd8073a44a09cca Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Tue, 25 Oct 2022 14:59:43 -0500 Subject: [PATCH 10/29] use resource strings too. Last commit of stuff from before paternity leave --- .../TerminalApp/ControlContextMenu.idl | 1 - .../TerminalApp/ControlContextMenu.xaml | 20 +++++----- .../Resources/en-US/Resources.resw | 21 +++++++++++ src/cascadia/TerminalApp/TerminalPage.cpp | 37 ++++++++++--------- 4 files changed, 51 insertions(+), 28 deletions(-) diff --git a/src/cascadia/TerminalApp/ControlContextMenu.idl b/src/cascadia/TerminalApp/ControlContextMenu.idl index d43da7ba056..26e2ac70d5a 100644 --- a/src/cascadia/TerminalApp/ControlContextMenu.idl +++ b/src/cascadia/TerminalApp/ControlContextMenu.idl @@ -7,7 +7,6 @@ namespace TerminalApp Windows.UI.Xaml.Controls.MenuFlyoutItem PasteItem{ get; }; Windows.UI.Xaml.Controls.MenuFlyoutItem CopyItem{ get; }; Windows.UI.Xaml.Controls.MenuFlyoutItem FindItem{ get; }; - Windows.UI.Xaml.Controls.MenuFlyoutItem SearchWebItem{ get; }; Windows.UI.Xaml.Controls.MenuFlyoutItem SplitPaneItem{ get; }; Windows.UI.Xaml.Controls.MenuFlyoutItem DuplicateTabItem{ get; }; Windows.UI.Xaml.Controls.MenuFlyoutItem ClosePaneItem{ get; }; diff --git a/src/cascadia/TerminalApp/ControlContextMenu.xaml b/src/cascadia/TerminalApp/ControlContextMenu.xaml index 3db170a7c65..f3f902eb4da 100644 --- a/src/cascadia/TerminalApp/ControlContextMenu.xaml +++ b/src/cascadia/TerminalApp/ControlContextMenu.xaml @@ -10,43 +10,43 @@ mc:Ignorable="d"> + x:Uid="PasteContextMenuEntry"> - + x:Uid="CopyContextMenuEntry"> + x:Uid="FindContextMenuEntry"> - - + --> + x:Uid="SplitPaneContextMenuEntry"> + x:Uid="DuplicateTabContextMenuEntry"> @@ -55,13 +55,13 @@ + x:Uid="ClosePaneContextMenuEntry"> + x:Uid="CloseTabContextMenuEntry"> diff --git a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw index 195535985d9..2574b4b53ad 100644 --- a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw @@ -746,4 +746,25 @@ Suggestions found: {0} {0} will be replaced with a number. + + Paste + + + Copy + + + Find selected text + + + Split pane + + + Duplicate tab + + + Close pane + + + Close tab + diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index 2078deae21c..e581d5a3b7e 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -4240,12 +4240,14 @@ namespace winrt::TerminalApp::implementation const winrt::Microsoft::Terminal::Control::ContextMenuRequestedEventArgs& args) { auto text = args.SelectedText(); - text; auto fwe = sender.try_as(); auto flyout = TerminalApp::ControlContextMenu(); + // Helper lambda for dispatching an ActionAndArgs onto the + // ShortcutActionDispatch. Used below to wire up each menu entry to the + // respective action. auto weak = get_weak(); auto makeCallback = [weak](const Microsoft::Terminal::Settings::Model::ActionAndArgs& actionAndArgs) { return [weak, actionAndArgs](auto&&, auto&&) { @@ -4256,42 +4258,43 @@ namespace winrt::TerminalApp::implementation }; }; - flyout.PasteItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::PasteText, - nullptr })); + // Wire up each item to the action that should be performed. By actually + // connecting these to actions, we ensure the implementation is + // consistent. This also leaves room for customizing this menu with + // actions in the future. + flyout.PasteItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::PasteText, nullptr })); + + // If we don't have selected text, then hide the find item, and disable the copy one. if (text.empty()) { flyout.CopyItem().IsEnabled(false); flyout.FindItem().Visibility(Visibility::Collapsed); - flyout.SearchWebItem().Visibility(Visibility::Collapsed); } else { - flyout.CopyItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::CopyText, - CopyTextArgs{} })); - flyout.FindItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::Find, - nullptr })); - // flyout.SearchWebItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::CopyText, nullptr })); + flyout.CopyItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::CopyText, CopyTextArgs{} })); + flyout.FindItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::Find, nullptr })); } - flyout.SplitPaneItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::SplitPane, - SplitPaneArgs{ SplitType::Duplicate } })); - flyout.DuplicateTabItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::DuplicateTab, - nullptr })); + flyout.SplitPaneItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::SplitPane, SplitPaneArgs{ SplitType::Duplicate } })); + flyout.DuplicateTabItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::DuplicateTab, nullptr })); + + // Only wire up "Close Pane" if there's multiple panes. if (_GetFocusedTabImpl()->GetLeafPaneCount() > 1) { - flyout.ClosePaneItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::ClosePane, - nullptr })); + flyout.ClosePaneItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::ClosePane, nullptr })); } else { flyout.ClosePaneItem().Visibility(Visibility::Collapsed); } - flyout.CloseTabItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::CloseTab, - CloseTabArgs{ _GetFocusedTabIndex().value() } })); + + flyout.CloseTabItem().Click(makeCallback(ActionAndArgs{ ShortcutAction::CloseTab, CloseTabArgs{ _GetFocusedTabIndex().value() } })); WUX::Controls::Primitives::FlyoutBase::SetAttachedFlyout(*this, flyout); + // Position the menu where the pointer is. This was the best way I found how. til::point absolutePointerPos{ til::math::rounding, CoreWindow::GetForCurrentThread().PointerPosition() }; til::point absoluteWindowOrigin{ til::math::rounding, CoreWindow::GetForCurrentThread().Bounds().X, From 61a9c8090ac35d47345006cd7821e0781ddc524d Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Tue, 25 Oct 2022 14:59:43 -0500 Subject: [PATCH 11/29] Migrate spelling-0.0.21 changes from main --- .github/actions/spelling/README.md | 1 + .github/actions/spelling/advice.md | 2 +- .github/actions/spelling/allow/allow.txt | 11 +- .github/actions/spelling/allow/apis.txt | 9 +- .github/actions/spelling/candidate.patterns | 523 +++++++++++++ .github/actions/spelling/excludes.txt | 38 +- .github/actions/spelling/expect/alphabet.txt | 7 - .github/actions/spelling/expect/expect.txt | 696 +++--------------- .github/actions/spelling/expect/web.txt | 2 - .../actions/spelling/line_forbidden.patterns | 30 +- .../actions/spelling/patterns/patterns.txt | 57 +- .github/actions/spelling/reject.txt | 27 +- .github/workflows/spelling2.yml | 104 ++- 13 files changed, 839 insertions(+), 668 deletions(-) create mode 100644 .github/actions/spelling/candidate.patterns diff --git a/.github/actions/spelling/README.md b/.github/actions/spelling/README.md index 2b1b5828597..4c40f7f02ac 100644 --- a/.github/actions/spelling/README.md +++ b/.github/actions/spelling/README.md @@ -6,6 +6,7 @@ File | Purpose | Format | Info [reject.txt](reject.txt) | Remove words from the dictionary (after allow) | grep pattern matching whole dictionary words | [reject](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-reject) [excludes.txt](excludes.txt) | Files to ignore entirely | perl regular expression | [excludes](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-excludes) [patterns/*.txt](patterns/) | Patterns to ignore from checked lines | perl regular expression (order matters, first match wins) | [patterns](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-patterns) +[candidate.patterns](candidate.patterns) | Patterns that might be worth adding to [patterns.txt](patterns.txt) | perl regular expression with optional comment block introductions (all matches will be suggested) | [candidates](https://github.com/check-spelling/check-spelling/wiki/Feature:-Suggest-patterns) [line_forbidden.patterns](line_forbidden.patterns) | Patterns to flag in checked lines | perl regular expression (order matters, first match wins) | [patterns](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-patterns) [expect/*.txt](expect.txt) | Expected words that aren't in the dictionary | one word per line (sorted, alphabetically) | [expect](https://github.com/check-spelling/check-spelling/wiki/Configuration#expect) [advice.md](advice.md) | Supplement for GitHub comment when unrecognized words are found | GitHub Markdown | [advice](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-advice) diff --git a/.github/actions/spelling/advice.md b/.github/actions/spelling/advice.md index 2c4c5443f8f..d82df49ee22 100644 --- a/.github/actions/spelling/advice.md +++ b/.github/actions/spelling/advice.md @@ -21,7 +21,7 @@ See the `README.md` in each directory for more information. :microscope: You can test your commits **without** *appending* to a PR by creating a new branch with that extra change and pushing it to your fork. The [check-spelling](https://github.com/marketplace/actions/check-spelling) action will run in response to your **push** -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. :wink: -
:clamp: If the flagged items are false positives +
If the flagged items are :exploding_head: false positives If items relate to a ... * binary file (or some other file you wouldn't want to check at all). diff --git a/.github/actions/spelling/allow/allow.txt b/.github/actions/spelling/allow/allow.txt index 53e188e1d80..eaa0a471190 100644 --- a/.github/actions/spelling/allow/allow.txt +++ b/.github/actions/spelling/allow/allow.txt @@ -1,7 +1,7 @@ admins allcolors -apc Apc +apc breadcrumb breadcrumbs bsd @@ -14,8 +14,8 @@ CMMI copyable cybersecurity dalet -dcs Dcs +dcs dialytika dje downside @@ -34,10 +34,12 @@ gantt gcc geeksforgeeks ghe +github gje godbolt hostname hostnames +https hyperlink hyperlinking hyperlinks @@ -54,6 +56,7 @@ Llast llvm Lmid locl +lol lorem Lorigin maxed @@ -81,6 +84,7 @@ runtimes shcha slnt Sos +ssh timeline timelines timestamped @@ -89,6 +93,7 @@ tokenizes tonos toolset tshe +ubuntu uiatextrange UIs und @@ -97,5 +102,7 @@ versioned vsdevcmd We'd wildcards +XBox +YBox yeru zhe diff --git a/.github/actions/spelling/allow/apis.txt b/.github/actions/spelling/allow/apis.txt index e7b0749498c..e0cc7550095 100644 --- a/.github/actions/spelling/allow/apis.txt +++ b/.github/actions/spelling/allow/apis.txt @@ -32,10 +32,10 @@ DERR dlldata DNE DONTADDTORECENT -DWMWA -DWORDLONG DWMSBT DWMWA +DWMWA +DWORDLONG endfor ENDSESSION enumset @@ -110,8 +110,8 @@ memchr memicmp MENUCOMMAND MENUDATA -MENUITEMINFOW MENUINFO +MENUITEMINFOW mmeapi MOUSELEAVE mov @@ -158,8 +158,8 @@ rcx REGCLS RETURNCMD rfind -roundf ROOTOWNER +roundf RSHIFT SACL schandle @@ -211,6 +211,7 @@ UPDATEINIFILE userenv USEROBJECTFLAGS Viewbox +virtualalloc wcsstr wcstoui winmain diff --git a/.github/actions/spelling/candidate.patterns b/.github/actions/spelling/candidate.patterns new file mode 100644 index 00000000000..4b40e728ee3 --- /dev/null +++ b/.github/actions/spelling/candidate.patterns @@ -0,0 +1,523 @@ +# marker to ignore all code on line +^.*/\* #no-spell-check-line \*/.*$ +# marker for ignoring a comment to the end of the line +// #no-spell-check.*$ + +# patch hunk comments +^\@\@ -\d+(?:,\d+|) \+\d+(?:,\d+|) \@\@ .* +# git index header +index [0-9a-z]{7,40}\.\.[0-9a-z]{7,40} + +# cid urls +(['"])cid:.*?\g{-1} + +# data url in parens +\(data:[^)]*?(?:[A-Z]{3,}|[A-Z][a-z]{2,}|[a-z]{3,})[^)]*\) +# data url in quotes +([`'"])data:.*?(?:[A-Z]{3,}|[A-Z][a-z]{2,}|[a-z]{3,}).*\g{-1} +# data url +data:[-a-zA-Z=;:/0-9+]*,\S* + +# mailto urls +mailto:[-a-zA-Z=;:/?%&0-9+@.]{3,} + +# magnet urls +magnet:[?=:\w]+ + +# magnet urls +"magnet:[^"]+" + +# obs: +"obs:[^"]*" + +# The `\b` here means a break, it's the fancy way to handle urls, but it makes things harder to read +# In this examples content, I'm using a number of different ways to match things to show various approaches +# asciinema +\basciinema\.org/a/[0-9a-zA-Z]+ + +# apple +\bdeveloper\.apple\.com/[-\w?=/]+ +# Apple music +\bembed\.music\.apple\.com/fr/playlist/usr-share/[-\w.]+ + +# appveyor api +\bci\.appveyor\.com/api/projects/status/[0-9a-z]+ +# appveyor project +\bci\.appveyor\.com/project/(?:[^/\s"]*/){2}builds?/\d+/job/[0-9a-z]+ + +# Amazon + +# Amazon +\bamazon\.com/[-\w]+/(?:dp/[0-9A-Z]+|) +# AWS S3 +\b\w*\.s3[^.]*\.amazonaws\.com/[-\w/&#%_?:=]* +# AWS execute-api +\b[0-9a-z]{10}\.execute-api\.[-0-9a-z]+\.amazonaws\.com\b +# AWS ELB +\b\w+\.[-0-9a-z]+\.elb\.amazonaws\.com\b +# AWS SNS +\bsns\.[-0-9a-z]+.amazonaws\.com/[-\w/&#%_?:=]* +# AWS VPC +vpc-\w+ + +# While you could try to match `http://` and `https://` by using `s?` in `https?://`, sometimes there +# YouTube url +\b(?:(?:www\.|)youtube\.com|youtu.be)/(?:channel/|embed/|user/|playlist\?list=|watch\?v=|v/|)[-a-zA-Z0-9?&=_%]* +# YouTube music +\bmusic\.youtube\.com/youtubei/v1/browse(?:[?&]\w+=[-a-zA-Z0-9?&=_]*) +# YouTube tag +<\s*youtube\s+id=['"][-a-zA-Z0-9?_]*['"] +# YouTube image +\bimg\.youtube\.com/vi/[-a-zA-Z0-9?&=_]* +# Google Accounts +\baccounts.google.com/[-_/?=.:;+%&0-9a-zA-Z]* +# Google Analytics +\bgoogle-analytics\.com/collect.[-0-9a-zA-Z?%=&_.~]* +# Google APIs +\bgoogleapis\.(?:com|dev)/[a-z]+/(?:v\d+/|)[a-z]+/[-@:./?=\w+|&]+ +# Google Storage +\b[-a-zA-Z0-9.]*\bstorage\d*\.googleapis\.com(?:/\S*|) +# Google Calendar +\bcalendar\.google\.com/calendar(?:/u/\d+|)/embed\?src=[@./?=\w&%]+ +\w+\@group\.calendar\.google\.com\b +# Google DataStudio +\bdatastudio\.google\.com/(?:(?:c/|)u/\d+/|)(?:embed/|)(?:open|reporting|datasources|s)/[-0-9a-zA-Z]+(?:/page/[-0-9a-zA-Z]+|) +# The leading `/` here is as opposed to the `\b` above +# ... a short way to match `https://` or `http://` since most urls have one of those prefixes +# Google Docs +/docs\.google\.com/[a-z]+/(?:ccc\?key=\w+|(?:u/\d+|d/(?:e/|)[0-9a-zA-Z_-]+/)?(?:edit\?[-\w=#.]*|/\?[\w=&]*|)) +# Google Drive +\bdrive\.google\.com/(?:file/d/|open)[-0-9a-zA-Z_?=]* +# Google Groups +\bgroups\.google\.com/(?:(?:forum/#!|d/)(?:msg|topics?|searchin)|a)/[^/\s"]+/[-a-zA-Z0-9$]+(?:/[-a-zA-Z0-9]+)* +# Google Maps +\bmaps\.google\.com/maps\?[\w&;=]* +# Google themes +themes\.googleusercontent\.com/static/fonts/[^/\s"]+/v\d+/[^.]+. +# Google CDN +\bclients2\.google(?:usercontent|)\.com[-0-9a-zA-Z/.]* +# Goo.gl +/goo\.gl/[a-zA-Z0-9]+ +# Google Chrome Store +\bchrome\.google\.com/webstore/detail/[-\w]*(?:/\w*|) +# Google Books +\bgoogle\.(?:\w{2,4})/books(?:/\w+)*\?[-\w\d=&#.]* +# Google Fonts +\bfonts\.(?:googleapis|gstatic)\.com/[-/?=:;+&0-9a-zA-Z]* +# Google Forms +\bforms\.gle/\w+ +# Google Scholar +\bscholar\.google\.com/citations\?user=[A-Za-z0-9_]+ +# Google Colab Research Drive +\bcolab\.research\.google\.com/drive/[-0-9a-zA-Z_?=]* + +# GitHub SHAs (api) +\bapi.github\.com/repos(?:/[^/\s"]+){3}/[0-9a-f]+\b +# GitHub SHAs (markdown) +(?:\[`?[0-9a-f]+`?\]\(https:/|)/(?:www\.|)github\.com(?:/[^/\s"]+){2,}(?:/[^/\s")]+)(?:[0-9a-f]+(?:[-0-9a-zA-Z/#.]*|)\b|) +# GitHub SHAs +\bgithub\.com(?:/[^/\s"]+){2}[@#][0-9a-f]+\b +# GitHub wiki +\bgithub\.com/(?:[^/]+/){2}wiki/(?:(?:[^/]+/|)_history|[^/]+(?:/_compare|)/[0-9a-f.]{40,})\b +# githubusercontent +/[-a-z0-9]+\.githubusercontent\.com/[-a-zA-Z0-9?&=_\/.]* +# githubassets +\bgithubassets.com/[0-9a-f]+(?:[-/\w.]+) +# gist github +\bgist\.github\.com/[^/\s"]+/[0-9a-f]+ +# git.io +\bgit\.io/[0-9a-zA-Z]+ +# GitHub JSON +"node_id": "[-a-zA-Z=;:/0-9+]*" +# Contributor +\[[^\]]+\]\(https://github\.com/[^/\s"]+\) +# GHSA +GHSA(?:-[0-9a-z]{4}){3} + +# GitLab commit +\bgitlab\.[^/\s"]*/\S+/\S+/commit/[0-9a-f]{7,16}#[0-9a-f]{40}\b +# GitLab merge requests +\bgitlab\.[^/\s"]*/\S+/\S+/-/merge_requests/\d+/diffs#[0-9a-f]{40}\b +# GitLab uploads +\bgitlab\.[^/\s"]*/uploads/[-a-zA-Z=;:/0-9+]* +# GitLab commits +\bgitlab\.[^/\s"]*/(?:[^/\s"]+/){2}commits?/[0-9a-f]+\b + +# binanace +accounts.binance.com/[a-z/]*oauth/authorize\?[-0-9a-zA-Z&%]* + +# bitbucket diff +\bapi\.bitbucket\.org/\d+\.\d+/repositories/(?:[^/\s"]+/){2}diff(?:stat|)(?:/[^/\s"]+){2}:[0-9a-f]+ +# bitbucket repositories commits +\bapi\.bitbucket\.org/\d+\.\d+/repositories/(?:[^/\s"]+/){2}commits?/[0-9a-f]+ +# bitbucket commits +\bbitbucket\.org/(?:[^/\s"]+/){2}commits?/[0-9a-f]+ + +# bit.ly +\bbit\.ly/\w+ + +# bitrise +\bapp\.bitrise\.io/app/[0-9a-f]*/[\w.?=&]* + +# bootstrapcdn.com +\bbootstrapcdn\.com/[-./\w]+ + +# cdn.cloudflare.com +\bcdnjs\.cloudflare\.com/[./\w]+ + +# circleci +\bcircleci\.com/gh(?:/[^/\s"]+){1,5}.[a-z]+\?[-0-9a-zA-Z=&]+ + +# gitter +\bgitter\.im(?:/[^/\s"]+){2}\?at=[0-9a-f]+ + +# gravatar +\bgravatar\.com/avatar/[0-9a-f]+ + +# ibm +[a-z.]*ibm\.com/[-_#=:%!?~.\\/\d\w]* + +# imgur +\bimgur\.com/[^.]+ + +# Internet Archive +\barchive\.org/web/\d+/(?:[-\w.?,'/\\+&%$#_:]*) + +# discord +/discord(?:app\.com|\.gg)/(?:invite/)?[a-zA-Z0-9]{7,} + +# Disqus +\bdisqus\.com/[-\w/%.()!?&=_]* + +# medium link +\blink\.medium\.com/[a-zA-Z0-9]+ +# medium +\bmedium\.com/\@?[^/\s"]+/[-\w]+ + +# microsoft +\b(?:https?://|)(?:(?:download\.visualstudio|docs|msdn2?|research)\.microsoft|blogs\.msdn)\.com/[-_a-zA-Z0-9()=./%]* +# powerbi +\bapp\.powerbi\.com/reportEmbed/[^"' ]* +# vs devops +\bvisualstudio.com(?::443|)/[-\w/?=%&.]* +# microsoft store +\bmicrosoft\.com/store/apps/\w+ + +# mvnrepository.com +\bmvnrepository\.com/[-0-9a-z./]+ + +# now.sh +/[0-9a-z-.]+\.now\.sh\b + +# oracle +\bdocs\.oracle\.com/[-0-9a-zA-Z./_?#&=]* + +# chromatic.com +/\S+.chromatic.com\S*[")] + +# codacy +\bapi\.codacy\.com/project/badge/Grade/[0-9a-f]+ + +# compai +\bcompai\.pub/v1/png/[0-9a-f]+ + +# mailgun api +\.api\.mailgun\.net/v3/domains/[0-9a-z]+\.mailgun.org/messages/[0-9a-zA-Z=@]* +# mailgun +\b[0-9a-z]+.mailgun.org + +# /message-id/ +/message-id/[-\w@./%]+ + +# Reddit +\breddit\.com/r/[/\w_]* + +# requestb.in +\brequestb\.in/[0-9a-z]+ + +# sched +\b[a-z0-9]+\.sched\.com\b + +# Slack url +slack://[a-zA-Z0-9?&=]+ +# Slack +\bslack\.com/[-0-9a-zA-Z/_~?&=.]* +# Slack edge +\bslack-edge\.com/[-a-zA-Z0-9?&=%./]+ +# Slack images +\bslack-imgs\.com/[-a-zA-Z0-9?&=%.]+ + +# shields.io +\bshields\.io/[-\w/%?=&.:+;,]* + +# stackexchange -- https://stackexchange.com/feeds/sites +\b(?:askubuntu|serverfault|stack(?:exchange|overflow)|superuser).com/(?:questions/\w+/[-\w]+|a/) + +# Sentry +[0-9a-f]{32}\@o\d+\.ingest\.sentry\.io\b + +# Twitter markdown +\[\@[^[/\]:]*?\]\(https://twitter.com/[^/\s"')]*(?:/status/\d+(?:\?[-_0-9a-zA-Z&=]*|)|)\) +# Twitter hashtag +\btwitter\.com/hashtag/[\w?_=&]* +# Twitter status +\btwitter\.com/[^/\s"')]*(?:/status/\d+(?:\?[-_0-9a-zA-Z&=]*|)|) +# Twitter profile images +\btwimg\.com/profile_images/[_\w./]* +# Twitter media +\btwimg\.com/media/[-_\w./?=]* +# Twitter link shortened +\bt\.co/\w+ + +# facebook +\bfburl\.com/[0-9a-z_]+ +# facebook CDN +\bfbcdn\.net/[\w/.,]* +# facebook watch +\bfb\.watch/[0-9A-Za-z]+ + +# dropbox +\bdropbox\.com/sh?/[^/\s"]+/[-0-9A-Za-z_.%?=&;]+ + +# ipfs protocol +ipfs://[0-9a-z]* +# ipfs url +/ipfs/[0-9a-z]* + +# w3 +\bw3\.org/[-0-9a-zA-Z/#.]+ + +# loom +\bloom\.com/embed/[0-9a-f]+ + +# regex101 +\bregex101\.com/r/[^/\s"]+/\d+ + +# figma +\bfigma\.com/file(?:/[0-9a-zA-Z]+/)+ + +# freecodecamp.org +\bfreecodecamp\.org/[-\w/.]+ + +# image.tmdb.org +\bimage\.tmdb\.org/[/\w.]+ + +# mermaid +\bmermaid\.ink/img/[-\w]+|\bmermaid-js\.github\.io/mermaid-live-editor/#/edit/[-\w]+ + +# Wikipedia +\ben\.wikipedia\.org/wiki/[-\w%.#]+ + +# gitweb +[^"\s]+/gitweb/\S+;h=[0-9a-f]+ + +# HyperKitty lists +/archives/list/[^@/]+\@[^/\s"]*/message/[^/\s"]*/ + +# lists +/thread\.html/[^"\s]+ + +# list-management +\blist-manage\.com/subscribe(?:[?&](?:u|id)=[0-9a-f]+)+ + +# kubectl.kubernetes.io/last-applied-configuration +"kubectl.kubernetes.io/last-applied-configuration": ".*" + +# pgp +\bgnupg\.net/pks/lookup[?&=0-9a-zA-Z]* + +# Spotify +\bopen\.spotify\.com/embed/playlist/\w+ + +# Mastodon +\bmastodon\.[-a-z.]*/(?:media/|\@)[?&=0-9a-zA-Z_]* + +# scastie +\bscastie\.scala-lang\.org/[^/]+/\w+ + +# images.unsplash.com +\bimages\.unsplash\.com/(?:(?:flagged|reserve)/|)[-\w./%?=%&.;]+ + +# pastebin +\bpastebin\.com/[\w/]+ + +# heroku +\b\w+\.heroku\.com/source/archive/\w+ + +# quip +\b\w+\.quip\.com/\w+(?:(?:#|/issues/)\w+)? + +# badgen.net +\bbadgen\.net/badge/[^")\]'\s]+ + +# statuspage.io +\w+\.statuspage\.io\b + +# media.giphy.com +\bmedia\.giphy\.com/media/[^/]+/[\w.?&=]+ + +# tinyurl +\btinyurl\.com/\w+ + +# getopts +\bgetopts\s+(?:"[^"]+"|'[^']+') + +# ANSI color codes +(?:\\(?:u00|x)1b|\x1b)\[\d+(?:;\d+|)m + +# URL escaped characters +\%[0-9A-F][A-F] +# IPv6 +\b(?:[0-9a-fA-F]{0,4}:){3,7}[0-9a-fA-F]{0,4}\b +# c99 hex digits (not the full format, just one I've seen) +0x[0-9a-fA-F](?:\.[0-9a-fA-F]*|)[pP] +# Punycode +\bxn--[-0-9a-z]+ +# sha +sha\d+:[0-9]*[a-f]{3,}[0-9a-f]* +# sha-... -- uses a fancy capture +(['"]|")[0-9a-f]{40,}\g{-1} +# hex runs +\b[0-9a-fA-F]{16,}\b +# hex in url queries +=[0-9a-fA-F]*?(?:[A-F]{3,}|[a-f]{3,})[0-9a-fA-F]*?& +# ssh +(?:ssh-\S+|-nistp256) [-a-zA-Z=;:/0-9+]{12,} + +# PGP +\b(?:[0-9A-F]{4} ){9}[0-9A-F]{4}\b +# GPG keys +\b(?:[0-9A-F]{4} ){5}(?: [0-9A-F]{4}){5}\b +# Well known gpg keys +.well-known/openpgpkey/[\w./]+ + +# uuid: +\b[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}\b +# hex digits including css/html color classes: +(?:[\\0][xX]|\\u|[uU]\+|#x?|\%23)[0-9_a-fA-FgGrR]*?[a-fA-FgGrR]{2,}[0-9_a-fA-FgGrR]*(?:[uUlL]{0,3}|u\d+)\b +# integrity +integrity="sha\d+-[-a-zA-Z=;:/0-9+]{40,}" + +# https://www.gnu.org/software/groff/manual/groff.html +# man troff content +\\f[BCIPR] +# ' +\\\(aq + +# .desktop mime types +^MimeTypes?=.*$ +# .desktop localized entries +^[A-Z][a-z]+\[[a-z]+\]=.*$ +# Localized .desktop content +Name\[[^\]]+\]=.* + +# IServiceProvider +\bI(?=(?:[A-Z][a-z]{2,})+\b) + +# crypt +"\$2[ayb]\$.{56}" + +# scrypt / argon +\$(?:scrypt|argon\d+[di]*)\$\S+ + +# Input to GitHub JSON +content: "[-a-zA-Z=;:/0-9+]*=" + +# Python stringprefix / binaryprefix +# Note that there's a high false positive rate, remove the `?=` and search for the regex to see if the matches seem like reasonable strings +(?v# +(?:(?<=[A-Z]{2})V|(?<=[a-z]{2}|[A-Z]{2})v)\d+(?:\b|(?=[a-zA-Z_])) +# Compiler flags (Scala) +(?:^|[\t ,>"'`=(])-J-[DPWXY](?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,}) +# Compiler flags +#(?:^|[\t ,"'`=(])-[DPWXYLlf](?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,}) + +# Compiler flags (linker) +,-B +# curl arguments +\b(?:\\n|)curl(?:\s+-[a-zA-Z]{1,2}\b)*(?:\s+-[a-zA-Z]{3,})(?:\s+-[a-zA-Z]+)* +# set arguments +\bset(?:\s+-[abefimouxE]{1,2})*\s+-[abefimouxE]{3,}(?:\s+-[abefimouxE]+)* +# tar arguments +\b(?:\\n|)g?tar(?:\.exe|)(?:(?:\s+--[-a-zA-Z]+|\s+-[a-zA-Z]+|\s[ABGJMOPRSUWZacdfh-pr-xz]+\b)(?:=[^ ]*|))+ +# tput arguments -- https://man7.org/linux/man-pages/man5/terminfo.5.html -- technically they can be more than 5 chars long... +\btput\s+(?:(?:-[SV]|-T\s*\w+)\s+)*\w{3,5}\b +# macOS temp folders +/var/folders/\w\w/[+\w]+/(?:T|-Caches-)/ diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt index b09b9a65f3b..bc509a5669e 100644 --- a/.github/actions/spelling/excludes.txt +++ b/.github/actions/spelling/excludes.txt @@ -2,14 +2,14 @@ (?:(?i)\.png$) (?:^|/)(?i)COPYRIGHT (?:^|/)(?i)LICEN[CS]E +(?:^|/)3rdparty/ (?:^|/)dirs$ (?:^|/)go\.mod$ (?:^|/)go\.sum$ (?:^|/)package(?:-lock|)\.json$ (?:^|/)sources(?:|\.dep)$ (?:^|/)vendor/ -ignore$ -SUMS$ +\.a$ \.ai$ \.avi$ \.bmp$ @@ -20,6 +20,8 @@ SUMS$ \.crt$ \.csr$ \.dll$ +\.docx?$ +\.drawio$ \.DS_Store$ \.eot$ \.eps$ @@ -31,6 +33,7 @@ SUMS$ \.icns$ \.ico$ \.jar$ +\.jks$ \.jpeg$ \.jpg$ \.key$ @@ -41,6 +44,7 @@ SUMS$ \.mod$ \.mp3$ \.mp4$ +\.o$ \.ocf$ \.otf$ \.pbxproj$ @@ -48,22 +52,41 @@ SUMS$ \.pem$ \.png$ \.psd$ +\.pyc$ \.runsettings$ +\.s$ \.sig$ \.so$ \.svg$ \.svgz$ +\.svgz?$ \.tar$ \.tgz$ +\.tiff?$ \.ttf$ \.vsdx$ \.wav$ +\.webm$ +\.webp$ \.woff +\.woff2?$ \.xcf$ \.xls +\.xlsx?$ \.xpm$ \.yml$ \.zip$ +^\.github/actions/spelling/ +^\.github/fabricbot.json$ +^\.gitignore$ +^\Q.git-blame-ignore-revs\E$ +^\Q.github/workflows/spelling.yml\E$ +^\Qdoc/reference/windows-terminal-logo.ans\E$ +^\Qsamples/ConPTY/EchoCon/EchoCon/EchoCon.vcxproj.filters\E$ +^\Qsrc/host/exe/Host.EXE.vcxproj.filters\E$ +^\Qsrc/host/ft_host/chafa.txt\E$ +^\Qsrc/tools/closetest/CloseTest.vcxproj.filters\E$ +^\XamlStyler.json$ ^build/config/ ^consolegit2gitfilters\.json$ ^dep/ @@ -90,12 +113,5 @@ SUMS$ ^src/tools/U8U16Test/(?:fr|ru|zh)\.txt$ ^src/types/ut_types/UtilsTests.cpp$ ^tools/ReleaseEngineering/ServicingPipeline.ps1$ -^\.github/actions/spelling/ -^\.github/fabricbot.json$ -^\.gitignore$ -^\Q.github/workflows/spelling.yml\E$ -^\Qsamples/ConPTY/EchoCon/EchoCon/EchoCon.vcxproj.filters\E$ -^\Qsrc/host/exe/Host.EXE.vcxproj.filters\E$ -^\Qsrc/host/ft_host/chafa.txt\E$ -^\Qsrc/tools/closetest/CloseTest.vcxproj.filters\E$ -^\XamlStyler.json$ +ignore$ +SUMS$ diff --git a/.github/actions/spelling/expect/alphabet.txt b/.github/actions/spelling/expect/alphabet.txt index 7275b200cba..23933713a40 100644 --- a/.github/actions/spelling/expect/alphabet.txt +++ b/.github/actions/spelling/expect/alphabet.txt @@ -5,26 +5,19 @@ AAAAAABBBBBBCCC AAAAABBBBBBCCC abcd abcd -abcde -abcdef -ABCDEFG -ABCDEFGH ABCDEFGHIJ abcdefghijk ABCDEFGHIJKLMNO abcdefghijklmnop ABCDEFGHIJKLMNOPQRST -abcdefghijklmnopqrstuvwxyz ABCG ABE abf BBBBB BBBBBBBB -BBBBBBBBBBBBBBDDDD BBBBBCCC BBBBCCCCC BBGGRR -CCE EFG EFGh QQQQQQQQQQABCDEFGHIJ diff --git a/.github/actions/spelling/expect/expect.txt b/.github/actions/spelling/expect/expect.txt index 0c94916712e..8f8f4828d0a 100644 --- a/.github/actions/spelling/expect/expect.txt +++ b/.github/actions/spelling/expect/expect.txt @@ -1,21 +1,19 @@ +aabbcc ABANDONFONT +abbcc ABCDEFGHIJKLMNOPQRSTUVWXY abgr abi +ABORTIFHUNG ACCESSTOKEN -acec -acf acidev ACIOSS ACover actctx ACTCTXW activatable -ACTIVEBORDER -ACTIVECAPTION ADDALIAS ADDREF -addressof ADDSTRING ADDTOOL AEnd @@ -27,8 +25,8 @@ ahz AImpl AInplace ALIGNRIGHT -alloc allocing +allocs alpc ALTERNATENAME ALTF @@ -39,35 +37,27 @@ ansicpg ANSISYS ANSISYSRC ANSISYSSC -antialias antialiasing ANull anycpu APARTMENTTHREADED APCs -api APIENTRY apiset APPBARDATA appcontainer -APPICON appium -applet appletname +applets applicationmodel APPLMODAL appmodel -apps APPWINDOW APrep apsect APSTUDIO archeologists -architected argb -argc -args -argv ARRAYSIZE ARROWKEYS asan @@ -77,19 +67,15 @@ ASDF asdfghjkl ASetting ASingle -asm -asmv asmx ASYNCWINDOWPOS atch ATest -attr ATTRCOLOR aumid Authenticode AUTOBUDDY AUTOCHECKBOX -autogenerated autohide AUTOHSCROLL automagically @@ -98,34 +84,29 @@ AUTORADIOBUTTON autoscrolling Autowrap AVerify -AVI AVX awch azzle -backend backgrounded Backgrounder backgrounding -backport +backported backstory barbaz Batang -baz Bazz BBDM bbwe bcount -bcrypt bcx bcz BEFOREPARENT beginthread -bgcolor bgfx bgidx Bgk BGR -BGRA +bgra BHID bigobj binplace @@ -135,14 +116,12 @@ bitcrazed bitflag bitmask BITOPERATION -bitset +bitsets BKCOLOR BKGND Bksp -blog Blt BLUESCROLL -bmp BODGY BOLDFONT BOOLIFY @@ -158,44 +137,34 @@ bpp BPPF branchconfig brandings -BRK Browsable -bsearch Bspace bstr BTNFACE -buf bufferout buffersize buflen -bugfix buildtransitive BUILDURI burriter BValue -byref -bytearray bytebuffer cac cacafire -callee capslock CARETBLINKINGENABLED CARRIAGERETURN cascadia -cassert castsi catid cazamor CBash -cbegin cbiex CBN CBoolean cbt cbuffer CCCBB -ccf cch CCHAR cci @@ -206,17 +175,11 @@ CComp CConsole CConversion CCRT -cctype -CDATA cdd -cdecl CDeclaration CEdit CELLSIZE -cend -cerr cfae -Cfg cfie cfiex cfte @@ -226,43 +189,31 @@ chafa changelist chaof charinfo -charset CHARSETINFO -chcp -checkbox -checkboxes chh chk -chrono CHT Cic -cjk CLA Clcompile CLE cleartype CLICKACTIVE clickdown -climits clipbrd CLIPCHILDREN CLIPSIBLINGS -clocale closetest cloudconsole cls CLSCTX -clsid +clsids CLUSTERMAP -cmath cmatrix cmder CMDEXT -Cmdlet -cmdline cmh CMOUSEBUTTONS -cmp cmpeq cmt cmw @@ -270,17 +221,16 @@ cmyk CNL cnt CNTRL -codebase Codeflow codepage codepath -codepoint +codepoints coinit COLLECTIONURI colorizing COLORMATRIX -colorref -colorscheme +COLORREFs +colorschemes colorspaces colorspec colortable @@ -289,33 +239,27 @@ colortest colortool COLR combaseapi -combobox comctl COMDAT commandline commctrl commdlg COMMITID -compat componentization conapi conareainfo conattrs conbufferout -concat concfg conclnt conddkrefs condrv conechokey conemu -config configurability conhost -conhostv conime conimeinfo -conint conintegrity conintegrityuwp coninteractivitybase @@ -343,34 +287,28 @@ consoleinternal Consoleroot CONSOLESETFOREGROUND consoletaeftemplates -CONSOLEV +consoleuwp Consolewait CONSOLEWINDOWOWNER consrv -constexpr constexprable constness contentfiles conterm -CONTEXTMENU contsf contypes convarea conwinuserrefs -coord coordnew COPYCOLOR -copymode CORESYSTEM cotaskmem countof -cout CPG cpinfo CPINFOEX CPLINFO cplusplus -cpp CPPCORECHECK cppcorecheckrules cpprest @@ -378,67 +316,45 @@ cpprestsdk cppwinrt CProc cpx -crbegin CREATESCREENBUFFER CREATESTRUCT CREATESTRUCTW cred -cref -crend -Crisman +crisman CRLFs crloew Crt CRTLIBS csbi csbiex -csharp CSHORT -CSIDL Cspace -csproj -Csr csrmsg CSRSS csrutil -cstdarg -cstddef -cstdio -cstdlib -cstr -cstring cstyle -csv CSwitch CTerminal CText -ctime ctl ctlseqs -Ctlv -ctor CTRLEVENT CTRLFREQUENCY CTRLKEYSHORTCUTS CTRLVOLUME -Ctx Ctxt -ctype CUF cupxy -curated CURRENTFONT currentmode CURRENTPAGE CURSORCOLOR CURSORSIZE CURSORTYPE +CUsers CUU Cwa cwch -cwchar -cwctype -cwd CXFRAME CXFULLSCREEN CXHSCROLL @@ -448,14 +364,11 @@ CXSIZE CXSMICON CXVIRTUALSCREEN CXVSCROLL -cxx CYFRAME CYFULLSCREEN -cygwin CYHSCROLL CYMIN CYPADDEDBORDER -CYRL CYSIZE CYSIZEFRAME CYSMICON @@ -463,8 +376,6 @@ CYVIRTUALSCREEN CYVSCROLL dai DATABLOCK -DATAVIEW -DATAW DBatch dbcs DBCSCHAR @@ -477,7 +388,6 @@ DBGOUTPUT dbh dblclk DBlob -DBUILD DColor DCOLORVALUE dcommon @@ -494,9 +404,11 @@ debugtype DECAC DECALN DECANM +DECARM DECAUPSS DECAWM DECBKM +DECCARA DECCKM DECCOLM DECCRA @@ -505,20 +417,19 @@ DECDHL decdld DECDWL DECEKBD +DECERA +DECFRA DECID DECKPAM DECKPM DECKPNM DECLRMM -decls -declspec -decltype -declval DECNKM DECNRCM DECOM DECPCTERM DECPS +DECRARA DECRC DECREQTPARM DECRLM @@ -526,6 +437,7 @@ DECRQM DECRQSS DECRQTSR decrst +DECSACE DECSASD DECSC DECSCA @@ -534,6 +446,7 @@ DECSCPP DECSCUSR DECSED DECSEL +DECSERA DECSET DECSLPP DECSLRM @@ -543,9 +456,7 @@ DECSTBM DECSTR DECSWL DECTCEM -Dedupe -deduplicate -deduplicated +DECXCPR DEFAPP DEFAULTBACKGROUND DEFAULTFOREGROUND @@ -560,38 +471,23 @@ DEFFACE defing DEFPUSHBUTTON defterm -deiconify DELAYLOAD -deletable DELETEONRELEASE -delims Delt demoable depersist deprioritized -deps -deque -deref -deserialization -deserialize -deserialized -deserializer -deserializing +deserializers desktopwindowxamlsource -dest DESTINATIONNAME devicecode -Devops Dext DFactory DFF -DFMT dhandler dialogbox -DINLINE directio DIRECTX -Dirs DISABLEDELAYEDEXPANSION DISABLENOSCROLL DISPLAYATTRIBUTE @@ -600,27 +496,21 @@ DISPLAYCHANGE distro dlg DLGC -dll -dllexport DLLGETVERSIONPROC -dllimport dllinit dllmain DLLVERSIONINFO DLOAD DLOOK dmp -DOCTYPE DONTCARE doskey dotnet -doubleclick -downlevel DPG -dpi DPIAPI DPICHANGE DPICHANGED +DPIs dpix dpiy dpnx @@ -628,8 +518,6 @@ DRAWFRAME DRAWITEM DRAWITEMSTRUCT drcs -dropdown -DROPDOWNLIST DROPFILES drv DSBCAPS @@ -640,21 +528,17 @@ DSBVOLUME dsm dsound DSSCL -dst DSwap DTest -dtor DTTERM DUMMYUNIONNAME -DUNICODE -DUNIT dup'ed dvi dwl DWLP dwm dwmapi -dword +DWORDs dwrite dxgi dxgidwm @@ -663,7 +547,6 @@ dxinterop dxsm dxttbmp Dyreen -eaf EASTEUROPE ECH echokey @@ -681,54 +564,37 @@ EINS EJO ELEMENTNOTAVAILABLE elems -elif -elseif emacs EMPTYBOX enabledelayedexpansion -endian -endif -endl -endlocal endptr endregion -ENQ -enqueuing ENTIREBUFFER -entrypoint +entrypoints ENU -enum ENUMLOGFONT ENUMLOGFONTEX enumranges -envvar -eol eplace EPres EQU ERASEBKGND -errorlevel -ETB etcoreapp ETW -ETX EUDC EVENTID eventing everytime evflags evt -ewdelete -exe execd -executables executionengine exemain EXETYPE +exeuwp exewin exitwin expectedinput -expr EXPUNGECOMMANDHISTORY EXSTYLE EXTENDEDEDITKEY @@ -737,43 +603,29 @@ EXTTEXTOUT facename FACENODE FACESIZE -failfast FAILIFTHERE -fallthrough fastlink fcharset -fclose -fcntl -fdc -FDD fdw fesb FFDE FFrom fgbg FGCOLOR -fgetc -fgetwc FGHIJ fgidx FGs FILEDESCRIPTION -fileno -filepath FILESUBTYPE FILESYSPATH -filesystem -FILETYPE fileurl FILEW FILLATTR FILLCONSOLEOUTPUT FILTERONPASTE -finalizer FINDCASE FINDDLG FINDDOWN -FINDSTR FINDSTRINGEXACT FINDUP FIter @@ -784,7 +636,6 @@ flyout fmodern fmtarg fmtid -FNV FOLDERID FONTCHANGE fontdlg @@ -793,8 +644,7 @@ FONTENUMPROC FONTFACE FONTFAMILY FONTHEIGHT -FONTINFO -fontlist +fontinfo FONTOK FONTSIZE FONTSTRING @@ -804,27 +654,20 @@ FONTWEIGHT FONTWIDTH FONTWINDOW fooo -forceinline FORCEOFFFEEDBACK FORCEONFEEDBACK -FORCEV -foreach -fprintf framebuffer FRAMECHANGED fre -freopen -frontend +frontends fsanitize Fscreen FSCTL FSINFOCLASS -fstream fte Ftm -fullscreen +Fullscreens fullwidth -func FUNCTIONCALL fuzzer fuzzmain @@ -836,10 +679,10 @@ fwlink GAUSSIAN gci gcx -gcy gdi gdip gdirenderer +Geddy geopol GETALIAS GETALIASES @@ -849,7 +692,6 @@ GETALIASEXESLENGTH GETAUTOHIDEBAREX GETCARETWIDTH getch -getchar GETCLIENTAREAANIMATION GETCOMMANDHISTORY GETCOMMANDHISTORYLENGTH @@ -871,9 +713,9 @@ GETHUNGAPPTIMEOUT GETICON GETITEMDATA GETKEYBOARDLAYOUTNAME +GETKEYSTATE GETLARGESTWINDOWSIZE GETLBTEXT -getline GETMINMAXINFO GETMOUSEINFO GETMOUSEVANISH @@ -883,8 +725,6 @@ GETOBJECT GETPOS GETSELECTIONINFO getset -GETSTATE -GETTEXT GETTEXTLEN GETTITLE GETWAITTOKILLSERVICETIMEOUT @@ -892,7 +732,6 @@ GETWAITTOKILLTIMEOUT GETWHEELSCROLLCHARACTERS GETWHEELSCROLLCHARS GETWHEELSCROLLLINES -getwriter GFEh Gfun gfx @@ -901,24 +740,17 @@ GHIJK GHIJKL GHIJKLM gitfilters -github -gitlab +gitmodules gle GLOBALFOCUS -globals GLYPHENTRY -gmail GMEM GNUC Goldmine gonce -Google goutput -GPUs -grayscale GREENSCROLL Grehan -grep Greyscale gridline groupbox @@ -927,7 +759,6 @@ gsl GTP GTR guc -gui guidatom GValue GWL @@ -937,8 +768,6 @@ HABCDEF Hackathon HALTCOND HANGEUL -hardcoded -hardcodes hashalg HASSTRINGS hbitmap @@ -953,7 +782,6 @@ hdr HDROP hdrstop HEIGHTSCROLL -hfile hfont hfontresource hglobal @@ -961,11 +789,9 @@ hhh hhook hhx HIBYTE -HICON +hicon HIDEWINDOW -HIGHLIGHTTEXT hinst -HINSTANCE Hirots HISTORYBUFS HISTORYNODUP @@ -977,33 +803,25 @@ hkey hkl HKLM hlocal -HLS hlsl -HMENU hmod hmodule hmon -HMONITOR -horiz HORZ hostable hostlib -HOTFIX HPA HPCON hpj -hpp HPR HProvider HREDRAW hresult hrottled -HRSRC hscroll hsl hstr hstring -hsv HTBOTTOMLEFT HTBOTTOMRIGHT HTCAPTION @@ -1011,7 +829,6 @@ HTCLIENT HTLEFT HTMAXBUTTON HTMINBUTTON -html HTMLTo HTRIGHT HTTOP @@ -1022,37 +839,17 @@ HVP hwheel hwnd HWNDPARENT -hxx -IAccessibility -IAction -IApi -IApplication -IBase -ICache -icacls iccex -IChar icket -ico -IComponent ICONERROR Iconified ICONINFORMATION IConsole ICONSTOP -IControl ICONWARNING -ICore -IData IDCANCEL IDD -IDefault -IDesktop -IDevice -IDictionary IDISHWND -IDispatch -IDisposable idl idllib IDOK @@ -1060,35 +857,18 @@ IDR idth idx IDXGI -IDynamic IEnd IEnum -IEnumerable IFACEMETHODIMP -ifdef ification -ifndef -IFont -ifstream IGNOREEND IGNORELANGUAGE -IHigh IHosted iid -IInitialize -IInput -IInspectable -IInteract -IInteractivity IIo -IList -imagemagick -Imatch ime Imm -IMouse IMPEXP -impl inbox inclusivity INCONTEXT @@ -1096,97 +876,59 @@ INFOEX inheritcursor inheritdoc inheritfrom -ini INITCOMMONCONTROLSEX INITDIALOG initguid INITMENU inkscape -inl INLINEPREFIX inlines -INotify -inout -inplace inproc Inputkeyinfo INPUTPROCESSORPROFILE inputrc Inputreadhandledata INSERTMODE -intellisense INTERACTIVITYBASE INTERCEPTCOPYPASTE INTERNALNAME -interop -interoperability inthread intsafe INVALIDARG INVALIDATERECT -IObservable ioctl -iomanip -iostream -iot ipch -ipconfig -IPersist ipp IProperty IPSINK ipsp -IRaw -IRead -IReference -IRender -IScheme -ISelection IShell -IState -IStoryboard -isupper ISwap -iswdigit -iswspace -ISystem iterm itermcolors ITerminal -IText itf Ith itoa IUI -IUia IUnknown ivalid -IValue -IVector -IWait -IWeb -IWin -IWindow -IXaml +IWIC IXMP IXP jconcpp JOBOBJECT JOBOBJECTINFOCLASS jpe -jpeg -jpg JPN -json -jsonc jsoncpp +Jsons jsprovider jumplist KAttrs kawa Kazu kazum -kbd kcub kcud kcuf @@ -1194,13 +936,11 @@ kcuu kernelbase kernelbasestaging KEYBDINPUT -keybinding keychord keydown keyevent KEYFIRST KEYLAST -keymap Keymapping keyscan keystate @@ -1220,22 +960,19 @@ langid LANGUAGELIST lasterror lastexitcode -LATN LAYOUTRTL +lbl LBN -LBound LBUTTON LBUTTONDBLCLK LBUTTONDOWN LBUTTONUP lcb +lci LCONTROL LCTRL lcx LEFTALIGN -LEFTSHIFT -len -lhs libpopcnt libsancov libtickit @@ -1245,11 +982,7 @@ LINESELECTION LINEWRAP LINKERRCAP LINKERROR -linkpath linputfile -Linq -linux -listbox listproperties listptr listptrsize @@ -1265,36 +998,28 @@ LOADONCALL loadu LOBYTE localappdata -localhost locsrc Loewen LOGFONT LOGFONTA LOGFONTW logissue -lowercased loword lparam -LPBYTE LPCCH lpch -LPCOLORREF LPCPLINFO LPCREATESTRUCT lpcs -LPCSTR LPCTSTR -LPCWSTR lpdata LPDBLIST lpdis LPDRAWITEMSTRUCT lpdw -LPDWORD lpelfe lpfn LPFNADDPROPSHEETPAGE -LPINT lpl LPMEASUREITEMSTRUCT LPMINMAXINFO @@ -1304,18 +1029,15 @@ LPNEWCPLINFOA LPNEWCPLINFOW LPNMHDR lpntme -LPPOINT LPPROC LPPROPSHEETPAGE LPPSHNOTIFY lprc -LPRECT lpstr lpsz LPTSTR LPTTFONTLIST lpv -LPVOID LPW LPWCH lpwfx @@ -1323,7 +1045,6 @@ LPWINDOWPOS lpwpos lpwstr LRESULT -lru lsb lsconfig lss @@ -1332,8 +1053,6 @@ lstrcmp lstrcmpi LTEXT LTLTLTLTL -ltrim -ltype LUID luma lval @@ -1342,7 +1061,6 @@ LVERTICAL LWA LWIN lwkmvj -mailto majorly makeappx MAKEINTRESOURCE @@ -1351,12 +1069,11 @@ MAKELANGID MAKELONG MAKELPARAM MAKELRESULT -malloc MAPBITMAP +MAPVIRTUALKEY MAPVK MAXDIMENSTRING maxing -MAXLENGTH MAXSHORT maxval maxversiontested @@ -1372,35 +1089,25 @@ MDs MEASUREITEM megamix memallocator -memcmp -memcpy -memmove -memset MENUCHAR MENUCONTROL MENUDROPALIGNMENT -MENUITEM MENUITEMINFO MENUSELECT -Mersenne messageext -metadata metaproj midl mii MIIM milli -mimetype mincore mindbogglingly -mingw minimizeall minkernel MINMAXINFO minwin minwindef Mip -mkdir MMBB mmcc MMCPL @@ -1413,46 +1120,34 @@ MODERNCORE MONITORINFO MONITORINFOEXW MONITORINFOF -monospaced -monostate MOUSEACTIVATE MOUSEFIRST MOUSEHWHEEL MOUSEMOVE -mousewheel movemask MOVESTART msb -msbuild msctf msctls msdata -msdn msft MSGCMDLINEF MSGF MSGFILTER MSGFLG MSGMARKMODE -MSGS MSGSCROLLMODE MSGSELECTMODE msiexec MSIL msix msrc -msvcrt MSVCRTD msys MTSM -mui -Mul -multiline munged munges murmurhash -mutex -mutexes muxes myapplet mydir @@ -1461,12 +1156,8 @@ Mypair Myval NAMELENGTH nameof -namespace -namespaced namestream -nano natvis -nbsp NCCALCSIZE NCCREATE NCLBUTTONDOWN @@ -1478,9 +1169,7 @@ NCRBUTTONDOWN NCRBUTTONUP NCXBUTTONDOWN NCXBUTTONUP -NDEBUG NEL -NEQ netcoreapp netstandard NEWCPLINFO @@ -1495,21 +1184,16 @@ NEWTEXTMETRICEX Newtonsoft NEXTLINE nfe -Nls NLSMODE nnn NOACTIVATE NOAPPLYNOW NOCLIP -NOCOLOR NOCOMM NOCONTEXTHELP NOCOPYBITS -nodiscard NODUP -noexcept -NOHELP -noinline +noexcepts NOINTEGRALHEIGHT NOINTERFACE NOLINKINFO @@ -1525,13 +1209,13 @@ NONINFRINGEMENT NONPREROTATED nonspace NOOWNERZORDER +Nop NOPAINT NOPQRST noprofile NOREDRAW NOREMOVE NOREPOSITION -noreturn NORMALDISPLAY NOSCRATCH NOSEARCH @@ -1540,23 +1224,17 @@ NOSENDCHANGING NOSIZE NOSNAPSHOT NOTHOUSANDS -nothrow NOTICKS +NOTIMEOUTIFNOTHUNG NOTIMPL -notin -NOTNULL NOTOPMOST NOTRACK NOTSUPPORTED nouicompat nounihan NOUPDATE -novtable -nowait NOYIELD NOZORDER -NPM -npos nrcs NSTATUS ntapi @@ -1568,6 +1246,7 @@ ntdll ntifs ntlpcapi ntm +nto ntrtl ntstatus ntsubauth @@ -1578,30 +1257,25 @@ ntuser NTVDM ntverp NTWIN -nuget nugetversions nullability nullness nullonfailure -nullopt -nullptr +nullopts NULs numlock numpad NUMSCROLL nupkg -nuspec NVIDIA -NVR OACR -oauth objbase ocolor odl -oem oemcp OEMFONT OEMFORMAT +OEMs offboarded OLEAUT OLECHAR @@ -1639,15 +1313,11 @@ OSG OSGENG osign oss -ostream -ostringstream +otepad ouicompat OUnter outdir -outfile -Outof OUTOFCONTEXT -OUTOFMEMORY Outptr outstr OVERLAPPEDWINDOW @@ -1663,15 +1333,12 @@ PAINTPARAMS PAINTSTRUCT PALPC pankaj -params parentable parms passthrough PATCOPY pathcch PATTERNID -PBOOL -PBYTE pcat pcb pcch @@ -1680,7 +1347,6 @@ PCCONSOLE PCD pcg pch -PCHAR PCIDLIST PCIS PCLIENT @@ -1702,12 +1368,10 @@ PCWCH PCWCHAR PCWSTR pda -pdb -pdbonly +Pdbs pdbstr pdtobj pdw -PDWORD pdx peb PEMAGIC @@ -1726,12 +1390,11 @@ pgdn PGONu pguid pgup -PHANDLE phhook phwnd -pid pidl PIDLIST +pids pii pinvoke pipename @@ -1740,20 +1403,12 @@ pixelheight PIXELSLIST PJOBOBJECT pkey -placeholders platforming playsound -plist ploc -PLOC ploca -PLOCA plocm -PLOCM PLOGICAL -plugin -PMv -png pnm PNMLINK pntm @@ -1762,14 +1417,11 @@ POBJECT Podcast POINTSLIST POLYTEXTW -popd -POPF poppack -popup POPUPATTR +popups PORFLG positionals -posix POSTCHARBREAKS POSX POSXSCROLL @@ -1789,18 +1441,12 @@ ppsz ppv ppwch PQRST -pragma prc prealigned -prebuilt -precomp prect prefast -prefilled prefs preinstalled -PRELOAD -PREMULTIPLIED prepopulated presorted PREVENTPINNING @@ -1809,14 +1455,11 @@ PREVIEWWINDOW PREVLINE prg pri -printf prioritization processenv processhost PROCESSINFOCLASS procs -Progman -proj PROPERTYID PROPERTYKEY PROPERTYVAL @@ -1830,7 +1473,6 @@ propvar propvariant propvarutil psa -psd PSECURITY pseudocode pseudoconsole @@ -1838,12 +1480,10 @@ pseudoterminal psh pshn PSHNOTIFY -PSHORT pshpack PSINGLE psl psldl -psm PSNRET PSobject psp @@ -1852,47 +1492,36 @@ psr PSTR psz ptch -ptr -ptrdiff +ptrs ptsz PTYIn PUCHAR -PULONG PUNICODE -pushd -putchar -putwchar -PVOID pwch -PWCHAR PWDDMCONSOLECONTEXT -PWORD pws -pwsh pwstr pwsz pythonw +Qaabbcc qos QRSTU -qsort -queryable QUERYOPEN QUESTIONMARK quickedit QUZ QWER +Qxxxxxxxxxxxxxxx qzmp RAII RALT rasterbar rasterfont rasterization -rawinput RAWPATH raytracers razzlerc rbar -rbegin RBUTTON RBUTTONDBLCLK RBUTTONDOWN @@ -1908,33 +1537,23 @@ RCOCW RCONTROL RCOW rcv -rdbuf readback READCONSOLE READCONSOLEOUTPUT READCONSOLEOUTPUTSTRING -Readline -readme READMODE -readonly -READWRITE -realloc +reallocs reamapping rects redef redefinable Redir -redirector redist REDSCROLL -refactor -refactoring REFCLSID -refcount REFGUID REFIID REFPROPERTYKEY -regex REGISTEROS REGISTERVDM regkey @@ -1955,18 +1574,15 @@ rescap Resequence RESETCONTENT resheader -resizable resmimetype resw resx -retval rfa rfid rftp -rgb -rgba RGBCOLOR rgbi +rgbs rgci rgfae rgfte @@ -1979,29 +1595,24 @@ rgs rgui rgw rgwch -rhs RIGHTALIGN RIGHTBUTTON riid Rike RIPMSG RIS -RMENU -rng roadmap robomac -roundtrip +rosetta +roundtrips RRF RRRGGGBB rsas rtcore RTEXT -rtf RTFTo -Rtl RTLREADING Rtn -rtrim RTTI ruleset runas @@ -2009,19 +1620,18 @@ RUNDLL runformat runft RUNFULLSCREEN +runfuzz runsettings -runtests +runtest runtimeclass runuia runut runxamlformat -rvalue RVERTICAL rvpa RWIN rxvt safearray -SAFECAST safemath sapi sba @@ -2039,12 +1649,10 @@ SCRBUFSIZE screenbuffer SCREENBUFFERINFO screeninfo -screenshot +screenshots scriptload -Scrollable scrollback -scrollbar -Scroller +scrollbars SCROLLFORWARD SCROLLINFO scrolllock @@ -2054,18 +1662,14 @@ SCROLLSCREENBUFFER scursor sddl sdeleted -sdk SDKDDK -searchbox securityappcontainer segfault SELCHANGE SELECTALL -selectany SELECTEDFONT SELECTSTRING Selfhosters -SERIALIZERS SERVERDLL SETACTIVE SETBUDDYINT @@ -2076,7 +1680,6 @@ SETCURSOR SETCURSORINFO SETCURSORPOSITION SETDISPLAYMODE -setfill SETFOCUS SETFONT SETFOREGROUND @@ -2087,30 +1690,24 @@ setintegritylevel SETITEMDATA SETITEMHEIGHT SETKEYSHORTCUTS -setlocal -setlocale SETMENUCLOSE -setmode SETNUMBEROFCOMMANDS SETOS SETPALETTE -SETPOS SETRANGE SETSCREENBUFFERSIZE SETSEL SETTEXTATTRIBUTE SETTINGCHANGE -SETTITLE -setw Setwindow SETWINDOWINFO SFGAO SFGAOF sfi SFINAE +SFolder SFUI sgr -SHANDLE SHCo shcore shellapi @@ -2118,7 +1715,6 @@ shellex shellscalingapi SHFILEINFO SHGFI -SHGFP SHIFTJIS Shl shlguid @@ -2133,7 +1729,6 @@ SHOWNA SHOWNOACTIVATE SHOWNORMAL SHOWWINDOW -SHRT sidebyside SIF SIGDN @@ -2142,7 +1737,6 @@ SINGLETHREADED siup sixel SIZEBOX -sizeof SIZESCROLL SKIPFONT SKIPOWNPROCESS @@ -2165,24 +1759,17 @@ SOURCEBRANCH sourced spammy spand -sprintf -srand -src SRCCODEPAGE SRCCOPY SRCINVERT srcsrv SRCSRVTRG srctool -sre srect srv srvinit srvpipe ssa -ssh -sstream -standalone STARTF STARTUPINFO STARTUPINFOEX @@ -2195,57 +1782,36 @@ Statusline stdafx STDAPI stdc -stdcall stdcpp -stderr -stdexcept -stdin -STDIO STDMETHODCALLTYPE STDMETHODIMP -stdout STGM stl -stoi -stol -stoul stoutapot Stri -strikethrough -stringstream +Stringable STRINGTABLE -strlen strrev strsafe -strtok -structs STUBHEAD STUVWX -STX stylecop SUA subcompartment -subfolder +subfolders subkey SUBLANG -submenu subresource -subspan -substr subsystemconsole subsystemwindows suiteless -svg swapchain swapchainpanel swappable SWMR SWP -swprintf SYMED -symlink SYNCPAINT -sys syscalls SYSCHAR SYSCOMMAND @@ -2265,8 +1831,6 @@ TARG targetentrypoint TARGETLIBS TARGETNAME -targetnametoken -targetsize targetver taskbar tbar @@ -2281,21 +1845,20 @@ TCI tcome tcommandline tcommands +Tdd TDelegated TDP TEAMPROJECT tearoff Teb tellp -telnet -telnetd -templated teraflop terminalcore +terminalinput +terminalrenderdata TERMINALSCROLLING terminfo TEs -testapp testbuildplatform testcon testd @@ -2318,7 +1881,6 @@ texel TExpected textattribute TEXTATTRIBUTEID -textbox textboxes textbuffer TEXTINCLUDE @@ -2326,15 +1888,14 @@ textinfo TEXTMETRIC TEXTMETRICW textmode +texttests TFCAT tfoo TFunction tga -threadpool THUMBPOSITION THUMBTRACK TIcon -tif tilunittests titlebar TITLEISLINKNAME @@ -2347,35 +1908,28 @@ TMAE TMPF TMult tmultiple -tmux -todo +TODOs tofrom tokenhelpers -tokenized -tokenizing -toolbar +toolbars TOOLINFO -tooltip TOOLWINDOW TOPDOWNDIB TOPLEFT -toplevel TOPRIGHT TOpt tosign touchpad -towlower -towupper Tpp Tpqrst tprivapi tracelog tracelogging traceloggingprovider +traceviewpp trackbar TRACKCOMPOSITION trackpad -transcoder transitioning Trd TREX @@ -2384,42 +1938,32 @@ triaging TRIANGLESTRIP Tribool TRIMZEROHEADINGS -truetype trx tsattrs tsf +tsgr TStr TSTRFORMAT TSub TTBITMAP -ttf TTFONT TTFONTLIST tthe tthis TTM TTo -TVPP +tvpp Txtev typechecked -typechecking -typedef -typeid -typeinfo typelib -typename -typeof typeparam TYUI UAC uap uapadmin UAX -ubuntu ucd uch -UCHAR -ucs udk UDM uer @@ -2428,42 +1972,30 @@ uia UIACCESS uiacore uiautomationcore -Uid uielem UIELEMENTENABLEDONLY -uint -uintptr +UINTs ulcch -ulong umul umulh Unadvise unattend -uncomment UNCPRIORITY -undef -Unescape unexpand -Unfocus unhighlighting unhosted -unicode -UNICODESTRING UNICODETEXT UNICRT -uninit uninitialize -uninstall Unintense Uniscribe -unittest unittesting +unittests unk unknwn unmark UNORM unparseable -unpause unregistering untests untextured @@ -2472,11 +2004,6 @@ UPDATEDISPLAY UPDOWN UPKEY UPSS -upvote -uri -url -urlencoded -USASCII usebackq USECALLBACK USECOLOR @@ -2490,41 +2017,29 @@ USEPOSITION userbase USERDATA userdpiapi -username Userp userprivapi -userprofile USERSRV USESHOWWINDOW USESIZE USESTDHANDLES -ushort usp USRDLL -utf -utils utr -uuid -uuidof -uuidv UVWX UVWXY uwa uwp uxtheme -vals Vanara vararg vclib -Vcount vcpkg vcprintf vcxitems -vcxproj vec vectorized VERCTRL -versioning VERTBAR VFT vga @@ -2533,24 +2048,22 @@ viewkind viewports Virt VIRTTERM -Virtualizing vkey +VKKEYSCAN VMs VPA -VPATH VPR VProc VRaw VREDRAW vsc +vsconfig vscprintf VSCROLL vsdevshell vsinfo -vsnprintf vso vspath -vsprintf VSTAMP vstest VSTS @@ -2577,51 +2090,39 @@ WANSUNG WANTARROWS WANTTAB wapproj -wav WAVEFORMATEX wbuilder wch -wchar +wchars WCIA WCIW -WClass -wcout -wcschr -wcscmp -wcscpy WCSHELPER wcsicmp -wcslen wcsnicmp -wcsrchr wcsrev -wcstod -wcstoul wddm wddmcon WDDMCONSOLECONTEXT wdm webpage -website -websocket +websites +websockets wekyb -WEOF wex wextest wextestclass WFill wfopen WHelper -whitelisting +wic WIDTHSCROLL Widthx -Wiki -Wikipedia wil WImpl WINAPI winbase winbasep +wincodec wincon winconp winconpty @@ -2631,14 +2132,12 @@ wincontypes WINCORE windbg WINDEF -WINDIR windll WINDOWALPHA Windowbuffer windowdpiapi WINDOWEDGE windowext -WINDOWFRAME windowime WINDOWINFO windowio @@ -2652,9 +2151,9 @@ windowrect windowsapp windowsinternalstring WINDOWSIZE +windowsshell windowsterminal windowsx -WINDOWTEXT windowtheme WINDOWTITLE winevent @@ -2691,9 +2190,6 @@ WNull wnwb workarea workaround -workflow -WORKITEM -wostream WOutside WOWARM WOWx @@ -2703,7 +2199,6 @@ wpf WPR WPrep WPresent -wprintf wprp wprpi wregex @@ -2720,11 +2215,8 @@ WRunoff WScript wsl WSLENV -wsmatch -wss wstr -wstring -wstringstream +wstrings wsz wtd WTest @@ -2745,9 +2237,8 @@ wyhash wymix wyr xact -xaml Xamlmeta -xargs +xamls xaz xbf xbutton @@ -2771,19 +2262,12 @@ xinxinchaof XManifest XMath XMFLOAT -xml -xmlns -xor xorg -XPosition XResource -xsd xsi -xsize xstyler XSubstantial xtended -xterm XTest XTPOPSGR XTPUSHSGR @@ -2791,24 +2275,22 @@ xtr XTWINOPS xunit xutr -xvalue XVIRTUALSCREEN XWalk +xwwyzz +xxyyzz yact -YAML YCast YCENTER YCount YDPI -yml YOffset -YPosition -YSize YSubstantial YVIRTUALSCREEN YWalk Zabcdefghijklmnopqrstuvwxyz ZCmd ZCtrl -zsh zxcvbnm +ZYXWVU +ZYXWVUTd diff --git a/.github/actions/spelling/expect/web.txt b/.github/actions/spelling/expect/web.txt index 47ce4058d24..52c1cfd1f0f 100644 --- a/.github/actions/spelling/expect/web.txt +++ b/.github/actions/spelling/expect/web.txt @@ -1,5 +1,3 @@ -http -www WCAG winui appshellintegration diff --git a/.github/actions/spelling/line_forbidden.patterns b/.github/actions/spelling/line_forbidden.patterns index 0120c775a60..31ad2ddcd26 100644 --- a/.github/actions/spelling/line_forbidden.patterns +++ b/.github/actions/spelling/line_forbidden.patterns @@ -1,3 +1,11 @@ +# reject `m_data` as there's a certain OS which has evil defines that break things if it's used elsewhere +# \bm_data\b + +# If you have a framework that uses `it()` for testing and `fit()` for debugging a specific test, +# you might not want to check in code where you were debugging w/ `fit()`, in which case, you might want +# to use this: +#\bfit\( + # s.b. GitHub \bGithub\b @@ -16,6 +24,12 @@ # s.b. greater than \bgreater then\b +# s.b. into +#\sin to\s + +# s.b. opt-in +\sopt in\s + # s.b. less than \bless then\b @@ -27,10 +41,22 @@ \b[Nn]o[nt][- ]existent\b # s.b. preexisting -[Pp]re-existing +[Pp]re[- ]existing + +# s.b. preempt +[Pp]re[- ]empt\b # s.b. preemptively -[Pp]re-emptively +[Pp]re[- ]emptively + +# s.b. reentrancy +[Rr]e[- ]entrancy + +# s.b. reentrant +[Rr]e[- ]entrant + +# s.b. workaround(s) +#\bwork[- ]arounds?\b # Reject duplicate words \s([A-Z]{3,}|[A-Z][a-z]{2,}|[a-z]{3,})\s\g{-1}\s diff --git a/.github/actions/spelling/patterns/patterns.txt b/.github/actions/spelling/patterns/patterns.txt index 7360e920f7f..a0e1931f36f 100644 --- a/.github/actions/spelling/patterns/patterns.txt +++ b/.github/actions/spelling/patterns/patterns.txt @@ -27,13 +27,68 @@ ROY\sG\.\sBIV # Python stringprefix / binaryprefix \b(?:B|BR|Br|F|FR|Fr|R|RB|RF|Rb|Rf|U|UR|Ur|b|bR|br|f|fR|fr|r|rB|rF|rb|rf|u|uR|ur)' +# Automatically suggested patterns +# hit-count: 3831 file-count: 582 +# IServiceProvider +\bI(?=(?:[A-Z][a-z]{2,})+\b) + +# hit-count: 71 file-count: 35 +# Compiler flags +(?:^|[\t ,"'`=(])-[D](?=[A-Z]{2,}|[A-Z][a-z]) +(?:^|[\t ,"'`=(])-[X](?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,}) + +# hit-count: 41 file-count: 28 +# version suffix v# +(?:(?<=[A-Z]{2})V|(?<=[a-z]{2}|[A-Z]{2})v)\d+(?:\b|(?=[a-zA-Z_])) + +# hit-count: 20 file-count: 9 +# hex runs +\b[0-9a-fA-F]{16,}\b + +# hit-count: 10 file-count: 7 +# uuid: +\b[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}\b + +# hit-count: 4 file-count: 4 +# mailto urls +mailto:[-a-zA-Z=;:/?%&0-9+@.]{3,} + +# hit-count: 4 file-count: 1 +# ANSI color codes +(?:\\(?:u00|x)1b|\x1b)\[\d+(?:;\d+|)m + +# hit-count: 2 file-count: 1 +# latex +\\(?:n(?:ew|ormal|osub)|r(?:enew)|t(?:able(?:of|)|he|itle))(?=[a-z]+) + +# hit-count: 1 file-count: 1 +# hex digits including css/html color classes: +(?:[\\0][xX]|\\u|[uU]\+|#x?|\%23)[0-9_a-fA-FgGrR]*?[a-fA-FgGrR]{2,}[0-9_a-fA-FgGrR]*(?:[uUlL]{0,3}|u\d+)\b + +# hit-count: 1 file-count: 1 +# Non-English +[a-zA-Z]*[ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź][a-zA-Z]{3}[a-zA-ZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź]* + +# hit-count: 1 file-count: 1 +# French +# This corpus only had capital letters, but you probably want lowercase ones as well. +\b[LN]'+[a-z]{2,}\b + # acceptable duplicates # ls directory listings [-bcdlpsw](?:[-r][-w][-sx]){3}\s+\d+\s+(\S+)\s+\g{-1}\s+\d+\s+ # C/idl types + English ... \s(Guid|long|LONG|that) \g{-1}\s + # javadoc / .net -(?:\@(?:groupname|param)|(?:public|private)(?:\s+static|\s+readonly)*)\s+(\w+)\s+\g{-1}\s +(?:[\\@](?:groupname|param)|(?:public|private)(?:\s+static|\s+readonly)*)\s+(\w+)\s+\g{-1}\s + +# Commit message -- Signed-off-by and friends +^\s*(?:(?:Based-on-patch|Co-authored|Helped|Mentored|Reported|Reviewed|Signed-off)-by|Thanks-to): (?:[^<]*<[^>]*>|[^<]*)\s*$ + +# Autogenerated revert commit message +^This reverts commit [0-9a-f]{40}\.$ + # vtmode --vtmode\s+(\w+)\s+\g{-1}\s diff --git a/.github/actions/spelling/reject.txt b/.github/actions/spelling/reject.txt index 4d43bc53eee..301719de47e 100644 --- a/.github/actions/spelling/reject.txt +++ b/.github/actions/spelling/reject.txt @@ -1,31 +1,12 @@ -benefitting -occurences? -Sorce ^attache$ ^attacher$ ^attachers$ +benefitting +occurences? ^dependan.* ^oer$ -^spae$ -^spae-man$ -^spaebook$ -^spaecraft$ -^spaed$ -^spaedom$ -^spaeing$ -^spaeings$ -^spaeman$ -^spaer$ -^Spaerobee$ -^spaes$ -^spaewife$ -^spaewoman$ -^spaework$ -^spaewright$ +Sorce +^[Ss]pae.* ^untill$ ^untilling$ -^wether$ ^wether.* -^wethers$ -^wetherteg$ -^[Ss]pae.* diff --git a/.github/workflows/spelling2.yml b/.github/workflows/spelling2.yml index d8369ca0cd3..446b24343ed 100644 --- a/.github/workflows/spelling2.yml +++ b/.github/workflows/spelling2.yml @@ -1,10 +1,57 @@ # spelling.yml is blocked per https://github.com/check-spelling/check-spelling/security/advisories/GHSA-g86g-chm8-7r2p name: Spell checking + +# Comment management is handled through a secondary job, for details see: +# https://github.com/check-spelling/check-spelling/wiki/Feature%3A-Restricted-Permissions +# +# `jobs.comment-push` runs when a push is made to a repository and the `jobs.spelling` job needs to make a comment +# (in odd cases, it might actually run just to collapse a commment, but that's fairly rare) +# it needs `contents: write` in order to add a comment. +# +# `jobs.comment-pr` runs when a pull_request is made to a repository and the `jobs.spelling` job needs to make a comment +# or collapse a comment (in the case where it had previously made a comment and now no longer needs to show a comment) +# it needs `pull-requests: write` in order to manipulate those comments. + +# Updating pull request branches is managed via comment handling. +# For details, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-expect-list +# +# These elements work together to make it happen: +# +# `on.issue_comment` +# This event listens to comments by users asking to update the metadata. +# +# `jobs.update` +# This job runs in response to an issue_comment and will push a new commit +# to update the spelling metadata. +# +# `with.experimental_apply_changes_via_bot` +# Tells the action to support and generate messages that enable it +# to make a commit to update the spelling metadata. +# +# `with.ssh_key` +# In order to trigger workflows when the commit is made, you can provide a +# secret (typically, a write-enabled github deploy key). +# +# For background, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-with-deploy-key + on: - pull_request_target: push: - branches: ["**"] - tags-ignore: ["**"] + branches: + - "**" + tags-ignore: + - "**" + pull_request_target: + branches: + - "**" + tags-ignore: + - "**" + types: + - 'opened' + - 'reopened' + - 'synchronize' + issue_comment: + types: + - 'created' jobs: spelling: @@ -24,23 +71,64 @@ jobs: steps: - name: check-spelling id: spelling - uses: check-spelling/check-spelling@v0.0.20 + uses: check-spelling/check-spelling@v0.0.21 with: suppress_push_for_open_pull_request: 1 checkout: true + check_file_names: 1 + spell_check_this: check-spelling/spell-check-this@prerelease post_comment: 0 + use_magic_file: 1 + extra_dictionary_limit: 10 + extra_dictionaries: + cspell:software-terms/src/software-terms.txt + cspell:python/src/python/python-lib.txt + cspell:node/node.txt + cspell:cpp/src/stdlib-c.txt + cspell:cpp/src/stdlib-cpp.txt + cspell:fullstack/fullstack.txt + cspell:filetypes/filetypes.txt + cspell:html/html.txt + cspell:cpp/src/compiler-msvc.txt + cspell:python/src/common/extra.txt + cspell:powershell/powershell.txt + cspell:aws/aws.txt + cspell:cpp/src/lang-keywords.txt + cspell:npm/npm.txt + cspell:dotnet/dotnet.txt + cspell:python/src/python/python.txt + cspell:css/css.txt + cspell:cpp/src/stdlib-cmath.txt + check_extra_dictionaries: '' - comment: - name: Report + comment-push: + name: Report (Push) + # If your workflow isn't running on push, you can remove this job runs-on: ubuntu-latest needs: spelling permissions: contents: write + if: (success() || failure()) && needs.spelling.outputs.followup && github.event_name == 'push' + steps: + - name: comment + uses: check-spelling/check-spelling@v0.0.21 + with: + checkout: true + spell_check_this: check-spelling/spell-check-this@prerelease + task: ${{ needs.spelling.outputs.followup }} + + comment-pr: + name: Report (PR) + # If you workflow isn't running on pull_request*, you can remove this job + runs-on: ubuntu-latest + needs: spelling + permissions: pull-requests: write - if: (success() || failure()) && needs.spelling.outputs.followup && github.event_name != 'push' + if: (success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name, 'pull_request') steps: - name: comment - uses: check-spelling/check-spelling@v0.0.20 + uses: check-spelling/check-spelling@v0.0.21 with: checkout: true + spell_check_this: check-spelling/spell-check-this@prerelease task: ${{ needs.spelling.outputs.followup }} From 6a600533c6b2d82b1929cbb8b94b6e0f090d5c45 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Wed, 1 Feb 2023 05:39:11 -0600 Subject: [PATCH 12/29] a commandbarflyout intsead, with a slightly more idomatic implementation --- src/cascadia/TerminalApp/TerminalPage.cpp | 14 +++++++- .../TerminalControl/SearchBoxControl.h | 2 -- src/cascadia/TerminalControl/TermControl.cpp | 33 +++++++++++++++++++ src/cascadia/TerminalControl/TermControl.h | 5 ++- src/cascadia/TerminalControl/TermControl.idl | 4 ++- src/cascadia/TerminalControl/TermControl.xaml | 18 +++++++++- 6 files changed, 70 insertions(+), 6 deletions(-) diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index 01ea857579a..361a6ed5da5 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -1654,7 +1654,19 @@ namespace winrt::TerminalApp::implementation term.ShowWindowChanged({ get_weak(), &TerminalPage::_ShowWindowChangedHandler }); - term.ContextMenuRequested({ get_weak(), &TerminalPage::_ContextMenuRequestedHandler }); + // term.ContextMenuRequested({ get_weak(), &TerminalPage::_ContextMenuRequestedHandler }); + + term.ContextMenu().Opening([term](const auto&, const auto&) { + AppBarButton searchCommandBar{}; + searchCommandBar.Icon(SymbolIcon{ Symbol::Find }); + searchCommandBar.Label(L"Searchy search"); + term.ContextMenu().PrimaryCommands().Append(searchCommandBar); + + AppBarButton thingCommandBar{}; + thingCommandBar.Icon(SymbolIcon{ Symbol::Share }); + thingCommandBar.Label(L"Thingy do"); + term.ContextMenu().SecondaryCommands().Append(thingCommandBar); + }); } // Method Description: diff --git a/src/cascadia/TerminalControl/SearchBoxControl.h b/src/cascadia/TerminalControl/SearchBoxControl.h index 5f7dee504d7..4a680edcb68 100644 --- a/src/cascadia/TerminalControl/SearchBoxControl.h +++ b/src/cascadia/TerminalControl/SearchBoxControl.h @@ -14,8 +14,6 @@ Author(s): --*/ #pragma once -#include "winrt/Windows.UI.Xaml.h" -#include "winrt/Windows.UI.Xaml.Controls.h" #include "SearchBoxControl.g.h" diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 7cbf1c4e8e1..06825b3ad30 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -88,6 +88,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation _interactivity.OpenHyperlink({ this, &TermControl::_HyperlinkHandler }); _interactivity.ScrollPositionChanged({ this, &TermControl::_ScrollPositionChanged }); + _interactivity.ContextMenuRequested([this](auto&&, auto&&) { + winrt::Windows::UI::Xaml::Controls::Primitives::FlyoutShowOptions myOption{}; + // myOption.ShowMode = isTransient ? FlyoutShowMode.Transient : FlyoutShowMode.Standard; + myOption.ShowMode(winrt::Windows::UI::Xaml::Controls::Primitives::FlyoutShowMode::Standard); + ContextMenu().ShowAt(*this, myOption); + }); + // Initialize the terminal only once the swapchainpanel is loaded - that // way, we'll be able to query the real pixel size it got on layout _layoutUpdatedRevoker = SwapChainPanel().LayoutUpdated(winrt::auto_revoke, [this](auto /*s*/, auto /*e*/) { @@ -135,6 +142,32 @@ namespace winrt::Microsoft::Terminal::Control::implementation _autoScrollTimer.Tick({ this, &TermControl::_UpdateAutoScroll }); _ApplyUISettings(); + + _originalPrimaryElements = winrt::single_threaded_observable_vector(); + _originalSecondaryElements = winrt::single_threaded_observable_vector(); + for (const auto& e : ContextMenu().PrimaryCommands()) + { + _originalPrimaryElements.Append(e); + } + for (const auto& e : ContextMenu().SecondaryCommands()) + { + _originalSecondaryElements.Append(e); + } + ContextMenu().Closed([weakThis = get_weak()](auto&&, auto&&) { + if (auto control{ weakThis.get() }; !control->_IsClosing()) + { + control->ContextMenu().PrimaryCommands().Clear(); + control->ContextMenu().SecondaryCommands().Clear(); + for (const auto& e : control->_originalPrimaryElements) + { + control->ContextMenu().PrimaryCommands().Append(e); + } + for (const auto& e : control->_originalSecondaryElements) + { + control->ContextMenu().SecondaryCommands().Append(e); + } + } + }); } void TermControl::_throttledUpdateScrollbar(const ScrollBarUpdate& update) diff --git a/src/cascadia/TerminalControl/TermControl.h b/src/cascadia/TerminalControl/TermControl.h index 7d89c2aaf7b..c61bc6e6fe4 100644 --- a/src/cascadia/TerminalControl/TermControl.h +++ b/src/cascadia/TerminalControl/TermControl.h @@ -148,7 +148,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation PROJECTED_FORWARDED_TYPED_EVENT(SetTaskbarProgress, IInspectable, IInspectable, _core, TaskbarProgressChanged); PROJECTED_FORWARDED_TYPED_EVENT(ConnectionStateChanged, IInspectable, IInspectable, _core, ConnectionStateChanged); PROJECTED_FORWARDED_TYPED_EVENT(ShowWindowChanged, IInspectable, Control::ShowWindowArgs, _core, ShowWindowChanged); - PROJECTED_FORWARDED_TYPED_EVENT(ContextMenuRequested, IInspectable, Control::ContextMenuRequestedEventArgs, _interactivity, ContextMenuRequested); + // PROJECTED_FORWARDED_TYPED_EVENT(ContextMenuRequested, IInspectable, Control::ContextMenuRequestedEventArgs, _interactivity, ContextMenuRequested); PROJECTED_FORWARDED_TYPED_EVENT(CloseTerminalRequested, IInspectable, IInspectable, _core, CloseTerminalRequested); PROJECTED_FORWARDED_TYPED_EVENT(PasteFromClipboard, IInspectable, Control::PasteFromClipboardEventArgs, _interactivity, PasteFromClipboard); @@ -223,6 +223,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation bool _isBackgroundLight{ false }; + winrt::Windows::Foundation::Collections::IObservableVector _originalPrimaryElements{ nullptr }; + winrt::Windows::Foundation::Collections::IObservableVector _originalSecondaryElements{ nullptr }; + inline bool _IsClosing() const noexcept { #ifndef NDEBUG diff --git a/src/cascadia/TerminalControl/TermControl.idl b/src/cascadia/TerminalControl/TermControl.idl index c16937c8084..780f75354e1 100644 --- a/src/cascadia/TerminalControl/TermControl.idl +++ b/src/cascadia/TerminalControl/TermControl.idl @@ -44,7 +44,9 @@ namespace Microsoft.Terminal.Control event Windows.Foundation.TypedEventHandler TabColorChanged; event Windows.Foundation.TypedEventHandler ReadOnlyChanged; event Windows.Foundation.TypedEventHandler FocusFollowMouseRequested; - event Windows.Foundation.TypedEventHandler ContextMenuRequested; + // event Windows.Foundation.TypedEventHandler ContextMenuRequested; + + Windows.UI.Xaml.Controls.CommandBarFlyout ContextMenu { get; }; event Windows.Foundation.TypedEventHandler Initialized; // This is an event handler forwarder for the underlying connection. diff --git a/src/cascadia/TerminalControl/TermControl.xaml b/src/cascadia/TerminalControl/TermControl.xaml index 1e2428eba3b..e078240234e 100644 --- a/src/cascadia/TerminalControl/TermControl.xaml +++ b/src/cascadia/TerminalControl/TermControl.xaml @@ -31,6 +31,22 @@ mc:Ignorable="d"> + + + + + + + + + + @@ -142,9 +139,6 @@ AppLogic.idl - - ControlContextMenu.xaml - @@ -239,9 +233,6 @@ - - ControlContextMenu.xaml - @@ -303,10 +294,6 @@ - - ControlContextMenu.xaml - Code - diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index 16a1cc3430a..5df0923e94a 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -4449,9 +4449,6 @@ namespace winrt::TerminalApp::implementation _updateThemeColors(); } - // void TerminalPage::_ContextMenuRequestedHandler(const IInspectable sender, - // const winrt::Microsoft::Terminal::Control::ContextMenuRequestedEventArgs& args) - // { void TerminalPage::_ContextMenuOpened(const IInspectable& sender, const IInspectable& /*args*/) { @@ -4467,7 +4464,8 @@ namespace winrt::TerminalApp::implementation const bool /*withSelection*/) { // withSelection can be used to add actions that only appear if there's - // selected text, like "search the web" + // selected text, like "search the web". In this initial draft, it's not + // actually augmented by the TerminalPage, so it's left commented out. auto menu = sender.try_as(); @@ -4489,10 +4487,10 @@ namespace winrt::TerminalApp::implementation const winrt::hstring& icon, const auto& action) { AppBarButton button{}; - // thingCommandBar.Icon(SymbolIcon{ Symbol::Share }); + if (!icon.empty()) { - auto iconElement= IconPathConverter::IconWUX(icon); + auto iconElement = IconPathConverter::IconWUX(icon); Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw); button.Icon(iconElement); } @@ -4507,16 +4505,16 @@ namespace winrt::TerminalApp::implementation // consistent. This also leaves room for customizing this menu with // actions in the future. - makeItem(RS_(L"SplitPaneContextMenuEntry/Text"), L"\xF246", ActionAndArgs{ ShortcutAction::SplitPane, SplitPaneArgs{ SplitType::Duplicate } }); - makeItem(RS_(L"DuplicateTabContextMenuEntry/Text"), L"\xF5ED", ActionAndArgs{ ShortcutAction::DuplicateTab, nullptr }); + makeItem(RS_(L"SplitPaneContextMenuEntryText"), L"\xF246", ActionAndArgs{ ShortcutAction::SplitPane, SplitPaneArgs{ SplitType::Duplicate } }); + makeItem(RS_(L"DuplicateTabContextMenuEntryText"), L"\xF5ED", ActionAndArgs{ ShortcutAction::DuplicateTab, nullptr }); // Only wire up "Close Pane" if there's multiple panes. if (_GetFocusedTabImpl()->GetLeafPaneCount() > 1) { - makeItem(RS_(L"ClosePaneContextMenuEntry/Text"), L"\xE89F", ActionAndArgs{ ShortcutAction::ClosePane, nullptr }); + makeItem(RS_(L"ClosePaneContextMenuEntryText"), L"\xE89F", ActionAndArgs{ ShortcutAction::ClosePane, nullptr }); } - makeItem(RS_(L"CloseTabContextMenuEntry/Text"), L"\xE711", ActionAndArgs{ ShortcutAction::CloseTab, CloseTabArgs{ _GetFocusedTabIndex().value() } }); + makeItem(RS_(L"CloseTabContextMenuEntryText"), L"\xE711", ActionAndArgs{ ShortcutAction::CloseTab, CloseTabArgs{ _GetFocusedTabIndex().value() } }); } } diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index cdf58e9dde9..7e392fc588d 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -3237,22 +3237,19 @@ namespace winrt::Microsoft::Terminal::Control::implementation Control::ContextMenuRequestedEventArgs args) { Controls::Primitives::FlyoutShowOptions myOption{}; - // myOption.ShowMode = isTransient ? FlyoutShowMode.Transient : FlyoutShowMode.Standard; myOption.ShowMode(Controls::Primitives::FlyoutShowMode::Standard); myOption.Placement(Controls::Primitives::FlyoutPlacementMode::TopEdgeAlignedLeft); // Position the menu where the pointer is. This was the best way I found how. - til::point absolutePointerPos{ til::math::rounding, CoreWindow::GetForCurrentThread().PointerPosition() }; - til::point absoluteWindowOrigin{ til::math::rounding, - CoreWindow::GetForCurrentThread().Bounds().X, - CoreWindow::GetForCurrentThread().Bounds().Y }; + const til::point absolutePointerPos{ til::math::rounding, CoreWindow::GetForCurrentThread().PointerPosition() }; + const til::point absoluteWindowOrigin{ til::math::rounding, + CoreWindow::GetForCurrentThread().Bounds().X, + CoreWindow::GetForCurrentThread().Bounds().Y }; // Get the offset (margin + tabs, etc..) of the control within the window const til::point controlOrigin{ til::math::flooring, this->TransformToVisual(nullptr).TransformPoint(Windows::Foundation::Point(0, 0)) }; - // TODO! This is off by the origin of the TermControl within the window. - // SPlit a pane and click on the right or bottom one, you'll see what I mean. - auto pos = (absolutePointerPos - absoluteWindowOrigin - controlOrigin).to_winrt_point(); + const auto pos = (absolutePointerPos - absoluteWindowOrigin - controlOrigin).to_winrt_point(); myOption.Position(pos); if (args.SelectedText().empty()) @@ -3264,6 +3261,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation SelectionContextMenu().ShowAt(*this, myOption); } } + void TermControl::_PasteCommandHandler(const IInspectable& /*sender*/, const IInspectable& /*args*/) { From d6fe5208433a7cccd0bbc0806e90acc1ba04e7d5 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Thu, 2 Feb 2023 17:39:08 -0600 Subject: [PATCH 18/29] 'cleanup --- .../UnitTests_TerminalCore/MockTermSettings.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/cascadia/UnitTests_TerminalCore/MockTermSettings.h b/src/cascadia/UnitTests_TerminalCore/MockTermSettings.h index 650e8c96ab8..1f3be0be999 100644 --- a/src/cascadia/UnitTests_TerminalCore/MockTermSettings.h +++ b/src/cascadia/UnitTests_TerminalCore/MockTermSettings.h @@ -7,7 +7,6 @@ #include "../../inc/ControlProperties.h" #include -#include using namespace winrt::Microsoft::Terminal::Core; @@ -18,18 +17,16 @@ namespace TerminalCoreUnitTests // Color Table is special because it's an array std::array _ColorTable; - public: -#define SETTINGS_GEN(type, name, ...) til::property name{ __VA_ARGS__ }; - // #define SETTINGS_GEN(type, name, ...) WINRT_PROPERTY(type, name, __VA_ARGS__); +#define SETTINGS_GEN(type, name, ...) WINRT_PROPERTY(type, name, __VA_ARGS__); CORE_SETTINGS(SETTINGS_GEN) CORE_APPEARANCE_SETTINGS(SETTINGS_GEN) #undef SETTINGS_GEN public: MockTermSettings(int32_t historySize, int32_t initialRows, int32_t initialCols) : - HistorySize(historySize), - InitialRows(initialRows), - InitialCols(initialCols) + _HistorySize(historySize), + _InitialRows(initialRows), + _InitialCols(initialCols) { } From 7aef3afef867efdc3c13bf795b4c770c3b6feda1 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Fri, 3 Feb 2023 05:33:49 -0600 Subject: [PATCH 19/29] bommand --- .../TerminalApp/ControlContextMenu.xaml | 70 ------------------- src/cascadia/TerminalApp/TerminalPage.xaml | 3 - .../Resources/en-US/Resources.resw | 4 +- src/cascadia/TerminalControl/TermControl.xaml | 4 +- 4 files changed, 4 insertions(+), 77 deletions(-) delete mode 100644 src/cascadia/TerminalApp/ControlContextMenu.xaml diff --git a/src/cascadia/TerminalApp/ControlContextMenu.xaml b/src/cascadia/TerminalApp/ControlContextMenu.xaml deleted file mode 100644 index f3f902eb4da..00000000000 --- a/src/cascadia/TerminalApp/ControlContextMenu.xaml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/cascadia/TerminalApp/TerminalPage.xaml b/src/cascadia/TerminalApp/TerminalPage.xaml index 2e3074e6c3f..3434cd868ee 100644 --- a/src/cascadia/TerminalApp/TerminalPage.xaml +++ b/src/cascadia/TerminalApp/TerminalPage.xaml @@ -225,8 +225,5 @@ Text="{x:Bind WindowName, Mode=OneWay}" /> - - - diff --git a/src/cascadia/TerminalControl/Resources/en-US/Resources.resw b/src/cascadia/TerminalControl/Resources/en-US/Resources.resw index 40a660caa21..aa2473890f2 100644 --- a/src/cascadia/TerminalControl/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalControl/Resources/en-US/Resources.resw @@ -232,11 +232,11 @@ Please either install the missing font or choose another one. Paste The tooltip for a paste button - + Find... The label of a button for searching for the selected text - + Find The tooltip for a button for searching for the selected text diff --git a/src/cascadia/TerminalControl/TermControl.xaml b/src/cascadia/TerminalControl/TermControl.xaml index 4e8a9550ba4..f0d48f63477 100644 --- a/src/cascadia/TerminalControl/TermControl.xaml +++ b/src/cascadia/TerminalControl/TermControl.xaml @@ -48,8 +48,8 @@ Click="_PasteCommandHandler" Icon="Paste" /> - From c77f959c056c71beb0d57fd115efed2bd87c0234 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sun, 5 Feb 2023 15:29:52 -0600 Subject: [PATCH 20/29] PR nits --- .../Resources/en-US/Resources.resw | 24 +++++++------------ src/cascadia/TerminalApp/TerminalPage.cpp | 14 +++++------ src/cascadia/TerminalApp/TerminalPage.h | 2 +- src/cascadia/TerminalControl/EventArgs.idl | 3 --- src/cascadia/TerminalControl/TermControl.cpp | 4 +--- src/cascadia/TerminalControl/TermControl.h | 1 - 6 files changed, 18 insertions(+), 30 deletions(-) diff --git a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw index 4f66269fa66..2d7a385fbb2 100644 --- a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw @@ -205,6 +205,15 @@ Close Tab + + Close Pane + + + Split Tab + + + Split Pane + Color... @@ -708,9 +717,6 @@ Open a new tab in given starting directory - - Split Tab - Open a new window with given starting directory @@ -752,18 +758,6 @@ Suggestions found: {0} {0} will be replaced with a number. - - Split pane - - - Duplicate tab - - - Close pane - - - Close tab - The "newTabMenu" field contains more than one entry of type "remainingProfiles". Only the first one will be considered. {Locked="newTabMenu"} {Locked="remainingProfiles"} diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index 5df0923e94a..3acd0e1f27f 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -4452,15 +4452,15 @@ namespace winrt::TerminalApp::implementation void TerminalPage::_ContextMenuOpened(const IInspectable& sender, const IInspectable& /*args*/) { - _populateContextMenu(sender, false); + _PopulateContextMenu(sender, false); } void TerminalPage::_SelectionMenuOpened(const IInspectable& sender, const IInspectable& /*args*/) { - _populateContextMenu(sender, true); + _PopulateContextMenu(sender, true); } - void TerminalPage::_populateContextMenu(const IInspectable& sender, + void TerminalPage::_PopulateContextMenu(const IInspectable& sender, const bool /*withSelection*/) { // withSelection can be used to add actions that only appear if there's @@ -4505,16 +4505,16 @@ namespace winrt::TerminalApp::implementation // consistent. This also leaves room for customizing this menu with // actions in the future. - makeItem(RS_(L"SplitPaneContextMenuEntryText"), L"\xF246", ActionAndArgs{ ShortcutAction::SplitPane, SplitPaneArgs{ SplitType::Duplicate } }); - makeItem(RS_(L"DuplicateTabContextMenuEntryText"), L"\xF5ED", ActionAndArgs{ ShortcutAction::DuplicateTab, nullptr }); + makeItem(RS_(L"SplitPaneText"), L"\xF246", ActionAndArgs{ ShortcutAction::SplitPane, SplitPaneArgs{ SplitType::Duplicate } }); + makeItem(RS_(L"DuplicateTabText"), L"\xF5ED", ActionAndArgs{ ShortcutAction::DuplicateTab, nullptr }); // Only wire up "Close Pane" if there's multiple panes. if (_GetFocusedTabImpl()->GetLeafPaneCount() > 1) { - makeItem(RS_(L"ClosePaneContextMenuEntryText"), L"\xE89F", ActionAndArgs{ ShortcutAction::ClosePane, nullptr }); + makeItem(RS_(L"PaneClose"), L"\xE89F", ActionAndArgs{ ShortcutAction::ClosePane, nullptr }); } - makeItem(RS_(L"CloseTabContextMenuEntryText"), L"\xE711", ActionAndArgs{ ShortcutAction::CloseTab, CloseTabArgs{ _GetFocusedTabIndex().value() } }); + makeItem(RS_(L"TabClose"), L"\xE711", ActionAndArgs{ ShortcutAction::CloseTab, CloseTabArgs{ _GetFocusedTabIndex().value() } }); } } diff --git a/src/cascadia/TerminalApp/TerminalPage.h b/src/cascadia/TerminalApp/TerminalPage.h index 2c40a363d8a..674a37fc4c2 100644 --- a/src/cascadia/TerminalApp/TerminalPage.h +++ b/src/cascadia/TerminalApp/TerminalPage.h @@ -464,7 +464,7 @@ namespace winrt::TerminalApp::implementation void _ContextMenuOpened(const IInspectable& sender, const IInspectable& args); void _SelectionMenuOpened(const IInspectable& sender, const IInspectable& args); - void _populateContextMenu(const IInspectable& sender, const bool withSelection); + void _PopulateContextMenu(const IInspectable& sender, const bool withSelection); #pragma region ActionHandlers // These are all defined in AppActionHandlers.cpp diff --git a/src/cascadia/TerminalControl/EventArgs.idl b/src/cascadia/TerminalControl/EventArgs.idl index 34f6f749379..cb9fe61b662 100644 --- a/src/cascadia/TerminalControl/EventArgs.idl +++ b/src/cascadia/TerminalControl/EventArgs.idl @@ -26,9 +26,6 @@ namespace Microsoft.Terminal.Control { String SelectedText { get; }; Windows.Foundation.Point Point { get; }; - // Ideas: - // String CurrentDirectory { get; }; - // Microsoft.Terminal.TerminalConnection.ConnectionState State { get; }; } runtimeclass TitleChangedEventArgs diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 7e392fc588d..00e49935fae 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -1352,10 +1352,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation } else { - const auto mouseButtons = TermControl::GetPressedMouseButtons(point); - const auto cursorPosition = point.Position(); - _interactivity.PointerPressed(mouseButtons, + _interactivity.PointerPressed(TermControl::GetPressedMouseButtons(point), TermControl::GetPointerUpdateKind(point), point.Timestamp(), ControlKeyStates{ args.KeyModifiers() }, diff --git a/src/cascadia/TerminalControl/TermControl.h b/src/cascadia/TerminalControl/TermControl.h index 4c381e3a378..ea5db62fce5 100644 --- a/src/cascadia/TerminalControl/TermControl.h +++ b/src/cascadia/TerminalControl/TermControl.h @@ -148,7 +148,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation PROJECTED_FORWARDED_TYPED_EVENT(SetTaskbarProgress, IInspectable, IInspectable, _core, TaskbarProgressChanged); PROJECTED_FORWARDED_TYPED_EVENT(ConnectionStateChanged, IInspectable, IInspectable, _core, ConnectionStateChanged); PROJECTED_FORWARDED_TYPED_EVENT(ShowWindowChanged, IInspectable, Control::ShowWindowArgs, _core, ShowWindowChanged); - // PROJECTED_FORWARDED_TYPED_EVENT(ContextMenuRequested, IInspectable, Control::ContextMenuRequestedEventArgs, _interactivity, ContextMenuRequested); PROJECTED_FORWARDED_TYPED_EVENT(CloseTerminalRequested, IInspectable, IInspectable, _core, CloseTerminalRequested); PROJECTED_FORWARDED_TYPED_EVENT(PasteFromClipboard, IInspectable, Control::PasteFromClipboardEventArgs, _interactivity, PasteFromClipboard); From ab55a8df7ba50675c925a65729297a5b62f52522 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sun, 5 Feb 2023 15:30:00 -0600 Subject: [PATCH 21/29] Revert "sad beeps" This reverts commit 520c89f1fe236c2684f7f2a8434d7e8157e3b597. --- src/inc/til/winrt.h | 67 --------------------------------------------- 1 file changed, 67 deletions(-) diff --git a/src/inc/til/winrt.h b/src/inc/til/winrt.h index 0e773ad5be6..35495fcc415 100644 --- a/src/inc/til/winrt.h +++ b/src/inc/til/winrt.h @@ -107,72 +107,5 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" typed_event& _origin; }; #endif -#ifdef WINRT_Windows_UI_Xaml_DataH - using property_changed_event = event; - - // This unfortunately doesn't seem feasible. It's gonna just result in more - // macros, which no one wants. - // - // Explanation can be found in the operator() below. - - // template - // struct observable_property - // { - // observable_property(property_changed_event e) : - // _event{ e } {}; - // observable_property(property_changed_event e, T defaultValue) : - // _event{ e }, - // _value{ defaultValue } {} - - // T operator()() - // { - // return _value; - // } - // void operator()(const T& value) - // { - // if (_value != value) - // { - // _value = value; - - // // This line right here is why we can't do this. - // _event(*sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L## #name }) - // // 1. We don't know who the sender is, or would require `this` to - // // always be the first parameter to one of these - // // observable_property's. - // // - // // 2. We don't know what our own name is. We need to actually raise - // // an event with the name of the variable as the parameter. Only - // // way to do that is with something dumb like - // // - // // ``` - // // til::observable Foo(this, L"Foo", 42) - // // ``` - // // - // // Which is just dang dumb - // } - // } - // void operator()(const T&& value) - // { - // _value = value; - // } - // property& operator=(const property& other) - // { - // _value = other._value; - // return *this; - // } - // property& operator=(const T& newValue) - // { - // _value = newValue; - // return *this; - // } - - // private: - // T _value; - // property_changed_event& _event; - // }; - - // #define OBSERVABLE(type, name, ...) til::observable_property name{ this, L## #name, this.PropertyChanged, __VA_ARGS__ }; - -#endif } From 559ecdb358c16f043a08ed5f5b1b00293b37b651 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sun, 5 Feb 2023 15:30:09 -0600 Subject: [PATCH 22/29] Revert "I suppose this is what happens when I have four uninterrupted hours away from the kid" This reverts commit b535a5f3f359b95156119679a144e0f7ada9ce4e. --- .../TilWinRtHelpersTests.cpp | 22 ----------- src/inc/til/winrt.h | 38 ++----------------- 2 files changed, 4 insertions(+), 56 deletions(-) diff --git a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp index 216b5b8a479..e32983b8e51 100644 --- a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp +++ b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp @@ -37,11 +37,8 @@ class TerminalCoreUnitTests::TilWinRtHelpersTests final TEST_CLASS(TilWinRtHelpersTests); TEST_METHOD(TestPropertySimple); TEST_METHOD(TestPropertyHString); - TEST_METHOD(TestEvent); TEST_METHOD(TestForwardedEvent); - - TEST_METHOD(TestTypedEvent); }; void TilWinRtHelpersTests::TestPropertySimple() @@ -127,22 +124,3 @@ void TilWinRtHelpersTests::TestForwardedEvent() VERIFY_ARE_EQUAL(3, handledOne); VERIFY_ARE_EQUAL(3, handledTwo); } - -void TilWinRtHelpersTests::TestTypedEvent() -{ - bool handledOne = false; - bool handledTwo = false; - - auto handler = [&](const winrt::hstring sender, const int& v) -> void { - VERIFY_ARE_EQUAL(L"sure", sender); - VERIFY_ARE_EQUAL(42, v); - handledOne = true; - }; - - til::typed_event MyEvent; - MyEvent(handler); - MyEvent([&](winrt::hstring, int) { handledTwo = true; }); - MyEvent.raise(L"sure", 42); - VERIFY_ARE_EQUAL(true, handledOne); - VERIFY_ARE_EQUAL(true, handledTwo); -} diff --git a/src/inc/til/winrt.h b/src/inc/til/winrt.h index 35495fcc415..0a4e49e1b8a 100644 --- a/src/inc/til/winrt.h +++ b/src/inc/til/winrt.h @@ -11,7 +11,10 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" property() = default; property(T defaultValue) : _value{ defaultValue } {} - + // T& operator()() + // { + // return _value; + // } T operator()() { return _value; @@ -73,39 +76,6 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" } event& _origin; }; - - template - struct typed_event - { - typed_event() = default; - winrt::event_token operator()(const winrt::Windows::Foundation::TypedEventHandler& handler) { return _handlers.add(handler); } - void operator()(const winrt::event_token& token) { _handlers.remove(token); } - template - void raise(Arg const&... args) - { - _handlers(args...); - } - winrt::event> _handlers; - }; - - template - struct forwarded_typed_event - { - forwarded_typed_event() = delete; - forwarded_typed_event(typed_event& other) : - _origin{ other } {} - forwarded_typed_event(forwarded_typed_event& other) : - _origin{ other._origin } {} - - winrt::event_token operator()(const winrt::Windows::Foundation::TypedEventHandler& handler) { return _origin(handler); } - void operator()(const winrt::event_token& token) { _origin(token); } - template - void raise(Arg const&... args) - { - _origin.raise(args...); - } - typed_event& _origin; - }; #endif } From 9ff0abe8347cbc300e952f82e52260cc298d15f2 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sun, 5 Feb 2023 15:30:13 -0600 Subject: [PATCH 23/29] Revert "practical use, look" This reverts commit eb88cd3a2d15fbf30af64a70f2ef859173388a40. --- .../UnitTests_TerminalCore/TilWinRtHelpersTests.cpp | 2 +- src/cascadia/inc/ControlProperties.h | 2 +- src/inc/til/winrt.h | 10 +--------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp index e32983b8e51..244ee7e79a3 100644 --- a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp +++ b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp @@ -54,7 +54,7 @@ void TilWinRtHelpersTests::TestPropertySimple() Foo = Foo() - 5; // 37 VERIFY_ARE_EQUAL(37, Foo()); - Foo = Foo() + Bar(); // 48 + Foo() += Bar(); // 48 VERIFY_ARE_EQUAL(48, Foo()); } diff --git a/src/cascadia/inc/ControlProperties.h b/src/cascadia/inc/ControlProperties.h index 5287e1e300c..d95c7f9f0f1 100644 --- a/src/cascadia/inc/ControlProperties.h +++ b/src/cascadia/inc/ControlProperties.h @@ -36,7 +36,7 @@ X(int32_t, InitialCols, 80) \ X(bool, SnapOnInput, true) \ X(bool, AltGrAliasing, true) \ - X(winrt::hstring, WordDelimiters, DEFAULT_WORD_DELIMITERS.c_str()) \ + X(winrt::hstring, WordDelimiters, DEFAULT_WORD_DELIMITERS) \ X(bool, CopyOnSelect, false) \ X(bool, FocusFollowMouse, false) \ X(winrt::Windows::Foundation::IReference, TabColor, nullptr) \ diff --git a/src/inc/til/winrt.h b/src/inc/til/winrt.h index 0a4e49e1b8a..c4843169881 100644 --- a/src/inc/til/winrt.h +++ b/src/inc/til/winrt.h @@ -11,11 +11,7 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" property() = default; property(T defaultValue) : _value{ defaultValue } {} - // T& operator()() - // { - // return _value; - // } - T operator()() + T& operator()() { return _value; } @@ -23,10 +19,6 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" { _value = value; } - void operator()(const T&& value) - { - _value = value; - } property& operator=(const property& other) { _value = other._value; From 564102b36f9de98882f9b78bf9516f1448e13dfd Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sun, 5 Feb 2023 15:30:15 -0600 Subject: [PATCH 24/29] Revert "forwarded_event, string tests" This reverts commit 7001e93550ef6ac182b7bb6aaaf3a0acbdbe2b82. --- .../TilWinRtHelpersTests.cpp | 52 ------------------- src/inc/til/winrt.h | 21 +------- 2 files changed, 1 insertion(+), 72 deletions(-) diff --git a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp index 244ee7e79a3..7a5d1e8843f 100644 --- a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp +++ b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp @@ -36,9 +36,7 @@ class TerminalCoreUnitTests::TilWinRtHelpersTests final { TEST_CLASS(TilWinRtHelpersTests); TEST_METHOD(TestPropertySimple); - TEST_METHOD(TestPropertyHString); TEST_METHOD(TestEvent); - TEST_METHOD(TestForwardedEvent); }; void TilWinRtHelpersTests::TestPropertySimple() @@ -58,16 +56,6 @@ void TilWinRtHelpersTests::TestPropertySimple() VERIFY_ARE_EQUAL(48, Foo()); } -void TilWinRtHelpersTests::TestPropertyHString() -{ - til::property Foo{ L"Foo" }; - - VERIFY_ARE_EQUAL(L"Foo", Foo()); - - Foo = L"bar"; - VERIFY_ARE_EQUAL(L"bar", Foo()); -} - void TilWinRtHelpersTests::TestEvent() { bool handledOne = false; @@ -84,43 +72,3 @@ void TilWinRtHelpersTests::TestEvent() VERIFY_ARE_EQUAL(true, handledOne); VERIFY_ARE_EQUAL(true, handledTwo); } - -void TilWinRtHelpersTests::TestForwardedEvent() -{ - using callback = winrt::delegate; - - struct Helper - { - til::event MyEvent; - } helper; - - int handledOne = 0; - int handledTwo = 0; - - auto handler = [&](const int& v) -> void { - VERIFY_ARE_EQUAL(42, v); - handledOne++; - }; - - helper.MyEvent(handler); - - til::forwarded_event ForwardedEvent{ helper.MyEvent }; - - ForwardedEvent([&](int) { handledTwo++; }); - - ForwardedEvent.raise(42); - - VERIFY_ARE_EQUAL(1, handledOne); - VERIFY_ARE_EQUAL(1, handledTwo); - - helper.MyEvent.raise(42); - - VERIFY_ARE_EQUAL(2, handledOne); - VERIFY_ARE_EQUAL(2, handledTwo); - - til::forwarded_event LayersOnLayers{ ForwardedEvent }; - LayersOnLayers.raise(42); - - VERIFY_ARE_EQUAL(3, handledOne); - VERIFY_ARE_EQUAL(3, handledTwo); -} diff --git a/src/inc/til/winrt.h b/src/inc/til/winrt.h index c4843169881..e7d483740fb 100644 --- a/src/inc/til/winrt.h +++ b/src/inc/til/winrt.h @@ -8,7 +8,7 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" template struct property { - property() = default; + property(){}; property(T defaultValue) : _value{ defaultValue } {} T& operator()() @@ -39,7 +39,6 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" template struct event { - event() = default; winrt::event_token operator()(const ArgsT& handler) { return _handlers.add(handler); } void operator()(const winrt::event_token& token) { _handlers.remove(token); } template @@ -50,24 +49,6 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned" winrt::event _handlers; }; - template - struct forwarded_event - { - forwarded_event() = delete; - forwarded_event(event& other) : - _origin{ other } {} - forwarded_event(forwarded_event& other) : - _origin{ other._origin } {} - - winrt::event_token operator()(const ArgsT& handler) { return _origin(handler); } - void operator()(const winrt::event_token& token) { _origin(token); } - template - void raise(Arg const&... args) - { - _origin.raise(args...); - } - event& _origin; - }; #endif } From a1d532901cb32caca8ac885b42c2c502da2757e3 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sun, 5 Feb 2023 15:30:32 -0600 Subject: [PATCH 25/29] Revert "okay maybe I have silly free time ideas too" This reverts commit eaf1a920e1a4d5a4ea349ed0036f3fa520709212. --- .../TilWinRtHelpersTests.cpp | 74 ------------------- .../UnitTests_TerminalCore/UnitTests.vcxproj | 1 - src/inc/til/winrt.h | 54 -------------- 3 files changed, 129 deletions(-) delete mode 100644 src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp delete mode 100644 src/inc/til/winrt.h diff --git a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp b/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp deleted file mode 100644 index 7a5d1e8843f..00000000000 --- a/src/cascadia/UnitTests_TerminalCore/TilWinRtHelpersTests.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -#include "pch.h" -#include - -#include - -#include "../renderer/inc/DummyRenderer.hpp" -#include "../renderer/base/Renderer.hpp" -#include "../renderer/dx/DxRenderer.hpp" - -#include "../cascadia/TerminalCore/Terminal.hpp" -#include "MockTermSettings.h" -#include "consoletaeftemplates.hpp" -#include "../../inc/TestUtils.h" - -#include - -using namespace winrt::Microsoft::Terminal::Core; -using namespace Microsoft::Terminal::Core; -using namespace Microsoft::Console::Render; -using namespace ::Microsoft::Console::Types; - -using namespace WEX::Common; -using namespace WEX::Logging; -using namespace WEX::TestExecution; - -namespace TerminalCoreUnitTests -{ - class TilWinRtHelpersTests; -}; -using namespace TerminalCoreUnitTests; - -class TerminalCoreUnitTests::TilWinRtHelpersTests final -{ - TEST_CLASS(TilWinRtHelpersTests); - TEST_METHOD(TestPropertySimple); - TEST_METHOD(TestEvent); -}; - -void TilWinRtHelpersTests::TestPropertySimple() -{ - til::property Foo; - til::property Bar(11); - - VERIFY_ARE_EQUAL(11, Bar()); - - Foo(42); - VERIFY_ARE_EQUAL(42, Foo()); - - Foo = Foo() - 5; // 37 - VERIFY_ARE_EQUAL(37, Foo()); - - Foo() += Bar(); // 48 - VERIFY_ARE_EQUAL(48, Foo()); -} - -void TilWinRtHelpersTests::TestEvent() -{ - bool handledOne = false; - bool handledTwo = false; - auto handler = [&](const int& v) -> void { - VERIFY_ARE_EQUAL(42, v); - handledOne = true; - }; - - til::event> MyEvent; - MyEvent(handler); - MyEvent([&](int) { handledTwo = true; }); - MyEvent.raise(42); - VERIFY_ARE_EQUAL(true, handledOne); - VERIFY_ARE_EQUAL(true, handledTwo); -} diff --git a/src/cascadia/UnitTests_TerminalCore/UnitTests.vcxproj b/src/cascadia/UnitTests_TerminalCore/UnitTests.vcxproj index 94967d5b0ed..d8ddd1fef74 100644 --- a/src/cascadia/UnitTests_TerminalCore/UnitTests.vcxproj +++ b/src/cascadia/UnitTests_TerminalCore/UnitTests.vcxproj @@ -26,7 +26,6 @@ - diff --git a/src/inc/til/winrt.h b/src/inc/til/winrt.h deleted file mode 100644 index e7d483740fb..00000000000 --- a/src/inc/til/winrt.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -#pragma once - -namespace til // Terminal Implementation Library. Also: "Today I Learned" -{ - template - struct property - { - property(){}; - property(T defaultValue) : - _value{ defaultValue } {} - T& operator()() - { - return _value; - } - void operator()(const T& value) - { - _value = value; - } - property& operator=(const property& other) - { - _value = other._value; - return *this; - } - property& operator=(const T& newValue) - { - _value = newValue; - return *this; - } - - private: - T _value; - }; - -#ifdef WINRT_Windows_Foundation_H - - template - struct event - { - winrt::event_token operator()(const ArgsT& handler) { return _handlers.add(handler); } - void operator()(const winrt::event_token& token) { _handlers.remove(token); } - template - void raise(Arg const&... args) - { - _handlers(args...); - } - winrt::event _handlers; - }; - -#endif - -} From daddcf171ef4f0ebdd5d29f2c988b707e43c2398 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Wed, 8 Mar 2023 12:32:53 -0600 Subject: [PATCH 26/29] the easy nits --- src/cascadia/TerminalApp/TerminalPage.cpp | 18 +++++++++++------- .../TerminalControl/ControlInteractivity.cpp | 16 ++-------------- src/cascadia/TerminalControl/EventArgs.h | 5 ++--- src/cascadia/TerminalControl/EventArgs.idl | 1 - src/cascadia/TerminalControl/TermControl.cpp | 11 +++-------- 5 files changed, 18 insertions(+), 33 deletions(-) diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index 65b96570195..d7d53b1a22e 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -4459,12 +4459,12 @@ namespace winrt::TerminalApp::implementation void TerminalPage::_ContextMenuOpened(const IInspectable& sender, const IInspectable& /*args*/) { - _PopulateContextMenu(sender, false); + _PopulateContextMenu(sender, false /*withSelection*/); } void TerminalPage::_SelectionMenuOpened(const IInspectable& sender, const IInspectable& /*args*/) { - _PopulateContextMenu(sender, true); + _PopulateContextMenu(sender, true /*withSelection*/); } void TerminalPage::_PopulateContextMenu(const IInspectable& sender, @@ -4474,14 +4474,18 @@ namespace winrt::TerminalApp::implementation // selected text, like "search the web". In this initial draft, it's not // actually augmented by the TerminalPage, so it's left commented out. - auto menu = sender.try_as(); + const auto& menu{ sender.try_as() }; + if (!menu) + { + return; + } // Helper lambda for dispatching an ActionAndArgs onto the // ShortcutActionDispatch. Used below to wire up each menu entry to the // respective action. auto weak = get_weak(); - auto makeCallback = [weak](const Microsoft::Terminal::Settings::Model::ActionAndArgs& actionAndArgs) { + auto makeCallback = [weak](const ActionAndArgs& actionAndArgs) { return [weak, actionAndArgs](auto&&, auto&&) { if (auto page{ weak.get() }) { @@ -4490,9 +4494,9 @@ namespace winrt::TerminalApp::implementation }; }; - auto makeItem = [menu, makeCallback](const winrt::hstring& label, - const winrt::hstring& icon, - const auto& action) { + auto makeItem = [&menu, &makeCallback](const winrt::hstring& label, + const winrt::hstring& icon, + const auto& action) { AppBarButton button{}; if (!icon.empty()) diff --git a/src/cascadia/TerminalControl/ControlInteractivity.cpp b/src/cascadia/TerminalControl/ControlInteractivity.cpp index e29e7d40fb1..b4b6915c7db 100644 --- a/src/cascadia/TerminalControl/ControlInteractivity.cpp +++ b/src/cascadia/TerminalControl/ControlInteractivity.cpp @@ -258,20 +258,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation { if (_core->Settings().RightClickContextMenu()) { - auto bufferText = _core->SelectedText(true); - std::wstring singleString = L""; - for (const auto& line : bufferText) - { - if (!singleString.empty()) - { - singleString += L"\r\n"; - } - singleString += line; - }; - auto contextArgs = winrt::make_self(winrt::hstring{ singleString }, - til::point{ pixelPosition }.to_winrt_point()); - - _ContextMenuRequestedHandlers(*this, *contextArgs); + auto contextArgs = winrt::make(til::point{ pixelPosition }.to_winrt_point()); + _ContextMenuRequestedHandlers(*this, contextArgs); } else { diff --git a/src/cascadia/TerminalControl/EventArgs.h b/src/cascadia/TerminalControl/EventArgs.h index 7444c4a517a..d473bcfcae0 100644 --- a/src/cascadia/TerminalControl/EventArgs.h +++ b/src/cascadia/TerminalControl/EventArgs.h @@ -57,10 +57,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation struct ContextMenuRequestedEventArgs : public ContextMenuRequestedEventArgsT { public: - ContextMenuRequestedEventArgs(const hstring& selectedText, winrt::Windows::Foundation::Point point) : - _SelectedText(selectedText), _Point(point) {} + ContextMenuRequestedEventArgs(winrt::Windows::Foundation::Point point) : + _Point(point) {} - WINRT_PROPERTY(winrt::hstring, SelectedText, L""); WINRT_PROPERTY(winrt::Windows::Foundation::Point, Point); }; diff --git a/src/cascadia/TerminalControl/EventArgs.idl b/src/cascadia/TerminalControl/EventArgs.idl index cb9fe61b662..e97b89da536 100644 --- a/src/cascadia/TerminalControl/EventArgs.idl +++ b/src/cascadia/TerminalControl/EventArgs.idl @@ -24,7 +24,6 @@ namespace Microsoft.Terminal.Control runtimeclass ContextMenuRequestedEventArgs { - String SelectedText { get; }; Windows.Foundation.Point Point { get; }; } diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 06151d36e3f..4731c925901 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -3250,14 +3250,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation const auto pos = (absolutePointerPos - absoluteWindowOrigin - controlOrigin).to_winrt_point(); myOption.Position(pos); - if (args.SelectedText().empty()) - { - ContextMenu().ShowAt(*this, myOption); - } - else - { - SelectionContextMenu().ShowAt(*this, myOption); - } + (_core.HasSelection() ? SelectionContextMenu() : + ContextMenu()) + .ShowAt(*this, myOption); } void TermControl::_PasteCommandHandler(const IInspectable& /*sender*/, From 6674df72c4f3cadc3b32fb68f18636927a9fac8e Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Thu, 16 Mar 2023 16:05:42 -0500 Subject: [PATCH 27/29] Use MUX in TermControl for fun and profit and faster menu opening --- src/cascadia/TerminalApp/TerminalPage.cpp | 2 +- src/cascadia/TerminalControl/TermControl.idl | 4 ++-- src/cascadia/TerminalControl/TermControl.xaml | 13 +++++++------ .../TerminalControl/TerminalControlLib.vcxproj | 1 + .../TerminalControl/dll/TerminalControl.vcxproj | 1 + src/cascadia/TerminalControl/pch.h | 4 ++++ src/cascadia/TerminalSettingsModel/ActionArgs.h | 1 - src/cascadia/TerminalSettingsModel/ActionArgs.idl | 1 - 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index d7d53b1a22e..1a86058d693 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -4474,7 +4474,7 @@ namespace winrt::TerminalApp::implementation // selected text, like "search the web". In this initial draft, it's not // actually augmented by the TerminalPage, so it's left commented out. - const auto& menu{ sender.try_as() }; + const auto& menu{ sender.try_as() }; if (!menu) { return; diff --git a/src/cascadia/TerminalControl/TermControl.idl b/src/cascadia/TerminalControl/TermControl.idl index b47093ca458..3c9f794f42c 100644 --- a/src/cascadia/TerminalControl/TermControl.idl +++ b/src/cascadia/TerminalControl/TermControl.idl @@ -45,8 +45,8 @@ namespace Microsoft.Terminal.Control event Windows.Foundation.TypedEventHandler ReadOnlyChanged; event Windows.Foundation.TypedEventHandler FocusFollowMouseRequested; - Windows.UI.Xaml.Controls.CommandBarFlyout ContextMenu { get; }; - Windows.UI.Xaml.Controls.CommandBarFlyout SelectionContextMenu { get; }; + Microsoft.UI.Xaml.Controls.CommandBarFlyout ContextMenu { get; }; + Microsoft.UI.Xaml.Controls.CommandBarFlyout SelectionContextMenu { get; }; event Windows.Foundation.TypedEventHandler Initialized; // This is an event handler forwarder for the underlying connection. diff --git a/src/cascadia/TerminalControl/TermControl.xaml b/src/cascadia/TerminalControl/TermControl.xaml index 0d80d75309a..58b5c8b08d0 100644 --- a/src/cascadia/TerminalControl/TermControl.xaml +++ b/src/cascadia/TerminalControl/TermControl.xaml @@ -10,6 +10,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:Microsoft.Terminal.Control" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:mux="using:Microsoft.UI.Xaml.Controls" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" d:DesignHeight="768" @@ -31,14 +32,14 @@ mc:Ignorable="d"> - + - + - + - + - - + +