mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 00:48:23 -06:00
Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor
This commit is contained in:
commit
64dfb945b0
@ -592,7 +592,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
NewTabArgs() = default;
|
||||
NewTabArgs(const Model::INewContentArgs& terminalArgs) :
|
||||
_ContentArgs{ terminalArgs } {};
|
||||
WINRT_PROPERTY(Model::INewContentArgs, ContentArgs, Model::NewTerminalArgs{});
|
||||
WINRT_PROPERTY(Model::INewContentArgs, ContentArgs, nullptr);
|
||||
|
||||
public:
|
||||
hstring GenerateName() const { return GenerateName(GetLibraryResourceLoader().ResourceContext()); }
|
||||
@ -640,9 +640,9 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
{
|
||||
if (_ContentArgs)
|
||||
{
|
||||
if (const auto newTermArgs = _ContentArgs.try_as<NewTerminalArgs>())
|
||||
if (const auto contentArgs = _ContentArgs.try_as<IActionArgsDescriptorAccess>())
|
||||
{
|
||||
return newTermArgs->GetArgDescriptors();
|
||||
return contentArgs.GetArgDescriptors();
|
||||
}
|
||||
}
|
||||
return {};
|
||||
@ -651,9 +651,9 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
{
|
||||
if (_ContentArgs)
|
||||
{
|
||||
if (const auto newTermArgs = _ContentArgs.try_as<NewTerminalArgs>())
|
||||
if (const auto contentArgs = _ContentArgs.try_as<IActionArgsDescriptorAccess>())
|
||||
{
|
||||
return newTermArgs->GetArgAt(index);
|
||||
return contentArgs.GetArgAt(index);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
@ -662,9 +662,9 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
{
|
||||
if (_ContentArgs)
|
||||
{
|
||||
if (const auto newTermArgs = _ContentArgs.try_as<NewTerminalArgs>())
|
||||
if (const auto contentArgs = _ContentArgs.try_as<IActionArgsDescriptorAccess>())
|
||||
{
|
||||
newTermArgs->SetArgAt(index, value);
|
||||
contentArgs.SetArgAt(index, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -689,7 +689,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
_SplitMode{ splitMode } {};
|
||||
|
||||
SPLIT_PANE_ARGS(DECLARE_ARGS);
|
||||
WINRT_PROPERTY(Model::INewContentArgs, ContentArgs, Model::NewTerminalArgs{});
|
||||
WINRT_PROPERTY(Model::INewContentArgs, ContentArgs, nullptr);
|
||||
|
||||
public:
|
||||
hstring GenerateName() const { return GenerateName(GetLibraryResourceLoader().ResourceContext()); }
|
||||
@ -757,33 +757,39 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
}
|
||||
winrt::Windows::Foundation::Collections::IVectorView<Model::ArgDescriptor> GetArgDescriptors()
|
||||
{
|
||||
static const auto thisArgs = INIT_ARG_DESCRIPTORS(SPLIT_PANE_ARGS);
|
||||
// Base args for SplitPane
|
||||
static const auto baseArgs = INIT_ARG_DESCRIPTORS(SPLIT_PANE_ARGS);
|
||||
|
||||
// Merge into a new vector
|
||||
std::vector<Model::ArgDescriptor> merged;
|
||||
// Cached merged variant: SplitPane + NewTerminalArgs
|
||||
static const auto mergedArgs = [] {
|
||||
std::vector<Model::ArgDescriptor> temp;
|
||||
|
||||
for (const auto desc : thisArgs)
|
||||
{
|
||||
merged.push_back(desc);
|
||||
}
|
||||
|
||||
if (_ContentArgs)
|
||||
{
|
||||
if (const auto newTermArgs = _ContentArgs.try_as<NewTerminalArgs>())
|
||||
// copy baseArgs
|
||||
for (const auto& desc : baseArgs)
|
||||
{
|
||||
auto contentArgs = newTermArgs->GetArgDescriptors();
|
||||
for (const auto desc : contentArgs)
|
||||
{
|
||||
merged.push_back(desc);
|
||||
}
|
||||
temp.push_back(desc);
|
||||
}
|
||||
}
|
||||
|
||||
return winrt::single_threaded_vector(std::move(merged)).GetView();
|
||||
// append NewTerminalArgs args
|
||||
const auto newTerminalArgsDesc{ Model::NewTerminalArgs{}.GetArgDescriptors() };
|
||||
for (const auto& desc : newTerminalArgsDesc)
|
||||
{
|
||||
temp.push_back(desc);
|
||||
}
|
||||
|
||||
return winrt::single_threaded_vector(std::move(temp)).GetView();
|
||||
}();
|
||||
|
||||
// Pick which cached vector to return
|
||||
if (_ContentArgs && _ContentArgs.try_as<NewTerminalArgs>())
|
||||
{
|
||||
return mergedArgs;
|
||||
}
|
||||
return baseArgs;
|
||||
}
|
||||
IInspectable GetArgAt(uint32_t index)
|
||||
{
|
||||
const auto additionalArgCount = INIT_ARG_DESCRIPTORS(SPLIT_PANE_ARGS).Size();
|
||||
const auto additionalArgCount = ARG_COUNT(SPLIT_PANE_ARGS);
|
||||
if (index < additionalArgCount)
|
||||
{
|
||||
X_MACRO_INDEX_BASE();
|
||||
@ -791,13 +797,13 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
}
|
||||
else
|
||||
{
|
||||
return _ContentArgs.as<NewTerminalArgs>()->GetArgAt(index - additionalArgCount);
|
||||
return _ContentArgs.as<IActionArgsDescriptorAccess>().GetArgAt(index - additionalArgCount);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
void SetArgAt(uint32_t index, IInspectable value)
|
||||
{
|
||||
const auto additionalArgCount = INIT_ARG_DESCRIPTORS(SPLIT_PANE_ARGS).Size();
|
||||
const auto additionalArgCount = ARG_COUNT(SPLIT_PANE_ARGS);
|
||||
if (index < additionalArgCount)
|
||||
{
|
||||
X_MACRO_INDEX_BASE();
|
||||
@ -805,7 +811,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
}
|
||||
else
|
||||
{
|
||||
_ContentArgs.as<NewTerminalArgs>()->SetArgAt(index - additionalArgCount, value);
|
||||
_ContentArgs.as<IActionArgsDescriptorAccess>().SetArgAt(index - additionalArgCount, value);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -815,7 +821,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
NewWindowArgs() = default;
|
||||
NewWindowArgs(const Model::INewContentArgs& terminalArgs) :
|
||||
_ContentArgs{ terminalArgs } {};
|
||||
WINRT_PROPERTY(Model::INewContentArgs, ContentArgs, Model::NewTerminalArgs{});
|
||||
WINRT_PROPERTY(Model::INewContentArgs, ContentArgs, nullptr);
|
||||
|
||||
public:
|
||||
hstring GenerateName() const { return GenerateName(GetLibraryResourceLoader().ResourceContext()); }
|
||||
@ -861,15 +867,15 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
}
|
||||
winrt::Windows::Foundation::Collections::IVectorView<Model::ArgDescriptor> GetArgDescriptors()
|
||||
{
|
||||
return _ContentArgs.as<NewTerminalArgs>()->GetArgDescriptors();
|
||||
return _ContentArgs.as<IActionArgsDescriptorAccess>().GetArgDescriptors();
|
||||
}
|
||||
IInspectable GetArgAt(uint32_t index) const
|
||||
{
|
||||
return _ContentArgs.as<NewTerminalArgs>()->GetArgAt(index);
|
||||
return _ContentArgs.as<IActionArgsDescriptorAccess>().GetArgAt(index);
|
||||
}
|
||||
void SetArgAt(uint32_t index, IInspectable value)
|
||||
{
|
||||
_ContentArgs.as<NewTerminalArgs>()->SetArgAt(index, value);
|
||||
_ContentArgs.as<IActionArgsDescriptorAccess>().SetArgAt(index, value);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -66,11 +66,17 @@ struct InitListPlaceholder
|
||||
#define CTOR_INIT(type, name, jsonKey, required, typeHint, ...) \
|
||||
_##name{ name##Param },
|
||||
|
||||
// Expands to `+1` for every arg in the list
|
||||
#define COUNT_ONE(type, name, jsonKey, required, typeHint, ...) +1
|
||||
|
||||
// Arg count macro
|
||||
#define ARG_COUNT(argsMacro) (0 argsMacro(COUNT_ONE))
|
||||
|
||||
#define ARG_DESC_STRINGIFY2(x) #x
|
||||
#define ARG_DESC_STRINGIFY(x) ARG_DESC_STRINGIFY2(x)
|
||||
#define ARG_DESC_WIDEN2(x) L##x
|
||||
#define ARG_DESC_WIDEN(x) ARG_DESC_WIDEN2(x)
|
||||
#define LOCALIZED_NAME(name) ARG_DESC_WIDEN(ARG_DESC_STRINGIFY(name##Localized))
|
||||
#define LOCALIZED_NAME(name) ARG_DESC_WIDEN(ARG_DESC_STRINGIFY(name##ActionArgumentLocalized))
|
||||
|
||||
// append this argument's description to the internal vector
|
||||
#define APPEND_ARG_DESCRIPTION(type, name, jsonKey, required, typeHint, ...) \
|
||||
@ -161,15 +167,7 @@ struct InitListPlaceholder
|
||||
// * GlobalSummonArgs has the QuakeModeFromJson helper
|
||||
|
||||
#define ACTION_ARG_BODY(className, argsMacro) \
|
||||
className() = default; \
|
||||
className( \
|
||||
argsMacro(CTOR_PARAMS) InitListPlaceholder = {}) : \
|
||||
argsMacro(CTOR_INIT) \
|
||||
_placeholder{} {}; \
|
||||
argsMacro(DECLARE_ARGS); \
|
||||
\
|
||||
private: \
|
||||
InitListPlaceholder _placeholder; \
|
||||
PARTIAL_ACTION_ARG_BODY(className, argsMacro) \
|
||||
\
|
||||
public: \
|
||||
hstring GenerateName() const \
|
||||
@ -216,21 +214,6 @@ public:
|
||||
til::hasher h; \
|
||||
argsMacro(HASH_ARGS); \
|
||||
return h.finalize(); \
|
||||
} \
|
||||
winrt::Windows::Foundation::Collections::IVectorView<ArgDescriptor> GetArgDescriptors() \
|
||||
{ \
|
||||
static const auto descriptors = INIT_ARG_DESCRIPTORS(argsMacro); \
|
||||
return descriptors; \
|
||||
} \
|
||||
IInspectable GetArgAt(uint32_t index) const \
|
||||
{ \
|
||||
X_MACRO_INDEX_BASE(); \
|
||||
argsMacro(GET_ARG_BY_INDEX) return nullptr; \
|
||||
} \
|
||||
void SetArgAt(uint32_t index, IInspectable value) \
|
||||
{ \
|
||||
X_MACRO_INDEX_BASE(); \
|
||||
argsMacro(SET_ARG_BY_INDEX) \
|
||||
}
|
||||
|
||||
#define PARTIAL_ACTION_ARG_BODY(className, argsMacro) \
|
||||
|
||||
@ -187,16 +187,97 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
|
||||
Model::IActionArgs ActionArgFactory::GetEmptyArgsForAction(Model::ShortcutAction shortcutAction)
|
||||
{
|
||||
// TODO: GH 19056 - we cannot cleanly macro this because of some special cases (SplitPaneArgs, NewTabArgs, NewWindowArgs)
|
||||
// where we initialize a NewTerminalArgs object to pass in to them because the settings UI cannot currently handle
|
||||
// a ContentArgs object that is not a NewTerminalArgs
|
||||
switch (shortcutAction)
|
||||
{
|
||||
#define ON_ALL_ACTIONS_WITH_ARGS(name) \
|
||||
case Model::ShortcutAction::name: \
|
||||
return winrt::make<name##Args>();
|
||||
|
||||
ALL_SHORTCUT_ACTIONS_WITH_ARGS
|
||||
|
||||
#undef ON_ALL_ACTIONS_WITH_ARGS
|
||||
|
||||
case Model::ShortcutAction::AdjustFontSize:
|
||||
return winrt::make<AdjustFontSizeArgs>();
|
||||
case Model::ShortcutAction::CloseOtherTabs:
|
||||
return winrt::make<CloseOtherTabsArgs>();
|
||||
case Model::ShortcutAction::CloseTabsAfter:
|
||||
return winrt::make<CloseTabsAfterArgs>();
|
||||
case Model::ShortcutAction::CloseTab:
|
||||
return winrt::make<CloseTabArgs>();
|
||||
case Model::ShortcutAction::CopyText:
|
||||
return winrt::make<CopyTextArgs>();
|
||||
case Model::ShortcutAction::ExecuteCommandline:
|
||||
return winrt::make<ExecuteCommandlineArgs>();
|
||||
case Model::ShortcutAction::FindMatch:
|
||||
return winrt::make<FindMatchArgs>();
|
||||
case Model::ShortcutAction::SearchForText:
|
||||
return winrt::make<SearchForTextArgs>();
|
||||
case Model::ShortcutAction::GlobalSummon:
|
||||
return winrt::make<GlobalSummonArgs>();
|
||||
case Model::ShortcutAction::MoveFocus:
|
||||
return winrt::make<MoveFocusArgs>();
|
||||
case Model::ShortcutAction::MovePane:
|
||||
return winrt::make<MovePaneArgs>();
|
||||
case Model::ShortcutAction::SwapPane:
|
||||
return winrt::make<SwapPaneArgs>();
|
||||
case Model::ShortcutAction::MoveTab:
|
||||
return winrt::make<MoveTabArgs>();
|
||||
case Model::ShortcutAction::NewTab:
|
||||
return winrt::make<NewTabArgs>(Model::NewTerminalArgs{});
|
||||
case Model::ShortcutAction::NewWindow:
|
||||
return winrt::make<NewWindowArgs>(Model::NewTerminalArgs{});
|
||||
case Model::ShortcutAction::NextTab:
|
||||
return winrt::make<NextTabArgs>();
|
||||
case Model::ShortcutAction::OpenSettings:
|
||||
return winrt::make<OpenSettingsArgs>();
|
||||
case Model::ShortcutAction::SetFocusMode:
|
||||
return winrt::make<SetFocusModeArgs>();
|
||||
case Model::ShortcutAction::SetFullScreen:
|
||||
return winrt::make<SetFullScreenArgs>();
|
||||
case Model::ShortcutAction::SetMaximized:
|
||||
return winrt::make<SetMaximizedArgs>();
|
||||
case Model::ShortcutAction::PrevTab:
|
||||
return winrt::make<PrevTabArgs>();
|
||||
case Model::ShortcutAction::RenameTab:
|
||||
return winrt::make<RenameTabArgs>();
|
||||
case Model::ShortcutAction::RenameWindow:
|
||||
return winrt::make<RenameWindowArgs>();
|
||||
case Model::ShortcutAction::ResizePane:
|
||||
return winrt::make<ResizePaneArgs>();
|
||||
case Model::ShortcutAction::ScrollDown:
|
||||
return winrt::make<ScrollDownArgs>();
|
||||
case Model::ShortcutAction::ScrollUp:
|
||||
return winrt::make<ScrollUpArgs>();
|
||||
case Model::ShortcutAction::ScrollToMark:
|
||||
return winrt::make<ScrollToMarkArgs>();
|
||||
case Model::ShortcutAction::AddMark:
|
||||
return winrt::make<AddMarkArgs>();
|
||||
case Model::ShortcutAction::SendInput:
|
||||
return winrt::make<SendInputArgs>();
|
||||
case Model::ShortcutAction::SetColorScheme:
|
||||
return winrt::make<SetColorSchemeArgs>();
|
||||
case Model::ShortcutAction::SetTabColor:
|
||||
return winrt::make<SetTabColorArgs>();
|
||||
case Model::ShortcutAction::SplitPane:
|
||||
return winrt::make<SplitPaneArgs>(SplitDirection::Automatic, Model::NewTerminalArgs{});
|
||||
case Model::ShortcutAction::SwitchToTab:
|
||||
return winrt::make<SwitchToTabArgs>();
|
||||
case Model::ShortcutAction::ToggleCommandPalette:
|
||||
return winrt::make<ToggleCommandPaletteArgs>();
|
||||
case Model::ShortcutAction::FocusPane:
|
||||
return winrt::make<FocusPaneArgs>();
|
||||
case Model::ShortcutAction::ExportBuffer:
|
||||
return winrt::make<ExportBufferArgs>();
|
||||
case Model::ShortcutAction::ClearBuffer:
|
||||
return winrt::make<ClearBufferArgs>();
|
||||
case Model::ShortcutAction::MultipleActions:
|
||||
return winrt::make<MultipleActionsArgs>();
|
||||
case Model::ShortcutAction::AdjustOpacity:
|
||||
return winrt::make<AdjustOpacityArgs>();
|
||||
case Model::ShortcutAction::Suggestions:
|
||||
return winrt::make<SuggestionsArgs>();
|
||||
case Model::ShortcutAction::SelectCommand:
|
||||
return winrt::make<SelectCommandArgs>();
|
||||
case Model::ShortcutAction::SelectOutput:
|
||||
return winrt::make<SelectOutputArgs>();
|
||||
case Model::ShortcutAction::ColorSelection:
|
||||
return winrt::make<ColorSelectionArgs>();
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
@ -580,7 +661,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
{
|
||||
const auto copiedCmd = winrt::get_self<Command>(cmd)->Copy();
|
||||
actionMap->_ActionMap.emplace(actionID, *copiedCmd);
|
||||
copiedCmd->IDChanged({ actionMap.get(), &ActionMap::_CommandIDChangedHandler });
|
||||
}
|
||||
|
||||
// Name --> Command
|
||||
@ -700,7 +780,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
}
|
||||
}
|
||||
}
|
||||
cmd.IDChanged({ this, &ActionMap::_CommandIDChangedHandler });
|
||||
_ActionMap.insert_or_assign(cmdID, cmd);
|
||||
}
|
||||
}
|
||||
@ -733,45 +812,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
_changeLog.emplace(KeysKey);
|
||||
}
|
||||
|
||||
void ActionMap::_CommandIDChangedHandler(const Model::Command& senderCmd, const winrt::hstring& oldID)
|
||||
{
|
||||
const auto newID = senderCmd.ID();
|
||||
if (newID != oldID)
|
||||
{
|
||||
if (const auto foundCmd{ _GetActionByID(newID) })
|
||||
{
|
||||
if (foundCmd.ActionAndArgs() != senderCmd.ActionAndArgs())
|
||||
{
|
||||
// we found a command that has the same ID as this one, but that command has different ActionAndArgs
|
||||
// this means that foundCommand's action and/or args have been changed since its ID was generated,
|
||||
// generate a new one for it
|
||||
// Note: this is recursive! Found command's ID being changed lands us back in here to resolve any cascading collisions
|
||||
foundCmd.GenerateID();
|
||||
}
|
||||
}
|
||||
// update _ActionMap with the ID change
|
||||
_ActionMap.erase(oldID);
|
||||
_ActionMap.emplace(newID, senderCmd);
|
||||
|
||||
// update _KeyMap so that all keys that pointed to the old ID now point to the new ID
|
||||
std::unordered_set<KeyChord, KeyChordHash, KeyChordEquality> keysToRemap{};
|
||||
for (const auto& [keys, cmdID] : _KeyMap)
|
||||
{
|
||||
if (cmdID == oldID)
|
||||
{
|
||||
keysToRemap.insert(keys);
|
||||
}
|
||||
}
|
||||
for (const auto& keys : keysToRemap)
|
||||
{
|
||||
_KeyMap.erase(keys);
|
||||
_KeyMap.emplace(keys, newID);
|
||||
}
|
||||
PropagateCommandIDChanged.raise(senderCmd, oldID);
|
||||
}
|
||||
_RefreshKeyBindingCaches();
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Determines whether the given key chord is explicitly unbound
|
||||
// Arguments:
|
||||
@ -1166,6 +1206,53 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
AddAction(*cmd, keys);
|
||||
}
|
||||
|
||||
void ActionMap::UpdateCommandID(const Model::Command& cmd, winrt::hstring newID)
|
||||
{
|
||||
const auto oldID = cmd.ID();
|
||||
if (newID.empty())
|
||||
{
|
||||
// if the new ID is empty, that means we need to generate a new one
|
||||
newID = winrt::get_self<implementation::ActionAndArgs>(cmd.ActionAndArgs())->GenerateID();
|
||||
}
|
||||
if (newID != oldID)
|
||||
{
|
||||
if (const auto foundCmd{ _GetActionByID(newID) })
|
||||
{
|
||||
const auto foundCmdActionAndArgs = foundCmd.ActionAndArgs();
|
||||
if (foundCmdActionAndArgs != cmd.ActionAndArgs())
|
||||
{
|
||||
// we found a command that has the same ID as this one, but that command has different ActionAndArgs
|
||||
// this means that foundCommand's action and/or args have been changed since its ID was generated,
|
||||
// generate a new one for it
|
||||
// Note: this is recursive! We're calling UpdateCommandID again wich lands us back in here to resolve any cascading collisions
|
||||
auto foundCmdNewID = winrt::get_self<implementation::ActionAndArgs>(foundCmdActionAndArgs)->GenerateID();
|
||||
UpdateCommandID(foundCmd, foundCmdNewID);
|
||||
}
|
||||
}
|
||||
cmd.ID(newID);
|
||||
// update _ActionMap with the ID change
|
||||
_ActionMap.erase(oldID);
|
||||
_ActionMap.emplace(newID, cmd);
|
||||
|
||||
// update _KeyMap so that all keys that pointed to the old ID now point to the new ID
|
||||
std::unordered_set<KeyChord, KeyChordHash, KeyChordEquality> keysToRemap{};
|
||||
for (const auto& [keys, cmdID] : _KeyMap)
|
||||
{
|
||||
if (cmdID == oldID)
|
||||
{
|
||||
keysToRemap.insert(keys);
|
||||
}
|
||||
}
|
||||
for (const auto& keys : keysToRemap)
|
||||
{
|
||||
_KeyMap.erase(keys);
|
||||
_KeyMap.emplace(keys, newID);
|
||||
}
|
||||
PropagateCommandIDChanged.raise(cmd, oldID);
|
||||
}
|
||||
_RefreshKeyBindingCaches();
|
||||
}
|
||||
|
||||
// Look for a .wt.json file in the given directory. If it exists,
|
||||
// read it, parse it's JSON, and retrieve all the sendInput actions.
|
||||
std::unordered_map<hstring, Model::Command> ActionMap::_loadLocalSnippets(const std::filesystem::path& currentWorkingDirectory)
|
||||
|
||||
@ -95,6 +95,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
void RegisterKeyBinding(Control::KeyChord keys, Model::ActionAndArgs action);
|
||||
void DeleteUserCommand(const winrt::hstring& cmdID);
|
||||
void AddSendInputAction(winrt::hstring name, winrt::hstring input, const Control::KeyChord keys);
|
||||
void UpdateCommandID(const Model::Command& cmd, winrt::hstring newID);
|
||||
|
||||
Windows::Foundation::Collections::IVector<Model::Command> ExpandedCommands();
|
||||
void ExpandCommands(const Windows::Foundation::Collections::IVectorView<Model::Profile>& profiles,
|
||||
@ -124,8 +125,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
|
||||
static std::unordered_map<hstring, Model::Command> _loadLocalSnippets(const std::filesystem::path& currentWorkingDirectory);
|
||||
|
||||
void _CommandIDChangedHandler(const Model::Command& senderCmd, const winrt::hstring& oldID);
|
||||
|
||||
Windows::Foundation::Collections::IMap<hstring, Model::ActionAndArgs> _AvailableActionsCache{ nullptr };
|
||||
Windows::Foundation::Collections::IMap<hstring, Model::Command> _NameMapCache{ nullptr };
|
||||
Windows::Foundation::Collections::IMap<Control::KeyChord, Model::Command> _GlobalHotkeysCache{ nullptr };
|
||||
|
||||
@ -47,5 +47,6 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
void AddKeyBinding(Microsoft.Terminal.Control.KeyChord keys, String cmdID);
|
||||
void RegisterKeyBinding(Microsoft.Terminal.Control.KeyChord keys, ActionAndArgs action);
|
||||
void AddSendInputAction(String name, String input, Microsoft.Terminal.Control.KeyChord keys);
|
||||
void UpdateCommandID(Command cmd, String newID);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,8 +9,6 @@
|
||||
#include "DefaultTerminal.h"
|
||||
#include "FileUtils.h"
|
||||
|
||||
#include "AllShortcutActions.h"
|
||||
|
||||
#include <LibraryResources.h>
|
||||
#include <VersionHelpers.h>
|
||||
#include <WtExeUtils.h>
|
||||
|
||||
@ -5,7 +5,6 @@ import "GlobalAppSettings.idl";
|
||||
import "Profile.idl";
|
||||
import "TerminalWarnings.idl";
|
||||
import "DefaultTerminal.idl";
|
||||
import "ActionArgs.idl";
|
||||
|
||||
namespace Microsoft.Terminal.Settings.Model
|
||||
{
|
||||
|
||||
@ -214,9 +214,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
|
||||
void Command::ID(const hstring& ID) noexcept
|
||||
{
|
||||
const auto oldID = _ID;
|
||||
_ID = ID;
|
||||
IDChanged.raise(*this, oldID);
|
||||
}
|
||||
|
||||
void Command::GenerateID()
|
||||
|
||||
@ -102,9 +102,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
WINRT_PROPERTY(OriginTag, Origin);
|
||||
WINRT_PROPERTY(winrt::hstring, Description, L"");
|
||||
|
||||
public:
|
||||
til::typed_event<Model::Command, winrt::hstring> IDChanged;
|
||||
|
||||
private:
|
||||
Json::Value _originalJson;
|
||||
Windows::Foundation::Collections::IMap<winrt::hstring, Model::Command> _subcommands{ nullptr };
|
||||
|
||||
@ -55,7 +55,5 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
|
||||
static IVector<Command> ParsePowerShellMenuComplete(String json, Int32 replaceLength);
|
||||
static IVector<Command> HistoryToCommands(IVector<String> commandHistory, String commandline, Boolean directories, String iconPath);
|
||||
|
||||
event Windows.Foundation.TypedEventHandler<Command, String> IDChanged;
|
||||
}
|
||||
}
|
||||
|
||||
@ -415,7 +415,7 @@
|
||||
<value>Clear all marks</value>
|
||||
</data>
|
||||
<data name="SendInputCommandKey" xml:space="preserve">
|
||||
<value>Send Input: "{0}"</value>
|
||||
<value>Send input: "{0}"</value>
|
||||
<comment>{0} will be replaced with a string of input as defined by the user</comment>
|
||||
</data>
|
||||
<data name="SetColorSchemeCommandKey" xml:space="preserve">
|
||||
@ -820,160 +820,160 @@
|
||||
<value>SSH Host Profile Generator</value>
|
||||
<comment>The display name of a dynamic profile generator for SSH hosts</comment>
|
||||
</data>
|
||||
<data name="DismissSelectionLocalized" xml:space="preserve">
|
||||
<data name="DismissSelectionActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Dismiss Selection</value>
|
||||
</data>
|
||||
<data name="SingleLineLocalized" xml:space="preserve">
|
||||
<data name="SingleLineActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Single Line</value>
|
||||
</data>
|
||||
<data name="WithControlSequencesLocalized" xml:space="preserve">
|
||||
<data name="WithControlSequencesActionArgumentLocalized" xml:space="preserve">
|
||||
<value>With Control Sequences</value>
|
||||
</data>
|
||||
<data name="CopyFormattingLocalized" xml:space="preserve">
|
||||
<data name="CopyFormattingActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Copy Formatting</value>
|
||||
</data>
|
||||
<data name="TabIndexLocalized" xml:space="preserve">
|
||||
<data name="TabIndexActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Tab Index</value>
|
||||
</data>
|
||||
<data name="WindowLocalized" xml:space="preserve">
|
||||
<data name="WindowActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Window</value>
|
||||
</data>
|
||||
<data name="ResizeDirectionLocalized" xml:space="preserve">
|
||||
<data name="ResizeDirectionActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Resize Direction</value>
|
||||
</data>
|
||||
<data name="FocusDirectionLocalized" xml:space="preserve">
|
||||
<data name="FocusDirectionActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Focus Direction</value>
|
||||
</data>
|
||||
<data name="DirectionLocalized" xml:space="preserve">
|
||||
<data name="DirectionActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Direction</value>
|
||||
</data>
|
||||
<data name="DeltaLocalized" xml:space="preserve">
|
||||
<data name="DeltaActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Delta</value>
|
||||
</data>
|
||||
<data name="InputLocalized" xml:space="preserve">
|
||||
<data name="InputActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Input</value>
|
||||
</data>
|
||||
<data name="TargetLocalized" xml:space="preserve">
|
||||
<data name="TargetActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Target</value>
|
||||
</data>
|
||||
<data name="IsFocusModeLocalized" xml:space="preserve">
|
||||
<data name="IsFocusModeActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Is Focus Mode</value>
|
||||
</data>
|
||||
<data name="IsMaximizedLocalized" xml:space="preserve">
|
||||
<data name="IsMaximizedActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Is Maximized</value>
|
||||
</data>
|
||||
<data name="IsFullScreenLocalized" xml:space="preserve">
|
||||
<data name="IsFullScreenActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Is Full Screen</value>
|
||||
</data>
|
||||
<data name="SchemeNameLocalized" xml:space="preserve">
|
||||
<data name="SchemeNameActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Scheme Name</value>
|
||||
</data>
|
||||
<data name="TabColorLocalized" xml:space="preserve">
|
||||
<data name="TabColorActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Tab Color</value>
|
||||
</data>
|
||||
<data name="TitleLocalized" xml:space="preserve">
|
||||
<data name="TitleActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Title</value>
|
||||
</data>
|
||||
<data name="CommandlineLocalized" xml:space="preserve">
|
||||
<data name="CommandlineActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Commandline</value>
|
||||
</data>
|
||||
<data name="IndexLocalized" xml:space="preserve">
|
||||
<data name="IndexActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Index</value>
|
||||
</data>
|
||||
<data name="RowsToScrollLocalized" xml:space="preserve">
|
||||
<data name="RowsToScrollActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Rows To Scroll</value>
|
||||
</data>
|
||||
<data name="ColorLocalized" xml:space="preserve">
|
||||
<data name="ColorActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Color</value>
|
||||
</data>
|
||||
<data name="LaunchModeLocalized" xml:space="preserve">
|
||||
<data name="LaunchModeActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Launch Mode</value>
|
||||
</data>
|
||||
<data name="NameLocalized" xml:space="preserve">
|
||||
<data name="NameActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Name</value>
|
||||
</data>
|
||||
<data name="KeyChordLocalized" xml:space="preserve">
|
||||
<data name="KeyChordActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Key Chord</value>
|
||||
</data>
|
||||
<data name="SourceLocalized" xml:space="preserve">
|
||||
<data name="SourceActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Source</value>
|
||||
</data>
|
||||
<data name="UseCommandlineLocalized" xml:space="preserve">
|
||||
<data name="UseCommandlineActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Use Commandline</value>
|
||||
</data>
|
||||
<data name="SwitcherModeLocalized" xml:space="preserve">
|
||||
<data name="SwitcherModeActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Switcher Mode</value>
|
||||
</data>
|
||||
<data name="QueryUrlLocalized" xml:space="preserve">
|
||||
<value>Query Url</value>
|
||||
<data name="QueryUrlActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Query URL</value>
|
||||
</data>
|
||||
<data name="DesktopLocalized" xml:space="preserve">
|
||||
<data name="DesktopActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Desktop</value>
|
||||
</data>
|
||||
<data name="MonitorLocalized" xml:space="preserve">
|
||||
<data name="MonitorActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Monitor</value>
|
||||
</data>
|
||||
<data name="ToggleVisibilityLocalized" xml:space="preserve">
|
||||
<data name="ToggleVisibilityActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Toggle Visibility</value>
|
||||
</data>
|
||||
<data name="DropdownDurationLocalized" xml:space="preserve">
|
||||
<data name="DropdownDurationActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Dropdown Duration</value>
|
||||
</data>
|
||||
<data name="IdLocalized" xml:space="preserve">
|
||||
<data name="IdActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Id</value>
|
||||
</data>
|
||||
<data name="PathLocalized" xml:space="preserve">
|
||||
<data name="PathActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Path</value>
|
||||
</data>
|
||||
<data name="ClearLocalized" xml:space="preserve">
|
||||
<data name="ClearActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Clear</value>
|
||||
</data>
|
||||
<data name="OpacityLocalized" xml:space="preserve">
|
||||
<data name="OpacityActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Opacity</value>
|
||||
</data>
|
||||
<data name="RelativeLocalized" xml:space="preserve">
|
||||
<data name="RelativeActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Relative</value>
|
||||
</data>
|
||||
<data name="ForegroundLocalized" xml:space="preserve">
|
||||
<data name="ForegroundActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Foreground</value>
|
||||
</data>
|
||||
<data name="BackgroundLocalized" xml:space="preserve">
|
||||
<data name="BackgroundActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Background</value>
|
||||
</data>
|
||||
<data name="MatchModeLocalized" xml:space="preserve">
|
||||
<data name="MatchModeActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Match Mode</value>
|
||||
</data>
|
||||
<data name="StartingDirectoryLocalized" xml:space="preserve">
|
||||
<data name="StartingDirectoryActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Starting Directory</value>
|
||||
</data>
|
||||
<data name="TabTitleLocalized" xml:space="preserve">
|
||||
<data name="TabTitleActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Tab Title</value>
|
||||
</data>
|
||||
<data name="ProfileIndexLocalized" xml:space="preserve">
|
||||
<data name="ProfileIndexActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Profile Index</value>
|
||||
</data>
|
||||
<data name="ProfileLocalized" xml:space="preserve">
|
||||
<data name="ProfileActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Profile</value>
|
||||
</data>
|
||||
<data name="SuppressApplicationTitleLocalized" xml:space="preserve">
|
||||
<data name="SuppressApplicationTitleActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Suppress Application Title</value>
|
||||
</data>
|
||||
<data name="ColorSchemeLocalized" xml:space="preserve">
|
||||
<data name="ColorSchemeActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Color Scheme</value>
|
||||
</data>
|
||||
<data name="ElevateLocalized" xml:space="preserve">
|
||||
<data name="ElevateActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Elevate</value>
|
||||
</data>
|
||||
<data name="ReloadEnvironmentVariablesLocalized" xml:space="preserve">
|
||||
<data name="ReloadEnvironmentVariablesActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Reload Environment Variables</value>
|
||||
</data>
|
||||
<data name="SplitDirectionLocalized" xml:space="preserve">
|
||||
<data name="SplitDirectionActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Split Direction</value>
|
||||
</data>
|
||||
<data name="SplitModeLocalized" xml:space="preserve">
|
||||
<data name="SplitModeActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Split Mode</value>
|
||||
</data>
|
||||
<data name="SplitSizeLocalized" xml:space="preserve">
|
||||
<data name="SplitSizeActionArgumentLocalized" xml:space="preserve">
|
||||
<value>Split Size</value>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user