Skip to content

Commit

Permalink
More things we might need for Non-Terminal content, #997
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed Oct 7, 2021
1 parent b4fd3f3 commit c7cb3ce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/cascadia/TerminalApp/Pane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3009,6 +3009,15 @@ void Pane::_AdvanceSnappedDimension(const bool widthOrHeight, LayoutSizeNode& si
sizeNode.size += widthOrHeight ? cellSize.Width : cellSize.Height;
}
}
else if (_IsLeaf())
{
// If we're a leaf that didn't have a TermControl, then just increment
// by one. We have to increment by _some_ value, because this is used in
// a while() loop to find the next bigger size we can snap to. But since
// a non-terminal control doesn't really care what size it's snapped to,
// we can just say "one pixel larger is the next snap point"
sizeNode.size += 1;
}
else if (!_IsLeaf())
{
// We're a parent pane, so we have to advance dimension of our children panes. In
Expand Down Expand Up @@ -3299,7 +3308,9 @@ std::optional<SplitDirection> Pane::PreCalculateAutoSplit(const std::shared_ptr<
bool Pane::ContainsReadOnly() const
{
const auto& termControl{ GetTerminalControl() };
return termControl ? termControl.ReadOnly() : (_firstChild->ContainsReadOnly() || _secondChild->ContainsReadOnly());
return termControl ?
termControl.ReadOnly() :
(_IsLeaf() ? false : (_firstChild->ContainsReadOnly() || _secondChild->ContainsReadOnly()));
}

// Method Description:
Expand Down
5 changes: 4 additions & 1 deletion src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,10 @@ namespace winrt::TerminalApp::implementation
// the control here instead.
if (_startupState == StartupState::Initialized)
{
_GetActiveControl().Focus(FocusState::Programmatic);
if (const auto& activeControl{ _GetActiveControl() })
{
activeControl.Focus(FocusState::Programmatic);
}
}
}
CATCH_LOG();
Expand Down

0 comments on commit c7cb3ce

Please sign in to comment.