Parcourir la source

Justifier->Aligner

Tig il y a 1 an
Parent
commit
c5a6c907a4
54 fichiers modifiés avec 1010 ajouts et 1003 suppressions
  1. 39 39
      Terminal.Gui/Drawing/Justification.cs
  2. 2 2
      Terminal.Gui/Drawing/Thickness.cs
  3. 31 31
      Terminal.Gui/Text/TextFormatter.cs
  4. 7 7
      Terminal.Gui/View/Layout/PosDim.cs
  5. 2 2
      Terminal.Gui/View/ViewText.cs
  6. 2 2
      Terminal.Gui/Views/Button.cs
  7. 5 5
      Terminal.Gui/Views/CheckBox.cs
  8. 3 3
      Terminal.Gui/Views/Dialog.cs
  9. 1 1
      Terminal.Gui/Views/ListView.cs
  10. 1 1
      Terminal.Gui/Views/Menu/Menu.cs
  11. 3 3
      Terminal.Gui/Views/MessageBox.cs
  12. 1 1
      Terminal.Gui/Views/ProgressBar.cs
  13. 7 7
      Terminal.Gui/Views/Slider.cs
  14. 3 3
      Terminal.Gui/Views/TableView/ColumnStyle.cs
  15. 5 5
      Terminal.Gui/Views/TableView/TableView.cs
  16. 8 8
      Terminal.Gui/Views/TextValidateField.cs
  17. 1 1
      Terminal.Gui/Views/TextView.cs
  18. 1 1
      Terminal.Gui/Views/Wizard/Wizard.cs
  19. 2 2
      UICatalog/Scenarios/BasicColors.cs
  20. 25 25
      UICatalog/Scenarios/Buttons.cs
  21. 1 1
      UICatalog/Scenarios/CharacterMap.cs
  22. 2 2
      UICatalog/Scenarios/CollectionNavigatorTester.cs
  23. 2 2
      UICatalog/Scenarios/ColorPicker.cs
  24. 13 13
      UICatalog/Scenarios/ComputedLayout.cs
  25. 11 11
      UICatalog/Scenarios/CsvEditor.cs
  26. 9 9
      UICatalog/Scenarios/Dialogs.cs
  27. 2 2
      UICatalog/Scenarios/DynamicMenuBar.cs
  28. 9 9
      UICatalog/Scenarios/Editor.cs
  29. 1 1
      UICatalog/Scenarios/ListColumns.cs
  30. 9 9
      UICatalog/Scenarios/MessageBoxes.cs
  31. 2 2
      UICatalog/Scenarios/Mouse.cs
  32. 22 22
      UICatalog/Scenarios/PosJustification.cs
  33. 7 7
      UICatalog/Scenarios/TableEditor.cs
  34. 1 1
      UICatalog/Scenarios/Text.cs
  35. 7 7
      UICatalog/Scenarios/TextFormatterDemo.cs
  36. 49 49
      UICatalog/Scenarios/TextJustificationAndDirection.cs
  37. 6 6
      UICatalog/Scenarios/TimeAndDate.cs
  38. 1 1
      UICatalog/Scenarios/Unicode.cs
  39. 5 5
      UICatalog/Scenarios/ViewExperiments.cs
  40. 4 4
      UICatalog/Scenarios/Wizards.cs
  41. 3 3
      UnitTests/Configuration/ThemeScopeTests.cs
  42. 3 3
      UnitTests/Configuration/ThemeTests.cs
  43. 46 46
      UnitTests/Dialogs/DialogTests.cs
  44. 452 0
      UnitTests/Drawing/AlignerTests.cs
  45. 0 445
      UnitTests/Drawing/JustifierTests.cs
  46. 144 144
      UnitTests/Text/TextFormatterTests.cs
  47. 2 2
      UnitTests/View/DrawTests.cs
  48. 6 6
      UnitTests/View/Layout/Dim.AutoTests.cs
  49. 6 6
      UnitTests/View/Text/AutoSizeTrueTests.cs
  50. 4 4
      UnitTests/Views/ButtonTests.cs
  51. 9 9
      UnitTests/Views/CheckBoxTests.cs
  52. 1 1
      UnitTests/Views/LabelTests.cs
  53. 20 20
      UnitTests/Views/TextValidateFieldTests.cs
  54. 2 2
      UnitTests/Views/ToplevelTests.cs

+ 39 - 39
Terminal.Gui/Drawing/Justification.cs

@@ -4,13 +4,13 @@ using static Terminal.Gui.Pos;
 namespace Terminal.Gui;
 
 /// <summary>
-///     Controls how the <see cref="Justifier"/> justifies items within a container.
+///     Controls how the <see cref="Aligner"/> aligns items within a container.
 /// </summary>
-public enum Justification
+public enum Alignment
 {
     /// <summary>
     ///     The items will be aligned to the left.
-    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
+    ///     Set <see cref="Aligner.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
     ///     each item.
     /// </summary>
     /// <remarks>
@@ -27,14 +27,14 @@ public enum Justification
 
     /// <summary>
     ///     The items will be aligned to the top.
-    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one line between
+    ///     Set <see cref="Aligner.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one line between
     ///     each item.
     /// </summary>
     Top = Left,
 
     /// <summary>
     ///     The items will be aligned to the right.
-    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
+    ///     Set <see cref="Aligner.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
     ///     each item.
     /// </summary>
     /// <remarks>
@@ -51,15 +51,15 @@ public enum Justification
 
     /// <summary>
     ///     The items will be aligned to the bottom.
-    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one line between
+    ///     Set <see cref="Aligner.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one line between
     ///     each item.
     /// </summary>
     Bottom = Right,
 
     /// <summary>
     ///     The group will be centered in the container.
-    ///     If centering is not possible, the group will be left-justified.
-    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
+    ///     If centering is not possible, the group will be left-aligned.
+    ///     Set <see cref="Aligner.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
     ///     each item.
     /// </summary>
     /// <remarks>
@@ -77,7 +77,7 @@ public enum Justification
     /// <summary>
     ///     The items will be justified. Space will be added between the items such that the first item
     ///     is at the start and the right side of the last item against the end.
-    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
+    ///     Set <see cref="Aligner.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
     ///     each item.
     /// </summary>
     /// <remarks>
@@ -94,7 +94,7 @@ public enum Justification
 
     /// <summary>
     ///     The first item will be aligned to the left and the remaining will aligned to the right.
-    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
+    ///     Set <see cref="Aligner.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
     ///     each item.
     /// </summary>
     /// <remarks>
@@ -111,14 +111,14 @@ public enum Justification
 
     /// <summary>
     ///     The first item will be aligned to the top and the remaining will aligned to the bottom.
-    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one line between
+    ///     Set <see cref="Aligner.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one line between
     ///     each item.
     /// </summary>
     FirstTopRestBottom = FirstLeftRestRight,
 
     /// <summary>
     ///     The last item will be aligned to the right and the remaining will aligned to the left.
-    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
+    ///     Set <see cref="Aligner.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
     ///     each item.
     /// </summary>
     /// <remarks>
@@ -135,29 +135,29 @@ public enum Justification
 
     /// <summary>
     ///     The last item will be aligned to the bottom and the remaining will aligned to the left.
-    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one line between
+    ///     Set <see cref="Aligner.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one line between
     ///     each item.
     /// </summary>
     LastBottomRestTop = LastRightRestLeft,
 }
 
 /// <summary>
-///     Justifies items within a container based on the specified <see cref="Justification"/>.
+///     Aligns items within a container based on the specified <see cref="Gui.Alignment"/>.
 /// </summary>
-public class Justifier : INotifyPropertyChanged
+public class Aligner : INotifyPropertyChanged
 {
-    private Justification _justification;
+    private Alignment _alignment;
 
     /// <summary>
-    ///     Gets or sets how the <see cref="Justifier"/> justifies items within a container.
+    ///     Gets or sets how the <see cref="Aligner"/> aligns items within a container.
     /// </summary>
-    public Justification Justification
+    public Alignment Alignment
     {
-        get => _justification;
+        get => _alignment;
         set
         {
-            _justification = value;
-            PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (nameof (Justification)));
+            _alignment = value;
+            PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (nameof (Alignment)));
         }
     }
 
@@ -179,7 +179,7 @@ public class Justifier : INotifyPropertyChanged
     private bool _putSpaceBetweenItems;
 
     /// <summary>
-    ///     Gets or sets whether <see cref="Justifier"/> puts a space is placed between items. Default is
+    ///     Gets or sets whether <see cref="Aligner"/> puts a space is placed between items. Default is
     ///     <see langword="false"/>. If <see langword="true"/>, a space will be
     ///     placed between each item, which is useful for justifying text.
     /// </summary>
@@ -203,25 +203,25 @@ public class Justifier : INotifyPropertyChanged
     public event PropertyChangedEventHandler PropertyChanged;
 
     /// <summary>
-    ///     Takes a list of items and returns their positions when justified within a container <see name="ContainerSize"/>
+    ///     Takes a list of items and returns their positions when aligned within a container <see name="ContainerSize"/>
     ///     wide based on the specified
-    ///     <see cref="Justification"/>.
+    ///     <see cref="Alignment"/>.
     /// </summary>
-    /// <param name="sizes">The sizes of the items to justify.</param>
+    /// <param name="sizes">The sizes of the items to align.</param>
     /// <returns>The locations of the items, from left to right.</returns>
-    public int [] Justify (int [] sizes) { return Justify (Justification, PutSpaceBetweenItems, ContainerSize, sizes); }
+    public int [] Align (int [] sizes) { return Align (Alignment, PutSpaceBetweenItems, ContainerSize, sizes); }
 
     /// <summary>
-    ///     Takes a list of items and returns their positions when justified within a container
+    ///     Takes a list of items and returns their positions when aligned within a container
     ///     <paramref name="containerSize"/> wide based on the specified
-    ///     <see cref="Justification"/>.
+    ///     <see cref="Alignment"/>.
     /// </summary>
-    /// <param name="sizes">The sizes of the items to justify.</param>
-    /// <param name="justification">The justification style.</param>
+    /// <param name="sizes">The sizes of the items to align.</param>
+    /// <param name="alignment">Specifies how the items will be aligned.</param>
     /// <param name="putSpaceBetweenItems">Puts a space is placed between items.</param>
     /// <param name="containerSize">The size of the container.</param>
     /// <returns>The locations of the items, from left to right.</returns>
-    public static int [] Justify (Justification justification, bool putSpaceBetweenItems, int containerSize, int [] sizes)
+    public static int [] Align (Alignment alignment, bool putSpaceBetweenItems, int containerSize, int [] sizes)
     {
         if (sizes.Length == 0)
         {
@@ -246,9 +246,9 @@ public class Justifier : INotifyPropertyChanged
             spaces = containerSize - totalItemsSize;
         }
 
-        switch (justification)
+        switch (alignment)
         {
-            case Justification.Left:
+            case Alignment.Left:
                 var currentPosition = 0;
 
                 for (var i = 0; i < sizes.Length; i++)
@@ -269,7 +269,7 @@ public class Justifier : INotifyPropertyChanged
                 }
 
                 break;
-            case Justification.Right:
+            case Alignment.Right:
                 currentPosition = containerSize - totalItemsSize - spaces;
 
                 for (var i = 0; i < sizes.Length; i++)
@@ -283,7 +283,7 @@ public class Justifier : INotifyPropertyChanged
 
                 break;
 
-            case Justification.Centered:
+            case Alignment.Centered:
                 if (sizes.Length > 1)
                 {
                     // remaining space to be distributed before first and after the items
@@ -314,7 +314,7 @@ public class Justifier : INotifyPropertyChanged
 
                 break;
 
-            case Justification.Justified:
+            case Alignment.Justified:
                 int spaceBetween = sizes.Length > 1 ? (containerSize - totalItemsSize) / (sizes.Length - 1) : 0;
                 int remainder = sizes.Length > 1 ? (containerSize - totalItemsSize) % (sizes.Length - 1) : 0;
                 currentPosition = 0;
@@ -330,7 +330,7 @@ public class Justifier : INotifyPropertyChanged
                 break;
 
             // 111 2222        33333
-            case Justification.LastRightRestLeft:
+            case Alignment.LastRightRestLeft:
                 if (sizes.Length > 1)
                 {
                     if (totalItemsSize > containerSize)
@@ -367,7 +367,7 @@ public class Justifier : INotifyPropertyChanged
                 break;
 
             // 111        2222 33333
-            case Justification.FirstLeftRestRight:
+            case Alignment.FirstLeftRestRight:
                 if (sizes.Length > 1)
                 {
                     currentPosition = 0;
@@ -402,7 +402,7 @@ public class Justifier : INotifyPropertyChanged
                 break;
 
             default:
-                throw new ArgumentOutOfRangeException (nameof (justification), justification, null);
+                throw new ArgumentOutOfRangeException (nameof (alignment), alignment, null);
         }
 
         return positions;

+ 2 - 2
Terminal.Gui/Drawing/Thickness.cs

@@ -232,8 +232,8 @@ public class Thickness : IEquatable<Thickness>
             var tf = new TextFormatter
             {
                 Text = label is null ? string.Empty : $"{label} {this}",
-                Justification = Justification.Centered,
-                VerticalJustification = Justification.Bottom,
+                Justification = Alignment.Centered,
+                VerticalJustification = Alignment.Bottom,
                 AutoSize = true
             };
             tf.Draw (rect, Application.Driver.CurrentAttribute, Application.Driver.CurrentAttribute, rect);

+ 31 - 31
Terminal.Gui/Text/TextFormatter.cs

@@ -17,14 +17,14 @@ public class TextFormatter
     private Size _size;
     private int _tabWidth = 4;
     private string _text;
-    private Justification _textJustification;
+    private Alignment _textJustification;
     private TextDirection _textDirection;
-    private Justification _textVerticalJustification;
+    private Alignment _textVerticalJustification;
     private bool _wordWrap = true;
 
     /// <summary>Get or sets the horizontal text justification.</summary>
     /// <value>The text justification.</value>
-    public Justification Justification
+    public Alignment Justification
     {
         get => _textJustification;
         set => _textJustification = EnableNeedsFormat (value);
@@ -34,7 +34,7 @@ public class TextFormatter
     /// <remarks>
     ///     <para>Used when <see cref="View"/> is using <see cref="Dim.Auto"/> to resize the view's <see cref="View.Viewport"/> to fit <see cref="Size"/>.</para>
     ///     <para>
-    ///         AutoSize is ignored if <see cref="Justification.Justified"/> is used.
+    ///         AutoSize is ignored if <see cref="Alignment.Justified"/> is used.
     ///     </para>
     /// </remarks>
     public bool AutoSize
@@ -224,7 +224,7 @@ public class TextFormatter
 
     /// <summary>Gets or sets the vertical text-justification.</summary>
     /// <value>The text vertical justification.</value>
-    public Justification VerticalJustification
+    public Alignment VerticalJustification
     {
         get => _textVerticalJustification;
         set => _textVerticalJustification = EnableNeedsFormat (value);
@@ -320,7 +320,7 @@ public class TextFormatter
             int x = 0, y = 0;
 
             // Horizontal Justification
-            if (Justification is Justification.Right)
+            if (Justification is Alignment.Right)
             {
                 if (isVertical)
                 {
@@ -335,7 +335,7 @@ public class TextFormatter
                     CursorPosition = screen.Width - runesWidth + (_hotKeyPos > -1 ? _hotKeyPos : 0);
                 }
             }
-            else if (Justification is Justification.Left)
+            else if (Justification is Alignment.Left)
             {
                 if (isVertical)
                 {
@@ -351,7 +351,7 @@ public class TextFormatter
 
                 CursorPosition = _hotKeyPos > -1 ? _hotKeyPos : 0;
             }
-            else if (Justification is Justification.Justified)
+            else if (Justification is Alignment.Justified)
             {
                 if (isVertical)
                 {
@@ -374,7 +374,7 @@ public class TextFormatter
 
                 CursorPosition = _hotKeyPos > -1 ? _hotKeyPos : 0;
             }
-            else if (Justification is Justification.Centered)
+            else if (Justification is Alignment.Centered)
             {
                 if (isVertical)
                 {
@@ -400,7 +400,7 @@ public class TextFormatter
             }
 
             // Vertical Justification
-            if (VerticalJustification is Justification.Bottom)
+            if (VerticalJustification is Alignment.Bottom)
             {
                 if (isVertical)
                 {
@@ -411,7 +411,7 @@ public class TextFormatter
                     y = screen.Bottom - linesFormatted.Count + line;
                 }
             }
-            else if (VerticalJustification is Justification.Top)
+            else if (VerticalJustification is Alignment.Top)
             {
                 if (isVertical)
                 {
@@ -422,7 +422,7 @@ public class TextFormatter
                     y = screen.Top + line;
                 }
             }
-            else if (VerticalJustification is Justification.Justified)
+            else if (VerticalJustification 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 Justification.Centered)
+            else if (VerticalJustification is Alignment.Centered)
             {
                 if (isVertical)
                 {
@@ -474,8 +474,8 @@ public class TextFormatter
                 {
                     if (idx < 0
                         || (isVertical
-                                ? VerticalJustification != Justification.Bottom && current < 0
-                                : Justification != Justification.Right && x + current + colOffset < 0))
+                                ? VerticalJustification != Alignment.Bottom && current < 0
+                                : Justification != Alignment.Right && x + current + colOffset < 0))
                     {
                         current++;
 
@@ -564,7 +564,7 @@ public class TextFormatter
 
                 if (HotKeyPos > -1 && idx == HotKeyPos)
                 {
-                    if ((isVertical && VerticalJustification == Justification.Justified) || (!isVertical && Justification == Justification.Justified))
+                    if ((isVertical && VerticalJustification == Alignment.Justified) || (!isVertical && Justification == Alignment.Justified))
                     {
                         CursorPosition = idx - start;
                     }
@@ -702,7 +702,7 @@ public class TextFormatter
                 _lines = Format (
                                  text,
                                  Size.Height,
-                                 VerticalJustification == Justification.Justified,
+                                 VerticalJustification == Alignment.Justified,
                                  Size.Width > colsWidth && WordWrap,
                                  PreserveTrailingSpaces,
                                  TabWidth,
@@ -726,7 +726,7 @@ public class TextFormatter
                 _lines = Format (
                                  text,
                                  Size.Width,
-                                 Justification == Justification.Justified,
+                                 Justification == Alignment.Justified,
                                  Size.Height > 1 && WordWrap,
                                  PreserveTrailingSpaces,
                                  TabWidth,
@@ -1034,7 +1034,7 @@ public class TextFormatter
         List<Rune> runes = StripCRLF (text).ToRuneList ();
 
         int start = Math.Max (
-                              !runes.Contains ((Rune)' ') && textFormatter is { VerticalJustification: Justification.Bottom } && IsVerticalDirection (textDirection)
+                              !runes.Contains ((Rune)' ') && textFormatter is { VerticalJustification: Alignment.Bottom } && IsVerticalDirection (textDirection)
                                   ? runes.Count - width
                                   : 0,
                               0);
@@ -1260,13 +1260,13 @@ public class TextFormatter
     public static string ClipAndJustify (
         string text,
         int width,
-        Justification textJustification,
+        Alignment textJustification,
         TextDirection textDirection = TextDirection.LeftRight_TopBottom,
         int tabWidth = 0,
         TextFormatter textFormatter = null
     )
     {
-        return ClipAndJustify (text, width, textJustification == Justification.Justified, textDirection, tabWidth, textFormatter);
+        return ClipAndJustify (text, width, textJustification == Alignment.Justified, textDirection, tabWidth, textFormatter);
     }
 
     /// <summary>Justifies text within a specified width.</summary>
@@ -1307,12 +1307,12 @@ public class TextFormatter
         {
             if (IsHorizontalDirection (textDirection))
             {
-                if (textFormatter is { Justification: Justification.Right })
+                if (textFormatter is { Justification: Alignment.Right })
                 {
                     return GetRangeThatFits (runes, runes.Count - width, text, width, tabWidth, textDirection);
                 }
 
-                if (textFormatter is { Justification: Justification.Centered })
+                if (textFormatter is { Justification: 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: Justification.Bottom })
+                if (textFormatter is { VerticalJustification: Alignment.Bottom })
                 {
                     return GetRangeThatFits (runes, runes.Count - width, text, width, tabWidth, textDirection);
                 }
 
-                if (textFormatter is { VerticalJustification: Justification.Centered })
+                if (textFormatter is { VerticalJustification: 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: Justification.Right })
+            if (textFormatter is { Justification: Alignment.Right })
             {
                 if (GetRuneWidth (text, tabWidth, textDirection) > width)
                 {
                     return GetRangeThatFits (runes, runes.Count - width, text, width, tabWidth, textDirection);
                 }
             }
-            else if (textFormatter is { Justification: Justification.Centered })
+            else if (textFormatter is { Justification: 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: Justification.Bottom })
+            if (textFormatter is { VerticalJustification: Alignment.Bottom })
             {
                 if (runes.Count - zeroLength > width)
                 {
                     return GetRangeThatFits (runes, runes.Count - width, text, width, tabWidth, textDirection);
                 }
             }
-            else if (textFormatter is { VerticalJustification: Justification.Centered })
+            else if (textFormatter is { VerticalJustification: Alignment.Centered })
             {
                 return GetRangeThatFits (runes, Math.Max ((runes.Count - width) / 2, 0), text, width, tabWidth, textDirection);
             }
@@ -1501,7 +1501,7 @@ public class TextFormatter
     public static List<string> Format (
         string text,
         int width,
-        Justification textJustification,
+        Alignment textJustification,
         bool wordWrap,
         bool preserveTrailingSpaces = false,
         int tabWidth = 0,
@@ -1513,7 +1513,7 @@ public class TextFormatter
         return Format (
                        text,
                        width,
-                       textJustification == Justification.Justified,
+                       textJustification == Alignment.Justified,
                        wordWrap,
                        preserveTrailingSpaces,
                        tabWidth,

+ 7 - 7
Terminal.Gui/View/Layout/PosDim.cs

@@ -211,7 +211,7 @@ public class Pos
     /// <param name="justification"></param>
     /// <param name="groupId">The optional, unique identifier for the set of views to justify according to <paramref name="justification"/>.</param>
     /// <returns></returns>
-    public static Pos Justify (Justification justification, int groupId = 0) { return new PosJustify (justification, groupId); }
+    public static Pos Justify (Alignment justification, int groupId = 0) { return new PosJustify (justification, groupId); }
 
     /// <summary>Serves as the default hash function. </summary>
     /// <returns>A hash code for the current object.</returns>
@@ -526,7 +526,7 @@ public class Pos
         /// <summary>
         /// Gets the justification settings.
         /// </summary>
-        public Justifier Justifier { get; } = new ();
+        public Aligner Justifier { get; } = new ();
 
 
         /// <summary>
@@ -542,7 +542,7 @@ public class Pos
             {
                 return;
             }
-            Justifier firstInGroup = null;
+            Aligner firstInGroup = null;
             List<int> dimensionsList = new ();
             List<View> viewsInGroup = views.Where (
                                                    v =>
@@ -585,7 +585,7 @@ public class Pos
             }
 
             firstInGroup.ContainerSize = size;
-            var locations = firstInGroup.Justify (dimensionsList.ToArray ());
+            var locations = firstInGroup.Align (dimensionsList.ToArray ());
 
             for (var index = 0; index < viewsInGroup.Count; index++)
             {
@@ -604,10 +604,10 @@ public class Pos
         /// </summary>
         /// <param name="justification"></param>
         /// <param name="groupId">The unique identifier for the set of views to justify according to <paramref name="justification"/>.</param>
-        public PosJustify (Justification justification, int groupId = 0)
+        public PosJustify (Alignment justification, int groupId = 0)
         {
             Justifier.PutSpaceBetweenItems = true;
-            Justifier.Justification = justification;
+            Justifier.Alignment = justification;
             _groupId = groupId;
             Justifier.PropertyChanged += Justifier_PropertyChanged;
         }
@@ -632,7 +632,7 @@ public class Pos
         /// <inheritdoc />
         public override string ToString ()
         {
-            return $"Justify(groupId={_groupId}, justification={Justifier.Justification})";
+            return $"Justify(groupId={_groupId}, justification={Justifier.Alignment})";
         }
 
         internal override int Anchor (int width)

+ 2 - 2
Terminal.Gui/View/ViewText.cs

@@ -87,7 +87,7 @@ public partial class View
     ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="Dim.DimAutoStyle.Text"/>, the <see cref="ContentSize"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The text justification.</value>
-    public virtual Justification TextJustification
+    public virtual Alignment TextJustification
     {
         get => TextFormatter.Justification;
         set
@@ -130,7 +130,7 @@ public partial class View
     ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="Dim.DimAutoStyle.Text"/>, the <see cref="ContentSize"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The vertical text justification.</value>
-    public virtual Justification VerticalTextJustification
+    public virtual Alignment VerticalTextJustification
     {
         get => TextFormatter.VerticalJustification;
         set

+ 2 - 2
Terminal.Gui/Views/Button.cs

@@ -37,8 +37,8 @@ public class Button : View
     /// <remarks>The width of the <see cref="Button"/> is computed based on the text length. The height will always be 1.</remarks>
     public Button ()
     {
-        Justification = Justification.Centered;
-        VerticalJustification = Justification.Centered;
+        TextJustification = Alignment.Centered;
+        VerticalTextJustification = Alignment.Centered;
 
         _leftBracket = Glyphs.LeftBracket;
         _rightBracket = Glyphs.RightBracket;

+ 5 - 5
Terminal.Gui/Views/CheckBox.cs

@@ -153,15 +153,15 @@ public class CheckBox : View
     /// <inheritdoc/>
     protected override void UpdateTextFormatterText ()
     {
-        switch (Justification)
+        switch (TextJustification)
         {
-            case Justification.Left:
-            case Justification.Centered:
-            case Justification.Justified:
+            case Alignment.Left:
+            case Alignment.Centered:
+            case Alignment.Justified:
                 TextFormatter.Text = $"{GetCheckedState ()} {GetFormatterText ()}";
 
                 break;
-            case Justification.Right:
+            case Alignment.Right:
                 TextFormatter.Text = $"{GetFormatterText ()} {GetCheckedState ()}";
 
                 break;

+ 3 - 3
Terminal.Gui/Views/Dialog.cs

@@ -98,7 +98,7 @@ public class Dialog : Window
 
     // TODO: Update button.X = Pos.Justify when justification changes
     /// <summary>Determines how the <see cref="Dialog"/> <see cref="Button"/>s are justified along the bottom of the dialog.</summary>
-    public Justification ButtonJustification { get; set; }
+    public Alignment ButtonJustification { get; set; }
 
     /// <summary>Optional buttons to lay out at the bottom of the dialog.</summary>
     public Button [] Buttons
@@ -118,11 +118,11 @@ public class Dialog : Window
         }
     }
 
-    /// <summary>The default <see cref="Justification"/> for <see cref="Dialog"/>.</summary>
+    /// <summary>The default <see cref="Alignment"/> for <see cref="Dialog"/>.</summary>
     /// <remarks>This property can be set in a Theme.</remarks>
     [SerializableConfigurationProperty (Scope = typeof (ThemeScope))]
     [JsonConverter (typeof (JsonStringEnumConverter))]
-    public static Justification DefaultButtonJustification { get; set; } = Justification.Right;
+    public static Alignment DefaultButtonJustification { get; set; } = Alignment.Right;
 
     /// <summary>
     ///     Adds a <see cref="Button"/> to the <see cref="Dialog"/>, its layout will be controlled by the

+ 1 - 1
Terminal.Gui/Views/ListView.cs

@@ -1002,7 +1002,7 @@ public class ListWrapper : IListDataSource
     private void RenderUstr (ConsoleDriver driver, string ustr, int col, int line, int width, int start = 0)
     {
         string str = start > ustr.GetColumns () ? string.Empty : ustr.Substring (Math.Min (start, ustr.ToRunes ().Length - 1));
-        string u = TextFormatter.ClipAndJustify (str, width, Justification.Left);
+        string u = TextFormatter.ClipAndJustify (str, width, Alignment.Left);
         driver.AddStr (u);
         width -= u.GetColumns ();
 

+ 1 - 1
Terminal.Gui/Views/Menu/Menu.cs

@@ -891,7 +891,7 @@ internal sealed class Menu : View
                     var tf = new TextFormatter
                     {
                         AutoSize = true,
-                        Justification = Justification.Centered, HotKeySpecifier = MenuBar.HotKeySpecifier, Text = textToDraw
+                        Justification = Alignment.Centered, HotKeySpecifier = MenuBar.HotKeySpecifier, Text = textToDraw
                     };
 
                     // The -3 is left/right border + one space (not sure what for)

+ 3 - 3
Terminal.Gui/Views/MessageBox.cs

@@ -340,8 +340,8 @@ public static class MessageBox
             }
         }
 
-        Justification buttonJust = Dialog.DefaultButtonJustification;
-        Dialog.DefaultButtonJustification = Justification.Centered;
+        Alignment buttonJust = Dialog.DefaultButtonJustification;
+        Dialog.DefaultButtonJustification = Alignment.Centered;
         var d = new Dialog
         {
             Buttons = buttonList.ToArray (),
@@ -374,7 +374,7 @@ public static class MessageBox
         var messageLabel = new Label
         {
             Text = message,
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             X = Pos.Center (),
             Y = 0
         };

+ 1 - 1
Terminal.Gui/Views/ProgressBar.cs

@@ -181,7 +181,7 @@ public class ProgressBar : View
 
         if (ProgressBarFormat != ProgressBarFormat.Simple && !_isActivity)
         {
-            var tf = new TextFormatter { Justification = Justification.Centered, Text = Text };
+            var tf = new TextFormatter { Justification = Alignment.Centered, Text = Text };
             var attr = new Attribute (ColorScheme.HotNormal.Foreground, ColorScheme.HotNormal.Background);
 
             if (_fraction > .5)

+ 7 - 7
Terminal.Gui/Views/Slider.cs

@@ -930,7 +930,7 @@ public class Slider<T> : View
         }
     }
 
-    private string JustifyText (string text, int width, Justification justification)
+    private string JustifyText (string text, int width, Alignment justification)
     {
         if (text is null)
         {
@@ -949,18 +949,18 @@ public class Slider<T> : View
         // Note: The formatter doesn't handle all of this ???
         switch (justification)
         {
-            case Justification.Justified:
+            case Alignment.Justified:
                 return TextFormatter.Justify (text, width);
-            case Justification.Left:
+            case Alignment.Left:
                 return text + s1 + s1 + s2;
-            case Justification.Centered:
+            case Alignment.Centered:
                 if (text.Length % 2 != 0)
                 {
                     return s1 + text + s1 + s2;
                 }
 
                 return s1 + s2 + text + s1;
-            case Justification.Right:
+            case Alignment.Right:
                 return s1 + s1 + s2 + text;
             default:
                 return text;
@@ -1293,7 +1293,7 @@ public class Slider<T> : View
                     switch (_config._legendsOrientation)
                     {
                         case Orientation.Horizontal:
-                            text = JustifyText (text, _config._innerSpacing + 1, Justification.Centered);
+                            text = JustifyText (text, _config._innerSpacing + 1, Alignment.Centered);
 
                             break;
                         case Orientation.Vertical:
@@ -1311,7 +1311,7 @@ public class Slider<T> : View
 
                             break;
                         case Orientation.Vertical:
-                            text = JustifyText (text, _config._innerSpacing + 1, Justification.Centered);
+                            text = JustifyText (text, _config._innerSpacing + 1, Alignment.Centered);
 
                             break;
                     }

+ 3 - 3
Terminal.Gui/Views/TableView/ColumnStyle.cs

@@ -11,7 +11,7 @@ public class ColumnStyle
     ///     Defines a delegate for returning custom justification per cell based on cell values. When specified this will
     ///     override <see cref="Justification"/>
     /// </summary>
-    public Func<object, Justification> JustificationGetter;
+    public Func<object, Alignment> JustificationGetter;
 
     /// <summary>
     ///     Defines a delegate for returning a custom color scheme per cell based on cell values. Return null for the
@@ -32,7 +32,7 @@ public class ColumnStyle
     ///     Defines the default justification for all values rendered in this column. For custom justification based on cell
     ///     contents use <see cref="JustificationGetter"/>.
     /// </summary>
-    public Justification Justification { get; set; }
+    public Alignment Justification { get; set; }
 
     /// <summary>Defines the format for values e.g. "yyyy-MM-dd" for dates</summary>
     public string Format { get; set; }
@@ -74,7 +74,7 @@ public class ColumnStyle
     /// </summary>
     /// <param name="cellValue"></param>
     /// <returns></returns>
-    public Justification GetJustification (object cellValue)
+    public Alignment GetJustification (object cellValue)
     {
         if (JustificationGetter is { })
         {

+ 5 - 5
Terminal.Gui/Views/TableView/TableView.cs

@@ -2085,16 +2085,16 @@ public class TableView : View
                         - (representation.EnumerateRunes ().Sum (c => c.GetColumns ())
                            + 1 /*leave 1 space for cell boundary*/);
 
-            switch (colStyle?.GetJustification (originalCellValue) ?? Justification.Left)
+            switch (colStyle?.GetJustification (originalCellValue) ?? Alignment.Left)
             {
-                case Justification.Left:
+                case Alignment.Left:
                     return representation + new string (' ', toPad);
-                case Justification.Right:
+                case Alignment.Right:
                     return new string (' ', toPad) + representation;
 
                 // TODO: With single line cells, centered and justified are the same right?
-                case Justification.Centered:
-                case Justification.Justified:
+                case Alignment.Centered:
+                case Alignment.Justified:
                     return
                         new string (' ', (int)Math.Floor (toPad / 2.0))
                         + // round down

+ 8 - 8
Terminal.Gui/Views/TextValidateField.cs

@@ -539,7 +539,7 @@ namespace Terminal.Gui
             {
                 int c = _provider.Cursor (mouseEvent.X - GetMargins (Viewport.Width).left);
 
-                if (_provider.Fixed == false && Justification == Justification.Right && Text.Length > 0)
+                if (_provider.Fixed == false && TextJustification == Alignment.Right && Text.Length > 0)
                 {
                     c++;
                 }
@@ -633,7 +633,7 @@ namespace Terminal.Gui
             // When it's right-aligned and it's a normal input, the cursor behaves differently.
             int curPos;
 
-            if (_provider?.Fixed == false && Justification == Justification.Right)
+            if (_provider?.Fixed == false && TextJustification == Alignment.Right)
             {
                 curPos = _cursorPosition + left - 1;
             }
@@ -650,7 +650,7 @@ namespace Terminal.Gui
         /// <returns></returns>
         private bool BackspaceKeyHandler ()
         {
-            if (_provider.Fixed == false && Justification == Justification.Right && _cursorPosition <= 1)
+            if (_provider.Fixed == false && TextJustification == Alignment.Right && _cursorPosition <= 1)
             {
                 return false;
             }
@@ -688,7 +688,7 @@ namespace Terminal.Gui
         /// <returns></returns>
         private bool DeleteKeyHandler ()
         {
-            if (_provider.Fixed == false && Justification == Justification.Right)
+            if (_provider.Fixed == false && TextJustification == Alignment.Right)
             {
                 _cursorPosition = _provider.CursorLeft (_cursorPosition);
             }
@@ -717,13 +717,13 @@ namespace Terminal.Gui
             int count = Text.Length;
             int total = width - count;
 
-            switch (Justification)
+            switch (TextJustification)
             {
-                case Justification.Left:
+                case Alignment.Left:
                     return (0, total);
-                case Justification.Centered:
+                case Alignment.Centered:
                     return (total / 2, total / 2 + total % 2);
-                case Justification.Right:
+                case Alignment.Right:
                     return (total, 0);
                 default:
                     return (0, total);

+ 1 - 1
Terminal.Gui/Views/TextView.cs

@@ -1776,7 +1776,7 @@ internal class WordWrapManager
                                                             TextFormatter.Format (
                                                                                   TextModel.ToString (line),
                                                                                   width,
-                                                                                  Justification.Left,
+                                                                                  Alignment.Left,
                                                                                   true,
                                                                                   preserveTrailingSpaces,
                                                                                   tabWidth

+ 1 - 1
Terminal.Gui/Views/Wizard/Wizard.cs

@@ -85,7 +85,7 @@ public class Wizard : Dialog
     {
         // Using Justify causes the Back and Next buttons to be hard justified against
         // the left and right edge
-        ButtonJustification = Justification.Justified;
+        ButtonJustification = Alignment.Justified;
         BorderStyle = LineStyle.Double;
 
         //// Add a horiz separator

+ 2 - 2
UICatalog/Scenarios/BasicColors.cs

@@ -32,7 +32,7 @@ public class BasicColors : Scenario
                 Y = 0,
                 Width = 1,
                 Height = 13,
-                VerticalJustification = Justification.Bottom,
+                VerticalTextJustification = Alignment.Bottom,
                 ColorScheme = new ColorScheme { Normal = attr },
                 Text = bg.ToString (),
                 TextDirection = TextDirection.TopBottom_LeftRight
@@ -45,7 +45,7 @@ public class BasicColors : Scenario
                 Y = y,
                 Width = 13,
                 Height = 1,
-                Justification = Justification.Right,
+                TextJustification = Alignment.Right,
                 ColorScheme = new ColorScheme { Normal = attr },
                 Text = bg.ToString ()
             };

+ 25 - 25
UICatalog/Scenarios/Buttons.cs

@@ -287,39 +287,39 @@ public class Buttons : Scenario
                                               switch (args.SelectedItem)
                                               {
                                                   case 0:
-                                                      moveBtn.Justification = Justification.Left;
-                                                      sizeBtn.Justification = Justification.Left;
-                                                      moveBtnA.Justification = Justification.Left;
-                                                      sizeBtnA.Justification = Justification.Left;
-                                                      moveHotKeyBtn.Justification = Justification.Left;
-                                                      moveUnicodeHotKeyBtn.Justification = Justification.Left;
+                                                      moveBtn.TextJustification = Alignment.Left;
+                                                      sizeBtn.TextJustification = Alignment.Left;
+                                                      moveBtnA.TextJustification = Alignment.Left;
+                                                      sizeBtnA.TextJustification = Alignment.Left;
+                                                      moveHotKeyBtn.TextJustification = Alignment.Left;
+                                                      moveUnicodeHotKeyBtn.TextJustification = Alignment.Left;
 
                                                       break;
                                                   case 1:
-                                                      moveBtn.Justification = Justification.Right;
-                                                      sizeBtn.Justification = Justification.Right;
-                                                      moveBtnA.Justification = Justification.Right;
-                                                      sizeBtnA.Justification = Justification.Right;
-                                                      moveHotKeyBtn.Justification = Justification.Right;
-                                                      moveUnicodeHotKeyBtn.Justification = Justification.Right;
+                                                      moveBtn.TextJustification = Alignment.Right;
+                                                      sizeBtn.TextJustification = Alignment.Right;
+                                                      moveBtnA.TextJustification = Alignment.Right;
+                                                      sizeBtnA.TextJustification = Alignment.Right;
+                                                      moveHotKeyBtn.TextJustification = Alignment.Right;
+                                                      moveUnicodeHotKeyBtn.TextJustification = Alignment.Right;
 
                                                       break;
                                                   case 2:
-                                                      moveBtn.Justification = Justification.Centered;
-                                                      sizeBtn.Justification = Justification.Centered;
-                                                      moveBtnA.Justification = Justification.Centered;
-                                                      sizeBtnA.Justification = Justification.Centered;
-                                                      moveHotKeyBtn.Justification = Justification.Centered;
-                                                      moveUnicodeHotKeyBtn.Justification = Justification.Centered;
+                                                      moveBtn.TextJustification = Alignment.Centered;
+                                                      sizeBtn.TextJustification = Alignment.Centered;
+                                                      moveBtnA.TextJustification = Alignment.Centered;
+                                                      sizeBtnA.TextJustification = Alignment.Centered;
+                                                      moveHotKeyBtn.TextJustification = Alignment.Centered;
+                                                      moveUnicodeHotKeyBtn.TextJustification = Alignment.Centered;
 
                                                       break;
                                                   case 3:
-                                                      moveBtn.Justification = Justification.Justified;
-                                                      sizeBtn.Justification = Justification.Justified;
-                                                      moveBtnA.Justification = Justification.Justified;
-                                                      sizeBtnA.Justification = Justification.Justified;
-                                                      moveHotKeyBtn.Justification = Justification.Justified;
-                                                      moveUnicodeHotKeyBtn.Justification = Justification.Justified;
+                                                      moveBtn.TextJustification = Alignment.Justified;
+                                                      sizeBtn.TextJustification = Alignment.Justified;
+                                                      moveBtnA.TextJustification = Alignment.Justified;
+                                                      sizeBtnA.TextJustification = Alignment.Justified;
+                                                      moveHotKeyBtn.TextJustification = Alignment.Justified;
+                                                      moveUnicodeHotKeyBtn.TextJustification = Alignment.Justified;
 
                                                       break;
                                               }
@@ -439,7 +439,7 @@ public class Buttons : Scenario
                 Y = Pos.Top (_down),
                 Width = Dim.Function (() => Digits),
                 Height = 1,
-                Justification = Justification.Centered,
+                TextJustification = Alignment.Centered,
                 CanFocus = true
             };
 

+ 1 - 1
UICatalog/Scenarios/CharacterMap.cs

@@ -958,7 +958,7 @@ internal class CharMap : View
             Y = 1,
             Width = Dim.Fill (),
             Height = Dim.Fill (1),
-            Justification = Justification.Centered
+            TextJustification = Alignment.Centered
         };
         var spinner = new SpinnerView { X = Pos.Center (), Y = Pos.Center (), Style = new Aesthetic () };
         spinner.AutoSpin = true;

+ 2 - 2
UICatalog/Scenarios/CollectionNavigatorTester.cs

@@ -142,7 +142,7 @@ public class CollectionNavigatorTester : Scenario
         var label = new Label
         {
             Text = "ListView",
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             X = 0,
             Y = 1, // for menu
             Width = Dim.Percent (50),
@@ -171,7 +171,7 @@ public class CollectionNavigatorTester : Scenario
         var label = new Label
         {
             Text = "TreeView",
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             X = Pos.Right (_listView) + 2,
             Y = 1, // for menu
             Width = Dim.Percent (50),

+ 2 - 2
UICatalog/Scenarios/ColorPicker.cs

@@ -69,8 +69,8 @@ public class ColorPickers : Scenario
         {
             Title = "Color Sample",
             Text = "Lorem Ipsum",
-            Justification = Justification.Centered,
-            VerticalJustification = Justification.Centered,
+            TextJustification = Alignment.Centered,
+            VerticalTextJustification = Alignment.Centered,
             BorderStyle = LineStyle.Heavy,
             X = Pos.Center (),
             Y = Pos.Center (),

+ 13 - 13
UICatalog/Scenarios/ComputedLayout.cs

@@ -91,7 +91,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           Justification = Justification.Left,
+                           TextJustification = Alignment.Left,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -103,7 +103,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           Justification = Justification.Right,
+                           TextJustification = Alignment.Right,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -115,7 +115,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           Justification = Justification.Centered,
+                           TextJustification = Alignment.Centered,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -127,7 +127,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           Justification = Justification.Justified,
+                           TextJustification = Alignment.Justified,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -153,7 +153,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           Justification = Justification.Left,
+                           TextJustification = Alignment.Left,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -165,7 +165,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           Justification = Justification.Right,
+                           TextJustification = Alignment.Right,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -177,7 +177,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           Justification = Justification.Centered,
+                           TextJustification = Alignment.Centered,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -189,7 +189,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           Justification = Justification.Justified,
+                           TextJustification = Alignment.Justified,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -324,7 +324,7 @@ public class ComputedLayout : Scenario
         var anchorEndLabel1 = new Label
         {
             Text = "This Label should be the 3rd to last line (AnchorEnd (3)).",
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             ColorScheme = Colors.ColorSchemes ["Menu"],
             Width = Dim.Fill (5),
             X = 5,
@@ -338,7 +338,7 @@ public class ComputedLayout : Scenario
         {
             Text =
                 "This TextField should be the 4th to last line (AnchorEnd (3) - 1).",
-            Justification = Justification.Left,
+            TextJustification = Alignment.Left,
             ColorScheme = Colors.ColorSchemes ["Menu"],
             Width = Dim.Fill (5),
             X = 5,
@@ -397,9 +397,9 @@ public class ComputedLayout : Scenario
 
 
         // Center three buttons with 
-        leftButton.X = Pos.Justify (Justification.Centered);
-        centerButton.X = Pos.Justify (Justification.Centered);
-        rightButton.X = Pos.Justify (Justification.Centered);
+        leftButton.X = Pos.Justify (Alignment.Centered);
+        centerButton.X = Pos.Justify (Alignment.Centered);
+        rightButton.X = Pos.Justify (Alignment.Centered);
 
         Application.Run (app);
         app.Dispose ();

+ 11 - 11
UICatalog/Scenarios/CsvEditor.cs

@@ -78,17 +78,17 @@ public class CsvEditor : Scenario
                                      _miLeft = new MenuItem (
                                                              "_Justify Left",
                                                              "",
-                                                             () => Justify (Justification.Left)
+                                                             () => Justify (Alignment.Left)
                                                             ),
                                      _miRight = new MenuItem (
                                                               "_Justify Right",
                                                               "",
-                                                              () => Justify (Justification.Right)
+                                                              () => Justify (Alignment.Right)
                                                              ),
                                      _miCentered = new MenuItem (
                                                                  "_Justify Centered",
                                                                  "",
-                                                                 () => Justify (Justification.Centered)
+                                                                 () => Justify (Alignment.Centered)
                                                                 ),
 
                                      // Format requires hard typed data table, when we read a CSV everything is untyped (string) so this only works for new columns in this demo
@@ -133,7 +133,7 @@ public class CsvEditor : Scenario
             Y = Pos.Bottom (_tableView),
             Text = "0,0",
             Width = Dim.Fill (),
-            Justification = Justification.Right
+            TextJustification = Alignment.Right
         };
         _selectedCellLabel.TextChanged += SelectedCellLabel_TextChanged;
 
@@ -218,7 +218,7 @@ public class CsvEditor : Scenario
         _tableView.Update ();
     }
 
-    private void Justify (Justification newJustification)
+    private void Justify (Alignment newJustification)
     {
         if (NoTableLoaded ())
         {
@@ -228,9 +228,9 @@ public class CsvEditor : Scenario
         ColumnStyle style = _tableView.Style.GetOrCreateColumnStyle (_tableView.SelectedColumn);
         style.Justification = newJustification;
 
-        _miLeft.Checked = style.Justification == Justification.Left;
-        _miRight.Checked = style.Justification == Justification.Right;
-        _miCentered.Checked = style.Justification == Justification.Centered;
+        _miLeft.Checked = style.Justification == Alignment.Left;
+        _miRight.Checked = style.Justification == Alignment.Right;
+        _miCentered.Checked = style.Justification == Alignment.Centered;
 
         _tableView.Update ();
     }
@@ -437,9 +437,9 @@ public class CsvEditor : Scenario
 
         ColumnStyle style = _tableView.Style.GetColumnStyleIfAny (_tableView.SelectedColumn);
 
-        _miLeft.Checked = style?.Justification == Justification.Left;
-        _miRight.Checked = style?.Justification == Justification.Right;
-        _miCentered.Checked = style?.Justification == Justification.Centered;
+        _miLeft.Checked = style?.Justification == Alignment.Left;
+        _miRight.Checked = style?.Justification == Alignment.Right;
+        _miCentered.Checked = style?.Justification == Alignment.Centered;
     }
 
     private void Open ()

+ 9 - 9
UICatalog/Scenarios/Dialogs.cs

@@ -18,7 +18,7 @@ public class Dialogs : Scenario
         var numButtonsLabel = new Label
         {
             X = 0,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = "_Number of Buttons:"
         };
 
@@ -28,7 +28,7 @@ public class Dialogs : Scenario
             Y = 0,
             Width = Dim.Width (numButtonsLabel),
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = "_Width:"
         };
         frame.Add (label);
@@ -49,7 +49,7 @@ public class Dialogs : Scenario
             Y = Pos.Bottom (label),
             Width = Dim.Width (numButtonsLabel),
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = "_Height:"
         };
         frame.Add (label);
@@ -83,7 +83,7 @@ public class Dialogs : Scenario
             Y = Pos.Bottom (label),
             Width = Dim.Width (numButtonsLabel),
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = "_Title:"
         };
         frame.Add (label);
@@ -115,7 +115,7 @@ public class Dialogs : Scenario
         {
             X = Pos.Right (numButtonsLabel) + 1,
             Y = Pos.Bottom (numButtonsLabel),
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = $"_Add {char.ConvertFromUtf32 (CODE_POINT)} to button text to stress wide char support",
             Checked = false
         };
@@ -127,7 +127,7 @@ public class Dialogs : Scenario
             Y = Pos.Bottom (glyphsNotWords),
             Width = Dim.Width (numButtonsLabel),
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = "Button St_yle:"
         };
         frame.Add (label);
@@ -145,7 +145,7 @@ public class Dialogs : Scenario
             }
         }
 
-        var labels = GetUniqueEnumNames<Justification> ();
+        var labels = GetUniqueEnumNames<Alignment> ();
         var styleRadioGroup = new RadioGroup
         {
             X = Pos.Right (label) + 1,
@@ -175,7 +175,7 @@ public class Dialogs : Scenario
 
         label = new()
         {
-            X = Pos.Center (), Y = Pos.Bottom (frame) + 4, Justification = Justification.Right, Text = "Button Pressed:"
+            X = Pos.Center (), Y = Pos.Bottom (frame) + 4, TextJustification = Alignment.Right, Text = "Button Pressed:"
         };
         Win.Add (label);
 
@@ -282,7 +282,7 @@ public class Dialogs : Scenario
             dialog = new()
             {
                 Title = titleEdit.Text,
-                ButtonJustification = (Justification)styleRadioGroup.SelectedItem,
+                ButtonJustification = (Alignment)styleRadioGroup.SelectedItem,
                 Buttons = buttons.ToArray ()
             };
 

+ 2 - 2
UICatalog/Scenarios/DynamicMenuBar.cs

@@ -623,7 +623,7 @@ public class DynamicMenuBar : Scenario
             var _lblMenuBar = new Label
             {
                 ColorScheme = Colors.ColorSchemes ["Dialog"],
-                Justification = Justification.Centered,
+                TextJustification = Alignment.Centered,
                 X = Pos.Right (_btnPrevious) + 1,
                 Y = Pos.Top (_btnPrevious),
 
@@ -636,7 +636,7 @@ public class DynamicMenuBar : Scenario
 
             var _lblParent = new Label
             {
-                Justification = Justification.Centered,
+                TextJustification = Alignment.Centered,
                 X = Pos.Right (_btnPrevious) + 1,
                 Y = Pos.Top (_btnPrevious) + 1,
 

+ 9 - 9
UICatalog/Scenarios/Editor.cs

@@ -882,7 +882,7 @@ public class Editor : Scenario
         {
             Y = 1,
             Width = lblWidth,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
 
             Text = "Find:"
         };
@@ -903,7 +903,7 @@ public class Editor : Scenario
             Y = Pos.Top (label),
             Width = 20,
             Enabled = !string.IsNullOrEmpty (txtToFind.Text),
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             IsDefault = true,
 
             Text = "Find _Next"
@@ -917,7 +917,7 @@ public class Editor : Scenario
             Y = Pos.Top (btnFindNext) + 1,
             Width = 20,
             Enabled = !string.IsNullOrEmpty (txtToFind.Text),
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
 
             Text = "Find _Previous"
         };
@@ -937,7 +937,7 @@ public class Editor : Scenario
             X = Pos.Right (txtToFind) + 1,
             Y = Pos.Top (btnFindPrevious) + 2,
             Width = 20,
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
 
             Text = "Cancel"
         };
@@ -1134,7 +1134,7 @@ public class Editor : Scenario
         {
             Y = 1,
             Width = lblWidth,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
 
             Text = "Find:"
         };
@@ -1155,7 +1155,7 @@ public class Editor : Scenario
             Y = Pos.Top (label),
             Width = 20,
             Enabled = !string.IsNullOrEmpty (txtToFind.Text),
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             IsDefault = true,
 
             Text = "Replace _Next"
@@ -1181,7 +1181,7 @@ public class Editor : Scenario
             Y = Pos.Top (btnFindNext) + 1,
             Width = 20,
             Enabled = !string.IsNullOrEmpty (txtToFind.Text),
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
 
             Text = "Replace _Previous"
         };
@@ -1194,7 +1194,7 @@ public class Editor : Scenario
             Y = Pos.Top (btnFindPrevious) + 1,
             Width = 20,
             Enabled = !string.IsNullOrEmpty (txtToFind.Text),
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
 
             Text = "Replace _All"
         };
@@ -1215,7 +1215,7 @@ public class Editor : Scenario
             X = Pos.Right (txtToFind) + 1,
             Y = Pos.Top (btnReplaceAll) + 1,
             Width = 20,
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
 
             Text = "Cancel"
         };

+ 1 - 1
UICatalog/Scenarios/ListColumns.cs

@@ -247,7 +247,7 @@ public class ListColumns : Scenario
             Text = "0,0",
 
             Width = Dim.Fill (),
-            Justification = Justification.Right
+            TextJustification = Alignment.Right
         };
 
         Win.Add (selectedCellLabel);

+ 9 - 9
UICatalog/Scenarios/MessageBoxes.cs

@@ -14,7 +14,7 @@ public class MessageBoxes : Scenario
         var frame = new FrameView { X = Pos.Center (), Y = 1, Width = Dim.Percent (75), Title = "MessageBox Options" };
         Win.Add (frame);
 
-        var label = new Label { X = 0, Y = 0, Justification = Justification.Right, Text = "Width:" };
+        var label = new Label { X = 0, Y = 0, TextJustification = Alignment.Right, Text = "Width:" };
         frame.Add (label);
 
         var widthEdit = new TextField
@@ -34,7 +34,7 @@ public class MessageBoxes : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = "Height:"
         };
         frame.Add (label);
@@ -69,7 +69,7 @@ public class MessageBoxes : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = "Title:"
         };
         frame.Add (label);
@@ -91,7 +91,7 @@ public class MessageBoxes : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = "Message:"
         };
         frame.Add (label);
@@ -113,7 +113,7 @@ public class MessageBoxes : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = "Num Buttons:"
         };
         frame.Add (label);
@@ -135,7 +135,7 @@ public class MessageBoxes : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = "Default Button:"
         };
         frame.Add (label);
@@ -157,7 +157,7 @@ public class MessageBoxes : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = "Style:"
         };
         frame.Add (label);
@@ -195,7 +195,7 @@ public class MessageBoxes : Scenario
 
         label = new()
         {
-            X = Pos.Center (), Y = Pos.Bottom (frame) + 2, Justification = Justification.Right, Text = "Button Pressed:"
+            X = Pos.Center (), Y = Pos.Bottom (frame) + 2, TextJustification = Alignment.Right, Text = "Button Pressed:"
         };
         Win.Add (label);
 
@@ -204,7 +204,7 @@ public class MessageBoxes : Scenario
             X = Pos.Center (),
             Y = Pos.Bottom (label) + 1,
             ColorScheme = Colors.ColorSchemes ["Error"],
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Text = " "
         };
 

+ 2 - 2
UICatalog/Scenarios/Mouse.cs

@@ -98,8 +98,8 @@ public class Mouse : Scenario
             Width = 20,
             Height = 3,
             Text = "Enter/Leave Demo",
-            Justification = Justification.Centered,
-            VerticalJustification = Justification.Centered,
+            TextJustification = Alignment.Centered,
+            VerticalTextJustification = Alignment.Centered,
             ColorScheme = Colors.ColorSchemes ["Dialog"]
         };
         win.Add (demo);

+ 22 - 22
UICatalog/Scenarios/PosJustification.cs

@@ -9,9 +9,9 @@ namespace UICatalog.Scenarios;
 [ScenarioCategory ("Layout")]
 public sealed class PosJustification : Scenario
 {
-    private readonly Justifier _horizJustifier = new ();
+    private readonly Aligner _horizJustifier = new ();
     private int _leftMargin;
-    private readonly Justifier _vertJustifier = new ();
+    private readonly Aligner _vertJustifier = new ();
     private int _topMargin;
 
     public override void Main ()
@@ -45,22 +45,22 @@ public sealed class PosJustification : Scenario
 
         RadioGroup justification = new ()
         {
-            X = Pos.Justify (_horizJustifier.Justification),
+            X = Pos.Justify (_horizJustifier.Alignment),
             Y = Pos.Center (),
-            RadioLabels = GetUniqueEnumNames<Justification> (false).ToArray (),
+            RadioLabels = GetUniqueEnumNames<Alignment> (false).ToArray (),
             ColorScheme = colorScheme
         };
 
         justification.SelectedItemChanged += (s, e) =>
                                              {
-                                                 _horizJustifier.Justification =
-                                                     (Justification)Enum.Parse (typeof (Justification), justification.SelectedItem.ToString ());
+                                                 _horizJustifier.Alignment =
+                                                     (Alignment)Enum.Parse (typeof (Alignment), justification.SelectedItem.ToString ());
 
                                                  foreach (View view in appWindow.Subviews.Where (v => v.X is Pos.PosJustify))
                                                  {
                                                      if (view.X is Pos.PosJustify j)
                                                      {
-                                                         var newJust = new Pos.PosJustify (_horizJustifier.Justification)
+                                                         var newJust = new Pos.PosJustify (_horizJustifier.Alignment)
                                                          {
                                                              Justifier =
                                                              {
@@ -75,7 +75,7 @@ public sealed class PosJustification : Scenario
 
         CheckBox putSpaces = new ()
         {
-            X = Pos.Justify (_horizJustifier.Justification),
+            X = Pos.Justify (_horizJustifier.Alignment),
             Y = Pos.Top (justification),
             ColorScheme = colorScheme,
             Text = "Spaces"
@@ -125,14 +125,14 @@ public sealed class PosJustification : Scenario
         addedViews.Add (
                         new()
                         {
-                            X = Pos.Justify (_horizJustifier.Justification),
+                            X = Pos.Justify (_horizJustifier.Alignment),
                             Y = Pos.Center (),
                             Text = NumberToWords.Convert (0)
                         });
 
         Buttons.NumericUpDown<int> addedViewsUpDown = new Buttons.NumericUpDown<int>
         {
-            X = Pos.Justify (_horizJustifier.Justification),
+            X = Pos.Justify (_horizJustifier.Alignment),
             Y = Pos.Top (justification),
             Width = 9,
             Title = "Added",
@@ -171,7 +171,7 @@ public sealed class PosJustification : Scenario
                                                   {
                                                       var button = new Button
                                                       {
-                                                          X = Pos.Justify (_horizJustifier.Justification),
+                                                          X = Pos.Justify (_horizJustifier.Alignment),
                                                           Y = Pos.Center (),
                                                           Text = NumberToWords.Convert (i + 1)
                                                       };
@@ -192,21 +192,21 @@ public sealed class PosJustification : Scenario
         RadioGroup justification = new ()
         {
             X = 0,
-            Y = Pos.Justify (_vertJustifier.Justification),
-            RadioLabels = GetUniqueEnumNames<Justification> (true).Reverse ().ToArray (),
+            Y = Pos.Justify (_vertJustifier.Alignment),
+            RadioLabels = GetUniqueEnumNames<Alignment> (true).Reverse ().ToArray (),
             ColorScheme = colorScheme
         };
 
         justification.SelectedItemChanged += (s, e) =>
                                              {
-                                                 _vertJustifier.Justification =
-                                                     (Justification)Enum.Parse (typeof (Justification), justification.SelectedItem.ToString ());
+                                                 _vertJustifier.Alignment =
+                                                     (Alignment)Enum.Parse (typeof (Alignment), justification.SelectedItem.ToString ());
 
                                                  foreach (View view in appWindow.Subviews.Where (v => v.Y is Pos.PosJustify))
                                                  {
                                                      if (view.Y is Pos.PosJustify j)
                                                      {
-                                                         var newJust = new Pos.PosJustify (_vertJustifier.Justification)
+                                                         var newJust = new Pos.PosJustify (_vertJustifier.Alignment)
                                                          {
                                                              Justifier =
                                                              {
@@ -222,7 +222,7 @@ public sealed class PosJustification : Scenario
         CheckBox putSpaces = new ()
         {
             X = 0,
-            Y = Pos.Justify (_vertJustifier.Justification),
+            Y = Pos.Justify (_vertJustifier.Alignment),
             ColorScheme = colorScheme,
             Text = "Spaces"
         };
@@ -272,14 +272,14 @@ public sealed class PosJustification : Scenario
                         new()
                         {
                             X = 0,
-                            Y = Pos.Justify (_vertJustifier.Justification),
+                            Y = Pos.Justify (_vertJustifier.Alignment),
                             Text = NumberToWords.Convert (0)
                         });
 
         Buttons.NumericUpDown<int> addedViewsUpDown = new Buttons.NumericUpDown<int>
         {
             X = 0,
-            Y = Pos.Justify (_vertJustifier.Justification),
+            Y = Pos.Justify (_vertJustifier.Alignment),
             Width = 9,
             Title = "Added",
             ColorScheme = colorScheme,
@@ -318,7 +318,7 @@ public sealed class PosJustification : Scenario
                                                       var button = new CheckBox
                                                       {
                                                           X = 0,
-                                                          Y = Pos.Justify (_vertJustifier.Justification),
+                                                          Y = Pos.Justify (_vertJustifier.Alignment),
                                                           Text = NumberToWords.Convert (i + 1)
                                                       };
                                                       appWindow.Add (button);
@@ -375,8 +375,8 @@ public sealed class PosJustification : Scenario
                 Width = 5
             };
 
-            v.X = Pos.Justify (Justification.Right, i / 3);
-            v.Y = Pos.Justify (Justification.Justified, i % 3 + 10);
+            v.X = Pos.Justify (Alignment.Right, i / 3);
+            v.Y = Pos.Justify (Alignment.Justified, i % 3 + 10);
 
             container.Add (v);
         }

+ 7 - 7
UICatalog/Scenarios/TableEditor.cs

@@ -707,7 +707,7 @@ public class TableEditor : Scenario
             Text = "0,0",
 
             Width = Dim.Fill (),
-            Justification = Justification.Right
+            TextJustification = Alignment.Right
         };
 
         Win.Add (selectedCellLabel);
@@ -1107,12 +1107,12 @@ public class TableEditor : Scenario
     {
         _tableView.Style.ColumnStyles.Clear ();
 
-        var alignMid = new ColumnStyle { Justification = Justification.Centered };
-        var alignRight = new ColumnStyle { Justification = Justification.Right };
+        var alignMid = new ColumnStyle { Justification = Alignment.Centered };
+        var alignRight = new ColumnStyle { Justification = Alignment.Right };
 
         var dateFormatStyle = new ColumnStyle
         {
-            Justification = Justification.Right,
+            Justification = Alignment.Right,
             RepresentationGetter = v =>
                                        v is DateTime d ? d.ToString ("yyyy-MM-dd") : v.ToString ()
         };
@@ -1126,15 +1126,15 @@ public class TableEditor : Scenario
 
                                        // align negative values right
                                        d < 0
-                                           ? Justification.Right
+                                           ? Alignment.Right
                                            :
 
                                            // align positive values left
-                                           Justification.Left
+                                           Alignment.Left
                                        :
 
                                        // not a double
-                                       Justification.Left,
+                                       Alignment.Left,
             ColorGetter = a => a.CellValue is double d
                                    ?
 

+ 1 - 1
UICatalog/Scenarios/Text.cs

@@ -290,7 +290,7 @@ public class Text : Scenario
             X = Pos.Right (regexProvider) + 1,
             Y = Pos.Y (regexProvider),
             Width = 30,
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Provider = provider2
         };
         Win.Add (regexProviderField);

+ 7 - 7
UICatalog/Scenarios/TextFormatterDemo.cs

@@ -75,17 +75,17 @@ public class TextFormatterDemo : Scenario
             }
         }
 
-        List<Justification> justifications = GetUniqueEnumValues<Justification>().ToList ();
+        List<Alignment> justifications = GetUniqueEnumValues<Alignment>().ToList ();
         Label [] singleLines = new Label [justifications.Count];
         Label [] multipleLines = new Label [justifications.Count];
 
         var multiLineHeight = 5;
 
-        foreach (Justification justification in justifications)
+        foreach (Alignment justification in justifications)
         {
             singleLines [(int)justification] = new()
             {
-                Justification = justification,
+                TextJustification = justification,
                 X = 0,
 
                 Width = Dim.Fill (),
@@ -96,7 +96,7 @@ public class TextFormatterDemo : Scenario
 
             multipleLines [(int)justification] = new()
             {
-                Justification = justification,
+                TextJustification = justification,
                 X = 0,
 
                 Width = Dim.Fill (),
@@ -112,7 +112,7 @@ public class TextFormatterDemo : Scenario
         };
         app.Add (label);
 
-        foreach (Justification justification in justifications)
+        foreach (Alignment justification in justifications)
         {
             label = new() { Y = Pos.Bottom (label), Text = $"{justification}:" };
             app.Add (label);
@@ -124,7 +124,7 @@ public class TextFormatterDemo : Scenario
         label = new() { Y = Pos.Bottom (label), Text = "Demonstrating multi-line and word wrap:" };
         app.Add (label);
 
-        foreach (Justification justification in justifications)
+        foreach (Alignment justification in justifications)
         {
             label = new() { Y = Pos.Bottom (label), Text = $"{justification}:" };
             app.Add (label);
@@ -135,7 +135,7 @@ public class TextFormatterDemo : Scenario
 
         unicodeCheckBox.Toggled += (s, e) =>
                                    {
-                                       foreach (Justification justification in justifications)
+                                       foreach (Alignment justification in justifications)
                                        {
                                            singleLines [(int)justification].Text = e.OldValue == true ? text : unicode;
                                            multipleLines [(int)justification].Text = e.OldValue == true ? text : unicode;

+ 49 - 49
UICatalog/Scenarios/TextJustificationAndDirection.cs

@@ -35,7 +35,7 @@ public class TextJustificationAndDirections : Scenario
             Y = 1,
             Width = 9,
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             ColorScheme = Colors.ColorSchemes ["Dialog"],
             Text = "Left"
         };
@@ -46,7 +46,7 @@ public class TextJustificationAndDirections : Scenario
             Y = 2,
             Width = 9,
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             ColorScheme = Colors.ColorSchemes ["Dialog"],
             Text = "Centered"
         };
@@ -57,7 +57,7 @@ public class TextJustificationAndDirections : Scenario
             Y = 3,
             Width = 9,
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             ColorScheme = Colors.ColorSchemes ["Dialog"],
             Text = "Right"
         };
@@ -68,7 +68,7 @@ public class TextJustificationAndDirections : Scenario
             Y = 4,
             Width = 9,
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             ColorScheme = Colors.ColorSchemes ["Dialog"],
             Text = "Justified"
         };
@@ -80,7 +80,7 @@ public class TextJustificationAndDirections : Scenario
             Width = Dim.Fill (1) - 9,
             Height = 1,
             ColorScheme = color1,
-            Justification = Justification.Left,
+            TextJustification = Alignment.Left,
             Text = txt
         };
 
@@ -91,7 +91,7 @@ public class TextJustificationAndDirections : Scenario
             Width = Dim.Fill (1) - 9,
             Height = 1,
             ColorScheme = color2,
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Text = txt
         };
 
@@ -102,7 +102,7 @@ public class TextJustificationAndDirections : Scenario
             Width = Dim.Fill (1) - 9,
             Height = 1,
             ColorScheme = color1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = txt
         };
 
@@ -113,7 +113,7 @@ public class TextJustificationAndDirections : Scenario
             Width = Dim.Fill (1) - 9,
             Height = 1,
             ColorScheme = color2,
-            Justification = Justification.Justified,
+            TextJustification = Alignment.Justified,
             Text = txt
         };
 
@@ -141,7 +141,7 @@ public class TextJustificationAndDirections : Scenario
             Height = 9,
             ColorScheme = color1,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalJustification = Justification.Bottom,
+            VerticalTextJustification = Alignment.Bottom,
             Text = "Top"
         };
         labelVT.TextFormatter.WordWrap = false;
@@ -154,7 +154,7 @@ public class TextJustificationAndDirections : Scenario
             Height = 9,
             ColorScheme = color1,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalJustification = Justification.Bottom,
+            VerticalTextJustification = Alignment.Bottom,
             Text = "Centered"
         };
         labelVM.TextFormatter.WordWrap = false;
@@ -167,7 +167,7 @@ public class TextJustificationAndDirections : Scenario
             Height = 9,
             ColorScheme = color1,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalJustification = Justification.Bottom,
+            VerticalTextJustification = Alignment.Bottom,
             Text = "Bottom"
         };
         labelVB.TextFormatter.WordWrap = false;
@@ -180,7 +180,7 @@ public class TextJustificationAndDirections : Scenario
             Height = 9,
             ColorScheme = color1,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalJustification = Justification.Bottom,
+            VerticalTextJustification = Alignment.Bottom,
             Text = "Justified"
         };
         labelVJ.TextFormatter.WordWrap = false;
@@ -193,7 +193,7 @@ public class TextJustificationAndDirections : Scenario
             Height = Dim.Fill (1),
             ColorScheme = color1,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalJustification = Justification.Top,
+            VerticalTextJustification = Alignment.Top,
             Text = txt
         };
         txtLabelVT.TextFormatter.WordWrap = false;
@@ -206,7 +206,7 @@ public class TextJustificationAndDirections : Scenario
             Height = Dim.Fill (1),
             ColorScheme = color2,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalJustification = Justification.Centered,
+            VerticalTextJustification = Alignment.Centered,
             Text = txt
         };
         txtLabelVM.TextFormatter.WordWrap = false;
@@ -219,7 +219,7 @@ public class TextJustificationAndDirections : Scenario
             Height = Dim.Fill (1),
             ColorScheme = color1,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalJustification = Justification.Bottom,
+            VerticalTextJustification = Alignment.Bottom,
             Text = txt
         };
         txtLabelVB.TextFormatter.WordWrap = false;
@@ -232,7 +232,7 @@ public class TextJustificationAndDirections : Scenario
             Height = Dim.Fill (1),
             ColorScheme = color2,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalJustification = Justification.Justified,
+            VerticalTextJustification = Alignment.Justified,
             Text = txt
         };
         txtLabelVJ.TextFormatter.WordWrap = false;
@@ -268,8 +268,8 @@ public class TextJustificationAndDirections : Scenario
             Y = 1,
             Width = Dim.Percent (100f / 3f),
             Height = Dim.Percent (100f / 3f),
-            Justification = Justification.Left,
-            VerticalJustification = Justification.Top,
+            TextJustification = Alignment.Left,
+            VerticalTextJustification = Alignment.Top,
             ColorScheme = color1,
             Text = txt
         };
@@ -281,8 +281,8 @@ public class TextJustificationAndDirections : Scenario
             Y = 1,
             Width = Dim.Percent (100f / 3f),
             Height = Dim.Percent (100f / 3f),
-            Justification = Justification.Centered,
-            VerticalJustification = Justification.Top,
+            TextJustification = Alignment.Centered,
+            VerticalTextJustification = Alignment.Top,
             ColorScheme = color1,
             Text = txt
         };
@@ -294,8 +294,8 @@ public class TextJustificationAndDirections : Scenario
             Y = 1,
             Width = Dim.Percent (100f, true),
             Height = Dim.Percent (100f / 3f),
-            Justification = Justification.Right,
-            VerticalJustification = Justification.Top,
+            TextJustification = Alignment.Right,
+            VerticalTextJustification = Alignment.Top,
             ColorScheme = color1,
             Text = txt
         };
@@ -307,8 +307,8 @@ public class TextJustificationAndDirections : Scenario
             Y = Pos.Bottom (txtLabelTL) + 1,
             Width = Dim.Width (txtLabelTL),
             Height = Dim.Percent (100f / 3f),
-            Justification = Justification.Left,
-            VerticalJustification = Justification.Centered,
+            TextJustification = Alignment.Left,
+            VerticalTextJustification = Alignment.Centered,
             ColorScheme = color1,
             Text = txt
         };
@@ -320,8 +320,8 @@ public class TextJustificationAndDirections : Scenario
             Y = Pos.Bottom (txtLabelTC) + 1,
             Width = Dim.Width (txtLabelTC),
             Height = Dim.Percent (100f / 3f),
-            Justification = Justification.Centered,
-            VerticalJustification = Justification.Centered,
+            TextJustification = Alignment.Centered,
+            VerticalTextJustification = Alignment.Centered,
             ColorScheme = color1,
             Text = txt
         };
@@ -333,8 +333,8 @@ public class TextJustificationAndDirections : Scenario
             Y = Pos.Bottom (txtLabelTR) + 1,
             Width = Dim.Percent (100f, true),
             Height = Dim.Percent (100f / 3f),
-            Justification = Justification.Right,
-            VerticalJustification = Justification.Centered,
+            TextJustification = Alignment.Right,
+            VerticalTextJustification = Alignment.Centered,
             ColorScheme = color1,
             Text = txt
         };
@@ -346,8 +346,8 @@ public class TextJustificationAndDirections : Scenario
             Y = Pos.Bottom (txtLabelML) + 1,
             Width = Dim.Width (txtLabelML),
             Height = Dim.Percent (100f, true),
-            Justification = Justification.Left,
-            VerticalJustification = Justification.Bottom,
+            TextJustification = Alignment.Left,
+            VerticalTextJustification = Alignment.Bottom,
             ColorScheme = color1,
             Text = txt
         };
@@ -359,8 +359,8 @@ public class TextJustificationAndDirections : Scenario
             Y = Pos.Bottom (txtLabelMC) + 1,
             Width = Dim.Width (txtLabelMC),
             Height = Dim.Percent (100f, true),
-            Justification = Justification.Centered,
-            VerticalJustification = Justification.Bottom,
+            TextJustification = Alignment.Centered,
+            VerticalTextJustification = Alignment.Bottom,
             ColorScheme = color1,
             Text = txt
         };
@@ -372,8 +372,8 @@ public class TextJustificationAndDirections : Scenario
             Y = Pos.Bottom (txtLabelMR) + 1,
             Width = Dim.Percent (100f, true),
             Height = Dim.Percent (100f, true),
-            Justification = Justification.Right,
-            VerticalJustification = Justification.Bottom,
+            TextJustification = Alignment.Right,
+            VerticalTextJustification = Alignment.Bottom,
             ColorScheme = color1,
             Text = txt
         };
@@ -392,7 +392,7 @@ public class TextJustificationAndDirections : Scenario
         // Save Justification in Data
         foreach (Label t in mtxts)
         {
-            t.Data = new { h = t.Justification, v = t.VerticalJustification };
+            t.Data = new { h = t.TextJustification, v = t.VerticalTextJustification };
         }
 
         container.Add (txtLabelTL);
@@ -593,8 +593,8 @@ public class TextJustificationAndDirections : Scenario
 
                 foreach (Label t in mtxts)
                 {
-                    t.Justification = (Justification)((dynamic)t.Data).h;
-                    t.VerticalJustification = (Justification)((dynamic)t.Data).v;
+                    t.TextJustification = (Alignment)((dynamic)t.Data).h;
+                    t.VerticalTextJustification = (Alignment)((dynamic)t.Data).v;
                 }
             }
             else
@@ -611,16 +611,16 @@ public class TextJustificationAndDirections : Scenario
                         switch (justifyOptions.SelectedItem)
                         {
                             case 0:
-                                t.VerticalJustification = Justification.Justified;
-                                t.Justification = ((dynamic)t.Data).h;
+                                t.VerticalTextJustification = Alignment.Justified;
+                                t.TextJustification = ((dynamic)t.Data).h;
                                 break;
                             case 1:
-                                t.VerticalJustification = (Justification)((dynamic)t.Data).v;
-                                t.Justification = Justification.Justified;
+                                t.VerticalTextJustification = (Alignment)((dynamic)t.Data).v;
+                                t.TextJustification = Alignment.Justified;
                                 break;
                             case 2:
-                                t.VerticalJustification = Justification.Justified;
-                                t.Justification = Justification.Justified;
+                                t.VerticalTextJustification = Alignment.Justified;
+                                t.TextJustification = Alignment.Justified;
                                 break;
                         }
                     }
@@ -629,16 +629,16 @@ public class TextJustificationAndDirections : Scenario
                         switch (justifyOptions.SelectedItem)
                         {
                             case 0:
-                                t.Justification = Justification.Justified;
-                                t.VerticalJustification = ((dynamic)t.Data).v;
+                                t.TextJustification = Alignment.Justified;
+                                t.VerticalTextJustification = ((dynamic)t.Data).v;
                                 break;
                             case 1:
-                                t.Justification = (Justification)((dynamic)t.Data).h;
-                                t.VerticalJustification = Justification.Justified;
+                                t.TextJustification = (Alignment)((dynamic)t.Data).h;
+                                t.VerticalTextJustification = Alignment.Justified;
                                 break;
                             case 2:
-                                t.Justification = Justification.Justified;
-                                t.VerticalJustification = Justification.Justified;
+                                t.TextJustification = Alignment.Justified;
+                                t.VerticalTextJustification = Alignment.Justified;
                                 break;
                         }
                     }

+ 6 - 6
UICatalog/Scenarios/TimeAndDate.cs

@@ -57,7 +57,7 @@ public class TimeAndDate : Scenario
         {
             X = Pos.Center (),
             Y = Pos.Bottom (longDate) + 1,
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
 
             Width = Dim.Fill (),
             Text = "Old Time: "
@@ -68,7 +68,7 @@ public class TimeAndDate : Scenario
         {
             X = Pos.Center (),
             Y = Pos.Bottom (_lblOldTime) + 1,
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
 
             Width = Dim.Fill (),
             Text = "New Time: "
@@ -79,7 +79,7 @@ public class TimeAndDate : Scenario
         {
             X = Pos.Center (),
             Y = Pos.Bottom (_lblNewTime) + 1,
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
 
             Width = Dim.Fill (),
             Text = "Time Format: "
@@ -90,7 +90,7 @@ public class TimeAndDate : Scenario
         {
             X = Pos.Center (),
             Y = Pos.Bottom (_lblTimeFmt) + 2,
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
 
             Width = Dim.Fill (),
             Text = "Old Date: "
@@ -101,7 +101,7 @@ public class TimeAndDate : Scenario
         {
             X = Pos.Center (),
             Y = Pos.Bottom (_lblOldDate) + 1,
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
 
             Width = Dim.Fill (),
             Text = "New Date: "
@@ -112,7 +112,7 @@ public class TimeAndDate : Scenario
         {
             X = Pos.Center (),
             Y = Pos.Bottom (_lblNewDate) + 1,
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
 
             Width = Dim.Fill (),
             Text = "Date Format: "

+ 1 - 1
UICatalog/Scenarios/Unicode.cs

@@ -132,7 +132,7 @@ public class UnicodeInMenu : Scenario
 
             Width = Dim.Percent (50),
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = $"Justify Right - {gitString}"
         };
         Win.Add (checkBox, checkBoxRight);

+ 5 - 5
UICatalog/Scenarios/ViewExperiments.cs

@@ -60,7 +60,7 @@ public class ViewExperiments : Scenario
             Width = 17,
             Title = "Window 1",
             Text = "Window #2",
-            Justification = Justification.Centered
+            TextJustification = Alignment.Centered
         };
 
         window1.Margin.Thickness = new (0);
@@ -84,7 +84,7 @@ public class ViewExperiments : Scenario
             Width = 37,
             Title = "Window2",
             Text = "Window #2 (Right(window1)+1",
-            Justification = Justification.Centered
+            TextJustification = Alignment.Centered
         };
 
         //view3.InitializeFrames ();
@@ -109,7 +109,7 @@ public class ViewExperiments : Scenario
             Width = 37,
             Title = "View4",
             Text = "View #4 (Right(window2)+1",
-            Justification = Justification.Centered
+            TextJustification = Alignment.Centered
         };
 
         //view4.InitializeFrames ();
@@ -134,7 +134,7 @@ public class ViewExperiments : Scenario
             Width = Dim.Fill (),
             Title = "View5",
             Text = "View #5 (Right(view4)+1 Fill",
-            Justification = Justification.Centered
+            TextJustification = Alignment.Centered
         };
 
         //view5.InitializeFrames ();
@@ -181,7 +181,7 @@ public class ViewExperiments : Scenario
             X = Pos.Center (),
             Y = Pos.Percent (50),
             Width = 30,
-            Justification = Justification.Centered
+            TextJustification = Alignment.Centered
         };
         label50.Border.Thickness = new (1, 3, 1, 1);
         label50.Height = 5;

+ 4 - 4
UICatalog/Scenarios/Wizards.cs

@@ -21,7 +21,7 @@ public class Wizards : Scenario
         };
         Win.Add (frame);
 
-        var label = new Label { X = 0, Y = 0, Justification = Justification.Right, Text = "Width:" };
+        var label = new Label { X = 0, Y = 0, TextJustification = Alignment.Right, Text = "Width:" };
         frame.Add (label);
 
         var widthEdit = new TextField
@@ -41,7 +41,7 @@ public class Wizards : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = "Height:"
         };
         frame.Add (label);
@@ -63,7 +63,7 @@ public class Wizards : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Text = "Title:"
         };
         frame.Add (label);
@@ -88,7 +88,7 @@ public class Wizards : Scenario
 
         label = new()
         {
-            X = Pos.Center (), Y = Pos.AnchorEnd (1), Justification = Justification.Right, Text = "Action:"
+            X = Pos.Center (), Y = Pos.AnchorEnd (1), TextJustification = Alignment.Right, Text = "Action:"
         };
         Win.Add (label);
 

+ 3 - 3
UnitTests/Configuration/ThemeScopeTests.cs

@@ -29,12 +29,12 @@ public class ThemeScopeTests
     {
         Reset ();
         Assert.NotEmpty (Themes);
-        Assert.Equal (Justification.Right, Dialog.DefaultButtonJustification);
+        Assert.Equal (Alignment.Right, Dialog.DefaultButtonJustification);
 
-        Themes ["Default"] ["Dialog.DefaultButtonJustification"].PropertyValue = Justification.Centered;
+        Themes ["Default"] ["Dialog.DefaultButtonJustification"].PropertyValue = Alignment.Centered;
 
         ThemeManager.Themes! [ThemeManager.SelectedTheme]!.Apply ();
-        Assert.Equal (Justification.Centered, Dialog.DefaultButtonJustification);
+        Assert.Equal (Alignment.Centered, Dialog.DefaultButtonJustification);
         Reset ();
     }
 

+ 3 - 3
UnitTests/Configuration/ThemeTests.cs

@@ -77,15 +77,15 @@ public class ThemeTests
     public void TestSerialize_RoundTrip ()
     {
         var theme = new ThemeScope ();
-        theme ["Dialog.DefaultButtonJustification"].PropertyValue = Justification.Right;
+        theme ["Dialog.DefaultButtonJustification"].PropertyValue = Alignment.Right;
 
         string json = JsonSerializer.Serialize (theme, _jsonOptions);
 
         var deserialized = JsonSerializer.Deserialize<ThemeScope> (json, _jsonOptions);
 
         Assert.Equal (
-                      Justification.Right,
-                      (Justification)deserialized ["Dialog.DefaultButtonJustification"].PropertyValue
+                      Alignment.Right,
+                      (Alignment)deserialized ["Dialog.DefaultButtonJustification"].PropertyValue
                      );
         Reset ();
     }

+ 46 - 46
UnitTests/Dialogs/DialogTests.cs

@@ -32,7 +32,7 @@ public class DialogTests
             Title = title,
             Width = width,
             Height = 1,
-            ButtonJustification = Justification.Centered,
+            ButtonJustification = Alignment.Centered,
             Buttons = [new Button { Text = btn1Text }]
         };
 
@@ -57,7 +57,7 @@ public class DialogTests
             Title = title,
             Width = width,
             Height = 1,
-            ButtonJustification = Justification.Justified,
+            ButtonJustification = Alignment.Justified,
             Buttons = [new Button { Text = btn1Text }]
         };
 
@@ -82,7 +82,7 @@ public class DialogTests
             Title = title,
             Width = width,
             Height = 1,
-            ButtonJustification = Justification.Right,
+            ButtonJustification = Alignment.Right,
             Buttons = [new Button { Text = btn1Text }]
         };
 
@@ -107,7 +107,7 @@ public class DialogTests
             Title = title,
             Width = width,
             Height = 1,
-            ButtonJustification = Justification.Left,
+            ButtonJustification = Alignment.Left,
             Buttons = [new Button { Text = btn1Text }]
         };
 
@@ -155,7 +155,7 @@ public class DialogTests
         (runstate, Dialog dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Centered,
+                                                    Alignment.Centered,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text },
@@ -172,7 +172,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                       title,
                                                       width,
-                                                      Justification.Justified,
+                                                      Alignment.Justified,
                                                       new Button { Text = btn1Text },
                                                       new Button { Text = btn2Text },
                                                       new Button { Text = btn3Text },
@@ -189,7 +189,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                       title,
                                                       width,
-                                                      Justification.Right,
+                                                      Alignment.Right,
                                                       new Button { Text = btn1Text },
                                                       new Button { Text = btn2Text },
                                                       new Button { Text = btn3Text },
@@ -206,7 +206,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                       title,
                                                       width,
-                                                      Justification.Left,
+                                                      Alignment.Left,
                                                       new Button { Text = btn1Text },
                                                       new Button { Text = btn2Text },
                                                       new Button { Text = btn3Text },
@@ -248,7 +248,7 @@ public class DialogTests
         (runstate, Dialog dlg) = RunButtonTestDialog (
                                                       title,
                                                       width,
-                                                      Justification.Centered,
+                                                      Alignment.Centered,
                                                       new Button { Text = btn1Text },
                                                       new Button { Text = btn2Text },
                                                       new Button { Text = btn3Text },
@@ -266,7 +266,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Justified,
+                                                    Alignment.Justified,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text },
@@ -283,7 +283,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Right,
+                                                    Alignment.Right,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text },
@@ -299,7 +299,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Left,
+                                                    Alignment.Left,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text },
@@ -340,7 +340,7 @@ public class DialogTests
         (runstate, Dialog dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Centered,
+                                                    Alignment.Centered,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text },
@@ -357,7 +357,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Justified,
+                                                    Alignment.Justified,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text },
@@ -374,7 +374,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Right,
+                                                    Alignment.Right,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text },
@@ -391,7 +391,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Left,
+                                                    Alignment.Left,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text },
@@ -434,7 +434,7 @@ public class DialogTests
         (runstate, Dialog dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Centered,
+                                                    Alignment.Centered,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text },
@@ -451,7 +451,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Justified,
+                                                    Alignment.Justified,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text },
@@ -468,7 +468,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Right,
+                                                    Alignment.Right,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text },
@@ -485,7 +485,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Left,
+                                                    Alignment.Left,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text },
@@ -517,7 +517,7 @@ public class DialogTests
         (runstate, Dialog dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Centered,
+                                                    Alignment.Centered,
                                                     new Button { Text = btnText }
                                                    );
 
@@ -534,7 +534,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Justified,
+                                                    Alignment.Justified,
                                                     new Button { Text = btnText }
                                                    );
         TestHelpers.AssertDriverContentsWithFrameAre ($"{buttonRow}", _output);
@@ -549,7 +549,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Right,
+                                                    Alignment.Right,
                                                     new Button { Text = btnText }
                                                    );
         TestHelpers.AssertDriverContentsWithFrameAre ($"{buttonRow}", _output);
@@ -564,7 +564,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Left,
+                                                    Alignment.Left,
                                                     new Button { Text = btnText }
                                                    );
         TestHelpers.AssertDriverContentsWithFrameAre ($"{buttonRow}", _output);
@@ -581,7 +581,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Centered,
+                                                    Alignment.Centered,
                                                     new Button { Text = btnText }
                                                    );
         TestHelpers.AssertDriverContentsWithFrameAre ($"{buttonRow}", _output);
@@ -596,7 +596,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Justified,
+                                                    Alignment.Justified,
                                                     new Button { Text = btnText }
                                                    );
         TestHelpers.AssertDriverContentsWithFrameAre ($"{buttonRow}", _output);
@@ -611,7 +611,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Right,
+                                                    Alignment.Right,
                                                     new Button { Text = btnText }
                                                    );
         TestHelpers.AssertDriverContentsWithFrameAre ($"{buttonRow}", _output);
@@ -626,7 +626,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Left,
+                                                    Alignment.Left,
                                                     new Button { Text = btnText }
                                                    );
         TestHelpers.AssertDriverContentsWithFrameAre ($"{buttonRow}", _output);
@@ -660,7 +660,7 @@ public class DialogTests
         (runstate, Dialog dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Centered,
+                                                    Alignment.Centered,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text }
@@ -676,7 +676,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Justified,
+                                                    Alignment.Justified,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text }
@@ -692,7 +692,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Right,
+                                                    Alignment.Right,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text }
@@ -708,7 +708,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Left,
+                                                    Alignment.Left,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text },
                                                     new Button { Text = btn3Text }
@@ -742,7 +742,7 @@ public class DialogTests
         (runstate, Dialog dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Centered,
+                                                    Alignment.Centered,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text }
                                                    );
@@ -757,7 +757,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Justified,
+                                                    Alignment.Justified,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text }
                                                    );
@@ -772,7 +772,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Right,
+                                                    Alignment.Right,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text }
                                                    );
@@ -787,7 +787,7 @@ public class DialogTests
         (runstate, dlg) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Left,
+                                                    Alignment.Left,
                                                     new Button { Text = btn1Text },
                                                     new Button { Text = btn2Text }
                                                    );
@@ -824,7 +824,7 @@ public class DialogTests
         // Default (Center)
         button1 = new Button { Text = btn1Text };
         button2 = new Button { Text = btn2Text };
-        (runstate, dlg) = RunButtonTestDialog (title, width, Justification.Centered, button1, button2);
+        (runstate, dlg) = RunButtonTestDialog (title, width, Alignment.Centered, button1, button2);
         button1.Visible = false;
         RunIteration (ref runstate, ref firstIteration);
         buttonRow = $@"{CM.Glyphs.VLine}         {btn2} {CM.Glyphs.VLine}";
@@ -836,7 +836,7 @@ public class DialogTests
         Assert.Equal (width, buttonRow.Length);
         button1 = new Button { Text = btn1Text };
         button2 = new Button { Text = btn2Text };
-        (runstate, dlg) = RunButtonTestDialog (title, width, Justification.Justified, button1, button2);
+        (runstate, dlg) = RunButtonTestDialog (title, width, Alignment.Justified, button1, button2);
         button1.Visible = false;
         RunIteration (ref runstate, ref firstIteration);
         buttonRow = $@"{CM.Glyphs.VLine}          {btn2}{CM.Glyphs.VLine}";
@@ -848,7 +848,7 @@ public class DialogTests
         Assert.Equal (width, buttonRow.Length);
         button1 = new Button { Text = btn1Text };
         button2 = new Button { Text = btn2Text };
-        (runstate, dlg) = RunButtonTestDialog (title, width, Justification.Right, button1, button2);
+        (runstate, dlg) = RunButtonTestDialog (title, width, Alignment.Right, button1, button2);
         button1.Visible = false;
         RunIteration (ref runstate, ref firstIteration);
         TestHelpers.AssertDriverContentsWithFrameAre ($"{buttonRow}", _output);
@@ -859,7 +859,7 @@ public class DialogTests
         Assert.Equal (width, buttonRow.Length);
         button1 = new Button { Text = btn1Text };
         button2 = new Button { Text = btn2Text };
-        (runstate, dlg) = RunButtonTestDialog (title, width, Justification.Left, button1, button2);
+        (runstate, dlg) = RunButtonTestDialog (title, width, Alignment.Left, button1, button2);
         button1.Visible = false;
         RunIteration (ref runstate, ref firstIteration);
         buttonRow = $@"{CM.Glyphs.VLine}        {btn2}  {CM.Glyphs.VLine}";
@@ -889,7 +889,7 @@ public class DialogTests
 
         win.Loaded += (s, a) =>
                       {
-                          Dialog.DefaultButtonJustification = Justification.Centered;
+                          Dialog.DefaultButtonJustification = Alignment.Centered;
                           var dlg = new Dialog { Width = 18, Height = 3, Buttons = [new () { Text = "Ok" }] };
 
                           dlg.Loaded += (s, a) =>
@@ -973,7 +973,7 @@ public class DialogTests
         var win = new Window ();
 
         int iterations = -1;
-        Dialog.DefaultButtonJustification = Justification.Centered;
+        Dialog.DefaultButtonJustification = Alignment.Centered;
 
         Iteration += (s, a) =>
                      {
@@ -1008,7 +1008,7 @@ public class DialogTests
     public void Dialog_Opened_From_Another_Dialog ()
     {
         ((FakeDriver)Driver).SetBufferSize (30, 10);
-        Dialog.DefaultButtonJustification = Justification.Centered;
+        Dialog.DefaultButtonJustification = Alignment.Centered;
 
         var btn1 = new Button { Text = "press me 1" };
         Button btn2 = null;
@@ -1285,7 +1285,7 @@ public class DialogTests
         (runstate, Dialog _) = RunButtonTestDialog (
                                                     title,
                                                     width,
-                                                    Justification.Centered,
+                                                    Alignment.Centered,
                                                     new Button { Text = btnText }
                                                    );
         TestHelpers.AssertDriverContentsWithFrameAre ($"{buttonRow}", _output);
@@ -1338,7 +1338,7 @@ public class DialogTests
         int width = buttonRow.Length;
         d.SetBufferSize (buttonRow.Length, 3);
 
-        (runstate, Dialog dlg) = RunButtonTestDialog (title, width, Justification.Centered, null);
+        (runstate, Dialog dlg) = RunButtonTestDialog (title, width, Alignment.Centered, null);
         TestHelpers.AssertDriverContentsWithFrameAre ($"{buttonRow}", _output);
 
         End (runstate);
@@ -1348,7 +1348,7 @@ public class DialogTests
     private (RunState, Dialog) RunButtonTestDialog (
         string title,
         int width,
-        Justification align,
+        Alignment align,
         params Button [] btns
     )
     {

+ 452 - 0
UnitTests/Drawing/AlignerTests.cs

@@ -0,0 +1,452 @@
+using System.Text;
+using Xunit.Abstractions;
+
+namespace Terminal.Gui.DrawingTests;
+
+public class AlignerTests (ITestOutputHelper output)
+{
+    private readonly ITestOutputHelper _output = output;
+
+    public static IEnumerable<object []> AlignmentEnumValues ()
+    {
+        foreach (object number in Enum.GetValues (typeof (Alignment)))
+        {
+            yield return new [] { number };
+        }
+    }
+
+    [Theory]
+    [MemberData (nameof (AlignmentEnumValues))]
+    public void NoItems_Works (Alignment alignment)
+    {
+        int [] sizes = [];
+        int [] positions = Aligner.Align (alignment, false, 100, sizes);
+        Assert.Equal (new int [] { }, positions);
+    }
+
+    [Theory]
+    [MemberData (nameof (AlignmentEnumValues))]
+    public void Negative_Widths_Not_Allowed (Alignment alignment)
+    {
+        Assert.Throws<ArgumentException> (
+                                          () => new Aligner
+                                          {
+                                              Alignment = alignment,
+                                              ContainerSize = 100
+                                          }.Align (new [] { -10, 20, 30 }));
+
+        Assert.Throws<ArgumentException> (
+                                          () => new Aligner
+                                          {
+                                              Alignment = alignment,
+                                              ContainerSize = 100
+                                          }.Align (new [] { 10, -20, 30 }));
+
+        Assert.Throws<ArgumentException> (
+                                          () => new Aligner
+                                          {
+                                              Alignment = alignment,
+                                              ContainerSize = 100
+                                          }.Align (new [] { 10, 20, -30 }));
+    }
+
+    [Theory]
+    [InlineData (Alignment.Left, new [] { 0 }, 1, new [] { 0 })]
+    [InlineData (Alignment.Left, new [] { 0, 0 }, 1, new [] { 0, 1 })]
+    [InlineData (Alignment.Left, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
+    [InlineData (Alignment.Left, new [] { 1 }, 1, new [] { 0 })]
+    [InlineData (Alignment.Left, new [] { 1 }, 2, new [] { 0 })]
+    [InlineData (Alignment.Left, new [] { 1 }, 3, new [] { 0 })]
+    [InlineData (Alignment.Left, new [] { 1, 1 }, 2, new [] { 0, 1 })]
+    [InlineData (Alignment.Left, new [] { 1, 1 }, 3, new [] { 0, 2 })]
+    [InlineData (Alignment.Left, new [] { 1, 1 }, 4, new [] { 0, 2 })]
+    [InlineData (Alignment.Left, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3 }, 10, new [] { 0, 2, 5 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3 }, 11, new [] { 0, 2, 5 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3 }, 12, new [] { 0, 2, 5 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3 }, 13, new [] { 0, 2, 5 })]
+    [InlineData (
+                    Alignment.Left,
+                    new [] { 1, 2, 3 },
+                    5,
+                    new [] { 0, 1, 3 })] // 5 is too small to fit the items. The first item is at 0, the items to the right are clipped.
+    [InlineData (Alignment.Left, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
+    [InlineData (Alignment.Left, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
+    [InlineData (Alignment.Left, new [] { 10 }, 101, new [] { 0 })]
+    [InlineData (Alignment.Left, new [] { 10, 20 }, 101, new [] { 0, 11 })]
+    [InlineData (Alignment.Left, new [] { 10, 20, 30 }, 100, new [] { 0, 11, 32 })]
+    [InlineData (Alignment.Left, new [] { 10, 20, 30 }, 101, new [] { 0, 11, 32 })]
+    [InlineData (Alignment.Left, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
+    [InlineData (Alignment.Left, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
+    [InlineData (Alignment.Right, new [] { 0 }, 1, new [] { 1 })]
+    [InlineData (Alignment.Right, new [] { 0, 0 }, 1, new [] { 0, 1 })]
+    [InlineData (Alignment.Right, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3 }, 10, new [] { 2, 4, 7 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3 }, 11, new [] { 3, 5, 8 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3 }, 12, new [] { 4, 6, 9 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3 }, 13, new [] { 5, 7, 10 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3 }, 5, new [] { -1, 0, 2 })] // 5 is too small to fit the items. The first item is at -1.
+    [InlineData (Alignment.Right, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
+    [InlineData (Alignment.Right, new [] { 10, 20, 30 }, 100, new [] { 38, 49, 70 })]
+    [InlineData (Alignment.Right, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
+    [InlineData (Alignment.Right, new [] { 10 }, 101, new [] { 91 })]
+    [InlineData (Alignment.Right, new [] { 10, 20 }, 101, new [] { 70, 81 })]
+    [InlineData (Alignment.Right, new [] { 10, 20, 30 }, 101, new [] { 39, 50, 71 })]
+    [InlineData (Alignment.Right, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
+    [InlineData (Alignment.Right, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
+    [InlineData (Alignment.Centered, new [] { 0 }, 1, new [] { 0 })]
+    [InlineData (Alignment.Centered, new [] { 0, 0 }, 1, new [] { 0, 1 })]
+    [InlineData (Alignment.Centered, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
+    [InlineData (Alignment.Centered, new [] { 1 }, 1, new [] { 0 })]
+    [InlineData (Alignment.Centered, new [] { 1 }, 2, new [] { 0 })]
+    [InlineData (Alignment.Centered, new [] { 1 }, 3, new [] { 1 })]
+    [InlineData (Alignment.Centered, new [] { 1, 1 }, 2, new [] { 0, 1 })]
+    [InlineData (Alignment.Centered, new [] { 1, 1 }, 3, new [] { 0, 2 })]
+    [InlineData (Alignment.Centered, new [] { 1, 1 }, 4, new [] { 0, 2 })]
+    [InlineData (Alignment.Centered, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
+    [InlineData (Alignment.Centered, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.Centered, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
+    [InlineData (Alignment.Centered, new [] { 1, 2, 3 }, 10, new [] { 1, 3, 6 })]
+    [InlineData (Alignment.Centered, new [] { 1, 2, 3 }, 11, new [] { 1, 3, 6 })]
+    [InlineData (
+                    Alignment.Centered,
+                    new [] { 1, 2, 3 },
+                    5,
+                    new [] { 0, 1, 3 })] // 5 is too small to fit the items. The first item is at 0, the items to the right are clipped.
+    [InlineData (Alignment.Centered, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Alignment.Centered, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
+    [InlineData (Alignment.Centered, new [] { 3, 3, 3 }, 9, new [] { 0, 3, 6 })]
+    [InlineData (Alignment.Centered, new [] { 3, 3, 3 }, 10, new [] { 0, 4, 7 })]
+    [InlineData (Alignment.Centered, new [] { 3, 3, 3 }, 11, new [] { 0, 4, 8 })]
+    [InlineData (Alignment.Centered, new [] { 3, 3, 3 }, 12, new [] { 0, 4, 8 })]
+    [InlineData (Alignment.Centered, new [] { 3, 3, 3 }, 13, new [] { 1, 5, 9 })]
+    [InlineData (Alignment.Centered, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
+    [InlineData (Alignment.Centered, new [] { 33, 33, 33 }, 101, new [] { 0, 34, 68 })]
+    [InlineData (Alignment.Centered, new [] { 33, 33, 33 }, 102, new [] { 0, 34, 68 })]
+    [InlineData (Alignment.Centered, new [] { 33, 33, 33 }, 103, new [] { 1, 35, 69 })]
+    [InlineData (Alignment.Centered, new [] { 33, 33, 33 }, 104, new [] { 1, 35, 69 })]
+    [InlineData (Alignment.Centered, new [] { 10 }, 101, new [] { 45 })]
+    [InlineData (Alignment.Centered, new [] { 10, 20 }, 101, new [] { 35, 46 })]
+    [InlineData (Alignment.Centered, new [] { 10, 20, 30 }, 100, new [] { 19, 30, 51 })]
+    [InlineData (Alignment.Centered, new [] { 10, 20, 30 }, 101, new [] { 19, 30, 51 })]
+    [InlineData (Alignment.Centered, new [] { 10, 20, 30, 40 }, 100, new [] { 0, 10, 30, 60 })]
+    [InlineData (Alignment.Centered, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
+    [InlineData (Alignment.Centered, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
+    [InlineData (Alignment.Centered, new [] { 3, 4, 5, 6 }, 25, new [] { 2, 6, 11, 17 })]
+    [InlineData (Alignment.Justified, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
+    [InlineData (Alignment.Justified, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
+    [InlineData (Alignment.Justified, new [] { 10, 20, 30 }, 100, new [] { 0, 30, 70 })]
+    [InlineData (Alignment.Justified, new [] { 10, 20, 30 }, 101, new [] { 0, 31, 71 })]
+    [InlineData (Alignment.Justified, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
+    [InlineData (Alignment.Justified, new [] { 11, 17, 23 }, 100, new [] { 0, 36, 77 })]
+    [InlineData (Alignment.Justified, new [] { 1, 2, 3 }, 11, new [] { 0, 4, 8 })]
+    [InlineData (Alignment.Justified, new [] { 10, 20 }, 101, new [] { 0, 81 })]
+    [InlineData (Alignment.Justified, new [] { 10 }, 101, new [] { 0 })]
+    [InlineData (Alignment.Justified, new [] { 3, 3, 3 }, 21, new [] { 0, 9, 18 })]
+    [InlineData (Alignment.Justified, new [] { 3, 4, 5 }, 21, new [] { 0, 8, 16 })]
+    [InlineData (Alignment.Justified, new [] { 3, 4, 5, 6 }, 18, new [] { 0, 3, 7, 12 })]
+    [InlineData (Alignment.Justified, new [] { 3, 4, 5, 6 }, 19, new [] { 0, 4, 8, 13 })]
+    [InlineData (Alignment.Justified, new [] { 3, 4, 5, 6 }, 20, new [] { 0, 4, 9, 14 })]
+    [InlineData (Alignment.Justified, new [] { 3, 4, 5, 6 }, 21, new [] { 0, 4, 9, 15 })]
+    [InlineData (Alignment.Justified, new [] { 6, 5, 4, 3 }, 22, new [] { 0, 8, 14, 19 })]
+    [InlineData (Alignment.Justified, new [] { 6, 5, 4, 3 }, 23, new [] { 0, 8, 15, 20 })]
+    [InlineData (Alignment.Justified, new [] { 6, 5, 4, 3 }, 24, new [] { 0, 8, 15, 21 })]
+    [InlineData (Alignment.Justified, new [] { 6, 5, 4, 3 }, 25, new [] { 0, 9, 16, 22 })]
+    [InlineData (Alignment.Justified, new [] { 6, 5, 4, 3 }, 26, new [] { 0, 9, 17, 23 })]
+    [InlineData (Alignment.Justified, new [] { 6, 5, 4, 3 }, 31, new [] { 0, 11, 20, 28 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 0 }, 1, new [] { 1 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 0, 0 }, 1, new [] { 0, 1 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1 }, 1, new [] { 0 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1 }, 2, new [] { 1 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1 }, 3, new [] { 2 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 1 }, 2, new [] { 0, 1 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 1 }, 3, new [] { 0, 2 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 1 }, 4, new [] { 0, 3 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3 }, 8, new [] { 0, 2, 5 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3 }, 9, new [] { 0, 2, 6 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3 }, 10, new [] { 0, 2, 7 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3 }, 11, new [] { 0, 2, 8 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3 }, 5, new [] { -1, 0, 2 })] // 5 is too small to fit the items. The first item is at -1.})]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 3, 3, 3 }, 21, new [] { 0, 4, 18 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 3, 4, 5 }, 21, new [] { 0, 4, 16 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 10 }, 101, new [] { 91 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 10, 20 }, 101, new [] { 0, 81 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 10, 20, 30 }, 100, new [] { 0, 11, 70 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 10, 20, 30 }, 101, new [] { 0, 11, 71 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 0 }, 1, new [] { 0 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 0, 0 }, 1, new [] { 0, 1 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 0, 0, 0 }, 1, new [] { 0, 0, 1 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1 }, 1, new [] { 0 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1 }, 2, new [] { 0 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1 }, 3, new [] { 0 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 1 }, 2, new [] { 0, 1 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 1 }, 3, new [] { 0, 2 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 1 }, 4, new [] { 0, 3 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3 }, 7, new [] { 0, 1, 4 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3 }, 8, new [] { 0, 2, 5 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3 }, 9, new [] { 0, 3, 6 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3 }, 10, new [] { 0, 4, 7 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3 }, 11, new [] { 0, 5, 8 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3 }, 5, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 1, 3, 7 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 12, new [] { 0, 1, 4, 8 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 3, 3, 3 }, 21, new [] { 0, 14, 18 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 3, 4, 5 }, 21, new [] { 0, 11, 16 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 33, 33, 33 }, 100, new [] { 0, 33, 67 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 10 }, 101, new [] { 0 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 10, 20 }, 101, new [] { 0, 81 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 10, 20, 30 }, 100, new [] { 0, 49, 70 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 10, 20, 30 }, 101, new [] { 0, 50, 71 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 10, 30, 61 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 10, 30, 60, 101 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 3, 3, 3 }, 21, new [] { 0, 14, 18 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 3, 4, 5 }, 21, new [] { 0, 11, 16 })]
+    public void Alignment_PutSpaceBetweenItems (Alignment alignment, int [] sizes, int containerSize, int [] expected)
+    {
+        int [] positions = new Aligner
+        {
+            PutSpaceBetweenItems = true,
+            Alignment = alignment,
+            ContainerSize = containerSize
+        }.Align (sizes);
+        AssertAlignment (alignment, sizes, containerSize, positions, expected);
+    }
+
+    [Theory]
+    [InlineData (Alignment.Left, new [] { 0 }, 1, new [] { 0 })]
+    [InlineData (Alignment.Left, new [] { 0, 0 }, 1, new [] { 0, 0 })]
+    [InlineData (Alignment.Left, new [] { 0, 0, 0 }, 1, new [] { 0, 0, 0 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3 }, 7, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3 }, 10, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3 }, 11, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3 }, 12, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3 }, 13, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Alignment.Left, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 1, 3, 6 })]
+    [InlineData (
+                    Alignment.Left,
+                    new [] { 1, 2, 3 },
+                    5,
+                    new [] { 0, 1, 3 })] // 5 is too small to fit the items. The first item is at 0, the items to the right are clipped.
+    [InlineData (Alignment.Left, new [] { 10, 20, 30 }, 100, new [] { 0, 10, 30 })]
+    [InlineData (Alignment.Left, new [] { 33, 33, 33 }, 100, new [] { 0, 33, 66 })]
+    [InlineData (Alignment.Left, new [] { 10 }, 101, new [] { 0 })]
+    [InlineData (Alignment.Left, new [] { 10, 20 }, 101, new [] { 0, 10 })]
+    [InlineData (Alignment.Left, new [] { 10, 20, 30 }, 101, new [] { 0, 10, 30 })]
+    [InlineData (Alignment.Left, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 10, 30, 60 })]
+    [InlineData (Alignment.Left, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 10, 30, 60, 100 })]
+    [InlineData (Alignment.Right, new [] { 0 }, 1, new [] { 1 })]
+    [InlineData (Alignment.Right, new [] { 0, 0 }, 1, new [] { 1, 1 })]
+    [InlineData (Alignment.Right, new [] { 0, 0, 0 }, 1, new [] { 1, 1, 1 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3 }, 7, new [] { 1, 2, 4 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3 }, 10, new [] { 4, 5, 7 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3 }, 11, new [] { 5, 6, 8 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3 }, 12, new [] { 6, 7, 9 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3 }, 13, new [] { 7, 8, 10 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3 }, 5, new [] { -1, 0, 2 })] // 5 is too small to fit the items. The first item is at -1.
+    [InlineData (Alignment.Right, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Alignment.Right, new [] { 1, 2, 3, 4 }, 11, new [] { 1, 2, 4, 7 })]
+    [InlineData (Alignment.Right, new [] { 10, 20, 30 }, 100, new [] { 40, 50, 70 })]
+    [InlineData (Alignment.Right, new [] { 33, 33, 33 }, 100, new [] { 1, 34, 67 })]
+    [InlineData (Alignment.Right, new [] { 10 }, 101, new [] { 91 })]
+    [InlineData (Alignment.Right, new [] { 10, 20 }, 101, new [] { 71, 81 })]
+    [InlineData (Alignment.Right, new [] { 10, 20, 30 }, 101, new [] { 41, 51, 71 })]
+    [InlineData (Alignment.Right, new [] { 10, 20, 30, 40 }, 101, new [] { 1, 11, 31, 61 })]
+    [InlineData (Alignment.Right, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 1, 11, 31, 61, 101 })]
+    [InlineData (Alignment.Centered, new [] { 1 }, 1, new [] { 0 })]
+    [InlineData (Alignment.Centered, new [] { 1 }, 2, new [] { 0 })]
+    [InlineData (Alignment.Centered, new [] { 1 }, 3, new [] { 1 })]
+    [InlineData (Alignment.Centered, new [] { 1, 1 }, 2, new [] { 0, 1 })]
+    [InlineData (Alignment.Centered, new [] { 1, 1 }, 3, new [] { 0, 1 })]
+    [InlineData (Alignment.Centered, new [] { 1, 1 }, 4, new [] { 1, 2 })]
+    [InlineData (Alignment.Centered, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
+    [InlineData (Alignment.Centered, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.Centered, new [] { 1, 2, 3 }, 7, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.Centered, new [] { 1, 2, 3 }, 10, new [] { 2, 3, 5 })]
+    [InlineData (Alignment.Centered, new [] { 1, 2, 3 }, 11, new [] { 2, 3, 5 })]
+    [InlineData (Alignment.Centered, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Alignment.Centered, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 1, 3, 6 })]
+    [InlineData (Alignment.Centered, new [] { 3, 3, 3 }, 9, new [] { 0, 3, 6 })]
+    [InlineData (Alignment.Centered, new [] { 3, 3, 3 }, 10, new [] { 0, 3, 6 })]
+    [InlineData (Alignment.Centered, new [] { 3, 3, 3 }, 11, new [] { 1, 4, 7 })]
+    [InlineData (Alignment.Centered, new [] { 3, 3, 3 }, 12, new [] { 1, 4, 7 })]
+    [InlineData (Alignment.Centered, new [] { 3, 3, 3 }, 13, new [] { 2, 5, 8 })]
+    [InlineData (
+                    Alignment.Centered,
+                    new [] { 1, 2, 3 },
+                    5,
+                    new [] { 0, 1, 3 })] // 5 is too small to fit the items. The first item is at 0, the items to the right are clipped.
+    [InlineData (Alignment.Centered, new [] { 33, 33, 33 }, 100, new [] { 0, 33, 66 })]
+    [InlineData (Alignment.Centered, new [] { 33, 33, 33 }, 101, new [] { 1, 34, 67 })]
+    [InlineData (Alignment.Centered, new [] { 33, 33, 33 }, 102, new [] { 1, 34, 67 })]
+    [InlineData (Alignment.Centered, new [] { 33, 33, 33 }, 103, new [] { 2, 35, 68 })]
+    [InlineData (Alignment.Centered, new [] { 33, 33, 33 }, 104, new [] { 2, 35, 68 })]
+    [InlineData (Alignment.Centered, new [] { 3, 4, 5, 6 }, 25, new [] { 3, 6, 10, 15 })]
+    [InlineData (Alignment.Justified, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
+    [InlineData (Alignment.Justified, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
+    [InlineData (Alignment.Justified, new [] { 10, 20, 30 }, 100, new [] { 0, 30, 70 })]
+    [InlineData (Alignment.Justified, new [] { 10, 20, 30 }, 101, new [] { 0, 31, 71 })]
+    [InlineData (Alignment.Justified, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
+    [InlineData (Alignment.Justified, new [] { 11, 17, 23 }, 100, new [] { 0, 36, 77 })]
+    [InlineData (Alignment.Justified, new [] { 1, 2, 3 }, 11, new [] { 0, 4, 8 })]
+    [InlineData (Alignment.Justified, new [] { 10, 20 }, 101, new [] { 0, 81 })]
+    [InlineData (Alignment.Justified, new [] { 10 }, 101, new [] { 0 })]
+    [InlineData (Alignment.Justified, new [] { 3, 3, 3 }, 21, new [] { 0, 9, 18 })]
+    [InlineData (Alignment.Justified, new [] { 3, 4, 5 }, 21, new [] { 0, 8, 16 })]
+    [InlineData (Alignment.Justified, new [] { 3, 4, 5, 6 }, 18, new [] { 0, 3, 7, 12 })]
+    [InlineData (Alignment.Justified, new [] { 3, 4, 5, 6 }, 19, new [] { 0, 4, 8, 13 })]
+    [InlineData (Alignment.Justified, new [] { 3, 4, 5, 6 }, 20, new [] { 0, 4, 9, 14 })]
+    [InlineData (Alignment.Justified, new [] { 3, 4, 5, 6 }, 21, new [] { 0, 4, 9, 15 })]
+    [InlineData (Alignment.Justified, new [] { 6, 5, 4, 3 }, 22, new [] { 0, 8, 14, 19 })]
+    [InlineData (Alignment.Justified, new [] { 6, 5, 4, 3 }, 23, new [] { 0, 8, 15, 20 })]
+    [InlineData (Alignment.Justified, new [] { 6, 5, 4, 3 }, 24, new [] { 0, 8, 15, 21 })]
+    [InlineData (Alignment.Justified, new [] { 6, 5, 4, 3 }, 25, new [] { 0, 9, 16, 22 })]
+    [InlineData (Alignment.Justified, new [] { 6, 5, 4, 3 }, 26, new [] { 0, 9, 17, 23 })]
+    [InlineData (Alignment.Justified, new [] { 6, 5, 4, 3 }, 31, new [] { 0, 11, 20, 28 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 0 }, 1, new [] { 1 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 0, 0 }, 1, new [] { 0, 1 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 0, 0, 0 }, 1, new [] { 0, 0, 1 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1 }, 1, new [] { 0 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1 }, 2, new [] { 1 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1 }, 3, new [] { 2 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 1 }, 2, new [] { 0, 1 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 1 }, 3, new [] { 0, 2 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 1 }, 4, new [] { 0, 3 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3 }, 7, new [] { 0, 1, 4 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3 }, 8, new [] { 0, 1, 5 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3 }, 9, new [] { 0, 1, 6 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3 }, 10, new [] { 0, 1, 7 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3 }, 11, new [] { 0, 1, 8 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 1, 3, 7 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 12, new [] { 0, 1, 3, 8 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 3, 3, 3 }, 21, new [] { 0, 3, 18 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 3, 4, 5 }, 21, new [] { 0, 3, 16 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 33, 33, 33 }, 100, new [] { 0, 33, 67 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 10 }, 101, new [] { 91 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 10, 20 }, 101, new [] { 0, 81 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 10, 20, 30 }, 100, new [] { 0, 10, 70 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 10, 20, 30 }, 101, new [] { 0, 10, 71 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 10, 30, 61 })]
+    [InlineData (Alignment.LastRightRestLeft, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 10, 30, 60, 101 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 0 }, 1, new [] { 0 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 0, 0 }, 1, new [] { 0, 1 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1 }, 1, new [] { 0 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1 }, 2, new [] { 0 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1 }, 3, new [] { 0 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 1 }, 2, new [] { 0, 1 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 1 }, 3, new [] { 0, 2 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 1 }, 4, new [] { 0, 3 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3 }, 8, new [] { 0, 3, 5 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3 }, 9, new [] { 0, 4, 6 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3 }, 10, new [] { 0, 5, 7 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3 }, 11, new [] { 0, 6, 8 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 12, new [] { 0, 3, 5, 8 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 3, 3, 3 }, 21, new [] { 0, 15, 18 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 3, 4, 5 }, 21, new [] { 0, 12, 16 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 10 }, 101, new [] { 0 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 10, 20 }, 101, new [] { 0, 81 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 10, 20, 30 }, 100, new [] { 0, 50, 70 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 10, 20, 30 }, 101, new [] { 0, 51, 71 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
+    [InlineData (Alignment.FirstLeftRestRight, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
+    public void Alignment_NoSpaceBetweenItems (Alignment alignment, int [] sizes, int containerSize, int [] expected)
+    {
+        int [] positions = new Aligner
+        {
+            PutSpaceBetweenItems = false,
+            Alignment = alignment,
+            ContainerSize = containerSize
+        }.Align (sizes);
+        AssertAlignment (alignment, sizes, containerSize, positions, expected);
+    }
+
+    private void AssertAlignment (Alignment alignment, int [] sizes, int totalSize, int [] positions, int [] expected)
+    {
+        try
+        {
+            _output.WriteLine ($"Testing: {RenderAlignment (alignment, sizes, totalSize, expected)}");
+        }
+        catch (Exception e)
+        {
+            _output.WriteLine ($"Exception rendering expected: {e.Message}");
+            _output.WriteLine ($"Actual: {RenderAlignment (alignment, sizes, totalSize, positions)}");
+        }
+
+        if (!expected.SequenceEqual (positions))
+        {
+            _output.WriteLine ($"Expected: {RenderAlignment (alignment, sizes, totalSize, expected)}");
+            _output.WriteLine ($"Actual: {RenderAlignment (alignment, sizes, totalSize, positions)}");
+            Assert.Fail (" Expected and actual do not match");
+        }
+    }
+
+    private string RenderAlignment (Alignment alignment, int [] sizes, int totalSize, int [] positions)
+    {
+        var output = new StringBuilder ();
+        output.AppendLine ($"Alignment: {alignment}, Positions: {string.Join (", ", positions)}, TotalSize: {totalSize}");
+
+        for (var i = 0; i <= totalSize / 10; i++)
+        {
+            output.Append (i.ToString ().PadRight (9) + " ");
+        }
+
+        output.AppendLine ();
+
+        for (var i = 0; i < totalSize; i++)
+        {
+            output.Append (i % 10);
+        }
+
+        output.AppendLine ();
+
+        var items = new char [totalSize];
+
+        for (var position = 0; position < positions.Length; position++)
+        {
+            // try
+            {
+                for (var j = 0; j < sizes [position] && positions [position] + j < totalSize; j++)
+                {
+                    if (positions [position] + j >= 0)
+                    {
+                        items [positions [position] + j] = (position + 1).ToString () [0];
+                    }
+                }
+            }
+        }
+
+        output.Append (new string (items).Replace ('\0', ' '));
+
+        return output.ToString ();
+    }
+}

+ 0 - 445
UnitTests/Drawing/JustifierTests.cs

@@ -1,445 +0,0 @@
-using System.Text;
-using Xunit.Abstractions;
-
-namespace Terminal.Gui.DrawingTests;
-
-public class JustifierTests (ITestOutputHelper output)
-{
-    private readonly ITestOutputHelper _output = output;
-
-    public static IEnumerable<object []> JustificationEnumValues ()
-    {
-        foreach (object number in Enum.GetValues (typeof (Justification)))
-        {
-            yield return new [] { number };
-        }
-    }
-
-    [Theory]
-    [MemberData (nameof (JustificationEnumValues))]
-    public void NoItems_Works (Justification justification)
-    {
-        int [] sizes = [];
-        int [] positions = Justifier.Justify (justification, false, 100, sizes);
-        Assert.Equal (new int [] { }, positions);
-    }
-
-    [Theory]
-    [MemberData (nameof (JustificationEnumValues))]
-    public void Negative_Widths_Not_Allowed (Justification justification)
-    {
-        Assert.Throws<ArgumentException> (() => new Justifier ()
-        {
-            Justification = justification,
-            ContainerSize = 100
-        }.Justify (new [] { -10, 20, 30 }));
-        Assert.Throws<ArgumentException> (() => new Justifier ()
-        {
-            Justification = justification,
-            ContainerSize = 100
-        }.Justify (new [] { 10, -20, 30 }));
-        Assert.Throws<ArgumentException> (() => new Justifier ()
-        {
-            Justification = justification,
-            ContainerSize = 100
-        }.Justify (new [] { 10, 20, -30 }));
-    }
-
-    [Theory]
-    [InlineData (Justification.Left, new [] { 0 }, 1, new [] { 0 })]
-    [InlineData (Justification.Left, new [] { 0, 0 }, 1, new [] { 0, 1 })]
-    [InlineData (Justification.Left, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
-    [InlineData (Justification.Left, new [] { 1 }, 1, new [] { 0 })]
-    [InlineData (Justification.Left, new [] { 1 }, 2, new [] { 0 })]
-    [InlineData (Justification.Left, new [] { 1 }, 3, new [] { 0 })]
-    [InlineData (Justification.Left, new [] { 1, 1 }, 2, new [] { 0, 1 })]
-    [InlineData (Justification.Left, new [] { 1, 1 }, 3, new [] { 0, 2 })]
-    [InlineData (Justification.Left, new [] { 1, 1 }, 4, new [] { 0, 2 })]
-    [InlineData (Justification.Left, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 10, new [] { 0, 2, 5 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 11, new [] { 0, 2, 5 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 12, new [] { 0, 2, 5 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 13, new [] { 0, 2, 5 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 5, new [] { 0, 1, 3 })] // 5 is too small to fit the items. The first item is at 0, the items to the right are clipped.
-    [InlineData (Justification.Left, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
-    [InlineData (Justification.Left, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
-    [InlineData (Justification.Left, new [] { 10 }, 101, new [] { 0 })]
-    [InlineData (Justification.Left, new [] { 10, 20 }, 101, new [] { 0, 11 })]
-    [InlineData (Justification.Left, new [] { 10, 20, 30 }, 100, new [] { 0, 11, 32 })]
-    [InlineData (Justification.Left, new [] { 10, 20, 30 }, 101, new [] { 0, 11, 32 })]
-    [InlineData (Justification.Left, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
-    [InlineData (Justification.Left, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
-    [InlineData (Justification.Right, new [] { 0 }, 1, new [] { 1 })]
-    [InlineData (Justification.Right, new [] { 0, 0 }, 1, new [] { 0, 1 })]
-    [InlineData (Justification.Right, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
-    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
-    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
-    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 10, new [] { 2, 4, 7 })]
-    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 11, new [] { 3, 5, 8 })]
-    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 12, new [] { 4, 6, 9 })]
-    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 13, new [] { 5, 7, 10 })]
-
-    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 5, new [] { -1, 0, 2 })] // 5 is too small to fit the items. The first item is at -1.
-
-    [InlineData (Justification.Right, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.Right, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
-    [InlineData (Justification.Right, new [] { 10, 20, 30 }, 100, new [] { 38, 49, 70 })]
-    [InlineData (Justification.Right, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
-    [InlineData (Justification.Right, new [] { 10 }, 101, new [] { 91 })]
-    [InlineData (Justification.Right, new [] { 10, 20 }, 101, new [] { 70, 81 })]
-    [InlineData (Justification.Right, new [] { 10, 20, 30 }, 101, new [] { 39, 50, 71 })]
-    [InlineData (Justification.Right, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
-    [InlineData (Justification.Right, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
-    [InlineData (Justification.Centered, new [] { 0 }, 1, new [] { 0 })]
-    [InlineData (Justification.Centered, new [] { 0, 0 }, 1, new [] { 0, 1 })]
-    [InlineData (Justification.Centered, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
-    [InlineData (Justification.Centered, new [] { 1 }, 1, new [] { 0 })]
-    [InlineData (Justification.Centered, new [] { 1 }, 2, new [] { 0 })]
-    [InlineData (Justification.Centered, new [] { 1 }, 3, new [] { 1 })]
-    [InlineData (Justification.Centered, new [] { 1, 1 }, 2, new [] { 0, 1 })]
-    [InlineData (Justification.Centered, new [] { 1, 1 }, 3, new [] { 0, 2 })]
-    [InlineData (Justification.Centered, new [] { 1, 1 }, 4, new [] { 0, 2 })]
-    [InlineData (Justification.Centered, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
-    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
-    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
-    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 10, new [] { 1, 3, 6 })]
-    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 11, new [] { 1, 3, 6 })]
-    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 5, new [] { 0, 1, 3 })] // 5 is too small to fit the items. The first item is at 0, the items to the right are clipped.
-    [InlineData (Justification.Centered, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.Centered, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
-    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 9, new [] { 0, 3, 6 })]
-    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 10, new [] { 0, 4, 7 })]
-    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 11, new [] { 0, 4, 8 })]
-    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 12, new [] { 0, 4, 8 })]
-    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 13, new [] { 1, 5, 9 })]
-    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
-    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 101, new [] { 0, 34, 68 })]
-    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 102, new [] { 0, 34, 68 })]
-    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 103, new [] { 1, 35, 69 })]
-    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 104, new [] { 1, 35, 69 })]
-    [InlineData (Justification.Centered, new [] { 10 }, 101, new [] { 45 })]
-    [InlineData (Justification.Centered, new [] { 10, 20 }, 101, new [] { 35, 46 })]
-    [InlineData (Justification.Centered, new [] { 10, 20, 30 }, 100, new [] { 19, 30, 51 })]
-    [InlineData (Justification.Centered, new [] { 10, 20, 30 }, 101, new [] { 19, 30, 51 })]
-    [InlineData (Justification.Centered, new [] { 10, 20, 30, 40 }, 100, new [] { 0, 10, 30, 60 })]
-    [InlineData (Justification.Centered, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
-    [InlineData (Justification.Centered, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
-    [InlineData (Justification.Centered, new [] { 3, 4, 5, 6 }, 25, new [] { 2, 6, 11, 17 })]
-    [InlineData (Justification.Justified, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
-    [InlineData (Justification.Justified, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
-    [InlineData (Justification.Justified, new [] { 10, 20, 30 }, 100, new [] { 0, 30, 70 })]
-    [InlineData (Justification.Justified, new [] { 10, 20, 30 }, 101, new [] { 0, 31, 71 })]
-    [InlineData (Justification.Justified, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
-    [InlineData (Justification.Justified, new [] { 11, 17, 23 }, 100, new [] { 0, 36, 77 })]
-    [InlineData (Justification.Justified, new [] { 1, 2, 3 }, 11, new [] { 0, 4, 8 })]
-    [InlineData (Justification.Justified, new [] { 10, 20 }, 101, new [] { 0, 81 })]
-    [InlineData (Justification.Justified, new [] { 10 }, 101, new [] { 0 })]
-    [InlineData (Justification.Justified, new [] { 3, 3, 3 }, 21, new [] { 0, 9, 18 })]
-    [InlineData (Justification.Justified, new [] { 3, 4, 5 }, 21, new [] { 0, 8, 16 })]
-    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 18, new [] { 0, 3, 7, 12 })]
-    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 19, new [] { 0, 4, 8, 13 })]
-    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 20, new [] { 0, 4, 9, 14 })]
-    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 21, new [] { 0, 4, 9, 15 })]
-    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 22, new [] { 0, 8, 14, 19 })]
-    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 23, new [] { 0, 8, 15, 20 })]
-    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 24, new [] { 0, 8, 15, 21 })]
-    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 25, new [] { 0, 9, 16, 22 })]
-    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 26, new [] { 0, 9, 17, 23 })]
-    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 31, new [] { 0, 11, 20, 28 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 0 }, 1, new [] { 1 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 0, 0 }, 1, new [] { 0, 1 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1 }, 1, new [] { 0 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1 }, 2, new [] { 1 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1 }, 3, new [] { 2 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1 }, 2, new [] { 0, 1 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1 }, 3, new [] { 0, 2 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1 }, 4, new [] { 0, 3 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 8, new [] { 0, 2, 5 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 9, new [] { 0, 2, 6 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 10, new [] { 0, 2, 7 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 11, new [] { 0, 2, 8 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 5, new [] { -1, 0, 2 })] // 5 is too small to fit the items. The first item is at -1.})]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 3, 3, 3 }, 21, new [] { 0, 4, 18 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 3, 4, 5 }, 21, new [] { 0, 4, 16 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 10 }, 101, new [] { 91 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20 }, 101, new [] { 0, 81 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30 }, 100, new [] { 0, 11, 70 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30 }, 101, new [] { 0, 11, 71 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 0 }, 1, new [] { 0 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 0, 0 }, 1, new [] { 0, 1 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 0, 0, 0 }, 1, new [] { 0, 0, 1 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1 }, 1, new [] { 0 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1 }, 2, new [] { 0 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1 }, 3, new [] { 0 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1 }, 2, new [] { 0, 1 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1 }, 3, new [] { 0, 2 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1 }, 4, new [] { 0, 3 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 7, new [] { 0, 1, 4 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 8, new [] { 0, 2, 5 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 9, new [] { 0, 3, 6 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 10, new [] { 0, 4, 7 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 11, new [] { 0, 5, 8 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 5, new [] { 0, 1, 3 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 1, 3, 7 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 12, new [] { 0, 1, 4, 8 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 3, 3, 3 }, 21, new [] { 0, 14, 18 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 3, 4, 5 }, 21, new [] { 0, 11, 16 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 33, 33, 33 }, 100, new [] { 0, 33, 67 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 10 }, 101, new [] { 0 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20 }, 101, new [] { 0, 81 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30 }, 100, new [] { 0, 49, 70 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30 }, 101, new [] { 0, 50, 71 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 10, 30, 61 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 10, 30, 60, 101 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 3, 3, 3 }, 21, new [] { 0, 14, 18 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 3, 4, 5 }, 21, new [] { 0, 11, 16 })]
-    public void TestJustifications_PutSpaceBetweenItems (Justification justification, int [] sizes, int containerSize, int [] expected)
-    {
-        int [] positions = new Justifier
-        {
-            PutSpaceBetweenItems = true,
-            Justification = justification,
-            ContainerSize = containerSize
-        }.Justify (sizes);
-        AssertJustification (justification, sizes, containerSize, positions, expected);
-    }
-
-    [Theory]
-    [InlineData (Justification.Left, new [] { 0 }, 1, new [] { 0 })]
-    [InlineData (Justification.Left, new [] { 0, 0 }, 1, new [] { 0, 0 })]
-    [InlineData (Justification.Left, new [] { 0, 0, 0 }, 1, new [] { 0, 0, 0 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 7, new [] { 0, 1, 3 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 10, new [] { 0, 1, 3 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 11, new [] { 0, 1, 3 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 12, new [] { 0, 1, 3 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 13, new [] { 0, 1, 3 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 5, new [] { 0, 1, 3 })] // 5 is too small to fit the items. The first item is at 0, the items to the right are clipped.
-
-    [InlineData (Justification.Left, new [] { 10, 20, 30 }, 100, new [] { 0, 10, 30 })]
-    [InlineData (Justification.Left, new [] { 33, 33, 33 }, 100, new [] { 0, 33, 66 })]
-    [InlineData (Justification.Left, new [] { 10 }, 101, new [] { 0 })]
-    [InlineData (Justification.Left, new [] { 10, 20 }, 101, new [] { 0, 10 })]
-    [InlineData (Justification.Left, new [] { 10, 20, 30 }, 101, new [] { 0, 10, 30 })]
-    [InlineData (Justification.Left, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 10, 30, 60 })]
-    [InlineData (Justification.Left, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 10, 30, 60, 100 })]
-    [InlineData (Justification.Right, new [] { 0 }, 1, new [] { 1 })]
-    [InlineData (Justification.Right, new [] { 0, 0 }, 1, new [] { 1, 1 })]
-    [InlineData (Justification.Right, new [] { 0, 0, 0 }, 1, new [] { 1, 1, 1 })]
-    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
-    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 7, new [] { 1, 2, 4 })]
-    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 10, new [] { 4, 5, 7 })]
-    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 11, new [] { 5, 6, 8 })]
-    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 12, new [] { 6, 7, 9 })]
-    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 13, new [] { 7, 8, 10 })]
-
-    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 5, new [] { -1, 0, 2 })] // 5 is too small to fit the items. The first item is at -1.
-
-    [InlineData (Justification.Right, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.Right, new [] { 1, 2, 3, 4 }, 11, new [] { 1, 2, 4, 7 })]
-    [InlineData (Justification.Right, new [] { 10, 20, 30 }, 100, new [] { 40, 50, 70 })]
-    [InlineData (Justification.Right, new [] { 33, 33, 33 }, 100, new [] { 1, 34, 67 })]
-    [InlineData (Justification.Right, new [] { 10 }, 101, new [] { 91 })]
-    [InlineData (Justification.Right, new [] { 10, 20 }, 101, new [] { 71, 81 })]
-    [InlineData (Justification.Right, new [] { 10, 20, 30 }, 101, new [] { 41, 51, 71 })]
-    [InlineData (Justification.Right, new [] { 10, 20, 30, 40 }, 101, new [] { 1, 11, 31, 61 })]
-    [InlineData (Justification.Right, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 1, 11, 31, 61, 101 })]
-    [InlineData (Justification.Centered, new [] { 1 }, 1, new [] { 0 })]
-    [InlineData (Justification.Centered, new [] { 1 }, 2, new [] { 0 })]
-    [InlineData (Justification.Centered, new [] { 1 }, 3, new [] { 1 })]
-    [InlineData (Justification.Centered, new [] { 1, 1 }, 2, new [] { 0, 1 })]
-    [InlineData (Justification.Centered, new [] { 1, 1 }, 3, new [] { 0, 1 })]
-    [InlineData (Justification.Centered, new [] { 1, 1 }, 4, new [] { 1, 2 })]
-    [InlineData (Justification.Centered, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
-    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
-    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 7, new [] { 0, 1, 3 })]
-    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 10, new [] { 2, 3, 5 })]
-    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 11, new [] { 2, 3, 5 })]
-    [InlineData (Justification.Centered, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.Centered, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 9, new [] { 0, 3, 6 })]
-    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 10, new [] { 0, 3, 6 })]
-    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 11, new [] { 1, 4, 7 })]
-    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 12, new [] { 1, 4, 7 })]
-    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 13, new [] { 2, 5, 8 })]
-    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 5, new [] { 0, 1, 3 })] // 5 is too small to fit the items. The first item is at 0, the items to the right are clipped.
-
-    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 100, new [] { 0, 33, 66 })]
-    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 101, new [] { 1, 34, 67 })]
-    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 102, new [] { 1, 34, 67 })]
-    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 103, new [] { 2, 35, 68 })]
-    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 104, new [] { 2, 35, 68 })]
-    [InlineData (Justification.Centered, new [] { 3, 4, 5, 6 }, 25, new [] { 3, 6, 10, 15 })]
-    [InlineData (Justification.Justified, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
-    [InlineData (Justification.Justified, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
-    [InlineData (Justification.Justified, new [] { 10, 20, 30 }, 100, new [] { 0, 30, 70 })]
-    [InlineData (Justification.Justified, new [] { 10, 20, 30 }, 101, new [] { 0, 31, 71 })]
-    [InlineData (Justification.Justified, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
-    [InlineData (Justification.Justified, new [] { 11, 17, 23 }, 100, new [] { 0, 36, 77 })]
-    [InlineData (Justification.Justified, new [] { 1, 2, 3 }, 11, new [] { 0, 4, 8 })]
-    [InlineData (Justification.Justified, new [] { 10, 20 }, 101, new [] { 0, 81 })]
-    [InlineData (Justification.Justified, new [] { 10 }, 101, new [] { 0 })]
-    [InlineData (Justification.Justified, new [] { 3, 3, 3 }, 21, new [] { 0, 9, 18 })]
-    [InlineData (Justification.Justified, new [] { 3, 4, 5 }, 21, new [] { 0, 8, 16 })]
-    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 18, new [] { 0, 3, 7, 12 })]
-    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 19, new [] { 0, 4, 8, 13 })]
-    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 20, new [] { 0, 4, 9, 14 })]
-    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 21, new [] { 0, 4, 9, 15 })]
-    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 22, new [] { 0, 8, 14, 19 })]
-    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 23, new [] { 0, 8, 15, 20 })]
-    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 24, new [] { 0, 8, 15, 21 })]
-    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 25, new [] { 0, 9, 16, 22 })]
-    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 26, new [] { 0, 9, 17, 23 })]
-    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 31, new [] { 0, 11, 20, 28 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 0 }, 1, new [] { 1 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 0, 0 }, 1, new [] { 0, 1 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 0, 0, 0 }, 1, new [] { 0, 0, 1 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1 }, 1, new [] { 0 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1 }, 2, new [] { 1 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1 }, 3, new [] { 2 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1 }, 2, new [] { 0, 1 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1 }, 3, new [] { 0, 2 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1 }, 4, new [] { 0, 3 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 7, new [] { 0, 1, 4 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 8, new [] { 0, 1, 5 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 9, new [] { 0, 1, 6 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 10, new [] { 0, 1, 7 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 11, new [] { 0, 1, 8 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 1, 3, 7 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 12, new [] { 0, 1, 3, 8 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 3, 3, 3 }, 21, new [] { 0, 3, 18 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 3, 4, 5 }, 21, new [] { 0, 3, 16 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 33, 33, 33 }, 100, new [] { 0, 33, 67 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 10 }, 101, new [] { 91 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20 }, 101, new [] { 0, 81 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30 }, 100, new [] { 0, 10, 70 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30 }, 101, new [] { 0, 10, 71 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 10, 30, 61 })]
-    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 10, 30, 60, 101 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 0 }, 1, new [] { 0 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 0, 0 }, 1, new [] { 0, 1 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1 }, 1, new [] { 0 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1 }, 2, new [] { 0 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1 }, 3, new [] { 0 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1 }, 2, new [] { 0, 1 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1 }, 3, new [] { 0, 2 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1 }, 4, new [] { 0, 3 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 8, new [] { 0, 3, 5 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 9, new [] { 0, 4, 6 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 10, new [] { 0, 5, 7 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 11, new [] { 0, 6, 8 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 12, new [] { 0, 3, 5, 8 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 3, 3, 3 }, 21, new [] { 0, 15, 18 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 3, 4, 5 }, 21, new [] { 0, 12, 16 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 10 }, 101, new [] { 0 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20 }, 101, new [] { 0, 81 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30 }, 100, new [] { 0, 50, 70 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30 }, 101, new [] { 0, 51, 71 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
-    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
-    public void TestJustifications_NoSpaceBetweenItems (Justification justification, int [] sizes, int containerSize, int [] expected)
-    {
-        int [] positions = new Justifier
-        {
-            PutSpaceBetweenItems = false,
-            Justification = justification,
-            ContainerSize = containerSize
-        }.Justify (sizes);
-        AssertJustification (justification, sizes, containerSize, positions, expected);
-    }
-
-    public void AssertJustification (Justification justification, int [] sizes, int totalSize, int [] positions, int [] expected)
-    {
-        try
-        {
-            _output.WriteLine ($"Testing: {RenderJustification (justification, sizes, totalSize, expected)}");
-        }
-        catch (Exception e)
-        {
-            _output.WriteLine ($"Exception rendering expected: {e.Message}");
-            _output.WriteLine ($"Actual: {RenderJustification (justification, sizes, totalSize, positions)}");
-        }
-
-        if (!expected.SequenceEqual (positions))
-        {
-            _output.WriteLine ($"Expected: {RenderJustification (justification, sizes, totalSize, expected)}");
-            _output.WriteLine ($"Actual: {RenderJustification (justification, sizes, totalSize, positions)}");
-            Assert.Fail (" Expected and actual do not match");
-        }
-    }
-
-    public string RenderJustification (Justification justification, int [] sizes, int totalSize, int [] positions)
-    {
-        var output = new StringBuilder ();
-        output.AppendLine ($"Justification: {justification}, Positions: {string.Join (", ", positions)}, TotalSize: {totalSize}");
-
-        for (var i = 0; i <= totalSize / 10; i++)
-        {
-            output.Append (i.ToString ().PadRight (9) + " ");
-        }
-
-        output.AppendLine ();
-
-        for (var i = 0; i < totalSize; i++)
-        {
-            output.Append (i % 10);
-        }
-
-        output.AppendLine ();
-
-        var items = new char [totalSize];
-
-        for (var position = 0; position < positions.Length; position++)
-        {
-            // try
-            {
-                for (var j = 0; j < sizes [position] && positions [position] + j < totalSize; j++)
-                {
-                    if (positions [position] + j >= 0)
-                    {
-                        items [positions [position] + j] = (position + 1).ToString () [0];
-                    }
-                }
-            }
-
-            //catch (Exception e)
-            //{
-            //    output.AppendLine ($"{e.Message} - position = {position}, positions[{position}]: {positions [position]}, sizes[{position}]: {sizes [position]}, totalSize: {totalSize}");
-            //    output.Append (new string (items).Replace ('\0', ' '));
-
-            //    Assert.Fail (e.Message + output.ToString ());
-            //}
-        }
-
-        output.Append (new string (items).Replace ('\0', ' '));
-
-        return output.ToString ();
-    }
-}

Fichier diff supprimé car celui-ci est trop grand
+ 144 - 144
UnitTests/Text/TextFormatterTests.cs


+ 2 - 2
UnitTests/View/DrawTests.cs

@@ -339,7 +339,7 @@ public class DrawTests (ITestOutputHelper _output)
             Text = "Test",
             Width = 6,
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             ColorScheme = Colors.ColorSchemes ["Base"]
         };
 
@@ -350,7 +350,7 @@ public class DrawTests (ITestOutputHelper _output)
             Y = 1,
             Width = 1,
             Height = 6,
-            VerticalJustification = Justification.Bottom,
+            VerticalTextJustification = Alignment.Bottom,
             ColorScheme = Colors.ColorSchemes ["Base"]
         };
         Toplevel top = new ();

+ 6 - 6
UnitTests/View/Layout/Dim.AutoTests.cs

@@ -681,11 +681,11 @@ public class DimAutoTests (ITestOutputHelper output)
         Assert.False (view.TextFormatter.AutoSize);
         Assert.Equal (Size.Empty, view.Frame.Size);
 
-        view.TextFormatter.Justification = Justification.Justified;
+        view.TextFormatter.Justification = Alignment.Justified;
         Assert.False (view.TextFormatter.AutoSize);
         Assert.Equal (Size.Empty, view.Frame.Size);
 
-        view.TextFormatter.VerticalJustification = Justification.Centered;
+        view.TextFormatter.VerticalJustification = Alignment.Centered;
         Assert.False (view.TextFormatter.AutoSize);
         Assert.Equal (Size.Empty, view.Frame.Size);
 
@@ -709,11 +709,11 @@ public class DimAutoTests (ITestOutputHelper output)
         Assert.False (view.TextFormatter.AutoSize);
         Assert.Equal (Size.Empty, view.Frame.Size);
 
-        view.Justification = Justification.Justified;
+        view.TextJustification = Alignment.Justified;
         Assert.False (view.TextFormatter.AutoSize);
         Assert.Equal (Size.Empty, view.Frame.Size);
 
-        view.VerticalJustification = Justification.Centered;
+        view.VerticalTextJustification = Alignment.Centered;
         Assert.False (view.TextFormatter.AutoSize);
         Assert.Equal (Size.Empty, view.Frame.Size);
 
@@ -738,7 +738,7 @@ public class DimAutoTests (ITestOutputHelper output)
         Assert.True (view.TextFormatter.AutoSize);
         Assert.NotEqual (Size.Empty, view.Frame.Size);
 
-        view.Justification = Justification.Justified;
+        view.TextJustification = Alignment.Justified;
         Assert.True (view.TextFormatter.AutoSize);
         Assert.NotEqual (Size.Empty, view.Frame.Size);
 
@@ -747,7 +747,7 @@ public class DimAutoTests (ITestOutputHelper output)
             Text = "_1234",
             Width = Dim.Auto ()
         };
-        view.VerticalJustification = Justification.Centered;
+        view.VerticalTextJustification = Alignment.Centered;
         Assert.True (view.TextFormatter.AutoSize);
         Assert.NotEqual (Size.Empty, view.Frame.Size);
 

+ 6 - 6
UnitTests/View/Text/AutoSizeTrueTests.cs

@@ -1811,7 +1811,7 @@ Y
             Y = 1,
             Width = width,
             Height = 1,
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
         };
 
         if (autoSize)
@@ -1826,7 +1826,7 @@ Y
             Y = 2,
             Width = width,
             Height = 1,
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
         };
         if (autoSize)
         {
@@ -1840,7 +1840,7 @@ Y
             Y = 3,
             Width = width,
             Height = 1,
-            Justification = Justification.Justified,
+            TextJustification = Alignment.Justified,
         };
         if (autoSize)
         {
@@ -1937,7 +1937,7 @@ Y
             Width = 1,
             Height = height,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalJustification = Justification.Centered
+            VerticalTextJustification = Alignment.Centered
         };
         if (autoSize)
         {
@@ -1952,7 +1952,7 @@ Y
             Width = 1,
             Height = height,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalJustification = Justification.Bottom
+            VerticalTextJustification = Alignment.Bottom
         };
         if (autoSize)
         {
@@ -1967,7 +1967,7 @@ Y
             Width = 1,
             Height = height,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalJustification = Justification.Justified
+            VerticalTextJustification = Alignment.Justified
         };
         if (autoSize)
         {

+ 4 - 4
UnitTests/Views/ButtonTests.cs

@@ -155,14 +155,14 @@ public class ButtonTests (ITestOutputHelper output)
 
         Assert.Equal ($"{CM.Glyphs.LeftBracket}  {CM.Glyphs.RightBracket}", btn.TextFormatter.Text);
         Assert.False (btn.IsDefault);
-        Assert.Equal (Justification.Centered, btn.Justification);
+        Assert.Equal (Alignment.Centered, btn.TextJustification);
         Assert.Equal ('_', btn.HotKeySpecifier.Value);
         Assert.True (btn.CanFocus);
         Assert.Equal (new (0, 0, 4, 1), btn.Viewport);
         Assert.Equal (new (0, 0, 4, 1), btn.Frame);
         Assert.Equal ($"{CM.Glyphs.LeftBracket}  {CM.Glyphs.RightBracket}", btn.TextFormatter.Text);
         Assert.False (btn.IsDefault);
-        Assert.Equal (Justification.Centered, btn.Justification);
+        Assert.Equal (Alignment.Centered, btn.TextJustification);
         Assert.Equal ('_', btn.HotKeySpecifier.Value);
         Assert.True (btn.CanFocus);
         Assert.Equal (new (0, 0, 4, 1), btn.Viewport);
@@ -195,7 +195,7 @@ public class ButtonTests (ITestOutputHelper output)
                       btn.TextFormatter.Format ()
                      );
         Assert.True (btn.IsDefault);
-        Assert.Equal (Justification.Centered, btn.Justification);
+        Assert.Equal (Alignment.Centered, btn.TextJustification);
         Assert.True (btn.CanFocus);
 
         btn.SetRelativeLayout (new (100, 100));
@@ -222,7 +222,7 @@ public class ButtonTests (ITestOutputHelper output)
                       btn.TextFormatter.Format ()
                      );
         Assert.True (btn.IsDefault);
-        Assert.Equal (Justification.Centered, btn.Justification);
+        Assert.Equal (Alignment.Centered, btn.TextJustification);
         Assert.Equal ('_', btn.HotKeySpecifier.Value);
         Assert.True (btn.CanFocus);
 

+ 9 - 9
UnitTests/Views/CheckBoxTests.cs

@@ -251,7 +251,7 @@ public class CheckBoxTests
             X = 1,
             Y = Pos.Center (),
             Text = "Check this out 你",
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 25
         };
         var win = new Window { Width = Dim.Fill (), Height = Dim.Fill (), Title = "Test Demo 你" };
@@ -262,7 +262,7 @@ public class CheckBoxTests
         Application.Begin (top);
         ((FakeDriver)Application.Driver).SetBufferSize (30, 5);
 
-        Assert.Equal (Justification.Centered, checkBox.Justification);
+        Assert.Equal (Alignment.Centered, checkBox.TextJustification);
         Assert.Equal (new (1, 1, 25, 1), checkBox.Frame);
         Assert.Equal (_size25x1, checkBox.TextFormatter.Size);
 
@@ -301,7 +301,7 @@ public class CheckBoxTests
             X = 1,
             Y = Pos.Center (),
             Text = "Check first out 你",
-            Justification = Justification.Justified,
+            TextJustification = Alignment.Justified,
             Width = 25
         };
 
@@ -310,7 +310,7 @@ public class CheckBoxTests
             X = 1,
             Y = Pos.Bottom (checkBox1),
             Text = "Check second out 你",
-            Justification = Justification.Justified,
+            TextJustification = Alignment.Justified,
             Width = 25
         };
         var win = new Window { Width = Dim.Fill (), Height = Dim.Fill (), Title = "Test Demo 你" };
@@ -321,9 +321,9 @@ public class CheckBoxTests
         Application.Begin (top);
         ((FakeDriver)Application.Driver).SetBufferSize (30, 6);
 
-        Assert.Equal (Justification.Justified, checkBox1.Justification);
+        Assert.Equal (Alignment.Justified, checkBox1.TextJustification);
         Assert.Equal (new (1, 1, 25, 1), checkBox1.Frame);
-        Assert.Equal (Justification.Justified, checkBox2.Justification);
+        Assert.Equal (Alignment.Justified, checkBox2.TextJustification);
         Assert.Equal (new (1, 2, 25, 1), checkBox2.Frame);
  
         var expected = @$"
@@ -378,7 +378,7 @@ public class CheckBoxTests
         Application.Begin (top);
         ((FakeDriver)Application.Driver).SetBufferSize (30, 5);
 
-        Assert.Equal (Justification.Left, checkBox.Justification);
+        Assert.Equal (Alignment.Left, checkBox.TextJustification);
         Assert.Equal (new (1, 1, 25, 1), checkBox.Frame);
         Assert.Equal (_size25x1, checkBox.TextFormatter.Size);
 
@@ -417,7 +417,7 @@ public class CheckBoxTests
             X = 1,
             Y = Pos.Center (),
             Text = "Check this out 你",
-            Justification = Justification.Right,
+            TextJustification = Alignment.Right,
             Width = 25
         };
         var win = new Window { Width = Dim.Fill (), Height = Dim.Fill (), Title = "Test Demo 你" };
@@ -428,7 +428,7 @@ public class CheckBoxTests
         Application.Begin (top);
         ((FakeDriver)Application.Driver).SetBufferSize (30, 5);
 
-        Assert.Equal (Justification.Right, checkBox.Justification);
+        Assert.Equal (Alignment.Right, checkBox.TextJustification);
         Assert.Equal (new (1, 1, 25, 1), checkBox.Frame);
         Assert.Equal (_size25x1, checkBox.TextFormatter.Size);
 

+ 1 - 1
UnitTests/Views/LabelTests.cs

@@ -206,7 +206,7 @@ public class LabelTests
     {
         var label = new Label ();
         Assert.Equal (string.Empty, label.Text);
-        Assert.Equal (Justification.Left, label.Justification);
+        Assert.Equal (Alignment.Left, label.TextJustification);
         Assert.False (label.CanFocus);
         Assert.Equal (new Rectangle (0, 0, 0, 0), label.Frame);
         Assert.Equal (KeyCode.Null, label.HotKey);

+ 20 - 20
UnitTests/Views/TextValidateFieldTests.cs

@@ -10,7 +10,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
 
             //                                             ****
@@ -44,7 +44,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Left,
+            TextJustification = Alignment.Left,
             Width = 30,
 
             //                                             ****
@@ -81,7 +81,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
 
             //                                             ****
@@ -115,7 +115,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
 
             //                                             *
@@ -137,7 +137,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
 
             //                                             *
@@ -161,7 +161,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
 
             //                                             ****
@@ -179,7 +179,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
 
             //                                             ****
@@ -196,7 +196,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
 
             //                                             ****
@@ -214,7 +214,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
 
             //                                             *
@@ -233,7 +233,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
 
             //                                             *
@@ -253,7 +253,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
 
             //                                             ** **
@@ -283,7 +283,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
 
             //                                             *
@@ -308,7 +308,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Left,
+            TextJustification = Alignment.Left,
             Width = 30,
 
             //                                             ****
@@ -338,7 +338,7 @@ public class TextValidateField_NET_Provider_Tests
 
         var field = new TextValidateField
         {
-            Justification = Justification.Left, Width = 30, Provider = new NetMaskedTextProvider ("--(0000)--")
+            TextJustification = Alignment.Left, Width = 30, Provider = new NetMaskedTextProvider ("--(0000)--")
         };
 
         field.Provider.TextChanged += (sender, e) => wasTextChanged = true;
@@ -356,7 +356,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
 
             //                                             *
@@ -381,7 +381,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Left,
+            TextJustification = Alignment.Left,
             Width = 30,
 
             //                                             ****
@@ -400,7 +400,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
 
             //                                             ****
@@ -540,7 +540,7 @@ public class TextValidateField_Regex_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
             Provider = new TextRegexProvider ("^[0-9][0-9][0-9]$") { ValidateOnInput = false }
         };
@@ -596,7 +596,7 @@ public class TextValidateField_Regex_Provider_Tests
 
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
             Provider = new TextRegexProvider ("^[0-9][0-9][0-9]$") { ValidateOnInput = false }
         };
@@ -616,7 +616,7 @@ public class TextValidateField_Regex_Provider_Tests
     {
         var field = new TextValidateField
         {
-            Justification = Justification.Centered,
+            TextJustification = Alignment.Centered,
             Width = 20,
             Provider = new TextRegexProvider ("^[0-9][0-9][0-9]$") { ValidateOnInput = false }
         };

+ 2 - 2
UnitTests/Views/ToplevelTests.cs

@@ -1482,8 +1482,8 @@ public class ToplevelTests
                         Y = Pos.Center (),
                         Width = Dim.Fill (),
                         Height = Dim.Fill (),
-                        Justification = Justification.Centered,
-                        VerticalJustification = Justification.Centered,
+                        TextJustification = Alignment.Centered,
+                        VerticalTextJustification = Alignment.Centered,
                         Text = "Test"
                     }
                    );

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff