mirror of
https://github.com/microsoft/terminal.git
synced 2026-05-18 18:56:25 +00:00
This makes command expansion the TerminalPage's responsibility, but it also only does it when the settings are reloaded. Lets try doing it every time the list of tabs changes
This commit is contained in:
@@ -731,9 +731,9 @@ std::string CascadiaSettings::_ApplyFirstRunChangesToSettingsTemplate(std::strin
|
||||
// - <none>
|
||||
void CascadiaSettings::_ExpandCommands()
|
||||
{
|
||||
winrt::TerminalApp::implementation::Command::ExpandCommands(_globals.GetCommands(),
|
||||
_profiles,
|
||||
_warnings);
|
||||
// winrt::TerminalApp::implementation::Command::ExpandCommands(_globals.GetCommands(),
|
||||
// _profiles,
|
||||
// _warnings);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
||||
@@ -306,7 +306,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void Command::ExpandCommands(std::unordered_map<winrt::hstring, winrt::TerminalApp::Command>& commands,
|
||||
const std::vector<::TerminalApp::Profile>& profiles,
|
||||
gsl::span<const ::TerminalApp::Profile> profiles,
|
||||
std::vector<::TerminalApp::SettingsLoadWarnings>& warnings)
|
||||
{
|
||||
std::vector<winrt::hstring> commandsToRemove;
|
||||
@@ -386,7 +386,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - and empty vector if the command wasn't expandable, otherwise a list of
|
||||
// the newly-created commands.
|
||||
std::vector<winrt::TerminalApp::Command> Command::_expandCommand(winrt::com_ptr<Command> expandable,
|
||||
const std::vector<::TerminalApp::Profile>& profiles,
|
||||
gsl::span<const ::TerminalApp::Profile> profiles,
|
||||
std::vector<::TerminalApp::SettingsLoadWarnings>& warnings)
|
||||
{
|
||||
std::vector<winrt::TerminalApp::Command> newCommands;
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace winrt::TerminalApp::implementation
|
||||
std::vector<::TerminalApp::SettingsLoadWarnings>& warnings);
|
||||
|
||||
static void ExpandCommands(std::unordered_map<winrt::hstring, winrt::TerminalApp::Command>& commands,
|
||||
const std::vector<::TerminalApp::Profile>& profiles,
|
||||
gsl::span<const ::TerminalApp::Profile> profiles,
|
||||
std::vector<::TerminalApp::SettingsLoadWarnings>& warnings);
|
||||
|
||||
static std::vector<::TerminalApp::SettingsLoadWarnings> LayerJson(std::unordered_map<winrt::hstring, winrt::TerminalApp::Command>& commands,
|
||||
@@ -66,7 +66,7 @@ namespace winrt::TerminalApp::implementation
|
||||
Windows::Foundation::Collections::IVector<TerminalApp::Command> _nestedCommandsView{ nullptr };
|
||||
|
||||
static std::vector<winrt::TerminalApp::Command> _expandCommand(winrt::com_ptr<Command> expandable,
|
||||
const std::vector<::TerminalApp::Profile>& profiles,
|
||||
gsl::span<const ::TerminalApp::Profile> profiles,
|
||||
std::vector<::TerminalApp::SettingsLoadWarnings>& warnings);
|
||||
void _createView();
|
||||
|
||||
|
||||
@@ -1982,9 +1982,16 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
void TerminalPage::_UpdateCommandsForPalette()
|
||||
{
|
||||
std::vector<::TerminalApp::SettingsLoadWarnings> warnings;
|
||||
std::unordered_map<winrt::hstring, winrt::TerminalApp::Command> copyOfCommands = _settings->GlobalSettings().GetCommands();
|
||||
|
||||
Command::ExpandCommands(copyOfCommands,
|
||||
_settings->GetProfiles(),
|
||||
warnings);
|
||||
|
||||
// Update the command palette when settings reload
|
||||
auto commandsCollection = winrt::single_threaded_vector<winrt::TerminalApp::Command>();
|
||||
for (auto& nameAndCommand : _settings->GlobalSettings().GetCommands())
|
||||
for (auto& nameAndCommand : copyOfCommands)
|
||||
{
|
||||
commandsCollection.Append(nameAndCommand.second);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user