diff --git a/Terminal.Gui/View/Layout/Pos.cs b/Terminal.Gui/View/Layout/Pos.cs index c5db51695..c4af54c0d 100644 --- a/Terminal.Gui/View/Layout/Pos.cs +++ b/Terminal.Gui/View/Layout/Pos.cs @@ -402,20 +402,42 @@ public class PosAbsolute (int position) : Pos internal override int Anchor (int width) { return Position; } } -internal class PosAnchorEnd : Pos +/// +/// Represents a position anchored to the end (right side or bottom). +/// +public class PosAnchorEnd : Pos { - private readonly int _offset; + /// + /// Gets the offset of the position from the right/bottom. + /// + public int Offset { get; } + + /// + /// Constructs a new position anchored to the end (right side or bottom) of the SuperView, + /// minus the respective dimension of the View. This is equivalent to using , + /// with an offset equivalent to the View's respective dimension. + /// public PosAnchorEnd () { UseDimForOffset = true; } - public PosAnchorEnd (int offset) { _offset = offset; } - public override bool Equals (object other) { return other is PosAnchorEnd anchorEnd && anchorEnd._offset == _offset; } - public override int GetHashCode () { return _offset.GetHashCode (); } + + /// + /// Constructs a new position anchored to the end (right side or bottom) of the SuperView, + /// + /// + public PosAnchorEnd (int offset) { Offset = offset; } + + /// + public override bool Equals (object other) { return other is PosAnchorEnd anchorEnd && anchorEnd.Offset == Offset; } + + /// + public override int GetHashCode () { return Offset.GetHashCode (); } /// /// If true, the offset is the width of the view, if false, the offset is the offset value. /// - internal bool UseDimForOffset { get; set; } + public bool UseDimForOffset { get; } - public override string ToString () { return UseDimForOffset ? "AnchorEnd()" : $"AnchorEnd({_offset})"; } + /// + public override string ToString () { return UseDimForOffset ? "AnchorEnd()" : $"AnchorEnd({Offset})"; } internal override int Anchor (int width) { @@ -424,7 +446,7 @@ internal class PosAnchorEnd : Pos return width; } - return width - _offset; + return width - Offset; } internal override int Calculate (int superviewDimension, Dim dim, View us, Dimension dimension)