Skip to content

Commit

Permalink
These are things I might need for #997
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed Oct 7, 2021
1 parent 0acb4d9 commit b4fd3f3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/cascadia/TerminalApp/Pane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,11 @@ TermControl Pane::GetTerminalControl() const
return _IsLeaf() ? _control.try_as<TermControl>() : nullptr;
}

Controls::UserControl Pane::GetUserControl() const
{
return _IsLeaf() ? _control : nullptr;
}

// Method Description:
// - Recursively remove the "Active" state from this Pane and all it's children.
// - Updates our visuals to match our new state, including highlighting our borders.
Expand Down
3 changes: 2 additions & 1 deletion src/cascadia/TerminalApp/Pane.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ class Pane : public std::enable_shared_from_this<Pane>
const bool lastFocused = false);

std::shared_ptr<Pane> GetActivePane();
winrt::Microsoft::Terminal::Control::TermControl GetLastFocusedTerminalControl();
winrt::Windows::UI::Xaml::Controls::UserControl GetUserControl() const;
winrt::Microsoft::Terminal::Control::TermControl GetTerminalControl() const;
winrt::Microsoft::Terminal::Settings::Model::Profile GetFocusedProfile();
winrt::Microsoft::Terminal::Control::TermControl GetLastFocusedTerminalControl();

// Method Description:
// - If this is a leaf pane, return its profile.
Expand Down
12 changes: 11 additions & 1 deletion src/cascadia/TerminalApp/TerminalTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,10 @@ namespace winrt::TerminalApp::implementation
winrt::fire_and_forget TerminalTab::Scroll(const int delta)
{
auto control = GetActiveTerminalControl();

if (!control)
{
co_return;
}
co_await winrt::resume_foreground(control.Dispatcher());

const auto currentOffset = control.ScrollOffset();
Expand Down Expand Up @@ -1341,6 +1344,13 @@ namespace winrt::TerminalApp::implementation
// - The tab's color, if any
std::optional<winrt::Windows::UI::Color> TerminalTab::GetTabColor()
{
const auto& termControl{ GetActiveTerminalControl() };
if (!termControl)
{
return std::nullopt;
}

const auto currControlColor{ termControl.TabColor() };
std::optional<winrt::Windows::UI::Color> controlTabColor;
if (const auto& control = GetActiveTerminalControl())
{
Expand Down

0 comments on commit b4fd3f3

Please sign in to comment.