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 Sep 1, 2021
1 parent 1ee3522 commit 7fb7d64
Show file tree
Hide file tree
Showing 3 changed files with 16 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 @@ -1014,6 +1014,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
1 change: 1 addition & 0 deletions src/cascadia/TerminalApp/Pane.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Pane : public std::enable_shared_from_this<Pane>
const bool lastFocused = false);

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

Expand Down
12 changes: 10 additions & 2 deletions src/cascadia/TerminalApp/TerminalTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,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 @@ -1269,7 +1272,12 @@ namespace winrt::TerminalApp::implementation
// - The tab's color, if any
std::optional<winrt::Windows::UI::Color> TerminalTab::GetTabColor()
{
const auto currControlColor{ GetActiveTerminalControl().TabColor() };
const auto& termControl{ GetActiveTerminalControl() };
if (!termControl)
{
return std::nullopt;
}
const auto currControlColor{ termControl.TabColor() };
std::optional<winrt::Windows::UI::Color> controlTabColor;
if (currControlColor != nullptr)
{
Expand Down

0 comments on commit 7fb7d64

Please sign in to comment.