Skip to content

Commit 61aaa71

Browse files
harderclaude
andcommitted
Clean up adornment thickness-delta helpers
Fix indentation of the Margin.ThicknessChanged handler body and factor the duplicated viewport-size formula out of GetViewportForAdornmentThickness and GetViewportFrameForAdornmentThickness into a shared GetViewportSizeForThickness helper. No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f64af09 commit 61aaa71

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

Terminal.Gui/ViewBase/View.Adornments.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private void SetupAdornments ()
2323
// When any adornment's thickness changes, recompute frames and request layout + redraw.
2424
Margin.ThicknessChanged += (_, _) =>
2525
{
26-
previousMarginThickness = HandleAdornmentThicknessChanged (Margin, previousMarginThickness);
26+
previousMarginThickness = HandleAdornmentThicknessChanged (Margin, previousMarginThickness);
2727
};
2828

2929
Border.ThicknessChanged += (_, _) =>
@@ -370,18 +370,19 @@ private Rectangle GetViewportForAdornmentThickness (IAdornment changedAdornment,
370370
{
371371
Thickness thickness = GetAdornmentsThicknessForAdornment (changedAdornment, changedThickness);
372372

373-
return new Rectangle (_viewportLocation,
374-
new Size (Math.Max (0, Frame.Width - thickness.Horizontal), Math.Max (0, Frame.Height - thickness.Vertical)));
373+
return new Rectangle (_viewportLocation, GetViewportSizeForThickness (thickness));
375374
}
376375

377376
private Rectangle GetViewportFrameForAdornmentThickness (IAdornment changedAdornment, Thickness changedThickness)
378377
{
379378
Thickness thickness = GetAdornmentsThicknessForAdornment (changedAdornment, changedThickness);
380379

381-
return new Rectangle (new Point (thickness.Left, thickness.Top),
382-
new Size (Math.Max (0, Frame.Width - thickness.Horizontal), Math.Max (0, Frame.Height - thickness.Vertical)));
380+
return new Rectangle (new Point (thickness.Left, thickness.Top), GetViewportSizeForThickness (thickness));
383381
}
384382

383+
private Size GetViewportSizeForThickness (Thickness thickness) =>
384+
new (Math.Max (0, Frame.Width - thickness.Horizontal), Math.Max (0, Frame.Height - thickness.Vertical));
385+
385386
private Thickness GetAdornmentsThicknessForAdornment (IAdornment changedAdornment, Thickness changedThickness)
386387
{
387388
Thickness thickness = Thickness.Empty;

0 commit comments

Comments
 (0)