TC: actually, we don't want to calculate panel size without padding

This commit is contained in:
Dustin L. Howett
2025-08-03 20:19:12 -05:00
parent b67fb19f7c
commit 2dac785e1a
2 changed files with 10 additions and 6 deletions

View File

@@ -1126,6 +1126,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
auto cx = gsl::narrow_cast<til::CoordType>(lrint(_panelWidth * _compositionScale));
auto cy = gsl::narrow_cast<til::CoordType>(lrint(_panelHeight * _compositionScale));
const auto padding = StringToXamlThickness(_settings->Padding());
auto padx = gsl::narrow_cast<til::CoordType>(lrint((padding.Left + padding.Right) * _compositionScale));
auto pady = gsl::narrow_cast<til::CoordType>(lrint((padding.Top + padding.Bottom) * _compositionScale));
cx -= padx;
cy -= pady;
// Don't actually resize so small that a single character wouldn't fit
// in either dimension. The buffer really doesn't like being size 0.
@@ -1139,7 +1145,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_terminal->ClearSelection();
// Tell the dx engine that our window is now the new size.
THROW_IF_FAILED(_renderEngine->SetWindowSize({ cx, cy }));
THROW_IF_FAILED(_renderEngine->SetWindowSize({ cx + padx, cy + pady }));
// Invalidate everything
_renderer->TriggerRedrawAll();

View File

@@ -1340,8 +1340,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
return false;
}
const auto panelWidth = static_cast<float>(SwapChainPanel().ActualWidth() - (_contentPadding.Left + _contentPadding.Right));
const auto panelHeight = static_cast<float>(SwapChainPanel().ActualHeight() - (_contentPadding.Top + _contentPadding.Bottom));
const auto panelWidth = static_cast<float>(SwapChainPanel().ActualWidth());
const auto panelHeight = static_cast<float>(SwapChainPanel().ActualHeight());
const auto panelScaleX = SwapChainPanel().CompositionScaleX();
const auto panelScaleY = SwapChainPanel().CompositionScaleY();
@@ -2478,9 +2478,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
const auto newSize = e.NewSize();
_core.SizeChanged(
newSize.Width - static_cast<float>(_contentPadding.Left + _contentPadding.Right),
newSize.Height - static_cast<float>(_contentPadding.Top + _contentPadding.Bottom));
_core.SizeChanged(newSize.Width, newSize.Height);
if (_automationPeer)
{