Skip to content

Commit

Permalink
Allow the settings to set marks with an optional color
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed Apr 20, 2022
1 parent 1a27350 commit 9e2eb1a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
11 changes: 9 additions & 2 deletions src/cascadia/TerminalApp/AppActionHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,15 @@ namespace winrt::TerminalApp::implementation
{
_ApplyToActiveControls([realArgs](auto& control) {
Control::ScrollMark mark;
mark.Color.Color = realArgs.Color();
mark.Color.HasValue = true;
if (realArgs.Color())
{
mark.Color.Color = realArgs.Color().Value();
mark.Color.HasValue = true;
}
else
{
mark.Color.HasValue = false;
}
control.AddMark(mark);
});
}
Expand Down
16 changes: 12 additions & 4 deletions src/cascadia/TerminalSettingsModel/ActionArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,18 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation

winrt::hstring AddMarkArgs::GenerateName() const
{
return winrt::hstring{
fmt::format(std::wstring_view(RS_(L"AddMarkWithColorCommandKey")),
til::color{ Color() }.ToHexString(true))
};
if (Color())
{
return winrt::hstring{
fmt::format(std::wstring_view(RS_(L"AddMarkWithColorCommandKey")),
til::color{ Color().Value() }.ToHexString(true))
};

}
else
{
return RS_(L"AddMarkCommandKey");
}
}

winrt::hstring MoveTabArgs::GenerateName() const
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalSettingsModel/ActionArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private:

////////////////////////////////////////////////////////////////////////////////
#define ADD_MARK_ARGS(X) \
X(til::color, Color, "color", false, 255, 255, 255)
X(Windows::Foundation::IReference<Microsoft::Terminal::Core::Color>, Color, "color", false, nullptr)

////////////////////////////////////////////////////////////////////////////////
#define TOGGLE_COMMAND_PALETTE_ARGS(X) \
Expand Down
3 changes: 1 addition & 2 deletions src/cascadia/TerminalSettingsModel/ActionArgs.idl
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,7 @@ namespace Microsoft.Terminal.Settings.Model

[default_interface] runtimeclass AddMarkArgs : IActionArgs
{
Microsoft.Terminal.Core.Color Color { get; };
// Windows.Foundation.IReference<UInt32> RowsToScroll { get; };
Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> Color { get; };
};

[default_interface] runtimeclass ToggleCommandPaletteArgs : IActionArgs
Expand Down

1 comment on commit 9e2eb1a

@github-actions

This comment was marked as duplicate.

Please sign in to comment.