Skip to content

Commit b4fd3f3

Browse files
committed
These are things I might need for #997
1 parent 0acb4d9 commit b4fd3f3

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/cascadia/TerminalApp/Pane.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,11 @@ TermControl Pane::GetTerminalControl() const
13041304
return _IsLeaf() ? _control.try_as<TermControl>() : nullptr;
13051305
}
13061306

1307+
Controls::UserControl Pane::GetUserControl() const
1308+
{
1309+
return _IsLeaf() ? _control : nullptr;
1310+
}
1311+
13071312
// Method Description:
13081313
// - Recursively remove the "Active" state from this Pane and all it's children.
13091314
// - Updates our visuals to match our new state, including highlighting our borders.

src/cascadia/TerminalApp/Pane.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ class Pane : public std::enable_shared_from_this<Pane>
6666
const bool lastFocused = false);
6767

6868
std::shared_ptr<Pane> GetActivePane();
69-
winrt::Microsoft::Terminal::Control::TermControl GetLastFocusedTerminalControl();
69+
winrt::Windows::UI::Xaml::Controls::UserControl GetUserControl() const;
7070
winrt::Microsoft::Terminal::Control::TermControl GetTerminalControl() const;
7171
winrt::Microsoft::Terminal::Settings::Model::Profile GetFocusedProfile();
72+
winrt::Microsoft::Terminal::Control::TermControl GetLastFocusedTerminalControl();
7273

7374
// Method Description:
7475
// - If this is a leaf pane, return its profile.

src/cascadia/TerminalApp/TerminalTab.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,10 @@ namespace winrt::TerminalApp::implementation
437437
winrt::fire_and_forget TerminalTab::Scroll(const int delta)
438438
{
439439
auto control = GetActiveTerminalControl();
440-
440+
if (!control)
441+
{
442+
co_return;
443+
}
441444
co_await winrt::resume_foreground(control.Dispatcher());
442445

443446
const auto currentOffset = control.ScrollOffset();
@@ -1341,6 +1344,13 @@ namespace winrt::TerminalApp::implementation
13411344
// - The tab's color, if any
13421345
std::optional<winrt::Windows::UI::Color> TerminalTab::GetTabColor()
13431346
{
1347+
const auto& termControl{ GetActiveTerminalControl() };
1348+
if (!termControl)
1349+
{
1350+
return std::nullopt;
1351+
}
1352+
1353+
const auto currControlColor{ termControl.TabColor() };
13441354
std::optional<winrt::Windows::UI::Color> controlTabColor;
13451355
if (const auto& control = GetActiveTerminalControl())
13461356
{

0 commit comments

Comments
 (0)