Default initialize a CmdPal mode (#7263)
Whoops, members are zero initialized in Debug builds but most likely not in Release builds So, this PR adds a couple of default values to `_currentMode` and its associated XAML strings to make cmdpal/ats work deterministically on first use. I also added a default value to `_anchorKey` just to be safe. Closes #7254
This commit is contained in:
parent
a02a29783e
commit
93ae6b6dba
|
@ -22,6 +22,7 @@ using namespace winrt::Windows::Foundation::Collections;
|
||||||
namespace winrt::TerminalApp::implementation
|
namespace winrt::TerminalApp::implementation
|
||||||
{
|
{
|
||||||
CommandPalette::CommandPalette() :
|
CommandPalette::CommandPalette() :
|
||||||
|
_anchorKey{ VirtualKey::None },
|
||||||
_switcherStartIdx{ 0 }
|
_switcherStartIdx{ 0 }
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
@ -30,6 +31,8 @@ namespace winrt::TerminalApp::implementation
|
||||||
_allCommands = winrt::single_threaded_vector<winrt::TerminalApp::Command>();
|
_allCommands = winrt::single_threaded_vector<winrt::TerminalApp::Command>();
|
||||||
_allTabActions = winrt::single_threaded_vector<winrt::TerminalApp::Command>();
|
_allTabActions = winrt::single_threaded_vector<winrt::TerminalApp::Command>();
|
||||||
|
|
||||||
|
_switchToMode(CommandPaletteMode::ActionMode);
|
||||||
|
|
||||||
if (CommandPaletteShadow())
|
if (CommandPaletteShadow())
|
||||||
{
|
{
|
||||||
// Hook up the shadow on the command palette to the backdrop that
|
// Hook up the shadow on the command palette to the backdrop that
|
||||||
|
@ -389,7 +392,11 @@ namespace winrt::TerminalApp::implementation
|
||||||
{
|
{
|
||||||
_filteredActions.Append(action);
|
_filteredActions.Append(action);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Leaving this block of code outside the above if-statement
|
||||||
|
// guarantees that the correct text is shown for the mode
|
||||||
|
// whenever _switchToMode is called.
|
||||||
switch (_currentMode)
|
switch (_currentMode)
|
||||||
{
|
{
|
||||||
case CommandPaletteMode::TabSwitcherMode:
|
case CommandPaletteMode::TabSwitcherMode:
|
||||||
|
@ -407,7 +414,6 @@ namespace winrt::TerminalApp::implementation
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// This is a helper to aid in sorting commands by their `Name`s, alphabetically.
|
// This is a helper to aid in sorting commands by their `Name`s, alphabetically.
|
||||||
static bool _compareCommandNames(const TerminalApp::Command& lhs, const TerminalApp::Command& rhs)
|
static bool _compareCommandNames(const TerminalApp::Command& lhs, const TerminalApp::Command& rhs)
|
||||||
|
|
Loading…
Reference in a new issue