diff --git a/Terminal.Gui/Drawing/Justification.cs b/Terminal.Gui/Drawing/Aligner.cs
similarity index 93%
rename from Terminal.Gui/Drawing/Justification.cs
rename to Terminal.Gui/Drawing/Aligner.cs
index d2b87a9a6..97f507391 100644
--- a/Terminal.Gui/Drawing/Justification.cs
+++ b/Terminal.Gui/Drawing/Aligner.cs
@@ -1,5 +1,4 @@
using System.ComponentModel;
-using static Terminal.Gui.Pos;
namespace Terminal.Gui;
@@ -15,7 +14,8 @@ public enum Alignment
///
///
///
- /// If the container is smaller than the total size of the items, the right items will be clipped (their locations will be greater than the container size).
+ /// If the container is smaller than the total size of the items, the right items will be clipped (their locations
+ /// will be greater than the container size).
///
///
///
@@ -39,7 +39,8 @@ public enum Alignment
///
///
///
- /// If the container is smaller than the total size of the items, the left items will be clipped (their locations will be negative).
+ /// If the container is smaller than the total size of the items, the left items will be clipped (their locations
+ /// will be negative).
///
///
///
@@ -99,7 +100,8 @@ public enum Alignment
///
///
///
- /// If the container is smaller than the total size of the items, the right items will be clipped (their locations will be greater than the container size).
+ /// If the container is smaller than the total size of the items, the right items will be clipped (their locations
+ /// will be greater than the container size).
///
///
///
@@ -123,7 +125,8 @@ public enum Alignment
///
///
///
- /// If the container is smaller than the total size of the items, the left items will be clipped (their locations will be negative).
+ /// If the container is smaller than the total size of the items, the left items will be clipped (their locations
+ /// will be negative).
///
///
///
@@ -138,7 +141,7 @@ public enum Alignment
/// Set to to ensure at least one line between
/// each item.
///
- LastBottomRestTop = LastRightRestLeft,
+ LastBottomRestTop = LastRightRestLeft
}
///
@@ -157,7 +160,7 @@ public class Aligner : INotifyPropertyChanged
set
{
_alignment = value;
- PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (nameof (Alignment)));
+ PropertyChanged?.Invoke (this, new (nameof (Alignment)));
}
}
@@ -172,7 +175,7 @@ public class Aligner : INotifyPropertyChanged
set
{
_containerSize = value;
- PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (nameof (ContainerSize)));
+ PropertyChanged?.Invoke (this, new (nameof (ContainerSize)));
}
}
@@ -185,8 +188,9 @@ public class Aligner : INotifyPropertyChanged
///
///
///
- /// If the total size of the items is greater than the container size, the space between items will be ignored starting
- /// from the right.
+ /// If the total size of the items is greater than the container size, the space between items will be ignored
+ /// starting
+ /// from the right.
///
///
public bool PutSpaceBetweenItems
@@ -195,11 +199,11 @@ public class Aligner : INotifyPropertyChanged
set
{
_putSpaceBetweenItems = value;
- PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (nameof (PutSpaceBetweenItems)));
+ PropertyChanged?.Invoke (this, new (nameof (PutSpaceBetweenItems)));
}
}
- ///
+ ///
public event PropertyChangedEventHandler PropertyChanged;
///
diff --git a/Terminal.Gui/Drawing/Thickness.cs b/Terminal.Gui/Drawing/Thickness.cs
index 3ee360f50..f541465d2 100644
--- a/Terminal.Gui/Drawing/Thickness.cs
+++ b/Terminal.Gui/Drawing/Thickness.cs
@@ -232,8 +232,8 @@ public class Thickness : IEquatable
var tf = new TextFormatter
{
Text = label is null ? string.Empty : $"{label} {this}",
- Justification = Alignment.Centered,
- VerticalJustification = Alignment.Bottom,
+ Alignment = Alignment.Centered,
+ VerticalAlignment = Alignment.Bottom,
AutoSize = true
};
tf.Draw (rect, Application.Driver.CurrentAttribute, Application.Driver.CurrentAttribute, rect);
diff --git a/Terminal.Gui/Resources/config.json b/Terminal.Gui/Resources/config.json
index c073d5aad..c2a63fe15 100644
--- a/Terminal.Gui/Resources/config.json
+++ b/Terminal.Gui/Resources/config.json
@@ -24,7 +24,7 @@
"Themes": [
{
"Default": {
- "Dialog.DefaultButtonJustification": "Right",
+ "Dialog.DefaultButtonAlignment": "Right",
"FrameView.DefaultBorderStyle": "Single",
"Window.DefaultBorderStyle": "Single",
"ColorSchemes": [
diff --git a/Terminal.Gui/Text/TextFormatter.cs b/Terminal.Gui/Text/TextFormatter.cs
index c05b84e7e..3d2e0d61d 100644
--- a/Terminal.Gui/Text/TextFormatter.cs
+++ b/Terminal.Gui/Text/TextFormatter.cs
@@ -3,7 +3,7 @@ using System.Diagnostics;
namespace Terminal.Gui;
///
-/// Provides text formatting. Supports s, horizontal justification, vertical justification,
+/// Provides text formatting. Supports s, horizontal alignment, vertical alignment,
/// multiple lines, and word-based line wrap.
///
public class TextFormatter
@@ -17,17 +17,17 @@ public class TextFormatter
private Size _size;
private int _tabWidth = 4;
private string _text;
- private Alignment _textJustification;
+ private Alignment _textAlignment;
private TextDirection _textDirection;
- private Alignment _textVerticalJustification;
+ private Alignment _textVerticalAlignment;
private bool _wordWrap = true;
- /// Get or sets the horizontal text justification.
- /// The text justification.
- public Alignment Justification
+ /// Get or sets the horizontal text alignment.
+ /// The text alignment.
+ public Alignment Alignment
{
- get => _textJustification;
- set => _textJustification = EnableNeedsFormat (value);
+ get => _textAlignment;
+ set => _textAlignment = EnableNeedsFormat (value);
}
/// Gets or sets whether the should be automatically changed to fit the .
@@ -222,12 +222,12 @@ public class TextFormatter
}
}
- /// Gets or sets the vertical text-justification.
- /// The text vertical justification.
- public Alignment VerticalJustification
+ /// Gets or sets the vertical text-alignment.
+ /// The text vertical alignment.
+ public Alignment VerticalAlignment
{
- get => _textVerticalJustification;
- set => _textVerticalJustification = EnableNeedsFormat (value);
+ get => _textVerticalAlignment;
+ set => _textVerticalAlignment = EnableNeedsFormat (value);
}
/// Gets or sets whether word wrap will be used to fit to .
@@ -319,8 +319,8 @@ public class TextFormatter
int x = 0, y = 0;
- // Horizontal Justification
- if (Justification is Alignment.Right)
+ // Horizontal Alignment
+ if (Alignment is Alignment.Right)
{
if (isVertical)
{
@@ -335,7 +335,7 @@ public class TextFormatter
CursorPosition = screen.Width - runesWidth + (_hotKeyPos > -1 ? _hotKeyPos : 0);
}
}
- else if (Justification is Alignment.Left)
+ else if (Alignment is Alignment.Left)
{
if (isVertical)
{
@@ -351,7 +351,7 @@ public class TextFormatter
CursorPosition = _hotKeyPos > -1 ? _hotKeyPos : 0;
}
- else if (Justification is Alignment.Justified)
+ else if (Alignment is Alignment.Justified)
{
if (isVertical)
{
@@ -374,7 +374,7 @@ public class TextFormatter
CursorPosition = _hotKeyPos > -1 ? _hotKeyPos : 0;
}
- else if (Justification is Alignment.Centered)
+ else if (Alignment is Alignment.Centered)
{
if (isVertical)
{
@@ -394,13 +394,13 @@ public class TextFormatter
}
else
{
- Debug.WriteLine ($"Unsupported Justification: {nameof (VerticalJustification)}");
+ Debug.WriteLine ($"Unsupported Alignment: {nameof (VerticalAlignment)}");
return;
}
- // Vertical Justification
- if (VerticalJustification is Alignment.Bottom)
+ // Vertical Alignment
+ if (VerticalAlignment is Alignment.Bottom)
{
if (isVertical)
{
@@ -411,7 +411,7 @@ public class TextFormatter
y = screen.Bottom - linesFormatted.Count + line;
}
}
- else if (VerticalJustification is Alignment.Top)
+ else if (VerticalAlignment is Alignment.Top)
{
if (isVertical)
{
@@ -422,7 +422,7 @@ public class TextFormatter
y = screen.Top + line;
}
}
- else if (VerticalJustification is Alignment.Justified)
+ else if (VerticalAlignment is Alignment.Justified)
{
if (isVertical)
{
@@ -436,7 +436,7 @@ public class TextFormatter
line < linesFormatted.Count - 1 ? screen.Height - interval <= 1 ? screen.Top + 1 : screen.Top + line * interval : screen.Bottom - 1;
}
}
- else if (VerticalJustification is Alignment.Centered)
+ else if (VerticalAlignment is Alignment.Centered)
{
if (isVertical)
{
@@ -451,7 +451,7 @@ public class TextFormatter
}
else
{
- Debug.WriteLine ($"Unsupported Justification: {nameof (VerticalJustification)}");
+ Debug.WriteLine ($"Unsupported Alignment: {nameof (VerticalAlignment)}");
return;
}
@@ -474,8 +474,8 @@ public class TextFormatter
{
if (idx < 0
|| (isVertical
- ? VerticalJustification != Alignment.Bottom && current < 0
- : Justification != Alignment.Right && x + current + colOffset < 0))
+ ? VerticalAlignment != Alignment.Bottom && current < 0
+ : Alignment != Alignment.Right && x + current + colOffset < 0))
{
current++;
@@ -564,7 +564,7 @@ public class TextFormatter
if (HotKeyPos > -1 && idx == HotKeyPos)
{
- if ((isVertical && VerticalJustification == Alignment.Justified) || (!isVertical && Justification == Alignment.Justified))
+ if ((isVertical && VerticalAlignment == Alignment.Justified) || (!isVertical && Alignment == Alignment.Justified))
{
CursorPosition = idx - start;
}
@@ -702,7 +702,7 @@ public class TextFormatter
_lines = Format (
text,
Size.Height,
- VerticalJustification == Alignment.Justified,
+ VerticalAlignment == Alignment.Justified,
Size.Width > colsWidth && WordWrap,
PreserveTrailingSpaces,
TabWidth,
@@ -726,7 +726,7 @@ public class TextFormatter
_lines = Format (
text,
Size.Width,
- Justification == Alignment.Justified,
+ Alignment == Alignment.Justified,
Size.Height > 1 && WordWrap,
PreserveTrailingSpaces,
TabWidth,
@@ -980,7 +980,7 @@ public class TextFormatter
// if value is not wide enough
if (text.EnumerateRunes ().Sum (c => c.GetColumns ()) < width)
{
- // pad it out with spaces to the given Justification
+ // pad it out with spaces to the given Alignment
int toPad = width - text.EnumerateRunes ().Sum (c => c.GetColumns ());
return text + new string (' ', toPad);
@@ -1002,7 +1002,7 @@ public class TextFormatter
/// instance to access any of his objects.
/// A list of word wrapped lines.
///
- /// This method does not do any justification.
+ /// This method does not do any alignment.
/// This method strips Newline ('\n' and '\r\n') sequences before processing.
///
/// If is at most one space will be preserved
@@ -1034,7 +1034,7 @@ public class TextFormatter
List runes = StripCRLF (text).ToRuneList ();
int start = Math.Max (
- !runes.Contains ((Rune)' ') && textFormatter is { VerticalJustification: Alignment.Bottom } && IsVerticalDirection (textDirection)
+ !runes.Contains ((Rune)' ') && textFormatter is { VerticalAlignment: Alignment.Bottom } && IsVerticalDirection (textDirection)
? runes.Count - width
: 0,
0);
@@ -1252,7 +1252,7 @@ public class TextFormatter
/// The number of columns to clip the text to. Text longer than will be
/// clipped.
///
- /// Justification.
+ /// Alignment.
/// The text direction.
/// The number of columns used for a tab.
/// instance to access any of his objects.
@@ -1260,13 +1260,13 @@ public class TextFormatter
public static string ClipAndJustify (
string text,
int width,
- Alignment textJustification,
+ Alignment textAlignment,
TextDirection textDirection = TextDirection.LeftRight_TopBottom,
int tabWidth = 0,
TextFormatter textFormatter = null
)
{
- return ClipAndJustify (text, width, textJustification == Alignment.Justified, textDirection, tabWidth, textFormatter);
+ return ClipAndJustify (text, width, textAlignment == Alignment.Justified, textDirection, tabWidth, textFormatter);
}
/// Justifies text within a specified width.
@@ -1307,12 +1307,12 @@ public class TextFormatter
{
if (IsHorizontalDirection (textDirection))
{
- if (textFormatter is { Justification: Alignment.Right })
+ if (textFormatter is { Alignment: Alignment.Right })
{
return GetRangeThatFits (runes, runes.Count - width, text, width, tabWidth, textDirection);
}
- if (textFormatter is { Justification: Alignment.Centered })
+ if (textFormatter is { Alignment: Alignment.Centered })
{
return GetRangeThatFits (runes, Math.Max ((runes.Count - width) / 2, 0), text, width, tabWidth, textDirection);
}
@@ -1322,12 +1322,12 @@ public class TextFormatter
if (IsVerticalDirection (textDirection))
{
- if (textFormatter is { VerticalJustification: Alignment.Bottom })
+ if (textFormatter is { VerticalAlignment: Alignment.Bottom })
{
return GetRangeThatFits (runes, runes.Count - width, text, width, tabWidth, textDirection);
}
- if (textFormatter is { VerticalJustification: Alignment.Centered })
+ if (textFormatter is { VerticalAlignment: Alignment.Centered })
{
return GetRangeThatFits (runes, Math.Max ((runes.Count - width) / 2, 0), text, width, tabWidth, textDirection);
}
@@ -1345,14 +1345,14 @@ public class TextFormatter
if (IsHorizontalDirection (textDirection))
{
- if (textFormatter is { Justification: Alignment.Right })
+ if (textFormatter is { Alignment: Alignment.Right })
{
if (GetRuneWidth (text, tabWidth, textDirection) > width)
{
return GetRangeThatFits (runes, runes.Count - width, text, width, tabWidth, textDirection);
}
}
- else if (textFormatter is { Justification: Alignment.Centered })
+ else if (textFormatter is { Alignment: Alignment.Centered })
{
return GetRangeThatFits (runes, Math.Max ((runes.Count - width) / 2, 0), text, width, tabWidth, textDirection);
}
@@ -1364,14 +1364,14 @@ public class TextFormatter
if (IsVerticalDirection (textDirection))
{
- if (textFormatter is { VerticalJustification: Alignment.Bottom })
+ if (textFormatter is { VerticalAlignment: Alignment.Bottom })
{
if (runes.Count - zeroLength > width)
{
return GetRangeThatFits (runes, runes.Count - width, text, width, tabWidth, textDirection);
}
}
- else if (textFormatter is { VerticalJustification: Alignment.Centered })
+ else if (textFormatter is { VerticalAlignment: Alignment.Centered })
{
return GetRangeThatFits (runes, Math.Max ((runes.Count - width) / 2, 0), text, width, tabWidth, textDirection);
}
@@ -1475,10 +1475,10 @@ public class TextFormatter
return s.ToString ();
}
- /// Formats text into lines, applying text justification and optionally wrapping text to new lines on word boundaries.
+ /// Formats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.
///
/// The number of columns to constrain the text to for word wrapping and clipping.
- /// Specifies how the text will be justified horizontally.
+ /// Specifies how the text will be aligned horizontally.
///
/// If , the text will be wrapped to new lines no longer than
/// . If , forces text to fit a single line. Line breaks are converted
@@ -1501,7 +1501,7 @@ public class TextFormatter
public static List Format (
string text,
int width,
- Alignment textJustification,
+ Alignment textAlignment,
bool wordWrap,
bool preserveTrailingSpaces = false,
int tabWidth = 0,
@@ -1513,7 +1513,7 @@ public class TextFormatter
return Format (
text,
width,
- textJustification == Alignment.Justified,
+ textAlignment == Alignment.Justified,
wordWrap,
preserveTrailingSpaces,
tabWidth,
@@ -1523,7 +1523,7 @@ public class TextFormatter
);
}
- /// Formats text into lines, applying text justification and optionally wrapping text to new lines on word boundaries.
+ /// Formats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.
///
/// The number of columns to constrain the text to for word wrapping and clipping.
/// Specifies whether the text should be justified.
@@ -1887,7 +1887,7 @@ public class TextFormatter
return lineIdx;
}
- /// Calculates the rectangle required to hold text, assuming no word wrapping or justification.
+ /// Calculates the rectangle required to hold text, assuming no word wrapping or alignment.
///
/// This API will return incorrect results if the text includes glyphs who's width is dependent on surrounding
/// glyphs (e.g. Arabic).
diff --git a/Terminal.Gui/View/Layout/PosDim.cs b/Terminal.Gui/View/Layout/PosDim.cs
index 79bd498b2..d6737b220 100644
--- a/Terminal.Gui/View/Layout/PosDim.cs
+++ b/Terminal.Gui/View/Layout/PosDim.cs
@@ -46,6 +46,14 @@ namespace Terminal.Gui;
///
///
///
+///
+///
+///
+/// Creates a object that aligns a set of views.
+///
+///
+///
+///
///
///
///
@@ -206,12 +214,12 @@ public class Pos
///
- /// Creates a object that justifies a set of views according to the specified justification.
+ /// Creates a object that aligns a set of views according to the specified alignment setting.
///
- ///
- /// The optional, unique identifier for the set of views to justify according to .
+ ///
+ /// The optional, unique identifier for the set of views to align according to .
///
- public static Pos Justify (Alignment justification, int groupId = 0) { return new PosJustify (justification, groupId); }
+ public static Pos Align (Alignment alignment, int groupId = 0) { return new PosAlign (alignment, groupId); }
/// Serves as the default hash function.
/// A hash code for the current object.
@@ -496,47 +504,45 @@ public class Pos
///
- /// Enables justification of a set of views.
+ /// Enables alignment of a set of views.
///
///
///
- /// The Group ID is used to identify a set of views that should be justified together. When only a single
- /// set of views is justified, setting the Group ID is not needed because it defaults to 0.
+ /// The Group ID is used to identify a set of views that should be alignment together. When only a single
+ /// set of views is aligned, setting the Group ID is not needed because it defaults to 0.
///
///
- /// The first view added to the Superview with a given Group ID is used to determine the justification of the group.
- /// The justification is applied to all views with the same Group ID.
+ /// The first view added to the Superview with a given Group ID is used to determine the alignment of the group.
+ /// The alignment is applied to all views with the same Group ID.
///
///
- public class PosJustify : Pos
+ public class PosAlign : Pos
{
- // TODO: Figure out how to invalidate _location if Justifier changes.
-
///
/// The cached location. Used to store the calculated location to avoid recalculating it.
///
private int? _location;
///
- /// Gets the identifier of a set of views that should be justified together. When only a single
- /// set of views is justified, setting the is not needed because it defaults to 0.
+ /// Gets the identifier of a set of views that should be aligned together. When only a single
+ /// set of views is aligned, setting the is not needed because it defaults to 0.
///
private readonly int _groupId;
///
- /// Gets the justification settings.
+ /// Gets the alignment settings.
///
- public Aligner Justifier { get; } = new ();
+ public Aligner Aligner { get; } = new ();
///
- /// Justifies the views in that have the same group ID as .
+ /// Aligns the views in that have the same group ID as .
///
///
///
///
///
- private static void JustifyGroup (int groupId, IList views, Dim.Dimension dimension, int size)
+ private static void AlignGroup (int groupId, IList views, Dim.Dimension dimension, int size)
{
if (views is null)
{
@@ -547,14 +553,14 @@ public class Pos
List viewsInGroup = views.Where (
v =>
{
- if (dimension == Dimension.Width && v.X is PosJustify justifyX)
+ if (dimension == Dimension.Width && v.X is PosAlign alignX)
{
- return justifyX._groupId == groupId;
+ return alignX._groupId == groupId;
}
- if (dimension == Dimension.Height && v.Y is PosJustify justifyY)
+ if (dimension == Dimension.Height && v.Y is PosAlign alignY)
{
- return justifyY._groupId == groupId;
+ return alignY._groupId == groupId;
}
return false;
@@ -566,13 +572,13 @@ public class Pos
foreach (var view in viewsInGroup)
{
- var posJustify = dimension == Dimension.Width ? view.X as PosJustify : view.Y as PosJustify;
+ var posAlign = dimension == Dimension.Width ? view.X as PosAlign : view.Y as PosAlign;
- if (posJustify is { })
+ if (posAlign is { })
{
if (firstInGroup is null)
{
- firstInGroup = posJustify.Justifier;
+ firstInGroup = posAlign.Aligner;
}
dimensionsList.Add (dimension == Dimension.Width ? view.Frame.Width : view.Frame.Height);
@@ -590,29 +596,29 @@ public class Pos
for (var index = 0; index < viewsInGroup.Count; index++)
{
View view = viewsInGroup [index];
- PosJustify justify = dimension == Dimension.Width ? view.X as PosJustify : view.Y as PosJustify;
+ PosAlign align = dimension == Dimension.Width ? view.X as PosAlign : view.Y as PosAlign;
- if (justify is { })
+ if (align is { })
{
- justify._location = locations [index];
+ align._location = locations [index];
}
}
}
///
- /// Enables justification of a set of views.
+ /// Enables alignment of a set of views.
///
- ///
- /// The unique identifier for the set of views to justify according to .
- public PosJustify (Alignment justification, int groupId = 0)
+ ///
+ /// The unique identifier for the set of views to align according to .
+ public PosAlign (Alignment alignment, int groupId = 0)
{
- Justifier.PutSpaceBetweenItems = true;
- Justifier.Alignment = justification;
+ Aligner.PutSpaceBetweenItems = true;
+ Aligner.Alignment = alignment;
_groupId = groupId;
- Justifier.PropertyChanged += Justifier_PropertyChanged;
+ Aligner.PropertyChanged += Aligner_PropertyChanged;
}
- private void Justifier_PropertyChanged (object sender, System.ComponentModel.PropertyChangedEventArgs e)
+ private void Aligner_PropertyChanged (object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
_location = null;
}
@@ -620,19 +626,19 @@ public class Pos
///
public override bool Equals (object other)
{
- return other is PosJustify justify && _groupId == justify._groupId && _location == justify._location && justify.Justifier.Equals (Justifier);
+ return other is PosAlign align && _groupId == align._groupId && _location == align._location && align.Aligner.Equals (Aligner);
}
///
public override int GetHashCode ()
{
- return Justifier.GetHashCode () ^ _groupId.GetHashCode ();
+ return Aligner.GetHashCode () ^ _groupId.GetHashCode ();
}
///
public override string ToString ()
{
- return $"Justify(groupId={_groupId}, justification={Justifier.Alignment})";
+ return $"Align(groupId={_groupId}, alignment={Aligner.Alignment})";
}
internal override int Anchor (int width)
@@ -642,7 +648,7 @@ public class Pos
internal override int Calculate (int superviewDimension, Dim dim, View us, Dim.Dimension dimension)
{
- if (_location.HasValue && Justifier.ContainerSize == superviewDimension)
+ if (_location.HasValue && Aligner.ContainerSize == superviewDimension)
{
return _location.Value;
}
@@ -652,7 +658,7 @@ public class Pos
return 0;
}
- JustifyGroup (_groupId, us.SuperView.Subviews, dimension, superviewDimension);
+ AlignGroup (_groupId, us.SuperView.Subviews, dimension, superviewDimension);
if (_location.HasValue)
{
diff --git a/Terminal.Gui/View/ViewText.cs b/Terminal.Gui/View/ViewText.cs
index 6e2ec991a..b45e0061f 100644
--- a/Terminal.Gui/View/ViewText.cs
+++ b/Terminal.Gui/View/ViewText.cs
@@ -34,7 +34,7 @@ public partial class View
///
///
/// The text will be drawn starting at the view origin (0, 0) and will be formatted according
- /// to and .
+ /// to and .
///
///
/// The text will word-wrap to additional lines if it does not fit horizontally. If 's height
@@ -80,19 +80,19 @@ public partial class View
public event EventHandler> TextChanged;
///
- /// Gets or sets how the View's is justified horizontally when drawn. Changing this property will
+ /// Gets or sets how the View's is aligned horizontally when drawn. Changing this property will
/// redisplay the .
///
///
/// or are using , the will be adjusted to fit the text.
///
- /// The text justification.
- public virtual Alignment TextJustification
+ /// The text alignment.
+ public virtual Alignment TextAlignment
{
- get => TextFormatter.Justification;
+ get => TextFormatter.Alignment;
set
{
- TextFormatter.Justification = value;
+ TextFormatter.Alignment = value;
UpdateTextFormatterText ();
OnResizeNeeded ();
}
@@ -122,20 +122,20 @@ public partial class View
public TextFormatter TextFormatter { get; init; } = new () { };
///
- /// Gets or sets how the View's is justified vertically when drawn. Changing this property will
+ /// Gets or sets how the View's is aligned vertically when drawn. Changing this property will
/// redisplay
/// the .
///
///
/// or are using , the will be adjusted to fit the text.
///
- /// The vertical text justification.
- public virtual Alignment VerticalTextJustification
+ /// The vertical text alignment.
+ public virtual Alignment VerticalTextAlignment
{
- get => TextFormatter.VerticalJustification;
+ get => TextFormatter.VerticalAlignment;
set
{
- TextFormatter.VerticalJustification = value;
+ TextFormatter.VerticalAlignment = value;
SetNeedsDisplay ();
}
}
diff --git a/Terminal.Gui/Views/Button.cs b/Terminal.Gui/Views/Button.cs
index 0a0fa5040..5fa80b70d 100644
--- a/Terminal.Gui/Views/Button.cs
+++ b/Terminal.Gui/Views/Button.cs
@@ -37,8 +37,8 @@ public class Button : View
/// The width of the is computed based on the text length. The height will always be 1.
public Button ()
{
- TextJustification = Alignment.Centered;
- VerticalTextJustification = Alignment.Centered;
+ TextAlignment = Alignment.Centered;
+ VerticalTextAlignment = Alignment.Centered;
_leftBracket = Glyphs.LeftBracket;
_rightBracket = Glyphs.RightBracket;
diff --git a/Terminal.Gui/Views/CheckBox.cs b/Terminal.Gui/Views/CheckBox.cs
index 8d598be2e..7bc069b02 100644
--- a/Terminal.Gui/Views/CheckBox.cs
+++ b/Terminal.Gui/Views/CheckBox.cs
@@ -153,7 +153,7 @@ public class CheckBox : View
///
protected override void UpdateTextFormatterText ()
{
- switch (TextJustification)
+ switch (TextAlignment)
{
case Alignment.Left:
case Alignment.Centered:
diff --git a/Terminal.Gui/Views/Dialog.cs b/Terminal.Gui/Views/Dialog.cs
index f7210744b..232830da5 100644
--- a/Terminal.Gui/Views/Dialog.cs
+++ b/Terminal.Gui/Views/Dialog.cs
@@ -51,7 +51,7 @@ public class Dialog : Window
ColorScheme = Colors.ColorSchemes ["Dialog"];
Modal = true;
- ButtonJustification = DefaultButtonJustification;
+ ButtonAlignment = DefaultButtonAlignment;
AddCommand (
Command.QuitToplevel,
@@ -96,9 +96,9 @@ public class Dialog : Window
}
}
- // TODO: Update button.X = Pos.Justify when justification changes
- /// Determines how the s are justified along the bottom of the dialog.
- public Alignment ButtonJustification { get; set; }
+ // TODO: Update button.X = Pos.Justify when alignment changes
+ /// Determines how the s are aligned along the bottom of the dialog.
+ public Alignment ButtonAlignment { get; set; }
/// Optional buttons to lay out at the bottom of the dialog.
public Button [] Buttons
@@ -122,7 +122,7 @@ public class Dialog : Window
/// This property can be set in a Theme.
[SerializableConfigurationProperty (Scope = typeof (ThemeScope))]
[JsonConverter (typeof (JsonStringEnumConverter))]
- public static Alignment DefaultButtonJustification { get; set; } = Alignment.Right;
+ public static Alignment DefaultButtonAlignment { get; set; } = Alignment.Right;
///
/// Adds a to the , its layout will be controlled by the
@@ -136,7 +136,7 @@ public class Dialog : Window
return;
}
- button.X = Pos.Justify (ButtonJustification);
+ button.X = Pos.Align (ButtonAlignment);
button.Y = Pos.AnchorEnd () - 1;
_buttons.Add (button);
diff --git a/Terminal.Gui/Views/Menu/Menu.cs b/Terminal.Gui/Views/Menu/Menu.cs
index b55bdfac5..4e2fa3320 100644
--- a/Terminal.Gui/Views/Menu/Menu.cs
+++ b/Terminal.Gui/Views/Menu/Menu.cs
@@ -891,7 +891,7 @@ internal sealed class Menu : View
var tf = new TextFormatter
{
AutoSize = true,
- Justification = Alignment.Centered, HotKeySpecifier = MenuBar.HotKeySpecifier, Text = textToDraw
+ Alignment = Alignment.Centered, HotKeySpecifier = MenuBar.HotKeySpecifier, Text = textToDraw
};
// The -3 is left/right border + one space (not sure what for)
diff --git a/Terminal.Gui/Views/MessageBox.cs b/Terminal.Gui/Views/MessageBox.cs
index 72e0f42b1..bf391997b 100644
--- a/Terminal.Gui/Views/MessageBox.cs
+++ b/Terminal.Gui/Views/MessageBox.cs
@@ -340,8 +340,8 @@ public static class MessageBox
}
}
- Alignment buttonJust = Dialog.DefaultButtonJustification;
- Dialog.DefaultButtonJustification = Alignment.Centered;
+ Alignment buttonJust = Dialog.DefaultButtonAlignment;
+ Dialog.DefaultButtonAlignment = Alignment.Centered;
var d = new Dialog
{
Buttons = buttonList.ToArray (),
@@ -350,7 +350,7 @@ public static class MessageBox
Width = Dim.Percent (60),
Height = 5 // Border + one line of text + vspace + buttons
};
- Dialog.DefaultButtonJustification = buttonJust;
+ Dialog.DefaultButtonAlignment = buttonJust;
if (width != 0)
{
@@ -374,7 +374,7 @@ public static class MessageBox
var messageLabel = new Label
{
Text = message,
- TextJustification = Alignment.Centered,
+ TextAlignment = Alignment.Centered,
X = Pos.Center (),
Y = 0
};
diff --git a/Terminal.Gui/Views/ProgressBar.cs b/Terminal.Gui/Views/ProgressBar.cs
index 9c56625b2..26760c04d 100644
--- a/Terminal.Gui/Views/ProgressBar.cs
+++ b/Terminal.Gui/Views/ProgressBar.cs
@@ -181,7 +181,7 @@ public class ProgressBar : View
if (ProgressBarFormat != ProgressBarFormat.Simple && !_isActivity)
{
- var tf = new TextFormatter { Justification = Alignment.Centered, Text = Text };
+ var tf = new TextFormatter { Alignment = Alignment.Centered, Text = Text };
var attr = new Attribute (ColorScheme.HotNormal.Foreground, ColorScheme.HotNormal.Background);
if (_fraction > .5)
diff --git a/Terminal.Gui/Views/Slider.cs b/Terminal.Gui/Views/Slider.cs
index 95ed09fd8..efddec1d3 100644
--- a/Terminal.Gui/Views/Slider.cs
+++ b/Terminal.Gui/Views/Slider.cs
@@ -930,7 +930,7 @@ public class Slider : View
}
}
- private string JustifyText (string text, int width, Alignment justification)
+ private string AlignText (string text, int width, Alignment alignment)
{
if (text is null)
{
@@ -947,7 +947,7 @@ public class Slider : View
string s2 = new (' ', w % 2);
// Note: The formatter doesn't handle all of this ???
- switch (justification)
+ switch (alignment)
{
case Alignment.Justified:
return TextFormatter.Justify (text, width);
@@ -1293,7 +1293,7 @@ public class Slider : View
switch (_config._legendsOrientation)
{
case Orientation.Horizontal:
- text = JustifyText (text, _config._innerSpacing + 1, Alignment.Centered);
+ text = AlignText (text, _config._innerSpacing + 1, Alignment.Centered);
break;
case Orientation.Vertical:
@@ -1311,7 +1311,7 @@ public class Slider : View
break;
case Orientation.Vertical:
- text = JustifyText (text, _config._innerSpacing + 1, Alignment.Centered);
+ text = AlignText (text, _config._innerSpacing + 1, Alignment.Centered);
break;
}
diff --git a/Terminal.Gui/Views/TableView/ColumnStyle.cs b/Terminal.Gui/Views/TableView/ColumnStyle.cs
index 02615e696..2d277abd9 100644
--- a/Terminal.Gui/Views/TableView/ColumnStyle.cs
+++ b/Terminal.Gui/Views/TableView/ColumnStyle.cs
@@ -1,17 +1,17 @@
namespace Terminal.Gui;
///
-/// Describes how to render a given column in a including and
+/// Describes how to render a given column in a including and
/// textual representation of cells (e.g. date formats)
/// See TableView Deep Dive for more information.
///
public class ColumnStyle
{
///
- /// Defines a delegate for returning custom justification per cell based on cell values. When specified this will
- /// override
+ /// Defines a delegate for returning custom alignment per cell based on cell values. When specified this will
+ /// override
///
- public Func