From bb60db76fbd381b7b054f1919f1aa4097a226956 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Tue, 10 Dec 2019 22:23:24 -0600 Subject: [PATCH] Re-add the keychords to the new tab flyout (#3903) ## Summary of the Pull Request On this month's episode of "Mike accidentally breaks this": Mike forgets that `==` is defined on a pair of winrt objects as "do these point to the _SAME_ object", not "do they have the same values". This just slipped right through code review. ## References Broken in #3825 ## PR Checklist * [x] Closes #3896 * [x] I work here * [ ] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments ## Validation Steps Performed Manually checked that these are still there --- src/cascadia/TerminalApp/ActionArgs.h | 19 +++++++------------ src/cascadia/TerminalApp/ActionArgs.idl | 1 + 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/cascadia/TerminalApp/ActionArgs.h b/src/cascadia/TerminalApp/ActionArgs.h index 0cbd7ff2193..5ccd365d88e 100644 --- a/src/cascadia/TerminalApp/ActionArgs.h +++ b/src/cascadia/TerminalApp/ActionArgs.h @@ -51,18 +51,13 @@ namespace winrt::TerminalApp::implementation static constexpr std::string_view ProfileKey{ "profile" }; public: - bool Equals(const IActionArgs& other) + bool Equals(const winrt::TerminalApp::NewTerminalArgs& other) { - auto otherAsUs = other.try_as(); - if (otherAsUs) - { - return otherAsUs->_Commandline == _Commandline && - otherAsUs->_StartingDirectory == _StartingDirectory && - otherAsUs->_TabTitle == _TabTitle && - otherAsUs->_ProfileIndex == _ProfileIndex && - otherAsUs->_Profile == _Profile; - } - return false; + return other.Commandline() == _Commandline && + other.StartingDirectory() == _StartingDirectory && + other.TabTitle() == _TabTitle && + other.ProfileIndex() == _ProfileIndex && + other.Profile() == _Profile; }; static winrt::TerminalApp::NewTerminalArgs FromJson(const Json::Value& json) { @@ -132,7 +127,7 @@ namespace winrt::TerminalApp::implementation auto otherAsUs = other.try_as(); if (otherAsUs) { - return otherAsUs->_TerminalArgs == _TerminalArgs; + return otherAsUs->_TerminalArgs.Equals(_TerminalArgs); } return false; }; diff --git a/src/cascadia/TerminalApp/ActionArgs.idl b/src/cascadia/TerminalApp/ActionArgs.idl index e55f0338ce8..2884afe0f80 100644 --- a/src/cascadia/TerminalApp/ActionArgs.idl +++ b/src/cascadia/TerminalApp/ActionArgs.idl @@ -39,6 +39,7 @@ namespace TerminalApp // ProfileIndex can be null (for "use the default"), so this needs to be // a IReference, so it's nullable Windows.Foundation.IReference ProfileIndex { get; }; + Boolean Equals(NewTerminalArgs other); }; [default_interface] runtimeclass ActionEventArgs : IActionEventArgs