浏览代码

Rebased with v2_develop

Tig 1 年之前
父节点
当前提交
6b1a429e56
共有 98 个文件被更改,包括 1293 次插入1169 次删除
  1. 10 10
      Terminal.Gui/Application.cs
  2. 3 3
      Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs
  3. 24 24
      Terminal.Gui/Drawing/LineCanvas.cs
  4. 2 2
      Terminal.Gui/Drawing/StraightLine.cs
  5. 3 3
      Terminal.Gui/Input/Mouse.cs
  6. 1 1
      Terminal.Gui/Text/Autocomplete/AppendAutocomplete.cs
  7. 1 1
      Terminal.Gui/Text/Autocomplete/PopupAutocomplete.PopUp.cs
  8. 11 11
      Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs
  9. 45 45
      Terminal.Gui/Text/TextFormatter.cs
  10. 10 10
      Terminal.Gui/View/Adornment/Adornment.cs
  11. 10 10
      Terminal.Gui/View/Adornment/Border.cs
  12. 1 1
      Terminal.Gui/View/Adornment/Padding.cs
  13. 59 62
      Terminal.Gui/View/Layout/ViewLayout.cs
  14. 3 3
      Terminal.Gui/View/View.cs
  15. 3 3
      Terminal.Gui/View/ViewAdornments.cs
  16. 108 83
      Terminal.Gui/View/ViewDrawing.cs
  17. 10 10
      Terminal.Gui/View/ViewMouse.cs
  18. 20 20
      Terminal.Gui/View/ViewText.cs
  19. 5 5
      Terminal.Gui/Views/ColorPicker.cs
  20. 18 18
      Terminal.Gui/Views/ComboBox.cs
  21. 4 4
      Terminal.Gui/Views/Dialog.cs
  22. 11 11
      Terminal.Gui/Views/FileDialog.cs
  23. 8 8
      Terminal.Gui/Views/GraphView/Annotations.cs
  24. 15 15
      Terminal.Gui/Views/GraphView/Axis.cs
  25. 9 9
      Terminal.Gui/Views/GraphView/GraphView.cs
  26. 1 1
      Terminal.Gui/Views/GraphView/Series.cs
  27. 10 10
      Terminal.Gui/Views/HexView.cs
  28. 2 2
      Terminal.Gui/Views/Line.cs
  29. 3 3
      Terminal.Gui/Views/LineView.cs
  30. 16 16
      Terminal.Gui/Views/ListView.cs
  31. 3 3
      Terminal.Gui/Views/Menu/ContextMenu.cs
  32. 15 13
      Terminal.Gui/Views/Menu/Menu.cs
  33. 11 15
      Terminal.Gui/Views/Menu/MenuBar.cs
  34. 1 1
      Terminal.Gui/Views/MessageBox.cs
  35. 10 10
      Terminal.Gui/Views/ProgressBar.cs
  36. 2 2
      Terminal.Gui/Views/RadioGroup.cs
  37. 25 25
      Terminal.Gui/Views/ScrollBarView.cs
  38. 19 19
      Terminal.Gui/Views/ScrollView.cs
  39. 22 22
      Terminal.Gui/Views/Slider.cs
  40. 1 1
      Terminal.Gui/Views/StatusBar.cs
  41. 14 14
      Terminal.Gui/Views/TabView.cs
  42. 4 4
      Terminal.Gui/Views/TableView/ListTableSource.cs
  43. 22 22
      Terminal.Gui/Views/TableView/TableView.cs
  44. 8 8
      Terminal.Gui/Views/TextField.cs
  45. 5 5
      Terminal.Gui/Views/TextValidateField.cs
  46. 3 3
      Terminal.Gui/Views/TextView.cs
  47. 42 42
      Terminal.Gui/Views/TileView.cs
  48. 7 7
      Terminal.Gui/Views/Toplevel.cs
  49. 14 14
      Terminal.Gui/Views/TreeView/TreeView.cs
  50. 2 2
      UICatalog/Scenarios/ASCIICustomButton.cs
  51. 5 5
      UICatalog/Scenarios/Animation.cs
  52. 1 1
      UICatalog/Scenarios/BackgroundWorkerCollection.cs
  53. 1 1
      UICatalog/Scenarios/Buttons.cs
  54. 15 15
      UICatalog/Scenarios/CharacterMap.cs
  55. 4 4
      UICatalog/Scenarios/ComputedLayout.cs
  56. 2 2
      UICatalog/Scenarios/Editor.cs
  57. 2 2
      UICatalog/Scenarios/GraphViewExample.cs
  58. 2 2
      UICatalog/Scenarios/LineDrawing.cs
  59. 1 1
      UICatalog/Scenarios/Notepad.cs
  60. 1 1
      UICatalog/Scenarios/ProgressBarStyles.cs
  61. 6 6
      UICatalog/Scenarios/Scrolling.cs
  62. 4 4
      UICatalog/Scenarios/Snake.cs
  63. 8 8
      UICatalog/Scenarios/ViewExperiments.cs
  64. 6 6
      UICatalog/Scenarios/VkeyPacketSimulator.cs
  65. 3 3
      UnitTests/Application/MouseTests.cs
  66. 26 26
      UnitTests/Drawing/LineCanvasTests.cs
  67. 2 2
      UnitTests/Drawing/StraightLineTests.cs
  68. 1 1
      UnitTests/UICatalog/ScenarioTests.cs
  69. 22 22
      UnitTests/View/Adornment/AdornmentTests.cs
  70. 21 21
      UnitTests/View/Adornment/ToScreenTests.cs
  71. 172 68
      UnitTests/View/DrawTests.cs
  72. 37 37
      UnitTests/View/Layout/AbsoluteLayoutTests.cs
  73. 4 4
      UnitTests/View/Layout/DimTests.cs
  74. 5 5
      UnitTests/View/Layout/PosTests.cs
  75. 7 7
      UnitTests/View/Layout/ScreenToTests.cs
  76. 8 8
      UnitTests/View/Layout/SetRelativeLayoutTests.cs
  77. 7 7
      UnitTests/View/Layout/ToScreenTests.cs
  78. 9 9
      UnitTests/View/Layout/ViewportTests.cs
  79. 34 34
      UnitTests/View/NavigationTests.cs
  80. 22 22
      UnitTests/View/SubviewTests.cs
  81. 3 3
      UnitTests/View/Text/AutoSizeFalseTests.cs
  82. 7 7
      UnitTests/View/Text/AutoSizeTrueTests.cs
  83. 40 40
      UnitTests/View/ViewTests.cs
  84. 6 6
      UnitTests/Views/ButtonTests.cs
  85. 18 18
      UnitTests/Views/ComboBoxTests.cs
  86. 25 25
      UnitTests/Views/GraphViewTests.cs
  87. 5 5
      UnitTests/Views/LabelTests.cs
  88. 29 29
      UnitTests/Views/ScrollBarViewTests.cs
  89. 5 5
      UnitTests/Views/ScrollViewTests.cs
  90. 2 2
      UnitTests/Views/StatusBarTests.cs
  91. 40 40
      UnitTests/Views/TableViewTests.cs
  92. 1 1
      UnitTests/Views/TextFieldTests.cs
  93. 1 1
      UnitTests/Views/TextValidateFieldTests.cs
  94. 7 7
      UnitTests/Views/TextViewTests.cs
  95. 3 3
      UnitTests/Views/ToplevelTests.cs
  96. 1 1
      UnitTests/Views/TreeTableSourceTests.cs
  97. 3 3
      UnitTests/Views/TreeViewTests.cs
  98. 3 3
      UnitTests/Views/WindowTests.cs

+ 10 - 10
Terminal.Gui/Application.cs

@@ -296,7 +296,7 @@ public static partial class Application
         Current = Top;
 
         // Ensure Top's layout is up to date.
-        Current.SetRelativeLayout (Driver.Bounds);
+        Current.SetRelativeLayout (Driver.Viewport);
 
         SupportedCultures = GetSupportedCultures ();
         _mainThreadId = Thread.CurrentThread.ManagedThreadId;
@@ -491,7 +491,7 @@ public static partial class Application
         }
 
         //if (Toplevel.LayoutStyle == LayoutStyle.Computed) {
-        Toplevel.SetRelativeLayout (Driver.Bounds);
+        Toplevel.SetRelativeLayout (Driver.Viewport);
 
         //}
 
@@ -1377,7 +1377,7 @@ public static partial class Application
     /// <remarks>
     ///     <para>
     ///         Use this event to receive mouse events in screen coordinates. Use <see cref="MouseEvent"/> to
-    ///         receive mouse events relative to a <see cref="View"/>'s bounds.
+    ///         receive mouse events relative to a <see cref="View.Viewport"/>.
     ///     </para>
     ///     <para>The <see cref="MouseEvent.View"/> will contain the <see cref="View"/> that contains the mouse coordinates.</para>
     /// </remarks>
@@ -1420,7 +1420,7 @@ public static partial class Application
         if (MouseGrabView is { })
         {
             // If the mouse is grabbed, send the event to the view that grabbed it.
-            // The coordinates are relative to the Bounds of the view that grabbed the mouse.
+            // The coordinates are relative to the Viewport of the view that grabbed the mouse.
             Point frameLoc = MouseGrabView.ScreenToFrame (a.MouseEvent.X, a.MouseEvent.Y);
 
             var viewRelativeMouseEvent = new MouseEvent
@@ -1432,9 +1432,9 @@ public static partial class Application
                 View = view
             };
 
-            if (MouseGrabView.Bounds.Contains (viewRelativeMouseEvent.X, viewRelativeMouseEvent.Y) is false)
+            if (MouseGrabView.Viewport.Contains (viewRelativeMouseEvent.X, viewRelativeMouseEvent.Y) is false)
             {
-                // The mouse has moved outside the bounds of the view that
+                // The mouse has moved outside the Viewport of the view that
                 // grabbed the mouse, so we tell the view that last got 
                 // OnMouseEnter the mouse is leaving
                 // BUGBUG: That sentence makes no sense. Either I'm missing something or this logic is flawed.
@@ -1488,14 +1488,14 @@ public static partial class Application
                 View = view
             };
         }
-        else if (view.BoundsToScreen (view.Bounds).Contains (a.MouseEvent.X, a.MouseEvent.Y))
+        else if (view.ViewportToScreen (view.Viewport).Contains (a.MouseEvent.X, a.MouseEvent.Y))
         {
-            Point boundsPoint = view.ScreenToBounds (a.MouseEvent.X, a.MouseEvent.Y);
+            Point viewportLocation = view.ScreenToViewport (a.MouseEvent.X, a.MouseEvent.Y);
 
             me = new MouseEvent
             {
-                X = boundsPoint.X,
-                Y = boundsPoint.Y,
+                X = viewportLocation.X,
+                Y = viewportLocation.Y,
                 Flags = a.MouseEvent.Flags,
                 ScreenPosition = new (a.MouseEvent.X, a.MouseEvent.Y),
                 View = view

+ 3 - 3
Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs

@@ -19,13 +19,13 @@ public abstract class ConsoleDriver
     internal bool [] _dirtyLines;
 
     /// <summary>Gets the dimensions of the terminal.</summary>
-    public Rectangle Bounds => new (0, 0, Cols, Rows);
+    public Rectangle Viewport => new (0, 0, Cols, Rows);
 
     /// <summary>
     ///     Gets or sets the clip rectangle that <see cref="AddRune(Rune)"/> and <see cref="AddStr(string)"/> are subject
     ///     to.
     /// </summary>
-    /// <value>The rectangle describing the bounds of <see cref="Clip"/>.</value>
+    /// <value>The rectangle describing the of <see cref="Clip"/> region.</value>
     public Rectangle Clip { get; set; }
 
     /// <summary>Get the operating system clipboard.</summary>
@@ -372,7 +372,7 @@ public abstract class ConsoleDriver
     /// <param name="col">The column.</param>
     /// <param name="row">The row.</param>
     /// <returns>
-    ///     <see langword="false"/> if the coordinate is outside of the screen bounds or outside of <see cref="Clip"/>.
+    ///     <see langword="false"/> if the coordinate is outside the screen bounds or outside of <see cref="Clip"/>.
     ///     <see langword="true"/> otherwise.
     /// </returns>
     public bool IsValidLocation (int col, int row) { return col >= 0 && row >= 0 && col < Cols && row < Rows && Clip.Contains (col, row); }

+ 24 - 24
Terminal.Gui/Drawing/LineCanvas.cs

@@ -48,7 +48,7 @@ public class LineCanvas : IDisposable
         // TODO: Add other resolvers
     };
 
-    private Rectangle _cachedBounds;
+    private Rectangle _cachedViewport;
 
     /// <summary>Creates a new instance.</summary>
     public LineCanvas ()
@@ -67,37 +67,37 @@ public class LineCanvas : IDisposable
     ///     Gets the rectangle that describes the bounds of the canvas. Location is the coordinates of the line that is
     ///     furthest left/top and Size is defined by the line that extends the furthest right/bottom.
     /// </summary>
-    public Rectangle Bounds
+    public Rectangle Viewport
     {
         get
         {
-            if (_cachedBounds.IsEmpty)
+            if (_cachedViewport.IsEmpty)
             {
                 if (_lines.Count == 0)
                 {
-                    return _cachedBounds;
+                    return _cachedViewport;
                 }
 
-                Rectangle bounds = _lines [0].Bounds;
+                Rectangle viewport = _lines [0].Viewport;
 
                 for (var i = 1; i < _lines.Count; i++)
                 {
-                    bounds = Rectangle.Union (bounds, _lines [i].Bounds);
+                    viewport = Rectangle.Union (viewport, _lines [i].Viewport);
                 }
 
-                if (bounds is {Width: 0} or {Height: 0})
+                if (viewport is {Width: 0} or {Height: 0})
                 {
-                    bounds = bounds with
+                    viewport = viewport with
                     {
-                        Width = Math.Clamp (bounds.Width, 1, short.MaxValue),
-                        Height = Math.Clamp (bounds.Height, 1, short.MaxValue)
+                        Width = Math.Clamp (viewport.Width, 1, short.MaxValue),
+                        Height = Math.Clamp (viewport.Height, 1, short.MaxValue)
                     };
                 }
 
-                _cachedBounds = bounds;
+                _cachedViewport = viewport;
             }
 
-            return _cachedBounds;
+            return _cachedViewport;
         }
     }
 
@@ -134,7 +134,7 @@ public class LineCanvas : IDisposable
         Attribute? attribute = default
     )
     {
-        _cachedBounds = Rectangle.Empty;
+        _cachedViewport = Rectangle.Empty;
         _lines.Add (new StraightLine (start, length, orientation, style, attribute));
     }
 
@@ -142,14 +142,14 @@ public class LineCanvas : IDisposable
     /// <param name="line"></param>
     public void AddLine (StraightLine line)
     {
-        _cachedBounds = Rectangle.Empty;
+        _cachedViewport = Rectangle.Empty;
         _lines.Add (line);
     }
 
     /// <summary>Clears all lines from the LineCanvas.</summary>
     public void Clear ()
     {
-        _cachedBounds = Rectangle.Empty;
+        _cachedViewport = Rectangle.Empty;
         _lines.Clear ();
     }
 
@@ -157,7 +157,7 @@ public class LineCanvas : IDisposable
     ///     Clears any cached states from the canvas Call this method if you make changes to lines that have already been
     ///     added.
     /// </summary>
-    public void ClearCache () { _cachedBounds = Rectangle.Empty; }
+    public void ClearCache () { _cachedViewport = Rectangle.Empty; }
 
     /// <summary>
     ///     Evaluates the lines that have been added to the canvas and returns a map containing the glyphs and their
@@ -170,9 +170,9 @@ public class LineCanvas : IDisposable
         Dictionary<Point, Cell> map = new ();
 
         // walk through each pixel of the bitmap
-        for (int y = Bounds.Y; y < Bounds.Y + Bounds.Height; y++)
+        for (int y = Viewport.Y; y < Viewport.Y + Viewport.Height; y++)
         {
-            for (int x = Bounds.X; x < Bounds.X + Bounds.Width; x++)
+            for (int x = Viewport.X; x < Viewport.X + Viewport.Width; x++)
             {
                 IntersectionDefinition? [] intersects = _lines
                                                         .Select (l => l.Intersects (x, y))
@@ -232,7 +232,7 @@ public class LineCanvas : IDisposable
     ///     intersection symbols.
     /// </summary>
     /// <returns>A map of all the points within the canvas.</returns>
-    public Dictionary<Point, Rune> GetMap () { return GetMap (Bounds); }
+    public Dictionary<Point, Rune> GetMap () { return GetMap (Viewport); }
 
     /// <summary>Merges one line canvas into this one.</summary>
     /// <param name="lineCanvas"></param>
@@ -260,13 +260,13 @@ public class LineCanvas : IDisposable
 
     /// <summary>
     ///     Returns the contents of the line canvas rendered to a string. The string will include all columns and rows,
-    ///     even if <see cref="Bounds"/> has negative coordinates. For example, if the canvas contains a single line that
+    ///     even if <see cref="Viewport"/> has negative coordinates. For example, if the canvas contains a single line that
     ///     starts at (-1,-1) with a length of 2, the rendered string will have a length of 2.
     /// </summary>
     /// <returns>The canvas rendered to a string.</returns>
     public override string ToString ()
     {
-        if (Bounds.IsEmpty)
+        if (Viewport.IsEmpty)
         {
             return string.Empty;
         }
@@ -275,13 +275,13 @@ public class LineCanvas : IDisposable
         Dictionary<Point, Rune> runeMap = GetMap ();
 
         // Create the rune canvas
-        Rune [,] canvas = new Rune [Bounds.Height, Bounds.Width];
+        Rune [,] canvas = new Rune [Viewport.Height, Viewport.Width];
 
         // Copy the rune map to the canvas, adjusting for any negative coordinates
         foreach (KeyValuePair<Point, Rune> kvp in runeMap)
         {
-            int x = kvp.Key.X - Bounds.X;
-            int y = kvp.Key.Y - Bounds.Y;
+            int x = kvp.Key.X - Viewport.X;
+            int y = kvp.Key.Y - Viewport.Y;
             canvas [y, x] = kvp.Value;
         }
 

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

@@ -45,8 +45,8 @@ public class StraightLine
     ///     Gets the rectangle that describes the bounds of the canvas. Location is the coordinates of the line that is
     ///     furthest left/top and Size is defined by the line that extends the furthest right/bottom.
     /// </summary>
-    // PERF: Probably better to store the rectangle rather than make a new one on every single access to Bounds.
-    internal Rectangle Bounds
+    // PERF: Probably better to store the rectangle rather than make a new one on every single access to Viewport.
+    internal Rectangle Viewport
     {
         get
         {

+ 3 - 3
Terminal.Gui/Input/Mouse.cs

@@ -116,10 +116,10 @@ public class MouseEvent
     /// <summary>The View at the location for the mouse event.</summary>
     public View View { get; set; }
 
-    /// <summary>The X position of the mouse in <see cref="View.Bounds"/>-relative coordinates.</summary>
+    /// <summary>The X position of the mouse in <see cref="Gui.View.Viewport"/>-relative coordinates.</summary>
     public int X { get; set; }
 
-    /// <summary>The Y position of the mouse in <see cref="View.Bounds"/>-relative coordinates.</summary>
+    /// <summary>The Y position of the mouse in <see cref="Gui.View.Viewport"/>-relative coordinates.</summary>
     public int Y { get; set; }
 
     /// <summary>
@@ -133,7 +133,7 @@ public class MouseEvent
     /// </summary>
     /// <remarks>
     ///     <para>
-    ///         The <see cref="X"/> and <see cref="Y"/> properties are always <see cref="View.Bounds"/>-relative. When the mouse is grabbed by a view,
+    ///         The <see cref="X"/> and <see cref="Y"/> properties are always <see cref="Gui.View.Viewport"/>-relative. When the mouse is grabbed by a view,
     ///         <see cref="ScreenPosition"/> provides the mouse position screen-relative coordinates, enabling the grabbed view to know how much the
     ///         mouse has moved.
     ///     </para>

+ 1 - 1
Terminal.Gui/Text/Autocomplete/AppendAutocomplete.cs

@@ -117,7 +117,7 @@ public class AppendAutocomplete : AutocompleteBase
         Suggestion suggestion = Suggestions.ElementAt (SelectedIdx);
         string fragment = suggestion.Replacement.Substring (suggestion.Remove);
 
-        int spaceAvailable = textField.Bounds.Width - textField.Text.GetColumns ();
+        int spaceAvailable = textField.Viewport.Width - textField.Text.GetColumns ();
         int spaceRequired = fragment.EnumerateRunes ().Sum (c => c.GetColumns ());
 
         if (spaceAvailable < spaceRequired)

+ 1 - 1
Terminal.Gui/Text/Autocomplete/PopupAutocomplete.PopUp.cs

@@ -16,7 +16,7 @@ public abstract partial class PopupAutocomplete
 
         protected internal override bool OnMouseEvent  (MouseEvent mouseEvent) { return _autoComplete.OnMouseEvent (mouseEvent); }
 
-        public override void OnDrawContent (Rectangle contentArea)
+        public override void OnDrawContent (Rectangle viewport)
         {
             if (!_autoComplete.LastPopupPos.HasValue)
             {

+ 11 - 11
Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs

@@ -271,13 +271,13 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
         if (PopupInsideContainer)
         {
             // don't overspill vertically
-            height = Math.Min (HostControl.Bounds.Height - renderAt.Y, MaxHeight);
+            height = Math.Min (HostControl.Viewport.Height - renderAt.Y, MaxHeight);
 
             // There is no space below, lets see if can popup on top
-            if (height < Suggestions.Count && HostControl.Bounds.Height - renderAt.Y >= height)
+            if (height < Suggestions.Count && HostControl.Viewport.Height - renderAt.Y >= height)
             {
                 // Verifies that the upper limit available is greater than the lower limit
-                if (renderAt.Y > HostControl.Bounds.Height - renderAt.Y)
+                if (renderAt.Y > HostControl.Viewport.Height - renderAt.Y)
                 {
                     renderAt.Y = Math.Max (renderAt.Y - Math.Min (Suggestions.Count + 1, MaxHeight + 1), 0);
                     height = Math.Min (Math.Min (Suggestions.Count, MaxHeight), LastPopupPos.Value.Y - 1);
@@ -287,13 +287,13 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
         else
         {
             // don't overspill vertically
-            height = Math.Min (Math.Min (top.Bounds.Height - HostControl.Frame.Bottom, MaxHeight), Suggestions.Count);
+            height = Math.Min (Math.Min (top.Viewport.Height - HostControl.Frame.Bottom, MaxHeight), Suggestions.Count);
 
             // There is no space below, lets see if can popup on top
             if (height < Suggestions.Count && HostControl.Frame.Y - top.Frame.Y >= height)
             {
                 // Verifies that the upper limit available is greater than the lower limit
-                if (HostControl.Frame.Y > top.Bounds.Height - HostControl.Frame.Y)
+                if (HostControl.Frame.Y > top.Viewport.Height - HostControl.Frame.Y)
                 {
                     renderAt.Y = Math.Max (HostControl.Frame.Y - Math.Min (Suggestions.Count, MaxHeight), 0);
                     height = Math.Min (Math.Min (Suggestions.Count, MaxHeight), HostControl.Frame.Y);
@@ -323,34 +323,34 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
         if (PopupInsideContainer)
         {
             // don't overspill horizontally, let's see if can be displayed on the left
-            if (width > HostControl.Bounds.Width - renderAt.X)
+            if (width > HostControl.Viewport.Width - renderAt.X)
             {
                 // Verifies that the left limit available is greater than the right limit
-                if (renderAt.X > HostControl.Bounds.Width - renderAt.X)
+                if (renderAt.X > HostControl.Viewport.Width - renderAt.X)
                 {
                     renderAt.X -= Math.Min (width, LastPopupPos.Value.X);
                     width = Math.Min (width, LastPopupPos.Value.X);
                 }
                 else
                 {
-                    width = Math.Min (width, HostControl.Bounds.Width - renderAt.X);
+                    width = Math.Min (width, HostControl.Viewport.Width - renderAt.X);
                 }
             }
         }
         else
         {
             // don't overspill horizontally, let's see if can be displayed on the left
-            if (width > top.Bounds.Width - (renderAt.X + HostControl.Frame.X))
+            if (width > top.Viewport.Width - (renderAt.X + HostControl.Frame.X))
             {
                 // Verifies that the left limit available is greater than the right limit
-                if (renderAt.X + HostControl.Frame.X > top.Bounds.Width - (renderAt.X + HostControl.Frame.X))
+                if (renderAt.X + HostControl.Frame.X > top.Viewport.Width - (renderAt.X + HostControl.Frame.X))
                 {
                     renderAt.X -= Math.Min (width, LastPopupPos.Value.X);
                     width = Math.Min (width, LastPopupPos.Value.X);
                 }
                 else
                 {
-                    width = Math.Min (width, top.Bounds.Width - renderAt.X);
+                    width = Math.Min (width, top.Viewport.Width - renderAt.X);
                 }
             }
         }

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

@@ -30,7 +30,7 @@ public class TextFormatter
 
     /// <summary>Gets or sets whether the <see cref="Size"/> should be automatically changed to fit the <see cref="Text"/>.</summary>
     /// <remarks>
-    ///     <para>Used by <see cref="View.AutoSize"/> to resize the view's <see cref="View.Bounds"/> to fit <see cref="Size"/>.</para>
+    ///     <para>Used by <see cref="View.AutoSize"/> to resize the view's <see cref="View.Viewport"/> to fit <see cref="Size"/>.</para>
     ///     <para>
     ///         AutoSize is ignored if <see cref="TextAlignment.Justified"/> and
     ///         <see cref="VerticalTextAlignment.Justified"/> are used.
@@ -73,8 +73,8 @@ public class TextFormatter
     }
 
     /// <summary>
-    ///     Determines if the bounds width will be used or only the text width will be used,
-    ///     If <see langword="true"/> all the bounds area will be filled with whitespaces and the same background color
+    ///     Determines if the viewport width will be used or only the text width will be used,
+    ///     If <see langword="true"/> all the viewport area will be filled with whitespaces and the same background color
     ///     showing a perfect rectangle.
     /// </summary>
     public bool FillRemaining { get; set; }
@@ -202,17 +202,17 @@ public class TextFormatter
     ///     Causes the text to be formatted (references <see cref="GetLines"/>). Sets <see cref="NeedsFormat"/> to
     ///     <c>false</c>.
     /// </remarks>
-    /// <param name="bounds">Specifies the screen-relative location and maximum size for drawing the text.</param>
+    /// <param name="viewport">Specifies the screen-relative location and maximum size for drawing the text.</param>
     /// <param name="normalColor">The color to use for all text except the hotkey</param>
     /// <param name="hotColor">The color to use to draw the hotkey</param>
-    /// <param name="containerBounds">Specifies the screen-relative location and maximum container size.</param>
+    /// <param name="maximum">Specifies the screen-relative location and maximum container size.</param>
     /// <param name="driver">The console driver currently used by the application.</param>
     /// <exception cref="ArgumentOutOfRangeException"></exception>
     public void Draw (
-        Rectangle bounds,
+        Rectangle viewport,
         Attribute normalColor,
         Attribute hotColor,
-        Rectangle containerBounds = default,
+        Rectangle maximum = default,
         ConsoleDriver driver = null
     )
     {
@@ -240,46 +240,46 @@ public class TextFormatter
         }
 
         bool isVertical = IsVerticalDirection (Direction);
-        Rectangle maxBounds = bounds;
+        Rectangle maxViewport = viewport;
 
         if (driver is { })
         {
             // INTENT: What, exactly, is the intent of this?
-            maxBounds = containerBounds == default (Rectangle)
-                            ? bounds
+            maxViewport = maximum == default (Rectangle)
+                            ? viewport
                             : new (
-                                   Math.Max (containerBounds.X, bounds.X),
-                                   Math.Max (containerBounds.Y, bounds.Y),
+                                   Math.Max (maximum.X, viewport.X),
+                                   Math.Max (maximum.Y, viewport.Y),
                                    Math.Max (
-                                             Math.Min (containerBounds.Width, containerBounds.Right - bounds.Left),
+                                             Math.Min (maximum.Width, maximum.Right - viewport.Left),
                                              0
                                             ),
                                    Math.Max (
                                              Math.Min (
-                                                       containerBounds.Height,
-                                                       containerBounds.Bottom - bounds.Top
+                                                       maximum.Height,
+                                                       maximum.Bottom - viewport.Top
                                                       ),
                                              0
                                             )
                                   );
         }
 
-        if (maxBounds.Width == 0 || maxBounds.Height == 0)
+        if (maxViewport.Width == 0 || maxViewport.Height == 0)
         {
             return;
         }
 
-        int lineOffset = !isVertical && bounds.Y < 0 ? Math.Abs (bounds.Y) : 0;
+        int lineOffset = !isVertical && viewport.Y < 0 ? Math.Abs (viewport.Y) : 0;
 
         for (int line = lineOffset; line < linesFormatted.Count; line++)
         {
-            if ((isVertical && line > bounds.Width) || (!isVertical && line > bounds.Height))
+            if ((isVertical && line > viewport.Width) || (!isVertical && line > viewport.Height))
             {
                 continue;
             }
 
-            if ((isVertical && line >= maxBounds.Left + maxBounds.Width)
-                || (!isVertical && line >= maxBounds.Top + maxBounds.Height + lineOffset))
+            if ((isVertical && line >= maxViewport.Left + maxViewport.Width)
+                || (!isVertical && line >= maxViewport.Top + maxViewport.Height + lineOffset))
             {
                 break;
             }
@@ -305,14 +305,14 @@ public class TextFormatter
                 if (isVertical)
                 {
                     int runesWidth = GetWidestLineLength (linesFormatted, line, TabWidth);
-                    x = bounds.Right - runesWidth;
-                    CursorPosition = bounds.Width - runesWidth + (_hotKeyPos > -1 ? _hotKeyPos : 0);
+                    x = viewport.Right - runesWidth;
+                    CursorPosition = viewport.Width - runesWidth + (_hotKeyPos > -1 ? _hotKeyPos : 0);
                 }
                 else
                 {
                     int runesWidth = StringExtensions.ToString (runes).GetColumns ();
-                    x = bounds.Right - runesWidth;
-                    CursorPosition = bounds.Width - runesWidth + (_hotKeyPos > -1 ? _hotKeyPos : 0);
+                    x = viewport.Right - runesWidth;
+                    CursorPosition = viewport.Width - runesWidth + (_hotKeyPos > -1 ? _hotKeyPos : 0);
                 }
             }
             else if (Alignment is TextAlignment.Left or TextAlignment.Justified)
@@ -322,11 +322,11 @@ public class TextFormatter
                     int runesWidth = line > 0
                                          ? GetWidestLineLength (linesFormatted, 0, line, TabWidth)
                                          : 0;
-                    x = bounds.Left + runesWidth;
+                    x = viewport.Left + runesWidth;
                 }
                 else
                 {
-                    x = bounds.Left;
+                    x = viewport.Left;
                 }
 
                 CursorPosition = _hotKeyPos > -1 ? _hotKeyPos : 0;
@@ -336,16 +336,16 @@ public class TextFormatter
                 if (isVertical)
                 {
                     int runesWidth = GetWidestLineLength (linesFormatted, line, TabWidth);
-                    x = bounds.Left + line + (bounds.Width - runesWidth) / 2;
+                    x = viewport.Left + line + (viewport.Width - runesWidth) / 2;
 
-                    CursorPosition = (bounds.Width - runesWidth) / 2 + (_hotKeyPos > -1 ? _hotKeyPos : 0);
+                    CursorPosition = (viewport.Width - runesWidth) / 2 + (_hotKeyPos > -1 ? _hotKeyPos : 0);
                 }
                 else
                 {
                     int runesWidth = StringExtensions.ToString (runes).GetColumns ();
-                    x = bounds.Left + (bounds.Width - runesWidth) / 2;
+                    x = viewport.Left + (viewport.Width - runesWidth) / 2;
 
-                    CursorPosition = (bounds.Width - runesWidth) / 2 + (_hotKeyPos > -1 ? _hotKeyPos : 0);
+                    CursorPosition = (viewport.Width - runesWidth) / 2 + (_hotKeyPos > -1 ? _hotKeyPos : 0);
                 }
             }
             else
@@ -358,35 +358,35 @@ public class TextFormatter
             {
                 if (isVertical)
                 {
-                    y = bounds.Bottom - runes.Length;
+                    y = viewport.Bottom - runes.Length;
                 }
                 else
                 {
-                    y = bounds.Bottom - linesFormatted.Count + line;
+                    y = viewport.Bottom - linesFormatted.Count + line;
                 }
             }
             else if (VerticalAlignment is VerticalTextAlignment.Top or VerticalTextAlignment.Justified)
             {
                 if (isVertical)
                 {
-                    y = bounds.Top;
+                    y = viewport.Top;
                 }
                 else
                 {
-                    y = bounds.Top + line;
+                    y = viewport.Top + line;
                 }
             }
             else if (VerticalAlignment == VerticalTextAlignment.Middle)
             {
                 if (isVertical)
                 {
-                    int s = (bounds.Height - runes.Length) / 2;
-                    y = bounds.Top + s;
+                    int s = (viewport.Height - runes.Length) / 2;
+                    y = viewport.Top + s;
                 }
                 else
                 {
-                    int s = (bounds.Height - linesFormatted.Count) / 2;
-                    y = bounds.Top + line + s;
+                    int s = (viewport.Height - linesFormatted.Count) / 2;
+                    y = viewport.Top + line + s;
                 }
             }
             else
@@ -394,9 +394,9 @@ public class TextFormatter
                 throw new ArgumentOutOfRangeException ($"{nameof (VerticalAlignment)}");
             }
 
-            int colOffset = bounds.X < 0 ? Math.Abs (bounds.X) : 0;
-            int start = isVertical ? bounds.Top : bounds.Left;
-            int size = isVertical ? bounds.Height : bounds.Width;
+            int colOffset = viewport.X < 0 ? Math.Abs (viewport.X) : 0;
+            int start = isVertical ? viewport.Top : viewport.Left;
+            int size = isVertical ? viewport.Height : viewport.Width;
             int current = start + colOffset;
             List<Point?> lastZeroWidthPos = null;
             Rune rune = default;
@@ -422,15 +422,15 @@ public class TextFormatter
                         break;
                     }
 
-                    if ((!isVertical && current - start > maxBounds.Left + maxBounds.Width - bounds.X + colOffset)
-                        || (isVertical && idx > maxBounds.Top + maxBounds.Height - bounds.Y))
+                    if ((!isVertical && current - start > maxViewport.Left + maxViewport.Width - viewport.X + colOffset)
+                        || (isVertical && idx > maxViewport.Top + maxViewport.Height - viewport.Y))
                     {
                         break;
                     }
                 }
 
-                //if ((!isVertical && idx > maxBounds.Left + maxBounds.Width - bounds.X + colOffset)
-                //	|| (isVertical && idx > maxBounds.Top + maxBounds.Height - bounds.Y))
+                //if ((!isVertical && idx > maxBounds.Left + maxBounds.Width - viewport.X + colOffset)
+                //	|| (isVertical && idx > maxBounds.Top + maxBounds.Height - viewport.Y))
 
                 //	break;
 

+ 10 - 10
Terminal.Gui/View/Adornment/Adornment.cs

@@ -1,7 +1,7 @@
 namespace Terminal.Gui;
 
 /// <summary>
-///     Adornments are a special form of <see cref="View"/> that appear outside the <see cref="View.Bounds"/>:
+///     Adornments are a special form of <see cref="View"/> that appear outside the <see cref="View.Viewport"/>:
 ///     <see cref="Margin"/>, <see cref="Border"/>, and <see cref="Padding"/>. They are defined using the
 ///     <see cref="Thickness"/> class, which specifies the thickness of the sides of a rectangle.
 /// </summary>
@@ -109,10 +109,10 @@ public class Adornment : View
     ///     Gets the rectangle that describes the area of the Adornment. The Location is always (0,0).
     ///     The size is the size of the <see cref="View.Frame"/>.
     /// </summary>
-    public override Rectangle Bounds
+    public override Rectangle Viewport
     {
         get => Frame with { Location = Point.Empty };
-        set => throw new InvalidOperationException ("It makes no sense to set Bounds of a Thickness.");
+        set => throw new InvalidOperationException ("It makes no sense to set Viewport of a Thickness.");
     }
 
     /// <inheritdoc/>
@@ -139,19 +139,19 @@ public class Adornment : View
     public override bool OnDrawAdornments () { return false; }
 
     /// <summary>Redraws the Adornments that comprise the <see cref="Adornment"/>.</summary>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         if (Thickness == Thickness.Empty)
         {
             return;
         }
 
-        Rectangle screenBounds = BoundsToScreen (contentArea);
+        Rectangle screen = ViewportToScreen (viewport);
         Attribute normalAttr = GetNormalColor ();
         Driver.SetAttribute (normalAttr);
 
         // This just draws/clears the thickness, not the insides.
-        Thickness.Draw (screenBounds, ToString ());
+        Thickness.Draw (screen, ToString ());
 
         if (!string.IsNullOrEmpty (TextFormatter.Text))
         {
@@ -162,11 +162,11 @@ public class Adornment : View
             }
         }
 
-        TextFormatter?.Draw (screenBounds, normalAttr, normalAttr, Rectangle.Empty);
+        TextFormatter?.Draw (screen, normalAttr, normalAttr, Rectangle.Empty);
 
         if (Subviews.Count > 0)
         {
-            base.OnDrawContent (contentArea);
+            base.OnDrawContent (viewport);
         }
 
         ClearLayoutNeeded ();
@@ -231,7 +231,7 @@ public class Adornment : View
     /// <summary>Called when a mouse event occurs within the Adornment.</summary>
     /// <remarks>
     ///     <para>
-    ///         The coordinates are relative to <see cref="View.Bounds"/>.
+    ///         The coordinates are relative to <see cref="View.Viewport"/>.
     ///     </para>
     ///     <para>
     ///         A mouse click on the Adornment will cause the Parent to focus.
@@ -297,7 +297,7 @@ public class Adornment : View
 
                 _dragPosition = new Point (mouseEvent.X, mouseEvent.Y);
 
-                Point parentLoc = Parent.SuperView?.ScreenToBounds (mouseEvent.ScreenPosition.X, mouseEvent.ScreenPosition.Y) ?? mouseEvent.ScreenPosition;
+                Point parentLoc = Parent.SuperView?.ScreenToViewport (mouseEvent.ScreenPosition.X, mouseEvent.ScreenPosition.Y) ?? mouseEvent.ScreenPosition;
 
                 GetLocationEnsuringFullVisibility (
                                      Parent,

+ 10 - 10
Terminal.Gui/View/Adornment/Border.cs

@@ -136,14 +136,14 @@ public class Border : Adornment
         }
     }
 
-    Rectangle GetBorderBounds (Rectangle screenBounds)
+    Rectangle GetBorderRectangle (Rectangle screenRect)
     {
         return new (
-                                      screenBounds.X + Math.Max (0, Thickness.Left - 1),
-                                      screenBounds.Y + Math.Max (0, Thickness.Top - 1),
+                                      screenRect.X + Math.Max (0, Thickness.Left - 1),
+                                      screenRect.Y + Math.Max (0, Thickness.Top - 1),
                                       Math.Max (
                                                 0,
-                                                screenBounds.Width
+                                                screenRect.Width
                                                 - Math.Max (
                                                             0,
                                                             Math.Max (0, Thickness.Left - 1)
@@ -152,7 +152,7 @@ public class Border : Adornment
                                                ),
                                       Math.Max (
                                                 0,
-                                                screenBounds.Height
+                                                screenRect.Height
                                                 - Math.Max (
                                                             0,
                                                             Math.Max (0, Thickness.Top - 1)
@@ -184,9 +184,9 @@ public class Border : Adornment
     }
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
-        base.OnDrawContent (contentArea);
+        base.OnDrawContent (viewport);
 
         if (Thickness == Thickness.Empty)
         {
@@ -194,7 +194,7 @@ public class Border : Adornment
         }
 
         //Driver.SetAttribute (Colors.ColorSchemes ["Error"].Normal);
-        Rectangle screenBounds = BoundsToScreen (contentArea);
+        Rectangle screenBounds = ViewportToScreen (viewport);
 
         //OnDrawSubviews (bounds); 
 
@@ -205,7 +205,7 @@ public class Border : Adornment
         // ...thickness extends outward (border/title is always as far in as possible)
         // PERF: How about a call to Rectangle.Offset?
 
-        var borderBounds = GetBorderBounds (screenBounds);
+        var borderBounds = GetBorderRectangle (screenBounds);
         int topTitleLineY = borderBounds.Y;
         int titleY = borderBounds.Y;
         var titleBarsLength = 0; // the little vertical thingies
@@ -466,6 +466,6 @@ public class Border : Adornment
             }
         }
 
-        //base.OnDrawContent (contentArea);
+        //base.OnDrawContent (viewport);
     }
 }

+ 1 - 1
Terminal.Gui/View/Adornment/Padding.cs

@@ -42,7 +42,7 @@ public class Padding : Adornment
     /// <summary>Called when a mouse event occurs within the Padding.</summary>
     /// <remarks>
     /// <para>
-    /// The coordinates are relative to <see cref="View.Bounds"/>.
+    /// The coordinates are relative to <see cref="View.Viewport"/>.
     /// </para>
     /// <para>
     /// A mouse click on the Padding will cause the Parent to focus.

+ 59 - 62
Terminal.Gui/View/Layout/ViewLayout.cs

@@ -42,10 +42,10 @@ public partial class View
     /// <summary>Gets or sets the absolute location and dimension of the view.</summary>
     /// <value>
     ///     The rectangle describing absolute location and dimension of the view, in coordinates relative to the
-    ///     <see cref="SuperView"/>'s <see cref="Bounds"/>.
+    ///     <see cref="SuperView"/>'s <see cref="Viewport"/>.
     /// </value>
     /// <remarks>
-    ///     <para>Frame is relative to the <see cref="SuperView"/>'s <see cref="Bounds"/>.</para>
+    ///     <para>Frame is relative to the <see cref="SuperView"/>'s <see cref="Viewport"/>.</para>
     ///     <para>
     ///         Setting Frame will set <see cref="X"/>, <see cref="Y"/>, <see cref="Width"/>, and <see cref="Height"/> to the
     ///         values of the corresponding properties of the <paramref name="value"/> parameter.
@@ -101,10 +101,10 @@ public partial class View
                 return ret;
             }
 
-            Point boundsOffset = super.GetBoundsOffset ();
-            boundsOffset.Offset(super.Frame.X, super.Frame.Y);
-            ret.X += boundsOffset.X;
-            ret.Y += boundsOffset.Y;
+            Point viewportOffset = super.GetViewportOffset ();
+            viewportOffset.Offset(super.Frame.X, super.Frame.Y);
+            ret.X += viewportOffset.X;
+            ret.Y += viewportOffset.Y;
             super = super.SuperView;
         }
 
@@ -113,14 +113,14 @@ public partial class View
 
     /// <summary>
     ///     Converts a screen-relative coordinate to a Frame-relative coordinate. Frame-relative means relative to the
-    ///     View's <see cref="SuperView"/>'s <see cref="Bounds"/>.
+    ///     View's <see cref="SuperView"/>'s <see cref="Viewport"/>.
     /// </summary>
-    /// <returns>The coordinate relative to the <see cref="SuperView"/>'s <see cref="Bounds"/>.</returns>
+    /// <returns>The coordinate relative to the <see cref="SuperView"/>'s <see cref="Viewport"/>.</returns>
     /// <param name="x">Screen-relative column.</param>
     /// <param name="y">Screen-relative row.</param>
     public virtual Point ScreenToFrame (int x, int y)
     {
-        Point superViewBoundsOffset = SuperView?.GetBoundsOffset () ?? Point.Empty;
+        Point superViewBoundsOffset = SuperView?.GetViewportOffset () ?? Point.Empty;
         if (SuperView is null)
         {
             superViewBoundsOffset.Offset (x - Frame.X, y - Frame.Y);
@@ -284,34 +284,31 @@ public partial class View
 
     #endregion Frame
 
-    #region Bounds
+    #region Viewport
 
     /// <summary>
-    ///     The bounds represent the View-relative rectangle used for this view; the area inside the view where
-    ///     subviews and content are presented.
+    ///     Gets or sets the rectangle describing the portion of the View's content that is visible to the user.
+    ///     The viewport Location is relative to the top-left corner of the inner rectangle of the <see cref="Adornment"/>s.
+    ///     If the viewport Size is the sames as the <see cref="ContentSize"/> the Location will be <c>0, 0</c>.
+    ///     Non-zero values for the location indicate the visible area is offset into the View's virtual <see cref="ContentSize"/>.
     /// </summary>
-    /// <value>The rectangle describing the location and size of the area where the views' subviews and content are drawn.</value>
+    /// <value>The rectangle describing the location and size of the viewport into the View's virtual content, described by <see cref="ContentSize"/>.</value>
     /// <remarks>
     ///     <para>
-    ///         If <see cref="LayoutStyle"/> is <see cref="LayoutStyle.Computed"/> the value of Bounds is indeterminate until
+    ///         If <see cref="LayoutStyle"/> is <see cref="LayoutStyle.Computed"/> the value of Viewport is indeterminate until
     ///         the view has been initialized ( <see cref="IsInitialized"/> is true) and <see cref="LayoutSubviews"/> has been
     ///         called.
     ///     </para>
     ///     <para>
-    ///         Updates to the Bounds updates <see cref="Frame"/>, and has the same effect as updating the
+    ///         Updates to the Viewport Size updates <see cref="Frame"/>, and has the same impact as updating the
     ///         <see cref="Frame"/>.
     ///     </para>
     ///     <para>
-    ///         Altering the Bounds will eventually (when the view is next laid out) cause the
+    ///         Altering the Viewport Size will eventually (when the view is next laid out) cause the
     ///         <see cref="LayoutSubview(View, Rectangle)"/> and <see cref="OnDrawContent(Rectangle)"/> methods to be called.
     ///     </para>
-    ///     <para>
-    ///         Because <see cref="Bounds"/> coordinates are relative to the upper-left corner of the <see cref="View"/>, the
-    ///         coordinates of the upper-left corner of the rectangle returned by this property are (0,0). Use this property to
-    ///         obtain the size of the area of the view for tasks such as drawing the view's contents.
-    ///     </para>
     /// </remarks>
-    public virtual Rectangle Bounds
+    public virtual Rectangle Viewport
     {
         get
         {
@@ -319,7 +316,7 @@ public partial class View
             if (LayoutStyle == LayoutStyle.Computed && !IsInitialized)
             {
                 Debug.WriteLine (
-                                 $"WARNING: Bounds is being accessed before the View has been initialized. This is likely a bug in {this}"
+                                 $"WARNING: Viewport is being accessed before the View has been initialized. This is likely a bug in {this}"
                                 );
             }
 #endif // DEBUG
@@ -341,13 +338,13 @@ public partial class View
         }
         set
         {
-            // TODO: Should we enforce Bounds.X/Y == 0? The code currently ignores value.X/Y which is
+            // TODO: Should we enforce Viewport.X/Y == 0? The code currently ignores value.X/Y which is
             // TODO: correct behavior, but is silent. Perhaps an exception?
 #if DEBUG
             if (value.Location != Point.Empty)
             {
                 Debug.WriteLine (
-                                 $"WARNING: Bounds.Location must always be 0,0. Location ({value.Location}) is ignored. {this}"
+                                 $"WARNING: Viewport.Location must always be 0,0. Location ({value.Location}) is ignored. {this}"
                                 );
             }
 #endif // DEBUG
@@ -362,37 +359,37 @@ public partial class View
         }
     }
 
-    /// <summary>Converts a <see cref="Bounds"/>-relative rectangle to a screen-relative rectangle.</summary>
-    public Rectangle BoundsToScreen (in Rectangle bounds)
+    /// <summary>Converts a <see cref="Viewport"/>-relative rectangle to a screen-relative rectangle.</summary>
+    public Rectangle ViewportToScreen (in Rectangle viewport)
     {
-        // Translate bounds to Frame (our SuperView's Bounds-relative coordinates)
+        // Translate bounds to Frame (our SuperView's Viewport-relative coordinates)
         Rectangle screen = FrameToScreen ();
-        Point boundsOffset = GetBoundsOffset ();
-        screen.Offset (boundsOffset.X + bounds.X, boundsOffset.Y + bounds.Y);
+        Point viewportOffset = GetViewportOffset ();
+        screen.Offset (viewportOffset.X + viewport.X, viewportOffset.Y + viewport.Y);
 
-        return new (screen.Location, bounds.Size);
+        return new (screen.Location, viewport.Size);
     }
 
-    /// <summary>Converts a screen-relative coordinate to a bounds-relative coordinate.</summary>
-    /// <returns>The coordinate relative to this view's <see cref="Bounds"/>.</returns>
+    /// <summary>Converts a screen-relative coordinate to a Viewport-relative coordinate.</summary>
+    /// <returns>The coordinate relative to this view's <see cref="Viewport"/>.</returns>
     /// <param name="x">Screen-relative column.</param>
     /// <param name="y">Screen-relative row.</param>
-    public Point ScreenToBounds (int x, int y)
+    public Point ScreenToViewport (int x, int y)
     {
-        Point boundsOffset = GetBoundsOffset ();
+        Point viewportOffset = GetViewportOffset ();
         Point screen = ScreenToFrame (x, y);
-        screen.Offset (-boundsOffset.X, -boundsOffset.Y);
+        screen.Offset (-viewportOffset.X, -viewportOffset.Y);
 
         return screen;
     }
 
     /// <summary>
-    ///     Helper to get the X and Y offset of the Bounds from the Frame. This is the sum of the Left and Top properties
+    ///     Helper to get the X and Y offset of the Viewport from the Frame. This is the sum of the Left and Top properties
     ///     of <see cref="Margin"/>, <see cref="Border"/> and <see cref="Padding"/>.
     /// </summary>
-    public Point GetBoundsOffset () { return Padding is null ? Point.Empty : Padding.Thickness.GetInside (Padding.Frame).Location; }
+    public Point GetViewportOffset () { return Padding is null ? Point.Empty : Padding.Thickness.GetInside (Padding.Frame).Location; }
 
-    #endregion Bounds
+    #endregion Viewport
 
     #region AutoSize
 
@@ -400,7 +397,7 @@ public partial class View
 
     /// <summary>
     ///     Gets or sets a flag that determines whether the View will be automatically resized to fit the <see cref="Text"/>
-    ///     within <see cref="Bounds"/>.
+    ///     within <see cref="Viewport"/>.
     ///     <para>
     ///         The default is <see langword="false"/>. Set to <see langword="true"/> to turn on AutoSize. If
     ///         <see langword="true"/> then <see cref="Width"/> and <see cref="Height"/> will be used if <see cref="Text"/> can
@@ -573,7 +570,7 @@ public partial class View
     /// <summary>Resizes the View to fit the specified size. Factors in the HotKey.</summary>
     /// <remarks>ResizeBoundsToFit can only be called when AutoSize is true (or being set to true).</remarks>
     /// <param name="size"></param>
-    /// <returns>whether the Bounds was changed or not</returns>
+    /// <returns>whether the Viewport was changed or not</returns>
     private bool ResizeBoundsToFit (Size size)
     {
         //if (AutoSize == false) {
@@ -598,7 +595,7 @@ public partial class View
 
         if (boundsChanged)
         {
-            Bounds = new (Bounds.X, Bounds.Y, canSizeW ? rW : Bounds.Width, canSizeH ? rH : Bounds.Height);
+            Viewport = new (Viewport.X, Viewport.Y, canSizeW ? rW : Viewport.Width, canSizeH ? rH : Viewport.Height);
         }
 
         return boundsChanged;
@@ -698,18 +695,18 @@ public partial class View
             found = start.Padding;
         }
 
-        Point boundsOffset = start.GetBoundsOffset ();
+        Point viewportOffset = start.GetViewportOffset ();
 
         if (found is { })
         {
             start = found;
-            boundsOffset = found.Parent.Frame.Location;
+            viewportOffset = found.Parent.Frame.Location;
         }
 
         if (start.InternalSubviews is { Count: > 0 })
         {
-            int startOffsetX = x - (start.Frame.X + boundsOffset.X);
-            int startOffsetY = y - (start.Frame.Y + boundsOffset.Y);
+            int startOffsetX = x - (start.Frame.X + viewportOffset.X);
+            int startOffsetY = y - (start.Frame.Y + viewportOffset.Y);
 
             for (int i = start.InternalSubviews.Count - 1; i >= 0; i--)
             {
@@ -728,7 +725,7 @@ public partial class View
 #nullable restore
 
     /// <summary>
-    ///     Gets a new location of the <see cref="View"/> that is within the Bounds of the <paramref name="viewToMove"/>'s
+    ///     Gets a new location of the <see cref="View"/> that is within the Viewport of the <paramref name="viewToMove"/>'s
     ///     <see cref="View.SuperView"/> (e.g. for dragging a Window). The `out` parameters are the new X and Y coordinates.
     /// </summary>
     /// <remarks>
@@ -765,8 +762,8 @@ public partial class View
         }
         else
         {
-            // Use the SuperView's Bounds, not Frame
-            maxDimension = viewToMove.SuperView.Bounds.Width;
+            // Use the SuperView's Viewport, not Frame
+            maxDimension = viewToMove.SuperView.Viewport.Width;
             superView = viewToMove.SuperView;
         }
 
@@ -912,7 +909,7 @@ public partial class View
 
         LayoutAdornments ();
 
-        Rectangle oldBounds = Bounds;
+        Rectangle oldBounds = Viewport;
         OnLayoutStarted (new () { OldBounds = oldBounds });
 
         SetTextFormatterSize ();
@@ -925,7 +922,7 @@ public partial class View
 
         foreach (View v in ordered)
         {
-            LayoutSubview (v, new (GetBoundsOffset (), Bounds.Size));
+            LayoutSubview (v, new (GetViewportOffset (), Viewport.Size));
         }
 
         // If the 'to' is rooted to 'from' and the layoutstyle is Computed it's a special-case.
@@ -972,11 +969,11 @@ public partial class View
     {
         // TODO: Identify a real-world use-case where this API should be virtual. 
         // TODO: Until then leave it `internal` and non-virtual
-        // First try SuperView.Bounds, then Application.Top, then Driver.Bounds.
+        // First try SuperView.Viewport, then Application.Top, then Driver.Viewport.
         // Finally, if none of those are valid, use int.MaxValue (for Unit tests).
-        Rectangle relativeBounds = SuperView is { IsInitialized: true } ? SuperView.Bounds :
-                                   Application.Top is { } && Application.Top.IsInitialized ? Application.Top.Bounds :
-                                   Application.Driver?.Bounds ?? new Rectangle (0, 0, int.MaxValue, int.MaxValue);
+        Rectangle relativeBounds = SuperView is { IsInitialized: true } ? SuperView.Viewport :
+                                   Application.Top is { } && Application.Top.IsInitialized ? Application.Top.Viewport :
+                                   Application.Driver?.Viewport ?? new Rectangle (0, 0, int.MaxValue, int.MaxValue);
         SetRelativeLayout (relativeBounds);
 
         // TODO: Determine what, if any of the below is actually needed here.
@@ -1018,12 +1015,12 @@ public partial class View
 
     /// <summary>
     ///     Applies the view's position (<see cref="X"/>, <see cref="Y"/>) and dimension (<see cref="Width"/>, and
-    ///     <see cref="Height"/>) to <see cref="Frame"/>, given a rectangle describing the SuperView's Bounds (nominally the
-    ///     same as <c>this.SuperView.Bounds</c>).
+    ///     <see cref="Height"/>) to <see cref="Frame"/>, given a rectangle describing the SuperView's Viewport (nominally the
+    ///     same as <c>this.SuperView.Viewport</c>).
     /// </summary>
     /// <param name="superviewBounds">
-    ///     The rectangle describing the SuperView's Bounds (nominally the same as
-    ///     <c>this.SuperView.Bounds</c>).
+    ///     The rectangle describing the SuperView's Viewport (nominally the same as
+    ///     <c>this.SuperView.Viewport</c>).
     /// </param>
     internal void SetRelativeLayout (Rectangle superviewBounds)
     {
@@ -1047,7 +1044,7 @@ public partial class View
         // TODO: View.AutoSize stuff is removed.
 
         // Returns the new dimension (width or height) and location (x or y) for the View given
-        //   the superview's Bounds
+        //   the superview's Viewport
         //   the current Pos (View.X or View.Y)
         //   the current Dim (View.Width or View.Height)
         // This method is called recursively if pos is Pos.PosCombine
@@ -1413,10 +1410,10 @@ public partial class View
         return result;
     } // TopologicalSort
 
-    private void LayoutSubview (View v, Rectangle contentArea)
+    private void LayoutSubview (View v, Rectangle viewport)
     {
         //if (v.LayoutStyle == LayoutStyle.Computed) {
-        v.SetRelativeLayout (contentArea);
+        v.SetRelativeLayout (viewport);
 
         //}
 

+ 3 - 3
Terminal.Gui/View/View.cs

@@ -52,7 +52,7 @@ namespace Terminal.Gui;
 ///         To create a View using Absolute layout, call a constructor that takes a Rect parameter to specify the
 ///         absolute position and size or simply set <see cref="View.Frame "/>). To create a View using Computed layout use
 ///         a constructor that does not take a Rect parameter and set the X, Y, Width and Height properties on the view to
-///         non-absolute values. Both approaches use coordinates that are relative to the <see cref="Bounds"/> of the
+///         non-absolute values. Both approaches use coordinates that are relative to the <see cref="Viewport"/> of the
 ///         <see cref="SuperView"/> the View is added to.
 ///     </para>
 ///     <para>
@@ -73,7 +73,7 @@ namespace Terminal.Gui;
 ///         a View can be accessed with the <see cref="SuperView"/> property.
 ///     </para>
 ///     <para>
-///         To flag a region of the View's <see cref="Bounds"/> to be redrawn call <see cref="SetNeedsDisplay(Rectangle)"/>
+///         To flag a region of the View's <see cref="Viewport"/> to be redrawn call <see cref="SetNeedsDisplay(Rectangle)"/>
 ///         .
 ///         To flag the entire view for redraw call <see cref="SetNeedsDisplay()"/>.
 ///     </para>
@@ -234,7 +234,7 @@ public partial class View : Responder, ISupportInitializeNotification
 
         // TODO: Move these into ViewText.cs as EndInit_Text() to consolodate.
         // TODO: Verify UpdateTextDirection really needs to be called here.
-        // These calls were moved from BeginInit as they access Bounds which is indeterminate until EndInit is called.
+        // These calls were moved from BeginInit as they access Viewport which is indeterminate until EndInit is called.
         UpdateTextDirection (TextDirection);
         UpdateTextFormatterText ();
         OnResizeNeeded ();

+ 3 - 3
Terminal.Gui/View/ViewAdornments.cs

@@ -39,7 +39,7 @@ public partial class View
 
     /// <summary>
     ///     The <see cref="Adornment"/> that enables separation of a View from other SubViews of the same
-    ///     SuperView. The margin offsets the <see cref="Bounds"/> from the <see cref="Frame"/>.
+    ///     SuperView. The margin offsets the <see cref="Viewport"/> from the <see cref="Frame"/>.
     /// </summary>
     /// <remarks>
     ///     <para>
@@ -55,7 +55,7 @@ public partial class View
     public Margin Margin { get; private set; }
 
     /// <summary>
-    ///     The <see cref="Adornment"/> that offsets the <see cref="Bounds"/> from the <see cref="Margin"/>.
+    ///     The <see cref="Adornment"/> that offsets the <see cref="Viewport"/> from the <see cref="Margin"/>.
     ///     The Border provides the space for a visual border (drawn using
     ///     line-drawing glyphs) and the Title. The Border expands inward; in other words if `Border.Thickness.Top == 2` the
     ///     border and title will take up the first row and the second row will be filled with spaces.
@@ -113,7 +113,7 @@ public partial class View
     }
 
     /// <summary>
-    ///     The <see cref="Adornment"/> inside of the view that offsets the <see cref="Bounds"/>
+    ///     The <see cref="Adornment"/> inside of the view that offsets the <see cref="Viewport"/>
     ///     from the <see cref="Border"/>.
     /// </summary>
     /// <remarks>

+ 108 - 83
Terminal.Gui/View/ViewDrawing.cs

@@ -55,40 +55,42 @@ public partial class View
 
     /// <summary>
     ///     Gets or sets whether this View will use it's SuperView's <see cref="LineCanvas"/> for rendering any border
-    ///     lines. If <see langword="true"/> the rendering of any borders drawn by this Frame will be done by it's parent's
+    ///     lines. If <see langword="true"/> the rendering of any borders drawn by this Frame will be done by its parent's
     ///     SuperView. If <see langword="false"/> (the default) this View's <see cref="OnDrawAdornments"/> method will be
     ///     called to render the borders.
     /// </summary>
     public virtual bool SuperViewRendersLineCanvas { get; set; } = false;
 
-    /// <summary>Displays the specified character in the specified column and row of the View.</summary>
-    /// <param name="col">Column (view-relative).</param>
-    /// <param name="row">Row (view-relative).</param>
-    /// <param name="ch">Ch.</param>
-    public void AddRune (int col, int row, Rune ch)
+    /// <summary>Draws the specified character in the specified viewport-relative column and row of the View.</summary>
+    /// <para>
+    ///     If the provided coordinates are outside the visible content area, this method does nothing.
+    /// </para>
+    /// <remarks>
+    ///     The top-left corner of the visible content area is <c>ViewPort.Location</c>.
+    /// </remarks>
+    /// <param name="col">Column (viewport-relative).</param>
+    /// <param name="row">Row (viewport-relative).</param>
+    /// <param name="rune">The Rune.</param>
+    public void AddRune (int col, int row, Rune rune)
     {
-        if (row < 0 || col < 0)
-        {
-            return;
-        }
-
-        if (row > _frame.Height - 1 || col > _frame.Width - 1)
+        if (row < 0 || col < 0 || row >= Viewport.Height || col >= Viewport.Width)
         {
+            // TODO: Change return type to bool so callers can determine success?
             return;
         }
 
         Move (col, row);
-        Driver.AddRune (ch);
+        Driver.AddRune (rune);
     }
 
-    /// <summary>Clears <see cref="Bounds"/> with the normal background.</summary>
+    /// <summary>Clears <see cref="Viewport"/> with the normal background.</summary>
     /// <remarks></remarks>
-    public void Clear () { Clear (Bounds); }
+    public void Clear () { Clear (Viewport); }
 
-    /// <summary>Clears the specified <see cref="Bounds"/>-relative rectangle with the normal background.</summary>
+    /// <summary>Clears the specified <see cref="Viewport"/>-relative rectangle with the normal background.</summary>
     /// <remarks></remarks>
-    /// <param name="contentArea">The Bounds-relative rectangle to clear.</param>
-    public void Clear (Rectangle contentArea)
+    /// <param name="viewport">The Viewport-relative rectangle to clear.</param>
+    public void Clear (Rectangle viewport)
     {
         if (Driver is null)
         {
@@ -98,23 +100,23 @@ public partial class View
         Attribute prev = Driver.SetAttribute (GetNormalColor ());
 
         // Clamp the region to the bounds of the view
-        contentArea = Rectangle.Intersect (contentArea, Bounds);
-        Driver.FillRect (BoundsToScreen (contentArea));
+        viewport = Rectangle.Intersect (viewport, Viewport);
+        Driver.FillRect (ViewportToScreen (viewport));
         Driver.SetAttribute (prev);
     }
 
-    /// <summary>Expands the <see cref="ConsoleDriver"/>'s clip region to include <see cref="Bounds"/>.</summary>
+    /// <summary>Expands the <see cref="ConsoleDriver"/>'s clip region to include <see cref="Viewport"/>.</summary>
     /// <returns>
     ///     The current screen-relative clip region, which can be then re-applied by setting
     ///     <see cref="ConsoleDriver.Clip"/>.
     /// </returns>
     /// <remarks>
     ///     <para>
-    ///         If <see cref="ConsoleDriver.Clip"/> and <see cref="Bounds"/> do not intersect, the clip region will be set to
+    ///         If <see cref="ConsoleDriver.Clip"/> and <see cref="Viewport"/> do not intersect, the clip region will be set to
     ///         <see cref="Rectangle.Empty"/>.
     ///     </para>
     /// </remarks>
-    public Rectangle ClipToBounds ()
+    public Rectangle ClipToViewport ()
     {
         if (Driver is null)
         {
@@ -122,7 +124,7 @@ public partial class View
         }
 
         Rectangle previous = Driver.Clip;
-        Driver.Clip = Rectangle.Intersect (previous, BoundsToScreen (Bounds));
+        Driver.Clip = Rectangle.Intersect (previous, ViewportToScreen (Viewport));
 
         return previous;
     }
@@ -133,7 +135,7 @@ public partial class View
     /// </summary>
     /// <remarks>
     ///     <para>
-    ///         Always use <see cref="Bounds"/> (view-relative) when calling <see cref="OnDrawContent(Rectangle)"/>, NOT
+    ///         Always use <see cref="Viewport"/> (view-relative) when calling <see cref="OnDrawContent(Rectangle)"/>, NOT
     ///         <see cref="Frame"/> (superview-relative).
     ///     </para>
     ///     <para>
@@ -142,7 +144,8 @@ public partial class View
     ///     </para>
     ///     <para>
     ///         Overrides of <see cref="OnDrawContent(Rectangle)"/> must ensure they do not set <c>Driver.Clip</c> to a clip
-    ///         region larger than the <ref name="Bounds"/> property, as this will cause the driver to clip the entire region.
+    ///         region larger than the <ref name="Viewport"/> property, as this will cause the driver to clip the entire
+    ///         region.
     ///     </para>
     /// </remarks>
     public void Draw ()
@@ -154,7 +157,7 @@ public partial class View
 
         OnDrawAdornments ();
 
-        Rectangle prevClip = ClipToBounds ();
+        Rectangle prevClip = ClipToViewport ();
 
         if (ColorScheme is { })
         {
@@ -163,12 +166,12 @@ public partial class View
         }
 
         // Invoke DrawContentEvent
-        var dev = new DrawEventArgs (Bounds);
+        var dev = new DrawEventArgs (Viewport);
         DrawContent?.Invoke (this, dev);
 
         if (!dev.Cancel)
         {
-            OnDrawContent (Bounds);
+            OnDrawContent (Viewport);
         }
 
         if (Driver is { })
@@ -179,7 +182,7 @@ public partial class View
         OnRenderLineCanvas ();
 
         // Invoke DrawContentCompleteEvent
-        OnDrawContentComplete (Bounds);
+        OnDrawContentComplete (Viewport);
 
         // BUGBUG: v2 - We should be able to use View.SetClip here and not have to resort to knowing Driver details.
         ClearLayoutNeeded ();
@@ -264,8 +267,8 @@ public partial class View
 
     /// <summary>Determines the current <see cref="ColorScheme"/> based on the <see cref="Enabled"/> value.</summary>
     /// <returns>
-    ///     <see cref="Terminal.Gui.ColorScheme.Focus"/> if <see cref="Enabled"/> is <see langword="true"/> or
-    ///     <see cref="Terminal.Gui.ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
+    ///     <see cref="ColorScheme.Focus"/> if <see cref="Enabled"/> is <see langword="true"/> or
+    ///     <see cref="ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
     ///     overridden can return other values.
     /// </returns>
     public virtual Attribute GetFocusColor ()
@@ -316,10 +319,17 @@ public partial class View
         return Enabled ? cs.Normal : cs.Disabled;
     }
 
-    /// <summary>This moves the cursor to the specified column and row in the view.</summary>
-    /// <returns>The move.</returns>
-    /// <param name="col">The column to move to, in view-relative coordinates.</param>
-    /// <param name="row">the row to move to, in view-relative coordinates.</param>
+    /// <summary>Moves the drawing cursor to the specified view-relative column and row in the view.</summary>
+    /// <remarks>
+    /// <para>
+    ///     If the provided coordinates are outside the visible content area, this method does nothing.
+    /// </para>
+    /// <para>
+    ///     The top-left corner of the visible content area is <c>ViewPort.Location</c>.
+    /// </para>
+    /// </remarks>
+    /// <param name="col">Column (viewport-relative).</param>
+    /// <param name="row">Row (viewport-relative).</param>
     public void Move (int col, int row)
     {
         if (Driver is null || Driver?.Rows == 0)
@@ -327,7 +337,13 @@ public partial class View
             return;
         }
 
-        Rectangle screen = BoundsToScreen (new (col, row, 0, 0));
+        if (col < 0 || row < 0 || col >= Viewport.Size.Width || row >= Viewport.Size.Height)
+        {
+            // TODO: Change return type to bool so callers can determine success?
+            return;
+        }
+
+        Rectangle screen = ViewportToScreen (new (col, row, 0, 0));
         Driver?.Move (screen.X, screen.Y);
     }
 
@@ -347,26 +363,50 @@ public partial class View
 
         // Each of these renders lines to either this View's LineCanvas 
         // Those lines will be finally rendered in OnRenderLineCanvas
-        Margin?.OnDrawContent (Margin.Bounds);
-        Border?.OnDrawContent (Border.Bounds);
-        Padding?.OnDrawContent (Padding.Bounds);
+        Margin?.OnDrawContent (Margin.Viewport);
+        Border?.OnDrawContent (Border.Viewport);
+        Padding?.OnDrawContent (Padding.Viewport);
 
         return true;
     }
 
-    /// <summary>Enables overrides to draw infinitely scrolled content and/or a background behind added controls.</summary>
-    /// <param name="contentArea">
-    ///     The view-relative rectangle describing the currently visible viewport into the
-    ///     <see cref="View"/>
+    /// <summary>
+    ///     Draws the view's content, including Subviews.
+    /// </summary>
+    /// <remarks>
+    ///     <para>
+    ///         The <paramref name="viewport"/> parameter is provided as a convenience; it has the same values as the
+    ///         <see cref="Viewport"/> property.
+    ///     </para>
+    ///     <para>
+    ///         The <see cref="Viewport"/> Location and Size indicate what part of the View's virtual content area, defined
+    ///         by <see cref="ContentSize"/>, is visible and should be drawn. The coordinates taken by <see cref="Move"/> and
+    ///         <see cref="AddRune"/> are relative to <see cref="Viewport"/>, thus if <c>ViewPort.Location.Y</c> is <c>5</c>
+    ///         the 6th row of the content should be drawn using <c>MoveTo (x, 5)</c>.
+    ///     </para>
+    ///     <para>
+    ///         If <see cref="ContentSize"/> is larger than <c>ViewPort.Size</c> drawing code should use <see cref="Viewport"/>
+    ///         to constrain drawing for better performance.
+    ///     </para>
+    ///     <para>
+    ///         The <see cref="Clip"/> may define smaller area than <see cref="Viewport"/>; complex drawing code can be more
+    ///         efficient by using <see cref="Clip"/> to constrain drawing for better performance.
+    ///     </para>
+    ///     <para>
+    ///         Overrides should loop through the subviews and call <see cref="Draw"/>.
+    ///     </para>
+    /// </remarks>
+    /// <param name="viewport">
+    ///     The rectangle describing the currently visible viewport into the <see cref="View"/>; has the same value as
+    ///     <see cref="Viewport"/>.
     /// </param>
-    /// <remarks>This method will be called before any subviews added with <see cref="Add(View)"/> have been drawn.</remarks>
-    public virtual void OnDrawContent (Rectangle contentArea)
+    public virtual void OnDrawContent (Rectangle viewport)
     {
         if (NeedsDisplay)
         {
             if (SuperView is { })
             {
-                Clear (contentArea);
+                Clear (viewport);
             }
 
             if (!string.IsNullOrEmpty (TextFormatter.Text))
@@ -379,7 +419,7 @@ public partial class View
 
             // This should NOT clear 
             TextFormatter?.Draw (
-                                 BoundsToScreen (contentArea),
+                                 ViewportToScreen (viewport),
                                  HasFocus ? GetFocusColor () : GetNormalColor (),
                                  HasFocus ? ColorScheme.HotFocus : GetHotNormalColor (),
                                  Rectangle.Empty
@@ -387,6 +427,7 @@ public partial class View
             SetSubViewNeedsDisplay ();
         }
 
+        // TODO: Move drawing of subviews to a separate OnDrawSubviews virtual method
         // Draw subviews
         // TODO: Implement OnDrawSubviews (cancelable);
         if (_subviews is { } && SubViewNeedsDisplay)
@@ -416,18 +457,13 @@ public partial class View
     }
 
     /// <summary>
-    ///     Enables overrides after completed drawing infinitely scrolled content and/or a background behind removed
-    ///     controls.
+    ///     Called after <see cref="OnDrawContent"/> to enable overrides.
     /// </summary>
-    /// <param name="contentArea">
-    ///     The view-relative rectangle describing the currently visible viewport into the
+    /// <param name="viewport">
+    ///     The viewport-relative rectangle describing the currently visible viewport into the
     ///     <see cref="View"/>
     /// </param>
-    /// <remarks>
-    ///     This method will be called after any subviews removed with <see cref="Remove(View)"/> have been completed
-    ///     drawing.
-    /// </remarks>
-    public virtual void OnDrawContentComplete (Rectangle contentArea) { DrawContentComplete?.Invoke (this, new (contentArea)); }
+    public virtual void OnDrawContentComplete (Rectangle viewport) { DrawContentComplete?.Invoke (this, new (viewport)); }
 
     // TODO: Make this cancelable
     /// <summary>
@@ -444,7 +480,7 @@ public partial class View
         }
 
         // If we have a SuperView, it'll render our frames.
-        if (!SuperViewRendersLineCanvas && LineCanvas.Bounds != Rectangle.Empty)
+        if (!SuperViewRendersLineCanvas && LineCanvas.Viewport != Rectangle.Empty)
         {
             foreach (KeyValuePair<Point, Cell> p in LineCanvas.GetCellMap ())
             {
@@ -484,7 +520,7 @@ public partial class View
         return true;
     }
 
-    /// <summary>Sets the area of this view needing to be redrawn to <see cref="Bounds"/>.</summary>
+    /// <summary>Sets the area of this view needing to be redrawn to <see cref="Viewport"/>.</summary>
     /// <remarks>
     ///     If the view has not been initialized (<see cref="IsInitialized"/> is <see langword="false"/>), this method
     ///     does nothing.
@@ -493,21 +529,28 @@ public partial class View
     {
         if (IsInitialized)
         {
-            SetNeedsDisplay (Bounds);
+            SetNeedsDisplay (Viewport);
         }
     }
 
     /// <summary>Expands the area of this view needing to be redrawn to include <paramref name="region"/>.</summary>
     /// <remarks>
-    ///     If the view has not been initialized (<see cref="IsInitialized"/> is <see langword="false"/>), the area to be
-    ///     redrawn will be the <paramref name="region"/>.
+    ///     <para>
+    ///         The location of <see cref="region"/> are relative to the View's content, bound by <c>Size.Empty</c> and
+    ///         <see cref="ContentSize"/>.
+    ///     </para>
+    ///     <para>
+    ///         If the view has not been initialized (<see cref="IsInitialized"/> is <see langword="false"/>), the area to be
+    ///         redrawn will be the <paramref name="region"/>.
+    ///     </para>
     /// </remarks>
-    /// <param name="region">The Bounds-relative region that needs to be redrawn.</param>
-    public void SetNeedsDisplay (Rectangle region)
+    /// <param name="region">The content-relative region that needs to be redrawn.</param>
+    public virtual void SetNeedsDisplay (Rectangle region)
     {
         if (!IsInitialized)
         {
             _needsDisplayRect = region;
+
             return;
         }
 
@@ -547,7 +590,7 @@ public partial class View
     {
         SubViewNeedsDisplay = true;
 
-        if (SuperView is { SubViewNeedsDisplay: false })
+        if (SuperView is { } && !SuperView.SubViewNeedsDisplay)
         {
             SuperView.SetSubViewNeedsDisplay ();
         }
@@ -568,22 +611,4 @@ public partial class View
             subview.ClearNeedsDisplay();
         }
     }
-
-    // INTENT: Isn't this just intersection? It isn't used anyway.
-    // Clips a rectangle in screen coordinates to the dimensions currently available on the screen
-    internal Rectangle ScreenClip (Rectangle regionScreen)
-    {
-        int x = regionScreen.X < 0 ? 0 : regionScreen.X;
-        int y = regionScreen.Y < 0 ? 0 : regionScreen.Y;
-
-        int w = regionScreen.X + regionScreen.Width >= Driver.Cols
-                    ? Driver.Cols - regionScreen.X
-                    : regionScreen.Width;
-
-        int h = regionScreen.Y + regionScreen.Height >= Driver.Rows
-                    ? Driver.Rows - regionScreen.Y
-                    : regionScreen.Height;
-
-        return new (x, y, w, h);
-    }
 }

+ 10 - 10
Terminal.Gui/View/ViewMouse.cs

@@ -12,7 +12,7 @@ public partial class View
     /// <summary>Event fired when a mouse event occurs.</summary>
     /// <remarks>
     /// <para>
-    /// The coordinates are relative to <see cref="View.Bounds"/>.
+    /// The coordinates are relative to <see cref="Viewport"/>.
     /// </para>
     /// </remarks>
     public event EventHandler<MouseEventEventArgs> MouseEvent;
@@ -24,24 +24,24 @@ public partial class View
     /// <see cref="MouseEvent.Flags"/> to see which button was clicked.
     /// </para>
     /// <para>
-    /// The coordinates are relative to <see cref="View.Bounds"/>.
+    /// The coordinates are relative to <see cref="Viewport"/>.
     /// </para>
     /// </remarks>
     public event EventHandler<MouseEventEventArgs> MouseClick;
 
-    /// <summary>Event fired when the mouse moves into the View's <see cref="Bounds"/>.</summary>
+    /// <summary>Event fired when the mouse moves into the View's <see cref="Viewport"/>.</summary>
     public event EventHandler<MouseEventEventArgs> MouseEnter;
 
-    /// <summary>Event fired when the mouse leaves the View's <see cref="Bounds"/>.</summary>
+    /// <summary>Event fired when the mouse leaves the View's <see cref="Viewport"/>.</summary>
     public event EventHandler<MouseEventEventArgs> MouseLeave;
 
     // TODO: OnMouseEnter should not be public virtual, but protected.
     /// <summary>
-    ///     Called when the mouse enters the View's <see cref="Bounds"/>. The view will now receive mouse events until the mouse leaves
+    ///     Called when the mouse enters the View's <see cref="Viewport"/>. The view will now receive mouse events until the mouse leaves
     ///     the view. At which time, <see cref="OnMouseLeave(Gui.MouseEvent)"/> will be called.
     /// </summary>
     /// <remarks>
-    /// The coordinates are relative to <see cref="View.Bounds"/>.
+    /// The coordinates are relative to <see cref="Viewport"/>.
     /// </remarks>
     /// <param name="mouseEvent"></param>
     /// <returns><see langword="true"/>, if the event was handled, <see langword="false"/> otherwise.</returns>
@@ -65,11 +65,11 @@ public partial class View
 
     // TODO: OnMouseLeave should not be public virtual, but protected.
     /// <summary>
-    ///     Called when the mouse has moved out of the View's <see cref="Bounds"/>. The view will no longer receive mouse events (until the
+    ///     Called when the mouse has moved out of the View's <see cref="Viewport"/>. The view will no longer receive mouse events (until the
     ///     mouse moves within the view again and <see cref="OnMouseEnter(Gui.MouseEvent)"/> is called).
     /// </summary>
     /// <remarks>
-    /// The coordinates are relative to <see cref="View.Bounds"/>.
+    /// The coordinates are relative to <see cref="Viewport"/>.
     /// </remarks>
     /// <param name="mouseEvent"></param>
     /// <returns><see langword="true"/>, if the event was handled, <see langword="false"/> otherwise.</returns>
@@ -92,10 +92,10 @@ public partial class View
     }
 
     // TODO: OnMouseEvent should not be public virtual, but protected.
-    /// <summary>Called when a mouse event occurs within the view's <see cref="Bounds"/>.</summary>
+    /// <summary>Called when a mouse event occurs within the view's <see cref="Viewport"/>.</summary>
     /// <remarks>
     /// <para>
-    /// The coordinates are relative to <see cref="View.Bounds"/>.
+    /// The coordinates are relative to <see cref="Viewport"/>.
     /// </para>
     /// </remarks>
     /// <param name="mouseEvent"></param>

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

@@ -30,10 +30,10 @@ public partial class View
     ///         <see cref="TextAlignment"/> and <see cref="TextDirection"/>.
     ///     </para>
     ///     <para>
-    ///         The text will word-wrap to additional lines if it does not fit horizontally. If <see cref="Bounds"/>'s height
+    ///         The text will word-wrap to additional lines if it does not fit horizontally. If <see cref="Viewport"/>'s height
     ///         is 1, the text will be clipped.
     ///     </para>
-    ///     <para>If <see cref="AutoSize"/> is <c>true</c>, the <see cref="Bounds"/> will be adjusted to fit the text.</para>
+    ///     <para>If <see cref="AutoSize"/> is <c>true</c>, the <see cref="Viewport"/> will be adjusted to fit the text.</para>
     ///     <para>When the text changes, the <see cref="TextChanged"/> is fired.</para>
     /// </remarks>
     public virtual string Text
@@ -80,7 +80,7 @@ public partial class View
     ///     redisplay the <see cref="View"/>.
     /// </summary>
     /// <remarks>
-    ///     <para>If <see cref="AutoSize"/> is <c>true</c>, the <see cref="Bounds"/> will be adjusted to fit the text.</para>
+    ///     <para>If <see cref="AutoSize"/> is <c>true</c>, the <see cref="Viewport"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The text alignment.</value>
     public virtual TextAlignment TextAlignment
@@ -99,7 +99,7 @@ public partial class View
     ///     <see cref="View"/>.
     /// </summary>
     /// <remarks>
-    ///     <para>If <see cref="AutoSize"/> is <c>true</c>, the <see cref="Bounds"/> will be adjusted to fit the text.</para>
+    ///     <para>If <see cref="AutoSize"/> is <c>true</c>, the <see cref="Viewport"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The text alignment.</value>
     public virtual TextDirection TextDirection
@@ -120,7 +120,7 @@ public partial class View
     ///     redisplay the <see cref="View"/>.
     /// </summary>
     /// <remarks>
-    ///     <para>If <see cref="AutoSize"/> is <c>true</c>, the <see cref="Bounds"/> will be adjusted to fit the text.</para>
+    ///     <para>If <see cref="AutoSize"/> is <c>true</c>, the <see cref="Viewport"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The text alignment.</value>
     public virtual VerticalTextAlignment VerticalTextAlignment
@@ -134,7 +134,7 @@ public partial class View
     }
 
     /// <summary>
-    ///     Gets the Frame dimensions required to fit <see cref="Text"/> within <see cref="Bounds"/> using the text
+    ///     Gets the Frame dimensions required to fit <see cref="Text"/> within <see cref="Viewport"/> using the text
     ///     <see cref="NavigationDirection"/> specified by the <see cref="TextFormatter"/> property and accounting for any
     ///     <see cref="HotKeySpecifier"/> characters.
     /// </summary>
@@ -146,8 +146,8 @@ public partial class View
 
         if (IsInitialized)
         {
-            x = Bounds.X;
-            y = Bounds.Y;
+            x = Viewport.X;
+            y = Viewport.Y;
         }
 
         Rectangle rect = TextFormatter.CalcRect (x, y, TextFormatter.Text, TextFormatter.Direction);
@@ -225,7 +225,7 @@ public partial class View
     }
 
     /// <summary>
-    ///     Internal API. Sets <see cref="TextFormatter"/>.Size to the current <see cref="Bounds"/> size, adjusted for
+    ///     Internal API. Sets <see cref="TextFormatter"/>.Size to the current <see cref="Viewport"/> size, adjusted for
     ///     <see cref="TextFormatter.HotKeySpecifier"/>.
     /// </summary>
     /// <remarks>
@@ -244,14 +244,14 @@ public partial class View
 
         if (string.IsNullOrEmpty (TextFormatter.Text))
         {
-            TextFormatter.Size = Bounds.Size;
+            TextFormatter.Size = Viewport.Size;
 
             return;
         }
 
         TextFormatter.Size = new (
-                                  Bounds.Size.Width + GetHotKeySpecifierLength (),
-                                  Bounds.Size.Height + GetHotKeySpecifierLength (false)
+                                  Viewport.Size.Width + GetHotKeySpecifierLength (),
+                                  Viewport.Size.Height + GetHotKeySpecifierLength (false)
                                  );
     }
 
@@ -304,12 +304,12 @@ public partial class View
             throw new InvalidOperationException ("SetFrameToFitText can only be called when AutoSize is true");
         }
 
-        // BUGBUG: This API is broken - should not assume Frame.Height == Bounds.Height
+        // BUGBUG: This API is broken - should not assume Frame.Height == Viewport.Height
         // <summary>
         // Gets the minimum dimensions required to fit the View's <see cref="Text"/>, factoring in <see cref="TextDirection"/>.
         // </summary>
         // <param name="sizeRequired">The minimum dimensions required.</param>
-        // <returns><see langword="true"/> if the dimensions fit within the View's <see cref="Bounds"/>, <see langword="false"/> otherwise.</returns>
+        // <returns><see langword="true"/> if the dimensions fit within the View's <see cref="Viewport"/>, <see langword="false"/> otherwise.</returns>
         // <remarks>
         // Always returns <see langword="false"/> if <see cref="AutoSize"/> is <see langword="true"/> or
         // if <see cref="Height"/> (Horizontal) or <see cref="Width"/> (Vertical) are not not set or zero.
@@ -324,7 +324,7 @@ public partial class View
                 return false;
             }
 
-            sizeRequired = Bounds.Size;
+            sizeRequired = Viewport.Size;
 
             if (AutoSize || string.IsNullOrEmpty (TextFormatter.Text))
             {
@@ -336,11 +336,11 @@ public partial class View
                 case true:
                     int colWidth = TextFormatter.GetWidestLineLength (new List<string> { TextFormatter.Text }, 0, 1);
 
-                    // TODO: v2 - This uses frame.Width; it should only use Bounds
+                    // TODO: v2 - This uses frame.Width; it should only use Viewport
                     if (_frame.Width < colWidth
-                        && (Width is null || (Bounds.Width >= 0 && Width is Dim.DimAbsolute && Width.Anchor (0) >= 0 && Width.Anchor (0) < colWidth)))
+                        && (Width is null || (Viewport.Width >= 0 && Width is Dim.DimAbsolute && Width.Anchor (0) >= 0 && Width.Anchor (0) < colWidth)))
                     {
-                        sizeRequired = new (colWidth, Bounds.Height);
+                        sizeRequired = new (colWidth, Viewport.Height);
 
                         return true;
                     }
@@ -349,7 +349,7 @@ public partial class View
                 default:
                     if (_frame.Height < 1 && (Height is null || (Height is Dim.DimAbsolute && Height.Anchor (0) == 0)))
                     {
-                        sizeRequired = new (Bounds.Width, 1);
+                        sizeRequired = new (Viewport.Width, 1);
 
                         return true;
                     }
@@ -392,7 +392,7 @@ public partial class View
         }
         else if (AutoSize && directionChanged && IsAdded)
         {
-            ResizeBoundsToFit (Bounds.Size);
+            ResizeBoundsToFit (Viewport.Size);
         }
 
         SetTextFormatterSize ();

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

@@ -98,7 +98,7 @@ public class ColorPicker : View
 
         SetFocus ();
 
-        if (me.X > Bounds.Width || me.Y > Bounds.Height)
+        if (me.X > Viewport.Width || me.Y > Viewport.Height)
         {
             return true;
         }
@@ -157,16 +157,16 @@ public class ColorPicker : View
     }
 
     ///<inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
-        base.OnDrawContent (contentArea);
+        base.OnDrawContent (viewport);
 
         Driver.SetAttribute (HasFocus ? ColorScheme.Focus : GetNormalColor ());
         var colorIndex = 0;
 
-        for (var y = 0; y < Bounds.Height / BoxHeight; y++)
+        for (var y = 0; y < Viewport.Height / BoxHeight; y++)
         {
-            for (var x = 0; x < Bounds.Width / BoxWidth; x++)
+            for (var x = 0; x < Viewport.Width / BoxWidth; x++)
             {
                 int foregroundColorIndex = y == 0 ? colorIndex + _cols : colorIndex - _cols;
                 Driver.SetAttribute (new Attribute ((ColorName)foregroundColorIndex, (ColorName)colorIndex));

+ 18 - 18
Terminal.Gui/Views/ComboBox.cs

@@ -245,8 +245,8 @@ public class ComboBox : View
     /// <inheritdoc/>
     protected internal override bool OnMouseEvent  (MouseEvent me)
     {
-        if (me.X == Bounds.Right - 1
-            && me.Y == Bounds.Top
+        if (me.X == Viewport.Right - 1
+            && me.Y == Viewport.Top
             && me.Flags == MouseFlags.Button1Pressed
             && _autoHide)
         {
@@ -284,9 +284,9 @@ public class ComboBox : View
     public virtual void OnCollapsed () { Collapsed?.Invoke (this, EventArgs.Empty); }
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
-        base.OnDrawContent (contentArea);
+        base.OnDrawContent (viewport);
 
         if (!_autoHide)
         {
@@ -294,7 +294,7 @@ public class ComboBox : View
         }
 
         Driver.SetAttribute (ColorScheme.Focus);
-        Move (Bounds.Right - 1, 0);
+        Move (Viewport.Right - 1, 0);
         Driver.AddRune (Glyphs.DownArrow);
     }
 
@@ -401,15 +401,15 @@ public class ComboBox : View
     /// <returns></returns>
     private int CalculatetHeight ()
     {
-        if (!IsInitialized || Bounds.Height == 0)
+        if (!IsInitialized || Viewport.Height == 0)
         {
             return 0;
         }
 
         return Math.Min (
-                         Math.Max (Bounds.Height - 1, _minimumHeight - 1),
+                         Math.Max (Viewport.Height - 1, _minimumHeight - 1),
                          _searchset?.Count > 0 ? _searchset.Count :
-                         IsShow ? Math.Max (Bounds.Height - 1, _minimumHeight - 1) : 0
+                         IsShow ? Math.Max (Viewport.Height - 1, _minimumHeight - 1) : 0
                         );
     }
 
@@ -491,10 +491,10 @@ public class ComboBox : View
         }
 
         Reset (true);
-        _listview.Clear (_listview.IsInitialized ? _listview.Bounds : Rectangle.Empty);
+        _listview.Clear (_listview.IsInitialized ? _listview.Viewport : Rectangle.Empty);
         _listview.TabStop = false;
         SuperView?.SendSubviewToBack (this);
-        Rectangle rect = _listview.BoundsToScreen (_listview.IsInitialized ? _listview.Bounds : Rectangle.Empty);
+        Rectangle rect = _listview.ViewportToScreen (_listview.IsInitialized ? _listview.Viewport : Rectangle.Empty);
         SuperView?.SetNeedsDisplay (rect);
         OnCollapsed ();
     }
@@ -607,18 +607,18 @@ public class ComboBox : View
 
     private void ProcessLayout ()
     {
-        if (Bounds.Height < _minimumHeight && (Height is null || Height is Dim.DimAbsolute))
+        if (Viewport.Height < _minimumHeight && (Height is null || Height is Dim.DimAbsolute))
         {
             Height = _minimumHeight;
         }
 
-        if ((!_autoHide && Bounds.Width > 0 && _search.Frame.Width != Bounds.Width)
-            || (_autoHide && Bounds.Width > 0 && _search.Frame.Width != Bounds.Width - 1))
+        if ((!_autoHide && Viewport.Width > 0 && _search.Frame.Width != Viewport.Width)
+            || (_autoHide && Viewport.Width > 0 && _search.Frame.Width != Viewport.Width - 1))
         {
-            _search.Width = _listview.Width = _autoHide ? Bounds.Width - 1 : Bounds.Width;
+            _search.Width = _listview.Width = _autoHide ? Viewport.Width - 1 : Viewport.Width;
             _listview.Height = CalculatetHeight ();
-            _search.SetRelativeLayout (Bounds);
-            _listview.SetRelativeLayout (Bounds);
+            _search.SetRelativeLayout (Viewport);
+            _listview.SetRelativeLayout (Viewport);
         }
     }
 
@@ -761,7 +761,7 @@ public class ComboBox : View
     private void ShowList ()
     {
         _listview.SetSource (_searchset);
-        _listview.Clear (Bounds); // Ensure list shrinks in Dialog as you type
+        _listview.Clear (Viewport); // Ensure list shrinks in Dialog as you type
         _listview.Height = CalculatetHeight ();
         SuperView?.BringSubviewToFront (this);
     }
@@ -839,7 +839,7 @@ public class ComboBox : View
             return res;
         }
 
-        public override void OnDrawContent (Rectangle contentArea)
+        public override void OnDrawContent (Rectangle viewport)
         {
             Attribute current = ColorScheme.Focus;
             Driver.SetAttribute (current);

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

@@ -165,7 +165,7 @@ public class Dialog : Window
         {
             case ButtonAlignments.Center:
                 // Center Buttons
-                shiftLeft = (Bounds.Width - buttonsWidth - _buttons.Count - 1) / 2 + 1;
+                shiftLeft = (Viewport.Width - buttonsWidth - _buttons.Count - 1) / 2 + 1;
 
                 for (int i = _buttons.Count - 1; i >= 0; i--)
                 {
@@ -178,7 +178,7 @@ public class Dialog : Window
                     }
                     else
                     {
-                        button.X = Bounds.Width - shiftLeft;
+                        button.X = Viewport.Width - shiftLeft;
                     }
 
                     button.Y = Pos.AnchorEnd (1);
@@ -190,7 +190,7 @@ public class Dialog : Window
                 // Justify Buttons
                 // leftmost and rightmost buttons are hard against edges. The rest are evenly spaced.
 
-                var spacing = (int)Math.Ceiling ((double)(Bounds.Width - buttonsWidth) / (_buttons.Count - 1));
+                var spacing = (int)Math.Ceiling ((double)(Viewport.Width - buttonsWidth) / (_buttons.Count - 1));
 
                 for (int i = _buttons.Count - 1; i >= 0; i--)
                 {
@@ -206,7 +206,7 @@ public class Dialog : Window
                         if (i == 0)
                         {
                             // first (leftmost) button 
-                            int left = Bounds.Width;
+                            int left = Viewport.Width;
                             button.X = Pos.AnchorEnd (left);
                         }
                         else

+ 11 - 11
Terminal.Gui/Views/FileDialog.cs

@@ -407,23 +407,23 @@ public class FileDialog : Dialog
     }
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
-        base.OnDrawContent (contentArea);
+        base.OnDrawContent (viewport);
 
         if (!string.IsNullOrWhiteSpace (_feedback))
         {
             int feedbackWidth = _feedback.EnumerateRunes ().Sum (c => c.GetColumns ());
-            int feedbackPadLeft = (Bounds.Width - feedbackWidth) / 2 - 1;
+            int feedbackPadLeft = (Viewport.Width - feedbackWidth) / 2 - 1;
 
-            feedbackPadLeft = Math.Min (Bounds.Width, feedbackPadLeft);
+            feedbackPadLeft = Math.Min (Viewport.Width, feedbackPadLeft);
             feedbackPadLeft = Math.Max (0, feedbackPadLeft);
 
-            int feedbackPadRight = Bounds.Width - (feedbackPadLeft + feedbackWidth + 2);
-            feedbackPadRight = Math.Min (Bounds.Width, feedbackPadRight);
+            int feedbackPadRight = Viewport.Width - (feedbackPadLeft + feedbackWidth + 2);
+            feedbackPadRight = Math.Min (Viewport.Width, feedbackPadRight);
             feedbackPadRight = Math.Max (0, feedbackPadRight);
 
-            Move (0, Bounds.Height / 2);
+            Move (0, Viewport.Height / 2);
 
             Driver.SetAttribute (new Attribute (Color.Red, ColorScheme.Normal.Background));
             Driver.AddStr (new string (' ', feedbackPadLeft));
@@ -773,12 +773,12 @@ public class FileDialog : Dialog
             return 0;
         }
 
-        return Bounds.Width
-               - _btnOk.Bounds.Width
-               - _btnCancel.Bounds.Width
+        return Viewport.Width
+               - _btnOk.Viewport.Width
+               - _btnCancel.Viewport.Width
                - 1
 
-               // TODO: Fiddle factor, seems the Bounds are wrong for someone
+               // TODO: Fiddle factor, seems the Viewport are wrong for someone
                - 2;
     }
 

+ 8 - 8
Terminal.Gui/Views/GraphView/Annotations.cs

@@ -18,7 +18,7 @@ public interface IAnnotation
 
     /// <summary>
     ///     Called once after series have been rendered (or before if <see cref="BeforeSeries"/> is true). Use
-    ///     <see cref="View.Driver"/> to draw and <see cref="View.Bounds"/> to avoid drawing outside of graph
+    ///     <see cref="View.Driver"/> to draw and <see cref="View.Viewport"/> to avoid drawing outside of graph
     /// </summary>
     /// <param name="graph"></param>
     void Render (GraphView graph);
@@ -62,7 +62,7 @@ public class TextAnnotation : IAnnotation
 
     /// <summary>
     ///     Draws the <see cref="Text"/> at the given coordinates with truncation to avoid spilling over
-    ///     <see name="View.Bounds"/> of the <paramref name="graph"/>
+    ///     <see name="View.Viewport"/> of the <paramref name="graph"/>
     /// </summary>
     /// <param name="graph"></param>
     /// <param name="x">Screen x position to start drawing string</param>
@@ -70,7 +70,7 @@ public class TextAnnotation : IAnnotation
     protected void DrawText (GraphView graph, int x, int y)
     {
         // the draw point is out of control bounds
-        if (!graph.Bounds.Contains (new Point (x, y)))
+        if (!graph.Viewport.Contains (new Point (x, y)))
         {
             return;
         }
@@ -83,7 +83,7 @@ public class TextAnnotation : IAnnotation
 
         graph.Move (x, y);
 
-        int availableWidth = graph.Bounds.Width - x;
+        int availableWidth = graph.Viewport.Width - x;
 
         if (availableWidth <= 0)
         {
@@ -127,7 +127,7 @@ public class LegendAnnotation : View, IAnnotation
     /// <summary>Returns false i.e. Legends render after series</summary>
     public bool BeforeSeries => false;
 
-    /// <summary>Draws the Legend and all entries into the area within <see cref="View.Bounds"/></summary>
+    /// <summary>Draws the Legend and all entries into the area within <see cref="View.Viewport"/></summary>
     /// <param name="graph"></param>
     public void Render (GraphView graph)
     {
@@ -165,13 +165,13 @@ public class LegendAnnotation : View, IAnnotation
             // add the text
             Move (1, linesDrawn);
 
-            string str = TextFormatter.ClipOrPad (entry.Item2, Bounds.Width - 1);
+            string str = TextFormatter.ClipOrPad (entry.Item2, Viewport.Width - 1);
             Application.Driver.AddStr (str);
 
             linesDrawn++;
 
             // Legend has run out of space
-            if (linesDrawn >= Bounds.Height)
+            if (linesDrawn >= Viewport.Height)
             {
                 break;
             }
@@ -182,7 +182,7 @@ public class LegendAnnotation : View, IAnnotation
     /// <param name="graphCellToRender">The symbol appearing on the graph that should appear in the legend</param>
     /// <param name="text">
     ///     Text to render on this line of the legend.  Will be truncated if outside of Legend
-    ///     <see cref="View.Bounds"/>
+    ///     <see cref="View.Viewport"/>
     /// </param>
     public void AddEntry (GraphCellToRender graphCellToRender, string text) { _entries.Add (Tuple.Create (graphCellToRender, text)); }
 }

+ 15 - 15
Terminal.Gui/Views/GraphView/Axis.cs

@@ -113,7 +113,7 @@ public class HorizontalAxis : Axis
             string toRender = text;
 
             // this is how much space is left
-            int xSpaceAvailable = graph.Bounds.Width - drawAtX;
+            int xSpaceAvailable = graph.Viewport.Width - drawAtX;
 
             // There is no space for the label at all!
             if (xSpaceAvailable <= 0)
@@ -127,7 +127,7 @@ public class HorizontalAxis : Axis
                 toRender = toRender.Substring (0, xSpaceAvailable);
             }
 
-            graph.Move (drawAtX, Math.Min (y + 1, graph.Bounds.Height - 1));
+            graph.Move (drawAtX, Math.Min (y + 1, graph.Viewport.Height - 1));
             driver.AddStr (toRender);
         }
     }
@@ -140,7 +140,7 @@ public class HorizontalAxis : Axis
             return;
         }
 
-        Rectangle bounds = graph.Bounds;
+        Rectangle bounds = graph.Viewport;
 
         IEnumerable<AxisIncrementToRender> labels = GetLabels (graph, bounds);
 
@@ -155,12 +155,12 @@ public class HorizontalAxis : Axis
             string toRender = Text;
 
             // if label is too long
-            if (toRender.Length > graph.Bounds.Width)
+            if (toRender.Length > graph.Viewport.Width)
             {
-                toRender = toRender.Substring (0, graph.Bounds.Width);
+                toRender = toRender.Substring (0, graph.Viewport.Width);
             }
 
-            graph.Move (graph.Bounds.Width / 2 - toRender.Length / 2, graph.Bounds.Height - 1);
+            graph.Move (graph.Viewport.Width / 2 - toRender.Length / 2, graph.Viewport.Height - 1);
             Application.Driver.AddStr (toRender);
         }
     }
@@ -174,7 +174,7 @@ public class HorizontalAxis : Axis
             return;
         }
 
-        Rectangle bounds = graph.Bounds;
+        Rectangle bounds = graph.Viewport;
 
         graph.Move (0, 0);
 
@@ -212,7 +212,7 @@ public class HorizontalAxis : Axis
 
         // float the X axis so that it accurately represents the origin of the graph
         // but anchor it to top/bottom if the origin is offscreen
-        return Math.Min (Math.Max (0, origin.Y), graph.Bounds.Height - ((int)graph.MarginBottom + 1));
+        return Math.Min (Math.Max (0, origin.Y), graph.Viewport.Height - ((int)graph.MarginBottom + 1));
     }
 
     /// <summary>Draws a horizontal axis line at the given <paramref name="x"/>, <paramref name="y"/> screen coordinates</summary>
@@ -317,7 +317,7 @@ public class VerticalAxis : Axis
             return;
         }
 
-        Rectangle bounds = graph.Bounds;
+        Rectangle bounds = graph.Viewport;
         IEnumerable<AxisIncrementToRender> labels = GetLabels (graph, bounds);
 
         foreach (AxisIncrementToRender label in labels)
@@ -331,13 +331,13 @@ public class VerticalAxis : Axis
             string toRender = Text;
 
             // if label is too long
-            if (toRender.Length > graph.Bounds.Height)
+            if (toRender.Length > graph.Viewport.Height)
             {
-                toRender = toRender.Substring (0, graph.Bounds.Height);
+                toRender = toRender.Substring (0, graph.Viewport.Height);
             }
 
             // Draw it 1 letter at a time vertically down row 0 of the control
-            int startDrawingAtY = graph.Bounds.Height / 2 - toRender.Length / 2;
+            int startDrawingAtY = graph.Viewport.Height / 2 - toRender.Length / 2;
 
             for (var i = 0; i < toRender.Length; i++)
             {
@@ -356,7 +356,7 @@ public class VerticalAxis : Axis
             return;
         }
 
-        Rectangle bounds = graph.Bounds;
+        Rectangle bounds = graph.Viewport;
 
         int x = GetAxisXPosition (graph);
 
@@ -385,7 +385,7 @@ public class VerticalAxis : Axis
 
         // float the Y axis so that it accurately represents the origin of the graph
         // but anchor it to left/right if the origin is offscreen
-        return Math.Min (Math.Max ((int)graph.MarginLeft, origin.X), graph.Bounds.Width - 1);
+        return Math.Min (Math.Max ((int)graph.MarginLeft, origin.X), graph.Viewport.Width - 1);
     }
 
     /// <summary>Draws a vertical axis line at the given <paramref name="x"/>, <paramref name="y"/> screen coordinates</summary>
@@ -409,7 +409,7 @@ public class VerticalAxis : Axis
             return graph.GraphSpaceToScreen (new PointF (0, Minimum.Value)).Y;
         }
 
-        return graph.Bounds.Height;
+        return graph.Viewport.Height;
     }
 
     private IEnumerable<AxisIncrementToRender> GetLabels (GraphView graph, Rectangle bounds)

+ 9 - 9
Terminal.Gui/Views/GraphView/GraphView.cs

@@ -192,12 +192,12 @@ public class GraphView : View
                           (int)((location.X - ScrollOffset.X) / CellSize.X) + (int)MarginLeft,
 
                           // screen coordinates are top down while graph coordinates are bottom up
-                          Bounds.Height - 1 - (int)MarginBottom - (int)((location.Y - ScrollOffset.Y) / CellSize.Y)
+                          Viewport.Height - 1 - (int)MarginBottom - (int)((location.Y - ScrollOffset.Y) / CellSize.Y)
                          );
     }
 
     ///<inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         if (CellSize.X == 0 || CellSize.Y == 0)
         {
@@ -209,10 +209,10 @@ public class GraphView : View
         Move (0, 0);
 
         // clear all old content
-        for (var i = 0; i < Bounds.Height; i++)
+        for (var i = 0; i < Viewport.Height; i++)
         {
             Move (0, i);
-            Driver.AddStr (new string (' ', Bounds.Width));
+            Driver.AddStr (new string (' ', Viewport.Width));
         }
 
         // If there is no data do not display a graph
@@ -222,8 +222,8 @@ public class GraphView : View
         }
 
         // The drawable area of the graph (anything that isn't in the margins)
-        int graphScreenWidth = Bounds.Width - (int)MarginLeft;
-        int graphScreenHeight = Bounds.Height - (int)MarginBottom;
+        int graphScreenWidth = Viewport.Width - (int)MarginLeft;
+        int graphScreenHeight = Viewport.Height - (int)MarginBottom;
 
         // if the margins take up the full draw bounds don't render
         if (graphScreenWidth < 0 || graphScreenHeight < 0)
@@ -287,10 +287,10 @@ public class GraphView : View
     }
 
     /// <summary>Scrolls the graph down 1 page.</summary>
-    public void PageDown () { Scroll (0, -1 * CellSize.Y * Bounds.Height); }
+    public void PageDown () { Scroll (0, -1 * CellSize.Y * Viewport.Height); }
 
     /// <summary>Scrolls the graph up 1 page.</summary>
-    public void PageUp () { Scroll (0, CellSize.Y * Bounds.Height); }
+    public void PageUp () { Scroll (0, CellSize.Y * Viewport.Height); }
 
     /// <summary>
     ///     Clears all settings configured on the graph and resets all properties to default values (
@@ -316,7 +316,7 @@ public class GraphView : View
     {
         return new (
                     ScrollOffset.X + (col - MarginLeft) * CellSize.X,
-                    ScrollOffset.Y + (Bounds.Height - (row + MarginBottom + 1)) * CellSize.Y,
+                    ScrollOffset.Y + (Viewport.Height - (row + MarginBottom + 1)) * CellSize.Y,
                     CellSize.X,
                     CellSize.Y
                    );

+ 1 - 1
Terminal.Gui/Views/GraphView/Series.cs

@@ -192,7 +192,7 @@ public class BarSeries : ISeries
                 screenStart.X = graph.AxisY.GetAxisXPosition (graph);
 
                 // dont draw bar off the right of the control
-                screenEnd.X = Math.Min (graph.Bounds.Width - 1, screenEnd.X);
+                screenEnd.X = Math.Min (graph.Viewport.Width - 1, screenEnd.X);
 
                 // if bar is off the screen
                 if (screenStart.Y < 0 || screenStart.Y > drawBounds.Height - graph.MarginBottom)

+ 10 - 10
Terminal.Gui/Views/HexView.cs

@@ -264,7 +264,7 @@ public class HexView : View
     /// <inheritdoc/>
     protected internal override bool OnMouseEvent  (MouseEvent me)
     {
-        // BUGBUG: Test this with a border! Assumes Frame == Bounds!
+        // BUGBUG: Test this with a border! Assumes Frame == Viewport!
 
         if (!me.Flags.HasFlag (MouseFlags.Button1Clicked)
             && !me.Flags.HasFlag (MouseFlags.Button1DoubleClicked)
@@ -351,14 +351,14 @@ public class HexView : View
     }
 
     ///<inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         Attribute currentAttribute;
         Attribute current = ColorScheme.Focus;
         Driver.SetAttribute (current);
         Move (0, 0);
 
-        // BUGBUG: Bounds!!!!
+        // BUGBUG: Viewport!!!!
         Rectangle frame = Frame;
 
         int nblocks = bytesPerLine / bsize;
@@ -373,7 +373,7 @@ public class HexView : View
         {
             Rectangle lineRect = new (0, line, frame.Width, 1);
 
-            if (!Bounds.Contains (lineRect))
+            if (!Viewport.Contains (lineRect))
             {
                 continue;
             }
@@ -611,15 +611,15 @@ public class HexView : View
         // Small buffers will just show the position, with the bsize field value (4 bytes)
         bytesPerLine = bsize;
 
-        if (Bounds.Width - displayWidth > 17)
+        if (Viewport.Width - displayWidth > 17)
         {
-            bytesPerLine = bsize * ((Bounds.Width - displayWidth) / 18);
+            bytesPerLine = bsize * ((Viewport.Width - displayWidth) / 18);
         }
     }
 
     private bool MoveDown (int bytes)
     {
-        // BUGBUG: Bounds!
+        // BUGBUG: Viewport!
         RedisplayLine (position);
 
         if (position + bytes < source.Length)
@@ -657,7 +657,7 @@ public class HexView : View
     {
         position = source.Length;
 
-        // BUGBUG: Bounds!
+        // BUGBUG: Viewport!
         if (position >= DisplayStart + bytesPerLine * Frame.Height)
         {
             SetDisplayStart (position);
@@ -744,7 +744,7 @@ public class HexView : View
             position++;
         }
 
-        // BUGBUG: Bounds!
+        // BUGBUG: Viewport!
         if (position >= DisplayStart + bytesPerLine * Frame.Height)
         {
             SetDisplayStart (DisplayStart + bytesPerLine);
@@ -793,7 +793,7 @@ public class HexView : View
         var delta = (int)(pos - DisplayStart);
         int line = delta / bytesPerLine;
 
-        // BUGBUG: Bounds!
+        // BUGBUG: Viewport!
         SetNeedsDisplay (new (0, line, Frame.Width, 1));
     }
 

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

@@ -17,7 +17,7 @@ public class Line : View
     public Orientation Orientation { get; set; }
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         LineCanvas lc = LineCanvas;
 
@@ -26,7 +26,7 @@ public class Line : View
             lc = adornment.Parent.LineCanvas;
         }
         lc.AddLine (
-                    BoundsToScreen (contentArea).Location,
+                    ViewportToScreen (viewport).Location,
                     Orientation == Orientation.Horizontal ? Frame.Width : Frame.Height,
                     Orientation,
                     BorderStyle

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

@@ -54,16 +54,16 @@ public class LineView : View
     public Rune? StartingAnchor { get; set; }
 
     /// <summary>Draws the line including any starting/ending anchors</summary>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
-        base.OnDrawContent (contentArea);
+        base.OnDrawContent (viewport);
 
         Move (0, 0);
         Driver.SetAttribute (GetNormalColor ());
 
         int hLineWidth = Math.Max (1, Glyphs.HLine.GetColumns ());
 
-        int dEnd = Orientation == Orientation.Horizontal ? Bounds.Width : Bounds.Height;
+        int dEnd = Orientation == Orientation.Horizontal ? Viewport.Width : Viewport.Height;
 
         for (var d = 0; d < dEnd; d += hLineWidth)
         {

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

@@ -318,9 +318,9 @@ public class ListView : View
             {
                 _top = Math.Max (_selected, 0);
             }
-            else if (Bounds.Height > 0 && _selected >= _top + Bounds.Height)
+            else if (Viewport.Height > 0 && _selected >= _top + Viewport.Height)
             {
-                _top = Math.Max (_selected - Bounds.Height + 1, 0);
+                _top = Math.Max (_selected - Viewport.Height + 1, 0);
             }
 
             LayoutStarted -= ListView_LayoutStarted;
@@ -399,7 +399,7 @@ public class ListView : View
 
         if (me.Y + _top >= _source.Count
             || me.Y + _top < 0
-            || me.Y + _top > _top + Bounds.Height)
+            || me.Y + _top > _top + Viewport.Height)
         {
             return true;
         }
@@ -449,7 +449,7 @@ public class ListView : View
             //can move by down by one.
             _selected++;
 
-            if (_selected >= _top + Bounds.Height)
+            if (_selected >= _top + Viewport.Height)
             {
                 _top++;
             }
@@ -466,9 +466,9 @@ public class ListView : View
             OnSelectedChanged ();
             SetNeedsDisplay ();
         }
-        else if (_selected >= _top + Bounds.Height)
+        else if (_selected >= _top + Viewport.Height)
         {
-            _top = Math.Max (_source.Count - Bounds.Height, 0);
+            _top = Math.Max (_source.Count - Viewport.Height, 0);
             SetNeedsDisplay ();
         }
 
@@ -483,7 +483,7 @@ public class ListView : View
         {
             _selected = _source.Count - 1;
 
-            if (_top + _selected > Bounds.Height - 1)
+            if (_top + _selected > Viewport.Height - 1)
             {
                 _top = Math.Max (_selected, 0);
             }
@@ -517,7 +517,7 @@ public class ListView : View
     /// <returns></returns>
     public virtual bool MovePageDown ()
     {
-        int n = _selected + Bounds.Height;
+        int n = _selected + Viewport.Height;
 
         if (n >= _source.Count)
         {
@@ -528,7 +528,7 @@ public class ListView : View
         {
             _selected = n;
 
-            if (_source.Count >= Bounds.Height)
+            if (_source.Count >= Viewport.Height)
             {
                 _top = Math.Max (_selected, 0);
             }
@@ -548,7 +548,7 @@ public class ListView : View
     /// <returns></returns>
     public virtual bool MovePageUp ()
     {
-        int n = _selected - Bounds.Height;
+        int n = _selected - Viewport.Height;
 
         if (n < 0)
         {
@@ -598,9 +598,9 @@ public class ListView : View
             {
                 _top = Math.Max (_selected, 0);
             }
-            else if (_selected > _top + Bounds.Height)
+            else if (_selected > _top + Viewport.Height)
             {
-                _top = Math.Max (_selected - Bounds.Height + 1, 0);
+                _top = Math.Max (_selected - Viewport.Height + 1, 0);
             }
 
             OnSelectedChanged ();
@@ -616,14 +616,14 @@ public class ListView : View
     }
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
-        base.OnDrawContent (contentArea);
+        base.OnDrawContent (viewport);
 
         Attribute current = ColorScheme.Focus;
         Driver.SetAttribute (current);
         Move (0, 0);
-        Rectangle f = Bounds;
+        Rectangle f = Viewport;
         int item = _top;
         bool focused = HasFocus;
         int col = _allowsMarking ? 2 : 0;
@@ -768,7 +768,7 @@ public class ListView : View
         }
         else
         {
-            Move (Bounds.Width - 1, _selected - _top);
+            Move (Viewport.Width - 1, _selected - _top);
         }
     }
 

+ 3 - 3
Terminal.Gui/Views/Menu/ContextMenu.cs

@@ -142,12 +142,12 @@ public sealed class ContextMenu : IDisposable
 
         _container = Application.Current;
         _container.Closing += Container_Closing;
-        Rectangle frame = Application.Driver.Bounds;
+        Rectangle frame = Application.Driver.Viewport;
         Point position = Position;
 
         if (Host is { })
         {
-            Point pos = Host.BoundsToScreen (frame).Location;
+            Point pos = Host.ViewportToScreen (frame).Location;
             pos.Y += Host.Frame.Height - 1;
 
             if (position != pos)
@@ -184,7 +184,7 @@ public sealed class ContextMenu : IDisposable
                 }
                 else
                 {
-                    Point pos = Host.BoundsToScreen (frame).Location;
+                    Point pos = Host.ViewportToScreen (frame).Location;
                     position.Y = pos.Y - rect.Height - 1;
                 }
             }

+ 15 - 13
Terminal.Gui/Views/Menu/Menu.cs

@@ -726,7 +726,7 @@ internal sealed class Menu : View
 
         View view = a.MouseEvent.View ?? this;
 
-        Point boundsPoint = view.ScreenToBounds (a.MouseEvent.X, a.MouseEvent.Y);
+        Point boundsPoint = view.ScreenToViewport (a.MouseEvent.X, a.MouseEvent.Y);
         var me = new MouseEvent
         {
             X = boundsPoint.X,
@@ -757,7 +757,7 @@ internal sealed class Menu : View
         return !item.IsEnabled () ? ColorScheme.Disabled : GetNormalColor ();
     }
 
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         if (_barItems.Children is null)
         {
@@ -771,14 +771,14 @@ internal sealed class Menu : View
         OnDrawAdornments ();
         OnRenderLineCanvas ();
 
-        for (int i = Bounds.Y; i < _barItems.Children.Length; i++)
+        for (int i = Viewport.Y; i < _barItems.Children.Length; i++)
         {
             if (i < 0)
             {
                 continue;
             }
 
-            if (BoundsToScreen (Bounds).Y + i >= Driver.Rows)
+            if (ViewportToScreen (Viewport).Y + i >= Driver.Rows)
             {
                 break;
             }
@@ -792,7 +792,8 @@ internal sealed class Menu : View
 
             if (item is null && BorderStyle != LineStyle.None)
             {
-                Move (-1, i);
+                var s = ViewportToScreen (new (-1, i, 0, 0));
+                Driver.Move (s.X, s.Y);
                 Driver.AddRune (Glyphs.LeftTee);
             }
             else if (Frame.X < Driver.Cols)
@@ -802,7 +803,7 @@ internal sealed class Menu : View
 
             Driver.SetAttribute (DetermineColorSchemeFor (item, i));
 
-            for (int p = Bounds.X; p < Frame.Width - 2; p++)
+            for (int p = Viewport.X; p < Frame.Width - 2; p++)
             {
                 // This - 2 is for the border
                 if (p < 0)
@@ -810,7 +811,7 @@ internal sealed class Menu : View
                     continue;
                 }
 
-                if (BoundsToScreen (Bounds).X + p >= Driver.Cols)
+                if (ViewportToScreen (Viewport).X + p >= Driver.Cols)
                 {
                     break;
                 }
@@ -839,7 +840,8 @@ internal sealed class Menu : View
             {
                 if (BorderStyle != LineStyle.None && SuperView?.Frame.Right - Frame.X > Frame.Width)
                 {
-                    Move (Frame.Width - 2, i);
+                    var s = ViewportToScreen (new (Frame.Width - 2, i, 0, 0));
+                    Driver.Move (s.X, s.Y);
                     Driver.AddRune (Glyphs.RightTee);
                 }
 
@@ -875,7 +877,7 @@ internal sealed class Menu : View
                 textToDraw = item.Title;
             }
 
-            Rectangle screen = BoundsToScreen (new (new (0 , i), Size.Empty));
+            Rectangle screen = ViewportToScreen (new (new (0 , i), Size.Empty));
             if (screen.X < Driver.Cols)
             {
                 Driver.Move (screen.X + 1, screen.Y);
@@ -893,10 +895,10 @@ internal sealed class Menu : View
 
                     // The -3 is left/right border + one space (not sure what for)
                     tf.Draw (
-                             BoundsToScreen (new (1, i, Frame.Width - 3, 1)),
+                             ViewportToScreen (new (1, i, Frame.Width - 3, 1)),
                              i == _currentChild ? ColorScheme.Focus : GetNormalColor (),
                              i == _currentChild ? ColorScheme.HotFocus : ColorScheme.HotNormal,
-                             SuperView?.BoundsToScreen (SuperView.Bounds) ?? Rectangle.Empty
+                             SuperView?.ViewportToScreen (SuperView.Viewport) ?? Rectangle.Empty
                             );
                 }
                 else
@@ -913,7 +915,7 @@ internal sealed class Menu : View
                             ? item.Help.GetColumns ()
                             : item.Help.GetColumns () + item.ShortcutTag.GetColumns () + 2;
                 int col = Frame.Width - l - 3;
-                screen = BoundsToScreen (new (new (col, i), Size.Empty));
+                screen = ViewportToScreen (new (new (col, i), Size.Empty));
 
                 if (screen.X < Driver.Cols)
                 {
@@ -939,7 +941,7 @@ internal sealed class Menu : View
     {
         if (Visible)
         {
-            OnDrawContent (Bounds);
+            OnDrawContent (Viewport);
         }
     }
 

+ 11 - 15
Terminal.Gui/Views/Menu/MenuBar.cs

@@ -469,15 +469,11 @@ public class MenuBar : View
     public event EventHandler<MenuOpeningEventArgs> MenuOpening;
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
-        Move (0, 0);
         Driver.SetAttribute (GetNormalColor ());
 
-        for (var i = 0; i < Frame.Width; i++)
-        {
-            Driver.AddRune ((Rune)' ');
-        }
+        Clear ();
 
         Move (1, 0);
         var pos = 0;
@@ -825,13 +821,13 @@ public class MenuBar : View
             return Point.Empty;
         }
 
-        Rectangle superViewFrame = SuperView is null ? Driver.Bounds : SuperView.Frame;
+        Rectangle superViewFrame = SuperView is null ? Driver.Viewport : SuperView.Frame;
         View sv = SuperView is null ? Application.Current : SuperView;
-        Point boundsOffset = sv.GetBoundsOffset ();
+        Point viewportOffset = sv.GetViewportOffset ();
 
         return new (
-                    superViewFrame.X - sv.Frame.X - boundsOffset.X,
-                    superViewFrame.Y - sv.Frame.Y - boundsOffset.Y
+                    superViewFrame.X - sv.Frame.X - viewportOffset.X,
+                    superViewFrame.Y - sv.Frame.Y - viewportOffset.Y
                    );
     }
 
@@ -842,11 +838,11 @@ public class MenuBar : View
     /// <returns>The location offset.</returns>
     internal Point GetScreenOffsetFromCurrent ()
     {
-        Rectangle screen = Driver.Bounds;
+        Rectangle screen = Driver.Viewport;
         Rectangle currentFrame = Application.Current.Frame;
-        Point boundsOffset = Application.Top.GetBoundsOffset ();
+        Point viewportOffset = Application.Top.GetViewportOffset ();
 
-        return new (screen.X - currentFrame.X - boundsOffset.X, screen.Y - currentFrame.Y - boundsOffset.Y);
+        return new (screen.X - currentFrame.X - viewportOffset.X, screen.Y - currentFrame.Y - viewportOffset.Y);
     }
 
     internal void NextMenu (bool isSubMenu = false, bool ignoreUseSubMenusSingleFrame = false)
@@ -1320,7 +1316,7 @@ public class MenuBar : View
 
         if (mi.IsTopLevel)
         {
-            Rectangle screen = BoundsToScreen (new (new (0, i), Size.Empty));
+            Rectangle screen = ViewportToScreen (new (new (0, i), Size.Empty));
             var menu = new Menu { Host = this, X = screen.X, Y = screen.Y, BarItems = mi };
             menu.Run (mi.Action);
             menu.Dispose ();
@@ -1684,7 +1680,7 @@ public class MenuBar : View
                     {
                         if (Menus [i].IsTopLevel)
                         {
-                            Rectangle screen = BoundsToScreen (new (new (0, i), Size.Empty));
+                            Rectangle screen = ViewportToScreen (new (new (0, i), Size.Empty));
                             var menu = new Menu { Host = this, X = screen.X, Y = screen.Y, BarItems = Menus [i] };
                             menu.Run (Menus [i].Action);
                             menu.Dispose ();

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

@@ -394,7 +394,7 @@ public static class MessageBox
                         }
 
                         // TODO: replace with Dim.Fit when implemented
-                        Rectangle maxBounds = d.SuperView?.Bounds ?? Application.Top.Bounds;
+                        Rectangle maxBounds = d.SuperView?.Viewport ?? Application.Top.Viewport;
 
                         Thickness adornmentsThickness = d.GetAdornmentsThickness ();
 

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

@@ -143,7 +143,7 @@ public class ProgressBar : View
     }
 
     ///<inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         Driver.SetAttribute (GetHotNormalColor ());
 
@@ -151,7 +151,7 @@ public class ProgressBar : View
 
         if (_isActivity)
         {
-            for (var i = 0; i < Bounds.Width; i++)
+            for (var i = 0; i < Viewport.Width; i++)
             {
                 if (Array.IndexOf (_activityPos, i) != -1)
                 {
@@ -165,15 +165,15 @@ public class ProgressBar : View
         }
         else
         {
-            var mid = (int)(_fraction * Bounds.Width);
+            var mid = (int)(_fraction * Viewport.Width);
             int i;
 
-            for (i = 0; (i < mid) & (i < Bounds.Width); i++)
+            for (i = 0; (i < mid) & (i < Viewport.Width); i++)
             {
                 Driver.AddRune (SegmentCharacter);
             }
 
-            for (; i < Bounds.Width; i++)
+            for (; i < Viewport.Width; i++)
             {
                 Driver.AddRune ((Rune)' ');
             }
@@ -190,10 +190,10 @@ public class ProgressBar : View
             }
 
             tf?.Draw (
-                      BoundsToScreen (Bounds),
+                      ViewportToScreen (Viewport),
                       attr,
                       ColorScheme.Normal,
-                      SuperView?.BoundsToScreen (SuperView.Bounds) ?? default (Rectangle)
+                      SuperView?.ViewportToScreen (SuperView.Viewport) ?? default (Rectangle)
                      );
         }
     }
@@ -244,13 +244,13 @@ public class ProgressBar : View
 
                 _delta = 1;
             }
-            else if (_activityPos [0] >= Bounds.Width)
+            else if (_activityPos [0] >= Viewport.Width)
             {
                 if (_bidirectionalMarquee)
                 {
                     for (var i = 0; i < _activityPos.Length; i++)
                     {
-                        _activityPos [i] = Bounds.Width + i - 2;
+                        _activityPos [i] = Viewport.Width + i - 2;
                     }
 
                     _delta = -1;
@@ -291,7 +291,7 @@ public class ProgressBar : View
 
     private void SetInitialProperties ()
     {
-        Height = 1; // This will be updated when Bounds is updated in ProgressBar_LayoutStarted
+        Height = 1; // This will be updated when Viewport is updated in ProgressBar_LayoutStarted
         CanFocus = false;
         _fraction = 0;
         LayoutStarted += ProgressBar_LayoutStarted;

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

@@ -201,9 +201,9 @@ public class RadioGroup : View
     }
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
-        base.OnDrawContent (contentArea);
+        base.OnDrawContent (viewport);
 
         Driver.SetAttribute (GetNormalColor ());
 

+ 25 - 25
Terminal.Gui/Views/ScrollBarView.cs

@@ -152,14 +152,14 @@ public class ScrollBarView : View
                 _keepContentAlwaysInViewport = value;
                 var pos = 0;
 
-                if (value && !_vertical && _position + Host.Bounds.Width > _size)
+                if (value && !_vertical && _position + Host.Viewport.Width > _size)
                 {
-                    pos = _size - Host.Bounds.Width + (_showBothScrollIndicator ? 1 : 0);
+                    pos = _size - Host.Viewport.Width + (_showBothScrollIndicator ? 1 : 0);
                 }
 
-                if (value && _vertical && _position + Host.Bounds.Height > _size)
+                if (value && _vertical && _position + Host.Viewport.Height > _size)
                 {
-                    pos = _size - Host.Bounds.Height + (_showBothScrollIndicator ? 1 : 0);
+                    pos = _size - Host.Viewport.Height + (_showBothScrollIndicator ? 1 : 0);
                 }
 
                 if (pos != 0)
@@ -301,7 +301,7 @@ public class ScrollBarView : View
         }
 
         int location = _vertical ? mouseEvent.Y : mouseEvent.X;
-        int barsize = _vertical ? Bounds.Height : Bounds.Width;
+        int barsize = _vertical ? Viewport.Height : Viewport.Width;
         int posTopLeftTee = _vertical ? _posTopTee + 1 : _posLeftTee + 1;
         int posBottomRightTee = _vertical ? _posBottomTee + 1 : _posRightTee + 1;
         barsize -= 2;
@@ -449,7 +449,7 @@ public class ScrollBarView : View
     public virtual void OnChangedPosition () { ChangedPosition?.Invoke (this, EventArgs.Empty); }
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         if (ColorScheme is null || ((!_showScrollIndicator || Size == 0) && AutoHideScrollBars && Visible))
         {
@@ -461,7 +461,7 @@ public class ScrollBarView : View
             return;
         }
 
-        if (Size == 0 || (_vertical && Bounds.Height == 0) || (!_vertical && Bounds.Width == 0))
+        if (Size == 0 || (_vertical && Viewport.Height == 0) || (!_vertical && Viewport.Width == 0))
         {
             return;
         }
@@ -470,13 +470,13 @@ public class ScrollBarView : View
 
         if (_vertical)
         {
-            if (Bounds.Right < Bounds.Width - 1)
+            if (Viewport.Right < Viewport.Width - 1)
             {
                 return;
             }
 
-            int col = Bounds.Width - 1;
-            int bh = Bounds.Height;
+            int col = Viewport.Width - 1;
+            int bh = Viewport.Height;
             Rune special;
 
             if (bh < 4)
@@ -486,7 +486,7 @@ public class ScrollBarView : View
 
                 Move (col, 0);
 
-                if (Bounds.Height == 1)
+                if (Viewport.Height == 1)
                 {
                     Driver.AddRune (Glyphs.Diamond);
                 }
@@ -495,15 +495,15 @@ public class ScrollBarView : View
                     Driver.AddRune (Glyphs.UpArrow);
                 }
 
-                if (Bounds.Height == 3)
+                if (Viewport.Height == 3)
                 {
                     Move (col, 1);
                     Driver.AddRune (Glyphs.Diamond);
                 }
 
-                if (Bounds.Height > 1)
+                if (Viewport.Height > 1)
                 {
-                    Move (col, Bounds.Height - 1);
+                    Move (col, Viewport.Height - 1);
                     Driver.AddRune (Glyphs.DownArrow);
                 }
             }
@@ -572,23 +572,23 @@ public class ScrollBarView : View
 
                 if (!hasTopTee)
                 {
-                    Move (col, Bounds.Height - 2);
+                    Move (col, Viewport.Height - 2);
                     Driver.AddRune (Glyphs.TopTee);
                 }
 
-                Move (col, Bounds.Height - 1);
+                Move (col, Viewport.Height - 1);
                 Driver.AddRune (Glyphs.DownArrow);
             }
         }
         else
         {
-            if (Bounds.Bottom < Bounds.Height - 1)
+            if (Viewport.Bottom < Viewport.Height - 1)
             {
                 return;
             }
 
-            int row = Bounds.Height - 1;
-            int bw = Bounds.Width;
+            int row = Viewport.Height - 1;
+            int bw = Viewport.Width;
             Rune special;
 
             if (bw < 4)
@@ -663,7 +663,7 @@ public class ScrollBarView : View
 
                 if (!hasLeftTee)
                 {
-                    Move (Bounds.Width - 2, row);
+                    Move (Viewport.Width - 2, row);
                     Driver.AddRune (Glyphs.LeftTee);
                 }
 
@@ -685,7 +685,7 @@ public class ScrollBarView : View
 
     internal bool CanScroll (int n, out int max, bool isVertical = false)
     {
-        if (Host?.Bounds.IsEmpty != false)
+        if (Host?.Viewport.IsEmpty != false)
         {
             max = 0;
 
@@ -706,7 +706,7 @@ public class ScrollBarView : View
 
     private bool CheckBothScrollBars (ScrollBarView scrollBarView, bool pending = false)
     {
-        int barsize = scrollBarView._vertical ? scrollBarView.Bounds.Height : scrollBarView.Bounds.Width;
+        int barsize = scrollBarView._vertical ? scrollBarView.Viewport.Height : scrollBarView.Viewport.Width;
 
         if (barsize == 0 || barsize >= scrollBarView._size)
         {
@@ -845,15 +845,15 @@ public class ScrollBarView : View
 
     private int GetBarsize (bool isVertical)
     {
-        if (Host?.Bounds.IsEmpty != false)
+        if (Host?.Viewport.IsEmpty != false)
         {
             return 0;
         }
 
         return isVertical ? KeepContentAlwaysInViewport
-                                ? Host.Bounds.Height + (_showBothScrollIndicator ? -2 : -1)
+                                ? Host.Viewport.Height + (_showBothScrollIndicator ? -2 : -1)
                                 : 0 :
-               KeepContentAlwaysInViewport ? Host.Bounds.Width + (_showBothScrollIndicator ? -2 : -1) : 0;
+               KeepContentAlwaysInViewport ? Host.Viewport.Width + (_showBothScrollIndicator ? -2 : -1) : 0;
     }
 
     private void Host_EnabledChanged (object sender, EventArgs e)

+ 19 - 19
Terminal.Gui/Views/ScrollView.cs

@@ -85,10 +85,10 @@ public class ScrollView : View
         AddCommand (Command.ScrollDown, () => ScrollDown (1));
         AddCommand (Command.ScrollLeft, () => ScrollLeft (1));
         AddCommand (Command.ScrollRight, () => ScrollRight (1));
-        AddCommand (Command.PageUp, () => ScrollUp (Bounds.Height));
-        AddCommand (Command.PageDown, () => ScrollDown (Bounds.Height));
-        AddCommand (Command.PageLeft, () => ScrollLeft (Bounds.Width));
-        AddCommand (Command.PageRight, () => ScrollRight (Bounds.Width));
+        AddCommand (Command.PageUp, () => ScrollUp (Viewport.Height));
+        AddCommand (Command.PageDown, () => ScrollDown (Viewport.Height));
+        AddCommand (Command.PageLeft, () => ScrollLeft (Viewport.Width));
+        AddCommand (Command.PageRight, () => ScrollRight (Viewport.Width));
         AddCommand (Command.TopHome, () => ScrollUp (_contentSize.Height));
         AddCommand (Command.BottomEnd, () => ScrollDown (_contentSize.Height));
         AddCommand (Command.LeftHome, () => ScrollLeft (_contentSize.Width));
@@ -234,26 +234,26 @@ public class ScrollView : View
                 _horizontal.OtherScrollBarView.KeepContentAlwaysInViewport = value;
                 Point p = default;
 
-                if (value && -_contentOffset.X + Bounds.Width > _contentSize.Width)
+                if (value && -_contentOffset.X + Viewport.Width > _contentSize.Width)
                 {
                     p = new Point (
-                                   _contentSize.Width - Bounds.Width + (_showVerticalScrollIndicator ? 1 : 0),
+                                   _contentSize.Width - Viewport.Width + (_showVerticalScrollIndicator ? 1 : 0),
                                    -_contentOffset.Y
                                   );
                 }
 
-                if (value && -_contentOffset.Y + Bounds.Height > _contentSize.Height)
+                if (value && -_contentOffset.Y + Viewport.Height > _contentSize.Height)
                 {
                     if (p == default (Point))
                     {
                         p = new Point (
                                        -_contentOffset.X,
-                                       _contentSize.Height - Bounds.Height + (_showHorizontalScrollIndicator ? 1 : 0)
+                                       _contentSize.Height - Viewport.Height + (_showHorizontalScrollIndicator ? 1 : 0)
                                       );
                     }
                     else
                     {
-                        p.Y = _contentSize.Height - Bounds.Height + (_showHorizontalScrollIndicator ? 1 : 0);
+                        p.Y = _contentSize.Height - Viewport.Height + (_showHorizontalScrollIndicator ? 1 : 0);
                     }
                 }
 
@@ -359,14 +359,14 @@ public class ScrollView : View
     }
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         SetViewsNeedsDisplay ();
 
-        Rectangle savedClip = ClipToBounds ();
+        Rectangle savedClip = ClipToViewport ();
 
         // TODO: It's bad practice for views to always clear a view. It negates clipping.
-        Clear (contentArea);
+        Clear ();
 
         if (!string.IsNullOrEmpty (_contentView.Text) || _contentView.Subviews.Count > 0)
         {
@@ -638,7 +638,7 @@ public class ScrollView : View
         bool v = false, h = false;
         var p = false;
 
-        if (Bounds.Height == 0 || Bounds.Height > _contentSize.Height)
+        if (Viewport.Height == 0 || Viewport.Height > _contentSize.Height)
         {
             if (ShowVerticalScrollIndicator)
             {
@@ -647,7 +647,7 @@ public class ScrollView : View
 
             v = false;
         }
-        else if (Bounds.Height > 0 && Bounds.Height == _contentSize.Height)
+        else if (Viewport.Height > 0 && Viewport.Height == _contentSize.Height)
         {
             p = true;
         }
@@ -661,7 +661,7 @@ public class ScrollView : View
             v = true;
         }
 
-        if (Bounds.Width == 0 || Bounds.Width > _contentSize.Width)
+        if (Viewport.Width == 0 || Viewport.Width > _contentSize.Width)
         {
             if (ShowHorizontalScrollIndicator)
             {
@@ -670,7 +670,7 @@ public class ScrollView : View
 
             h = false;
         }
-        else if (Bounds.Width > 0 && Bounds.Width == _contentSize.Width && p)
+        else if (Viewport.Width > 0 && Viewport.Width == _contentSize.Width && p)
         {
             if (ShowHorizontalScrollIndicator)
             {
@@ -722,13 +722,13 @@ public class ScrollView : View
 
         if (v)
         {
-            _vertical.SetRelativeLayout (Bounds);
+            _vertical.SetRelativeLayout (Viewport);
             _vertical.Draw ();
         }
 
         if (h)
         {
-            _horizontal.SetRelativeLayout (Bounds);
+            _horizontal.SetRelativeLayout (Viewport);
             _horizontal.Draw ();
         }
 
@@ -736,7 +736,7 @@ public class ScrollView : View
 
         if (v && h)
         {
-            _contentBottomRightCorner.SetRelativeLayout (Bounds);
+            _contentBottomRightCorner.SetRelativeLayout (Viewport);
             _contentBottomRightCorner.Draw ();
         }
     }

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

@@ -374,7 +374,7 @@ public class Slider<T> : View
     }
 
     /// <summary>
-    ///     If <see langword="true"/> the slider will be sized to fit the available space (the Bounds of the the
+    ///     If <see langword="true"/> the slider will be sized to fit the available space (the Viewport of the the
     ///     SuperView).
     /// </summary>
     /// <remarks>
@@ -663,17 +663,17 @@ public class Slider<T> : View
 
         if (AutoSize)
         {
-            // Max size is SuperView's Bounds. Min Size is size that will fit.
+            // Max size is SuperView's Viewport. Min Size is size that will fit.
             if (SuperView is { })
             {
-                // Calculate the size of the slider based on the size of the SuperView's Bounds.
+                // Calculate the size of the slider based on the size of the SuperView's Viewport.
                 if (_config._sliderOrientation == Orientation.Horizontal)
                 {
-                    size = int.Min (SuperView.Bounds.Width, CalcBestLength ());
+                    size = int.Min (SuperView.Viewport.Width, CalcBestLength ());
                 }
                 else
                 {
-                    size = int.Min (SuperView.Bounds.Height, CalcBestLength ());
+                    size = int.Min (SuperView.Viewport.Height, CalcBestLength ());
                 }
             }
             else
@@ -686,14 +686,14 @@ public class Slider<T> : View
         }
         else
         {
-            // Fit Slider to the Bounds
+            // Fit Slider to the Viewport
             if (_config._sliderOrientation == Orientation.Horizontal)
             {
-                size = Bounds.Width;
+                size = Viewport.Width;
             }
             else
             {
-                size = Bounds.Height;
+                size = Viewport.Height;
             }
         }
 
@@ -777,15 +777,15 @@ public class Slider<T> : View
 
         if (_config._sliderOrientation == Orientation.Horizontal)
         {
-            Bounds = new (
-                          Bounds.Location,
+            Viewport = new (
+                          Viewport.Location,
                           new (
                                int.Min (
-                                        SuperView.Bounds.Width - adornmentsThickness.Horizontal,
+                                        SuperView.Viewport.Width - adornmentsThickness.Horizontal,
                                         CalcBestLength ()
                                        ),
                                int.Min (
-                                        SuperView.Bounds.Height - adornmentsThickness.Vertical,
+                                        SuperView.Viewport.Height - adornmentsThickness.Vertical,
                                         CalcThickness ()
                                        )
                               )
@@ -793,15 +793,15 @@ public class Slider<T> : View
         }
         else
         {
-            Bounds = new (
-                          Bounds.Location,
+            Viewport = new (
+                          Viewport.Location,
                           new (
                                int.Min (
-                                        SuperView.Bounds.Width - adornmentsThickness.Horizontal,
+                                        SuperView.Viewport.Width - adornmentsThickness.Horizontal,
                                         CalcThickness ()
                                        ),
                                int.Min (
-                                        SuperView.Bounds.Height - adornmentsThickness.Vertical,
+                                        SuperView.Viewport.Height - adornmentsThickness.Vertical,
                                         CalcBestLength ()
                                        )
                               )
@@ -988,7 +988,7 @@ public class Slider<T> : View
 
         if (TryGetPositionByOption (FocusedOption, out (int x, int y) position))
         {
-            if (IsInitialized && Bounds.Contains (position.x, position.y))
+            if (IsInitialized && Viewport.Contains (position.x, position.y))
             {
                 Move (position.x, position.y);
             }
@@ -996,7 +996,7 @@ public class Slider<T> : View
     }
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         // TODO: make this more surgical to reduce repaint
 
@@ -1009,9 +1009,9 @@ public class Slider<T> : View
 #if (DEBUG)
         Driver?.SetAttribute (new Attribute (Color.White, Color.Red));
 
-        for (var y = 0; y < contentArea.Height; y++)
+        for (var y = 0; y < viewport.Height; y++)
         {
-            for (var x = 0; x < contentArea.Width; x++)
+            for (var x = 0; x < viewport.Width; x++)
             {
                 // MoveAndAdd (x, y, '·');
             }
@@ -1073,7 +1073,7 @@ public class Slider<T> : View
     private void DrawSlider ()
     {
         // TODO: be more surgical on clear
-        Clear (Bounds);
+        Clear (Viewport);
 
         // Attributes
 
@@ -1241,7 +1241,7 @@ public class Slider<T> : View
             }
         }
 
-        int remaining = isVertical ? Bounds.Height - y : Bounds.Width - x;
+        int remaining = isVertical ? Viewport.Height - y : Viewport.Width - x;
 
         // Right Spacing
         if (_config._showEndSpacing)

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

@@ -172,7 +172,7 @@ public class StatusBar : View
     }
 
     ///<inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         Move (0, 0);
         Driver.SetAttribute (GetNormalColor ());

+ 14 - 14
Terminal.Gui/Views/TabView.cs

@@ -297,7 +297,7 @@ public class TabView : View
         }
 
         // if current viewport does not include the selected tab
-        if (!CalculateViewport (Bounds).Any (r => Equals (SelectedTab, r.Tab)))
+        if (!CalculateViewport (Viewport).Any (r => Equals (SelectedTab, r.Tab)))
         {
             // Set scroll offset so the first tab rendered is the
             TabScrollOffset = Math.Max (0, Tabs.IndexOf (SelectedTab));
@@ -311,14 +311,14 @@ public class TabView : View
     public int EnsureValidScrollOffsets (int value) { return Math.Max (Math.Min (value, Tabs.Count - 1), 0); }
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         Driver.SetAttribute (GetNormalColor ());
 
         if (Tabs.Any ())
         {
-            Rectangle savedClip = ClipToBounds ();
-            _tabsBar.OnDrawContent (contentArea);
+            Rectangle savedClip = ClipToViewport ();
+            _tabsBar.OnDrawContent (viewport);
             _contentView.SetNeedsDisplay ();
             _contentView.Draw ();
             Driver.Clip = savedClip;
@@ -326,7 +326,7 @@ public class TabView : View
     }
 
     /// <inheritdoc/>
-    public override void OnDrawContentComplete (Rectangle contentArea) { _tabsBar.OnDrawContentComplete (contentArea); }
+    public override void OnDrawContentComplete (Rectangle viewport) { _tabsBar.OnDrawContentComplete (viewport); }
 
     /// <summary>
     ///     Removes the given <paramref name="tab"/> from <see cref="Tabs"/>. Caller is responsible for disposing the
@@ -657,12 +657,12 @@ public class TabView : View
             return false;
         }
 
-        public override void OnDrawContent (Rectangle contentArea)
+        public override void OnDrawContent (Rectangle viewport)
         {
-            _host._tabLocations = _host.CalculateViewport (Bounds).ToArray ();
+            _host._tabLocations = _host.CalculateViewport (Viewport).ToArray ();
 
             // clear any old text
-            Clear (contentArea);
+            Clear (viewport);
 
             RenderTabLine ();
 
@@ -670,7 +670,7 @@ public class TabView : View
             Driver.SetAttribute (GetNormalColor ());
         }
 
-        public override void OnDrawContentComplete (Rectangle contentArea)
+        public override void OnDrawContentComplete (Rectangle viewport)
         {
             if (_host._tabLocations is null)
             {
@@ -683,7 +683,7 @@ public class TabView : View
             for (var i = 0; i < tabLocations.Length; i++)
             {
                 View tab = tabLocations [i].Tab;
-                Rectangle vts = tab.BoundsToScreen (tab.Bounds);
+                Rectangle vts = tab.ViewportToScreen (tab.Viewport);
                 var lc = new LineCanvas ();
                 int selectedOffset = _host.Style.ShowTopLine && tabLocations [i].IsSelected ? 0 : 1;
 
@@ -1115,7 +1115,7 @@ public class TabView : View
 
                     int lastSelectedTab = !_host.Style.ShowTopLine && i == selectedTab ? 1 :
                                           _host.Style.TabsOnBottom ? 1 : 0;
-                    Rectangle tabsBarVts = BoundsToScreen (Bounds);
+                    Rectangle tabsBarVts = ViewportToScreen (Viewport);
                     int lineLength = tabsBarVts.Right - vts.Right;
 
                     // Right horizontal line
@@ -1238,7 +1238,7 @@ public class TabView : View
 
             View selected = null;
             int topLine = _host.Style.ShowTopLine ? 1 : 0;
-            int width = Bounds.Width;
+            int width = Viewport.Width;
 
             foreach (TabToRender toRender in tabLocations)
             {
@@ -1314,7 +1314,7 @@ public class TabView : View
                 }
 
                 tab.TextFormatter.Draw (
-                                        tab.BoundsToScreen (tab.Bounds),
+                                        tab.ViewportToScreen (tab.Viewport),
                                         prevAttr,
                                         ColorScheme.HotNormal
                                        );
@@ -1360,7 +1360,7 @@ public class TabView : View
             // if there are more tabs to the right not visible
             if (ShouldDrawRightScrollIndicator ())
             {
-                _rightScrollIndicator.X = Bounds.Width - 1;
+                _rightScrollIndicator.X = Viewport.Width - 1;
                 _rightScrollIndicator.Y = y;
 
                 // indicate that

+ 4 - 4
Terminal.Gui/Views/TableView/ListTableSource.cs

@@ -109,12 +109,12 @@ public class ListTableSource : ITableSource
 
         if (Style.Orientation == Orientation.Vertical != Style.ScrollParallel)
         {
-            float f = (float)_tableView.Bounds.Height - _tableView.GetHeaderHeight ();
+            float f = (float)_tableView.Viewport.Height - _tableView.GetHeaderHeight ();
             cols = (int)Math.Ceiling (Count / f);
         }
         else
         {
-            cols = (int)Math.Ceiling (((float)_tableView.Bounds.Width - 1) / colWidth) - 2;
+            cols = (int)Math.Ceiling (((float)_tableView.Viewport.Width - 1) / colWidth) - 2;
         }
 
         return cols > 1 ? cols : 1;
@@ -179,7 +179,7 @@ public class ListTableSource : ITableSource
 
     private void TableView_DrawContent (object sender, DrawEventArgs e)
     {
-        if (!_tableView.Bounds.Equals (_lastBounds)
+        if (!_tableView.Viewport.Equals (_lastBounds)
             || _tableView.MaxCellWidth != _lastMaxCellWidth
             || _tableView.MinCellWidth != _lastMinCellWidth
             || Style != _lastStyle
@@ -188,7 +188,7 @@ public class ListTableSource : ITableSource
             DataTable = CreateTable (CalculateColumns ());
         }
 
-        _lastBounds = _tableView.Bounds;
+        _lastBounds = _tableView.Viewport;
         _lastMinCellWidth = _tableView.MaxCellWidth;
         _lastMaxCellWidth = _tableView.MaxCellWidth;
         _lastStyle = Style;

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

@@ -483,7 +483,7 @@ public class TableView : View
             return null;
         }
 
-        IEnumerable<ColumnToRender> viewPort = CalculateViewport (Bounds);
+        IEnumerable<ColumnToRender> viewPort = CalculateViewport (Viewport);
 
         int headerHeight = GetHeaderHeightIfAny ();
 
@@ -502,7 +502,7 @@ public class TableView : View
         }
 
         // the cell is way down below the scroll area and off the screen
-        if (tableRow > RowOffset + (Bounds.Height - headerHeight))
+        if (tableRow > RowOffset + (Viewport.Height - headerHeight))
         {
             return null;
         }
@@ -577,7 +577,7 @@ public class TableView : View
             return;
         }
 
-        ColumnToRender [] columnsToRender = CalculateViewport (Bounds).ToArray ();
+        ColumnToRender [] columnsToRender = CalculateViewport (Viewport).ToArray ();
         int headerHeight = GetHeaderHeightIfAny ();
 
         //if we have scrolled too far to the left 
@@ -595,7 +595,7 @@ public class TableView : View
                 while (SelectedColumn > columnsToRender.Max (r => r.Column))
                 {
                     ColumnOffset++;
-                    columnsToRender = CalculateViewport (Bounds).ToArray ();
+                    columnsToRender = CalculateViewport (Viewport).ToArray ();
 
                     // if we are already scrolled to the last column then break
                     // this will prevent any theoretical infinite loop
@@ -612,9 +612,9 @@ public class TableView : View
         }
 
         //if we have scrolled too far down
-        if (SelectedRow >= RowOffset + (Bounds.Height - headerHeight))
+        if (SelectedRow >= RowOffset + (Viewport.Height - headerHeight))
         {
-            RowOffset = SelectedRow - (Bounds.Height - headerHeight) + 1;
+            RowOffset = SelectedRow - (Viewport.Height - headerHeight) + 1;
         }
 
         //if we have scrolled too far up
@@ -896,9 +896,9 @@ public class TableView : View
     }
 
     ///<inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
-        base.OnDrawContent (contentArea);
+        base.OnDrawContent (viewport);
 
         Move (0, 0);
 
@@ -906,12 +906,12 @@ public class TableView : View
         scrollLeftPoint = null;
 
         // What columns to render at what X offset in viewport
-        ColumnToRender [] columnsToRender = CalculateViewport (Bounds).ToArray ();
+        ColumnToRender [] columnsToRender = CalculateViewport (Viewport).ToArray ();
 
         Driver.SetAttribute (GetNormalColor ());
 
         //invalidate current row (prevents scrolling around leaving old characters in the frame
-        Driver.AddStr (new string (' ', Bounds.Width));
+        Driver.AddStr (new string (' ', Viewport.Width));
 
         var line = 0;
 
@@ -925,7 +925,7 @@ public class TableView : View
             */
             if (Style.ShowHorizontalHeaderOverline)
             {
-                RenderHeaderOverline (line, Bounds.Width, columnsToRender);
+                RenderHeaderOverline (line, Viewport.Width, columnsToRender);
                 line++;
             }
 
@@ -937,7 +937,7 @@ public class TableView : View
 
             if (Style.ShowHorizontalHeaderUnderline)
             {
-                RenderHeaderUnderline (line, Bounds.Width, columnsToRender);
+                RenderHeaderUnderline (line, Viewport.Width, columnsToRender);
                 line++;
             }
         }
@@ -945,9 +945,9 @@ public class TableView : View
         int headerLinesConsumed = line;
 
         //render the cells
-        for (; line < Bounds.Height; line++)
+        for (; line < Viewport.Height; line++)
         {
-            ClearLine (line, Bounds.Width);
+            ClearLine (line, Viewport.Width);
 
             //work out what Row to render
             int rowToRender = RowOffset + (line - headerLinesConsumed);
@@ -963,7 +963,7 @@ public class TableView : View
             {
                 if (rowToRender == Table.Rows && Style.ShowHorizontalBottomline)
                 {
-                    RenderBottomLine (line, Bounds.Width, columnsToRender);
+                    RenderBottomLine (line, Viewport.Width, columnsToRender);
                 }
 
                 continue;
@@ -1001,7 +1001,7 @@ public class TableView : View
     /// <param name="extend">true to extend the current selection (if any) instead of replacing</param>
     public void PageDown (bool extend)
     {
-        ChangeSelectionByOffset (0, Bounds.Height - GetHeaderHeightIfAny (), extend);
+        ChangeSelectionByOffset (0, Viewport.Height - GetHeaderHeightIfAny (), extend);
         Update ();
     }
 
@@ -1009,7 +1009,7 @@ public class TableView : View
     /// <param name="extend">true to extend the current selection (if any) instead of replacing</param>
     public void PageUp (bool extend)
     {
-        ChangeSelectionByOffset (0, -(Bounds.Height - GetHeaderHeightIfAny ()), extend);
+        ChangeSelectionByOffset (0, -(Viewport.Height - GetHeaderHeightIfAny ()), extend);
         Update ();
     }
 
@@ -1073,7 +1073,7 @@ public class TableView : View
             return null;
         }
 
-        IEnumerable<ColumnToRender> viewPort = CalculateViewport (Bounds);
+        IEnumerable<ColumnToRender> viewPort = CalculateViewport (Viewport);
 
         int headerHeight = GetHeaderHeightIfAny ();
 
@@ -1658,7 +1658,7 @@ public class TableView : View
         // Renders something like:
         // │ArithmeticComparator│chi       │Healthboard│Interpretation│Labnumber│
 
-        ClearLine (row, Bounds.Width);
+        ClearLine (row, Viewport.Width);
 
         //render start of line
         if (style.ShowVerticalHeaderLines)
@@ -1688,7 +1688,7 @@ public class TableView : View
         //render end of line
         if (style.ShowVerticalHeaderLines)
         {
-            AddRune (Bounds.Width - 1, row, Glyphs.VLine);
+            AddRune (Viewport.Width - 1, row, Glyphs.VLine);
         }
     }
 
@@ -1846,7 +1846,7 @@ public class TableView : View
         }
 
         Driver.SetAttribute (color);
-        Driver.AddStr (new string (' ', Bounds.Width));
+        Driver.AddStr (new string (' ', Viewport.Width));
 
         // Render cells for each visible header for the current row
         for (var i = 0; i < columnsToRender.Length; i++)
@@ -1955,7 +1955,7 @@ public class TableView : View
 
             //render start and end of line
             AddRune (0, row, Glyphs.VLine);
-            AddRune (Bounds.Width - 1, row, Glyphs.VLine);
+            AddRune (Viewport.Width - 1, row, Glyphs.VLine);
         }
     }
 

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

@@ -973,7 +973,7 @@ public class TextField : View
     }
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         _isDrawing = true;
 
@@ -1196,8 +1196,8 @@ public class TextField : View
 
         int pos = _cursorPosition - ScrollOffset + Math.Min (Frame.X, 0);
         int offB = OffSetBackground ();
-        Rectangle containerFrame = SuperView?.BoundsToScreen (SuperView.Bounds) ?? default (Rectangle);
-        Rectangle thisFrame = BoundsToScreen (Bounds);
+        Rectangle containerFrame = SuperView?.ViewportToScreen (SuperView.Viewport) ?? default (Rectangle);
+        Rectangle thisFrame = ViewportToScreen (Viewport);
 
         if (pos > -1
             && col >= pos
@@ -1746,7 +1746,7 @@ public class TextField : View
         }
     }
 
-    // BUGBUG: This assumes Frame == Bounds. It's also not clear what the intention is. For now, changed to always return 0.
+    // BUGBUG: This assumes Frame == Viewport. It's also not clear what the intention is. For now, changed to always return 0.
     private int OffSetBackground ()
     {
         var offB = 0;
@@ -1878,9 +1878,9 @@ public class TextField : View
         Move (0, 0);
         string render = Caption;
 
-        if (render.GetColumns () > Bounds.Width)
+        if (render.GetColumns () > Viewport.Width)
         {
-            render = render [..Bounds.Width];
+            render = render [..Viewport.Width];
         }
 
         Driver.AddStr (render);
@@ -1941,9 +1941,9 @@ public class TextField : View
     {
         _cursorPosition = Text.GetRuneCount ();
 
-        if (Bounds.Width > 0)
+        if (Viewport.Width > 0)
         {
-            ScrollOffset = _cursorPosition > Bounds.Width + 1 ? _cursorPosition - Bounds.Width + 1 : 0;
+            ScrollOffset = _cursorPosition > Viewport.Width + 1 ? _cursorPosition - Viewport.Width + 1 : 0;
         }
 
         Autocomplete.HostControl = this;

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

@@ -537,7 +537,7 @@ namespace Terminal.Gui
         {
             if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Pressed))
             {
-                int c = _provider.Cursor (mouseEvent.X - GetMargins (Bounds.Width).left);
+                int c = _provider.Cursor (mouseEvent.X - GetMargins (Viewport.Width).left);
 
                 if (_provider.Fixed == false && TextAlignment == TextAlignment.Right && Text.Length > 0)
                 {
@@ -555,7 +555,7 @@ namespace Terminal.Gui
         }
 
         /// <inheritdoc/>
-        public override void OnDrawContent (Rectangle contentArea)
+        public override void OnDrawContent (Rectangle viewport)
         {
             if (_provider is null)
             {
@@ -568,7 +568,7 @@ namespace Terminal.Gui
             Color bgcolor = !IsValid ? new Color (Color.BrightRed) : ColorScheme.Focus.Background;
             var textColor = new Attribute (ColorScheme.Focus.Foreground, bgcolor);
 
-            (int margin_left, int margin_right) = GetMargins (Bounds.Width);
+            (int margin_left, int margin_right) = GetMargins (Viewport.Width);
 
             Move (0, 0);
 
@@ -642,7 +642,7 @@ namespace Terminal.Gui
         /// <inheritdoc/>
         public override void PositionCursor ()
         {
-            (int left, _) = GetMargins (Bounds.Width);
+            (int left, _) = GetMargins (Viewport.Width);
 
             // Fixed = true, is for inputs that have fixed width, like masked ones.
             // Fixed = false, is for normal input.
@@ -660,7 +660,7 @@ namespace Terminal.Gui
                 Move (curPos, 0);
             }
 
-            if (curPos < 0 || curPos >= Bounds.Width)
+            if (curPos < 0 || curPos >= Viewport.Width)
             {
                 Application.Driver.SetCursorVisibility (CursorVisibility.Invisible);
             }

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

@@ -3586,7 +3586,7 @@ public class TextView : View
     }
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         _isDrawing = true;
 
@@ -3649,7 +3649,7 @@ public class TextView : View
                     AddRune (col, row, rune);
                 }
 
-                if (!TextModel.SetCol (ref col, contentArea.Right, cols))
+                if (!TextModel.SetCol (ref col, viewport.Right, cols))
                 {
                     break;
                 }
@@ -3672,7 +3672,7 @@ public class TextView : View
         if (row < bottom)
         {
             SetNormalColor ();
-            ClearRegion (contentArea.Left, row, right, bottom);
+            ClearRegion (viewport.Left, row, right, bottom);
         }
 
         PositionCursor ();

+ 42 - 42
Terminal.Gui/Views/TileView.cs

@@ -156,19 +156,19 @@ public class TileView : View
             return;
         }
 
-        Rectangle contentArea = Bounds;
+        Rectangle viewport = Viewport;
 
         if (HasBorder ())
         {
-            contentArea = new (
-                               contentArea.X + 1,
-                               contentArea.Y + 1,
-                               Math.Max (0, contentArea.Width - 2),
-                               Math.Max (0, contentArea.Height - 2)
-                              );
+            viewport = new (
+                            viewport.X + 1,
+                            viewport.Y + 1,
+                            Math.Max (0, viewport.Width - 2),
+                            Math.Max (0, viewport.Height - 2)
+                           );
         }
 
-        Setup (contentArea);
+        Setup (viewport);
         base.LayoutSubviews ();
     }
 
@@ -179,12 +179,12 @@ public class TileView : View
     public override bool OnDrawAdornments () { return false; }
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         Driver.SetAttribute (ColorScheme.Normal);
-        Clear (contentArea);
+        Clear (viewport);
 
-        base.OnDrawContent (contentArea);
+        base.OnDrawContent (viewport);
 
         var lc = new LineCanvas ();
 
@@ -195,19 +195,19 @@ public class TileView : View
         {
             if (HasBorder ())
             {
-                lc.AddLine (Point.Empty, Bounds.Width, Orientation.Horizontal, LineStyle);
-                lc.AddLine (Point.Empty, Bounds.Height, Orientation.Vertical, LineStyle);
+                lc.AddLine (Point.Empty, Viewport.Width, Orientation.Horizontal, LineStyle);
+                lc.AddLine (Point.Empty, Viewport.Height, Orientation.Vertical, LineStyle);
 
                 lc.AddLine (
-                            new Point (Bounds.Width - 1, Bounds.Height - 1),
-                            -Bounds.Width,
+                            new Point (Viewport.Width - 1, Viewport.Height - 1),
+                            -Viewport.Width,
                             Orientation.Horizontal,
                             LineStyle
                            );
 
                 lc.AddLine (
-                            new Point (Bounds.Width - 1, Bounds.Height - 1),
-                            -Bounds.Height,
+                            new Point (Viewport.Width - 1, Viewport.Height - 1),
+                            -Viewport.Height,
                             Orientation.Vertical,
                             LineStyle
                            );
@@ -217,7 +217,7 @@ public class TileView : View
             {
                 bool isRoot = _splitterLines.Contains (line);
 
-                Rectangle screen = line.BoundsToScreen (Rectangle.Empty);
+                Rectangle screen = line.ViewportToScreen (Rectangle.Empty);
                 Point origin = ScreenToFrame (screen.X, screen.Y);
                 int length = line.Orientation == Orientation.Horizontal ? line.Frame.Width : line.Frame.Height;
 
@@ -241,7 +241,7 @@ public class TileView : View
 
         Driver.SetAttribute (ColorScheme.Normal);
 
-        foreach (KeyValuePair<Point, Rune> p in lc.GetMap (Bounds))
+        foreach (KeyValuePair<Point, Rune> p in lc.GetMap (Viewport))
         {
             AddRune (p.Key.X, p.Key.Y, p.Value);
         }
@@ -423,7 +423,7 @@ public class TileView : View
                                         );
         }
 
-        int fullSpace = _orientation == Orientation.Vertical ? Bounds.Width : Bounds.Height;
+        int fullSpace = _orientation == Orientation.Vertical ? Viewport.Width : Viewport.Height;
 
         if (fullSpace != 0 && !IsValidNewSplitterPos (idx, value, fullSpace))
         {
@@ -758,9 +758,9 @@ public class TileView : View
         return false;
     }
 
-    private void Setup (Rectangle contentArea)
+    private void Setup (Rectangle viewport)
     {
-        if (contentArea.IsEmpty || contentArea.Height <= 0 || contentArea.Width <= 0)
+        if (viewport.IsEmpty || viewport.Height <= 0 || viewport.Width <= 0)
         {
             return;
         }
@@ -803,17 +803,17 @@ public class TileView : View
 
             if (Orientation == Orientation.Vertical)
             {
-                tile.ContentView.X = i == 0 ? contentArea.X : Pos.Right (visibleSplitterLines [i - 1]);
-                tile.ContentView.Y = contentArea.Y;
-                tile.ContentView.Height = contentArea.Height;
-                tile.ContentView.Width = GetTileWidthOrHeight (i, Bounds.Width, visibleTiles, visibleSplitterLines);
+                tile.ContentView.X = i == 0 ? viewport.X : Pos.Right (visibleSplitterLines [i - 1]);
+                tile.ContentView.Y = viewport.Y;
+                tile.ContentView.Height = viewport.Height;
+                tile.ContentView.Width = GetTileWidthOrHeight (i, Viewport.Width, visibleTiles, visibleSplitterLines);
             }
             else
             {
-                tile.ContentView.X = contentArea.X;
-                tile.ContentView.Y = i == 0 ? contentArea.Y : Pos.Bottom (visibleSplitterLines [i - 1]);
-                tile.ContentView.Width = contentArea.Width;
-                tile.ContentView.Height = GetTileWidthOrHeight (i, Bounds.Height, visibleTiles, visibleSplitterLines);
+                tile.ContentView.X = viewport.X;
+                tile.ContentView.Y = i == 0 ? viewport.Y : Pos.Bottom (visibleSplitterLines [i - 1]);
+                tile.ContentView.Width = viewport.Width;
+                tile.ContentView.Height = GetTileWidthOrHeight (i, Viewport.Height, visibleTiles, visibleSplitterLines);
             }
         }
     }
@@ -837,7 +837,7 @@ public class TileView : View
         /// </summary>
         public Point GetLocalCoordinateForTitle (TileView intoCoordinateSpace)
         {
-            Rectangle screen = Tile.ContentView.BoundsToScreen (Rectangle.Empty);
+            Rectangle screen = Tile.ContentView.ViewportToScreen (Rectangle.Empty);
             return intoCoordinateSpace.ScreenToFrame (screen.X, screen.Y - 1);
         }
 
@@ -845,7 +845,7 @@ public class TileView : View
         {
             Dim spaceDim = Tile.ContentView.Width;
 
-            int spaceAbs = spaceDim.Anchor (Parent.Bounds.Width);
+            int spaceAbs = spaceDim.Anchor (Parent.Viewport.Width);
 
             var title = $" {Tile.Title} ";
 
@@ -893,7 +893,7 @@ public class TileView : View
         {
             if (dragPosition is { } || CanFocus)
             {
-                Point location = moveRuneRenderLocation ?? new Point (Bounds.Width / 2, Bounds.Height / 2);
+                Point location = moveRuneRenderLocation ?? new Point (Viewport.Width / 2, Viewport.Height / 2);
 
                 AddRune (location.X, location.Y, Glyphs.Diamond);
             }
@@ -919,7 +919,7 @@ public class TileView : View
                     {
                         moveRuneRenderLocation = new Point (
                                                             0,
-                                                            Math.Max (1, Math.Min (Bounds.Height - 2, mouseEvent.Y))
+                                                            Math.Max (1, Math.Min (Viewport.Height - 2, mouseEvent.Y))
                                                            );
                     }
                 }
@@ -943,7 +943,7 @@ public class TileView : View
                 {
                     int dx = mouseEvent.X - dragPosition.Value.X;
                     Parent.SetSplitterPos (Idx, Offset (X, dx));
-                    moveRuneRenderLocation = new Point (0, Math.Max (1, Math.Min (Bounds.Height - 2, mouseEvent.Y)));
+                    moveRuneRenderLocation = new Point (0, Math.Max (1, Math.Min (Viewport.Height - 2, mouseEvent.Y)));
                 }
 
                 Parent.SetNeedsDisplay ();
@@ -969,9 +969,9 @@ public class TileView : View
             return false;
         }
 
-        public override void OnDrawContent (Rectangle contentArea)
+        public override void OnDrawContent (Rectangle viewport)
         {
-            base.OnDrawContent (contentArea);
+            base.OnDrawContent (viewport);
 
             DrawSplitterSymbol ();
         }
@@ -988,7 +988,7 @@ public class TileView : View
         {
             base.PositionCursor ();
 
-            Point location = moveRuneRenderLocation ?? new Point (Bounds.Width / 2, Bounds.Height / 2);
+            Point location = moveRuneRenderLocation ?? new Point (Viewport.Width / 2, Viewport.Height / 2);
             Move (location.X, location.Y);
         }
 
@@ -1032,10 +1032,10 @@ public class TileView : View
             {
                 if (Orientation == Orientation.Horizontal)
                 {
-                    return Parent.SetSplitterPos (Idx, ConvertToPosFactor (newValue, Parent.Bounds.Height));
+                    return Parent.SetSplitterPos (Idx, ConvertToPosFactor (newValue, Parent.Viewport.Height));
                 }
 
-                return Parent.SetSplitterPos (Idx, ConvertToPosFactor (newValue, Parent.Bounds.Width));
+                return Parent.SetSplitterPos (Idx, ConvertToPosFactor (newValue, Parent.Viewport.Width));
             }
 
             return Parent.SetSplitterPos (Idx, newValue);
@@ -1071,8 +1071,8 @@ public class TileView : View
         {
             int posAbsolute = pos.Anchor (
                                           Orientation == Orientation.Horizontal
-                                              ? Parent.Bounds.Height
-                                              : Parent.Bounds.Width
+                                              ? Parent.Viewport.Height
+                                              : Parent.Viewport.Width
                                          );
 
             return posAbsolute + delta;

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

@@ -249,7 +249,7 @@ public partial class Toplevel : View
     }
 
     /// <inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         if (!Visible)
         {
@@ -268,12 +268,12 @@ public partial class Toplevel : View
             {
                 foreach (Toplevel top in Application.OverlappedChildren.AsEnumerable ().Reverse ())
                 {
-                    if (top.Frame.IntersectsWith (Bounds))
+                    if (top.Frame.IntersectsWith (Viewport))
                     {
                         if (top != this && !top.IsCurrentTop && !OutsideTopFrame (top) && top.Visible)
                         {
                             top.SetNeedsLayout ();
-                            top.SetNeedsDisplay (top.Bounds);
+                            top.SetNeedsDisplay (top.Viewport);
                             top.Draw ();
                             top.OnRenderLineCanvas ();
                         }
@@ -284,20 +284,20 @@ public partial class Toplevel : View
             // This should not be here, but in base
             foreach (View view in Subviews)
             {
-                if (view.Frame.IntersectsWith (Bounds) && !OutsideTopFrame (this))
+                if (view.Frame.IntersectsWith (Viewport) && !OutsideTopFrame (this))
                 {
                     //view.SetNeedsLayout ();
-                    view.SetNeedsDisplay (view.Bounds);
+                    view.SetNeedsDisplay (view.Viewport);
                     view.SetSubViewNeedsDisplay ();
                 }
             }
 
-            base.OnDrawContent (contentArea);
+            base.OnDrawContent (viewport);
 
             // This is causing the menus drawn incorrectly if UseSubMenusSingleFrame is true
             //if (this.MenuBar is { } && this.MenuBar.IsMenuOpen && this.MenuBar.openMenu is { }) {
             //	// TODO: Hack until we can get compositing working right.
-            //	this.MenuBar.openMenu.Redraw (this.MenuBar.openMenu.Bounds);
+            //	this.MenuBar.openMenu.Redraw (this.MenuBar.openMenu.Viewport);
             //}
         }
     }

+ 14 - 14
Terminal.Gui/Views/TreeView/TreeView.cs

@@ -742,10 +742,10 @@ public class TreeView<T> : View, ITreeView where T : class
             //if user has scrolled up too far to see their selection
             ScrollOffsetVertical = idx;
         }
-        else if (idx >= ScrollOffsetVertical + Bounds.Height - leaveSpace)
+        else if (idx >= ScrollOffsetVertical + Viewport.Height - leaveSpace)
         {
             //if user has scrolled off bottom of visible tree
-            ScrollOffsetVertical = Math.Max (0, idx + 1 - (Bounds.Height - leaveSpace));
+            ScrollOffsetVertical = Math.Max (0, idx + 1 - (Viewport.Height - leaveSpace));
         }
     }
 
@@ -868,12 +868,12 @@ public class TreeView<T> : View, ITreeView where T : class
             }
 
             // If control has no height to it then there is no visible area for content
-            if (Bounds.Height == 0)
+            if (Viewport.Height == 0)
             {
                 return 0;
             }
 
-            return map.Skip (ScrollOffsetVertical).Take (Bounds.Height).Max (b => b.GetWidth (Driver));
+            return map.Skip (ScrollOffsetVertical).Take (Viewport.Height).Max (b => b.GetWidth (Driver));
         }
 
         return map.Max (b => b.GetWidth (Driver));
@@ -886,13 +886,13 @@ public class TreeView<T> : View, ITreeView where T : class
     ///     If you have screen coordinates then use <see cref="View.ScreenToFrame"/> to translate these into the client area of
     ///     the <see cref="TreeView{T}"/>.
     /// </summary>
-    /// <param name="row">The row of the <see cref="View.Bounds"/> of the <see cref="TreeView{T}"/>.</param>
+    /// <param name="row">The row of the <see cref="View.Viewport"/> of the <see cref="TreeView{T}"/>.</param>
     /// <returns>The object currently displayed on this row or null.</returns>
     public T GetObjectOnRow (int row) { return HitTest (row)?.Model; }
 
     /// <summary>
     ///     <para>
-    ///         Returns the Y coordinate within the <see cref="View.Bounds"/> of the tree at which <paramref name="toFind"/>
+    ///         Returns the Y coordinate within the <see cref="View.Viewport"/> of the tree at which <paramref name="toFind"/>
     ///         would be displayed or null if it is not currently exposed (e.g. its parent is collapsed).
     ///     </para>
     ///     <para>
@@ -967,7 +967,7 @@ public class TreeView<T> : View, ITreeView where T : class
     public void GoToEnd ()
     {
         IReadOnlyCollection<Branch<T>> map = BuildLineMap ();
-        ScrollOffsetVertical = Math.Max (0, map.Count - Bounds.Height + 1);
+        ScrollOffsetVertical = Math.Max (0, map.Count - Viewport.Height + 1);
         SelectedObject = map.LastOrDefault ()?.Model;
 
         SetNeedsDisplay ();
@@ -1129,12 +1129,12 @@ public class TreeView<T> : View, ITreeView where T : class
     /// <summary>Moves the selection down by the height of the control (1 page).</summary>
     /// <param name="expandSelection">True if the navigation should add the covered nodes to the selected current selection.</param>
     /// <exception cref="NotImplementedException"></exception>
-    public void MovePageDown (bool expandSelection = false) { AdjustSelection (Bounds.Height, expandSelection); }
+    public void MovePageDown (bool expandSelection = false) { AdjustSelection (Viewport.Height, expandSelection); }
 
     /// <summary>Moves the selection up by the height of the control (1 page).</summary>
     /// <param name="expandSelection">True if the navigation should add the covered nodes to the selected current selection.</param>
     /// <exception cref="NotImplementedException"></exception>
-    public void MovePageUp (bool expandSelection = false) { AdjustSelection (-Bounds.Height, expandSelection); }
+    public void MovePageUp (bool expandSelection = false) { AdjustSelection (-Viewport.Height, expandSelection); }
 
     /// <summary>
     ///     This event is raised when an object is activated e.g. by double clicking or pressing
@@ -1143,7 +1143,7 @@ public class TreeView<T> : View, ITreeView where T : class
     public event EventHandler<ObjectActivatedEventArgs<T>> ObjectActivated;
 
     ///<inheritdoc/>
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
         if (roots is null)
         {
@@ -1160,7 +1160,7 @@ public class TreeView<T> : View, ITreeView where T : class
 
         IReadOnlyCollection<Branch<T>> map = BuildLineMap ();
 
-        for (var line = 0; line < Bounds.Height; line++)
+        for (var line = 0; line < Viewport.Height; line++)
         {
             int idxToRender = ScrollOffsetVertical + line;
 
@@ -1168,14 +1168,14 @@ public class TreeView<T> : View, ITreeView where T : class
             if (idxToRender < map.Count)
             {
                 // Render the line
-                map.ElementAt (idxToRender).Draw (Driver, ColorScheme, line, Bounds.Width);
+                map.ElementAt (idxToRender).Draw (Driver, ColorScheme, line, Viewport.Width);
             }
             else
             {
                 // Else clear the line to prevent stale symbols due to scrolling etc
                 Move (0, line);
                 Driver.SetAttribute (GetNormalColor ());
-                Driver.AddStr (new string (' ', Bounds.Width));
+                Driver.AddStr (new string (' ', Viewport.Width));
             }
         }
     }
@@ -1247,7 +1247,7 @@ public class TreeView<T> : View, ITreeView where T : class
             int idx = map.IndexOf (b => b.Model.Equals (SelectedObject));
 
             // if currently selected line is visible
-            if (idx - ScrollOffsetVertical >= 0 && idx - ScrollOffsetVertical < Bounds.Height)
+            if (idx - ScrollOffsetVertical >= 0 && idx - ScrollOffsetVertical < Viewport.Height)
             {
                 Move (0, idx - ScrollOffsetVertical);
             }

+ 2 - 2
UICatalog/Scenarios/ASCIICustomButton.cs

@@ -79,14 +79,14 @@ public class ASCIICustomButtonTest : Scenario
 
             var fillText = new StringBuilder ();
 
-            for (var i = 0; i < Bounds.Height; i++)
+            for (var i = 0; i < Viewport.Height; i++)
             {
                 if (i > 0)
                 {
                     fillText.AppendLine ("");
                 }
 
-                for (var j = 0; j < Bounds.Width; j++)
+                for (var j = 0; j < Viewport.Width; j++)
                 {
                     fillText.Append ("█");
                 }

+ 5 - 5
UICatalog/Scenarios/Animation.cs

@@ -163,16 +163,16 @@ public class Animation : Scenario
         private Rectangle oldSize = Rectangle.Empty;
         public void NextFrame () { currentFrame = (currentFrame + 1) % frameCount; }
 
-        public override void OnDrawContent (Rectangle contentArea)
+        public override void OnDrawContent (Rectangle viewport)
         {
-            base.OnDrawContent (contentArea);
+            base.OnDrawContent (viewport);
 
-            if (oldSize != Bounds)
+            if (oldSize != Viewport)
             {
                 // Invalidate cached images now size has changed
                 matchSizes = new Image<Rgba32> [frameCount];
                 brailleCache = new string [frameCount];
-                oldSize = Bounds;
+                oldSize = Viewport;
             }
 
             Image<Rgba32> imgScaled = matchSizes [currentFrame];
@@ -183,7 +183,7 @@ public class Animation : Scenario
                 Image<Rgba32> imgFull = fullResImages [currentFrame];
 
                 // keep aspect ratio
-                int newSize = Math.Min (Bounds.Width, Bounds.Height);
+                int newSize = Math.Min (Viewport.Width, Viewport.Height);
 
                 // generate one
                 matchSizes [currentFrame] = imgScaled = imgFull.Clone (

+ 1 - 1
UICatalog/Scenarios/BackgroundWorkerCollection.cs

@@ -285,7 +285,7 @@ public class BackgroundWorkerCollection : Scenario
             LayoutStarted += (s, e) =>
                              {
                                  int btnsWidth = _start.Frame.Width + _close.Frame.Width + 2 - 1;
-                                 int shiftLeft = Math.Max ((Bounds.Width - btnsWidth) / 2 - 2, 0);
+                                 int shiftLeft = Math.Max ((Viewport.Width - btnsWidth) / 2 - 2, 0);
 
                                  shiftLeft += _close.Frame.Width + 1;
                                  _close.X = Pos.AnchorEnd (shiftLeft);

+ 1 - 1
UICatalog/Scenarios/Buttons.cs

@@ -48,7 +48,7 @@ public class Buttons : Scenario
 
         View prev = colorButtonsLabel;
 
-        //With this method there is no need to call Application.TopReady += () => Application.TopRedraw (Top.Bounds);
+        //With this method there is no need to call Application.TopReady += () => Application.TopRedraw (Top.Viewport);
         Pos x = Pos.Right (colorButtonsLabel) + 2;
 
         foreach (KeyValuePair<string, ColorScheme> colorScheme in Colors.ColorSchemes)

+ 15 - 15
UICatalog/Scenarios/CharacterMap.cs

@@ -374,7 +374,7 @@ internal class CharMap : ScrollView
                     Command.PageUp,
                     () =>
                     {
-                        int page = (Bounds.Height / _rowHeight - 1) * 16;
+                        int page = (Viewport.Height / _rowHeight - 1) * 16;
                         SelectedCodePoint -= Math.Min (page, SelectedCodePoint);
 
                         return true;
@@ -385,7 +385,7 @@ internal class CharMap : ScrollView
                     Command.PageDown,
                     () =>
                     {
-                        int page = (Bounds.Height / _rowHeight - 1) * 16;
+                        int page = (Viewport.Height / _rowHeight - 1) * 16;
                         SelectedCodePoint += Math.Min (page, MaxCodePoint - SelectedCodePoint);
 
                         return true;
@@ -458,7 +458,7 @@ internal class CharMap : ScrollView
                 int row = SelectedCodePoint / 16 * _rowHeight;
                 int col = SelectedCodePoint % 16 * COLUMN_WIDTH;
 
-                int height = Bounds.Height - (ShowHorizontalScrollIndicator ? 2 : 1);
+                int height = Viewport.Height - (ShowHorizontalScrollIndicator ? 2 : 1);
 
                 if (row + ContentOffset.Y < 0)
                 {
@@ -474,7 +474,7 @@ internal class CharMap : ScrollView
                                         );
                 }
 
-                int width = Bounds.Width / COLUMN_WIDTH * COLUMN_WIDTH - (ShowVerticalScrollIndicator ? RowLabelWidth + 1 : RowLabelWidth);
+                int width = Viewport.Width / COLUMN_WIDTH * COLUMN_WIDTH - (ShowVerticalScrollIndicator ? RowLabelWidth + 1 : RowLabelWidth);
 
                 if (col + ContentOffset.X < 0)
                 {
@@ -525,9 +525,9 @@ internal class CharMap : ScrollView
     private static int RowWidth => RowLabelWidth + COLUMN_WIDTH * 16;
     public event EventHandler<ListViewItemEventArgs> Hover;
 
-    public override void OnDrawContent (Rectangle contentArea)
+    public override void OnDrawContent (Rectangle viewport)
     {
-        if (contentArea.Height == 0 || contentArea.Width == 0)
+        if (viewport.Height == 0 || viewport.Width == 0)
         {
             return;
         }
@@ -535,17 +535,17 @@ internal class CharMap : ScrollView
         // Call the base (ScrollView) to draw the scrollbars. Do this ahead of our own drawing so that
         // any wide or tall glyphs actually render over the scrollbars (on platforms like Windows Terminal) that 
         // does this correctly.
-        base.OnDrawContent (contentArea);
+        base.OnDrawContent (viewport);
 
-        Rectangle viewport = new (
+        Rectangle viewportOffset = new (
                                   ContentOffset,
                                   new (
-                                       Math.Max (Bounds.Width - (ShowVerticalScrollIndicator ? 1 : 0), 0),
-                                       Math.Max (Bounds.Height - (ShowHorizontalScrollIndicator ? 1 : 0), 0)
+                                       Math.Max (Viewport.Width - (ShowVerticalScrollIndicator ? 1 : 0), 0),
+                                       Math.Max (Viewport.Height - (ShowHorizontalScrollIndicator ? 1 : 0), 0)
                                       )
                                  );
 
-        Rectangle oldClip = ClipToBounds ();
+        Rectangle oldClip = ClipToViewport ();
 
         if (ShowHorizontalScrollIndicator)
         {
@@ -587,11 +587,11 @@ internal class CharMap : ScrollView
             }
         }
 
-        int firstColumnX = viewport.X + RowLabelWidth;
+        int firstColumnX = viewportOffset.X + RowLabelWidth;
 
         // Even though the Clip is set to prevent us from drawing on the row potentially occupied by the horizontal
         // scroll bar, we do the smart thing and not actually draw that row if not necessary.
-        for (var y = 1; y < Bounds.Height - (ShowHorizontalScrollIndicator ? 1 : 0); y++)
+        for (var y = 1; y < Viewport.Height - (ShowHorizontalScrollIndicator ? 1 : 0); y++)
         {
             // What row is this?
             int row = (y - ContentOffset.Y - 1) / _rowHeight;
@@ -720,9 +720,9 @@ internal class CharMap : ScrollView
     {
         if (HasFocus
             && Cursor.X >= RowLabelWidth
-            && Cursor.X < Bounds.Width - (ShowVerticalScrollIndicator ? 1 : 0)
+            && Cursor.X < Viewport.Width - (ShowVerticalScrollIndicator ? 1 : 0)
             && Cursor.Y > 0
-            && Cursor.Y < Bounds.Height - (ShowHorizontalScrollIndicator ? 1 : 0))
+            && Cursor.Y < Viewport.Height - (ShowHorizontalScrollIndicator ? 1 : 0))
         {
             Driver.SetCursorVisibility (_cursor);
             Move (Cursor.X, Cursor.Y);

+ 4 - 4
UICatalog/Scenarios/ComputedLayout.cs

@@ -56,12 +56,12 @@ public class ComputedLayout : Scenario
         Application.Top.LayoutComplete += (s, a) =>
                                           {
                                               horizontalRuler.Text =
-                                                  rule.Repeat ((int)Math.Ceiling (horizontalRuler.Bounds.Width / (double)rule.Length)) [
-                                                   ..horizontalRuler.Bounds.Width];
+                                                  rule.Repeat ((int)Math.Ceiling (horizontalRuler.Viewport.Width / (double)rule.Length)) [
+                                                   ..horizontalRuler.Viewport.Width];
 
                                               verticalRuler.Text =
-                                                  vrule.Repeat ((int)Math.Ceiling (verticalRuler.Bounds.Height * 2 / (double)rule.Length))
-                                                      [..(verticalRuler.Bounds.Height * 2)];
+                                                  vrule.Repeat ((int)Math.Ceiling (verticalRuler.Viewport.Height * 2 / (double)rule.Length))
+                                                      [..(verticalRuler.Viewport.Height * 2)];
                                           };
 
         Application.Top.Add (verticalRuler);

+ 2 - 2
UICatalog/Scenarios/Editor.cs

@@ -758,8 +758,8 @@ public class Editor : Scenario
         _winDialog = new Window
         {
             Title = isFind ? "Find" : "Replace",
-            X = Win.Bounds.Width / 2 - 30,
-            Y = Win.Bounds.Height / 2 - 10,
+            X = Win.Viewport.Width / 2 - 30,
+            Y = Win.Viewport.Height / 2 - 10,
             ColorScheme = Colors.ColorSchemes ["TopLevel"]
         };
 

+ 2 - 2
UICatalog/Scenarios/GraphViewExample.cs

@@ -254,7 +254,7 @@ public class GraphViewExample : Scenario
 
         _graphView.AxisY.Minimum = 0;
 
-        var legend = new LegendAnnotation (new Rectangle (_graphView.Bounds.Width - 20, 0, 20, 5));
+        var legend = new LegendAnnotation (new Rectangle (_graphView.Viewport.Width - 20, 0, 20, 5));
 
         legend.AddEntry (
                          new GraphCellToRender (stiple, series.SubSeries.ElementAt (0).OverrideBarColor),
@@ -872,7 +872,7 @@ public class GraphViewExample : Scenario
         _graphView.Annotations.Add (new TextAnnotation { Text = "M", ScreenPosition = new Point (0, 10) });
 
         _graphView.Annotations.Add (
-                                    new TextAnnotation { Text = "F", ScreenPosition = new Point (_graphView.Bounds.Width - 1, 10) }
+                                    new TextAnnotation { Text = "F", ScreenPosition = new Point (_graphView.Viewport.Width - 1, 10) }
                                    );
 
         _graphView.SetNeedsDisplay ();

+ 2 - 2
UICatalog/Scenarios/LineDrawing.cs

@@ -36,9 +36,9 @@ public class LineDrawing : Scenario
         public DrawingArea () { AddLayer (); }
         public LineStyle LineStyle { get; set; }
 
-        public override void OnDrawContentComplete (Rectangle contentArea)
+        public override void OnDrawContentComplete (Rectangle viewport)
         {
-            base.OnDrawContentComplete (contentArea);
+            base.OnDrawContentComplete (viewport);
 
             foreach (LineCanvas canvas in _layers)
             {

+ 1 - 1
UICatalog/Scenarios/Notepad.cs

@@ -350,7 +350,7 @@ public class Notepad : Scenario
                                     );
         }
 
-        Rectangle screen = ((View)sender).BoundsToScreen (new (e.MouseEvent.X, e.MouseEvent.Y, 0, 0));
+        Rectangle screen = ((View)sender).ViewportToScreen (new (e.MouseEvent.X, e.MouseEvent.Y, 0, 0));
 
         var contextMenu = new ContextMenu { Position = screen.Location, MenuItems = items };
 

+ 1 - 1
UICatalog/Scenarios/ProgressBarStyles.cs

@@ -70,7 +70,7 @@ public class ProgressBarStyles : Scenario
                                          dialog.X = pbList.Frame.X;
                                          dialog.Y = pbList.Frame.Height;
 
-                                         dialog.Bounds = new Rectangle (0, 0, colorPicker.Frame.Width, colorPicker.Frame.Height);
+                                         dialog.Viewport = new Rectangle (0, 0, colorPicker.Frame.Width, colorPicker.Frame.Height);
 
                                          Application.Top.LayoutSubviews ();
                                      };

+ 6 - 6
UICatalog/Scenarios/Scrolling.cs

@@ -67,17 +67,17 @@ public class Scrolling : Scenario
         void Top_Loaded (object sender, EventArgs args)
         {
             horizontalRuler.Text =
-                rule.Repeat ((int)Math.Ceiling (horizontalRuler.Bounds.Width / (double)rule.Length)) [
-                                                                                                      ..horizontalRuler.Bounds.Width]
+                rule.Repeat ((int)Math.Ceiling (horizontalRuler.Viewport.Width / (double)rule.Length)) [
+                                                                                                      ..horizontalRuler.Viewport.Width]
                 + "\n"
                 + "|         ".Repeat (
-                                       (int)Math.Ceiling (horizontalRuler.Bounds.Width / (double)rule.Length)
+                                       (int)Math.Ceiling (horizontalRuler.Viewport.Width / (double)rule.Length)
                                       ) [
-                                         ..horizontalRuler.Bounds.Width];
+                                         ..horizontalRuler.Viewport.Width];
 
             verticalRuler.Text =
-                vrule.Repeat ((int)Math.Ceiling (verticalRuler.Bounds.Height * 2 / (double)rule.Length))
-                    [..(verticalRuler.Bounds.Height * 2)];
+                vrule.Repeat ((int)Math.Ceiling (verticalRuler.Viewport.Height * 2 / (double)rule.Length))
+                    [..(verticalRuler.Viewport.Height * 2)];
             Application.Top.Loaded -= Top_Loaded;
         }
 

+ 4 - 4
UICatalog/Scenarios/Snake.cs

@@ -309,12 +309,12 @@ public class Snake : Scenario
 
         public SnakeState State { get; }
 
-        public override void OnDrawContent (Rectangle contentArea)
+        public override void OnDrawContent (Rectangle viewport)
         {
-            base.OnDrawContent (contentArea);
+            base.OnDrawContent (viewport);
 
             Driver.SetAttribute (white);
-            Clear (contentArea);
+            Clear (viewport);
 
             var canvas = new LineCanvas ();
 
@@ -341,7 +341,7 @@ public class Snake : Scenario
                                );
             }
 
-            foreach (KeyValuePair<Point, Rune> p in canvas.GetMap (Bounds))
+            foreach (KeyValuePair<Point, Rune> p in canvas.GetMap (Viewport))
             {
                 AddRune (p.Key.X, p.Key.Y, p.Value);
             }

+ 8 - 8
UICatalog/Scenarios/ViewExperiments.cs

@@ -217,18 +217,18 @@ public class ViewExperiments : Scenario
                                    containerLabel.Text =
                                        $"Container.Frame: {
                                            Application.Top.Frame
-                                       } .Bounds: {
-                                           Application.Top.Bounds
+                                       } .Viewport: {
+                                           Application.Top.Viewport
                                        }\nView.Frame: {
                                            view.Frame
-                                       } .Bounds: {
-                                           view.Bounds
-                                       } .BoundsOffset: {
-                                           view.GetBoundsOffset ()
+                                       } .Viewport: {
+                                           view.Viewport
+                                       } .viewportOffset: {
+                                           view.GetViewportOffset ()
                                        }\n .Padding.Frame: {
                                            view.Padding.Frame
-                                       } .Padding.Bounds: {
-                                           view.Padding.Bounds
+                                       } .Padding.Viewport: {
+                                           view.Padding.Viewport
                                        }";
                                };
 

+ 6 - 6
UICatalog/Scenarios/VkeyPacketSimulator.cs

@@ -265,20 +265,20 @@ public class VkeyPacketSimulator : Scenario
             inputHorizontalRuler.Text = outputHorizontalRuler.Text =
                                             ruler.Repeat (
                                                           (int)Math.Ceiling (
-                                                                             inputHorizontalRuler.Bounds.Width
+                                                                             inputHorizontalRuler.Viewport.Width
                                                                              / (double)ruler.Length
                                                                             )
                                                          ) [
-                                                            ..inputHorizontalRuler.Bounds.Width];
+                                                            ..inputHorizontalRuler.Viewport.Width];
             inputVerticalRuler.Height = tvInput.Frame.Height + 1;
 
             inputVerticalRuler.Text =
-                ruler.Repeat ((int)Math.Ceiling (inputVerticalRuler.Bounds.Height / (double)ruler.Length)) [
-                     ..inputVerticalRuler.Bounds.Height];
+                ruler.Repeat ((int)Math.Ceiling (inputVerticalRuler.Viewport.Height / (double)ruler.Length)) [
+                     ..inputVerticalRuler.Viewport.Height];
 
             outputVerticalRuler.Text =
-                ruler.Repeat ((int)Math.Ceiling (outputVerticalRuler.Bounds.Height / (double)ruler.Length)) [
-                     ..outputVerticalRuler.Bounds.Height];
+                ruler.Repeat ((int)Math.Ceiling (outputVerticalRuler.Viewport.Height / (double)ruler.Length)) [
+                     ..outputVerticalRuler.Viewport.Height];
         }
 
         Win.LayoutComplete += Win_LayoutComplete;

+ 3 - 3
UnitTests/Application/MouseTests.cs

@@ -61,7 +61,7 @@ public class MouseTests
 
     /// <summary>
     ///     Tests that the mouse coordinates passed to the focused view are correct when the mouse is clicked. No adornments;
-    ///     Frame == Bounds
+    ///     Frame == Viewport
     /// </summary>
     [Theory]
     [AutoInitShutdown]
@@ -134,7 +134,7 @@ public class MouseTests
 
     /// <summary>
     ///     Tests that the mouse coordinates passed to the focused view are correct when the mouse is clicked. With
-    ///     Frames; Frame != Bounds
+    ///     Frames; Frame != Viewport
     /// </summary>
     [AutoInitShutdown]
     [Theory]
@@ -206,7 +206,7 @@ public class MouseTests
 
         var view = new View { X = pos.X, Y = pos.Y, Width = size.Width, Height = size.Height };
 
-        // Give the view a border. With PR #2920, mouse clicks are only passed if they are inside the view's Bounds.
+        // Give the view a border. With PR #2920, mouse clicks are only passed if they are inside the view's Viewport.
         view.BorderStyle = LineStyle.Single;
         view.CanFocus = true;
 

+ 26 - 26
UnitTests/Drawing/LineCanvasTests.cs

@@ -293,7 +293,7 @@ public class LineCanvasTests
         View v = GetCanvas (out LineCanvas lc);
         v.Width = 10;
         v.Height = 10;
-        v.Bounds = new Rectangle (0, 0, 10, 10);
+        v.Viewport = new Rectangle (0, 0, 10, 10);
 
         lc.AddLine (new Point (x1, y1), len1, o1, s1);
         lc.AddLine (new Point (x2, y2), len2, o2, s2);
@@ -366,7 +366,7 @@ public class LineCanvasTests
                 )]
     [Theory]
     [SetupFakeDriver]
-    public void Bounds_H_And_V_Lines_Both_Positive (
+    public void Viewport_H_And_V_Lines_Both_Positive (
         int x,
         int y,
         int length,
@@ -380,7 +380,7 @@ public class LineCanvasTests
         canvas.AddLine (new Point (x, y), length, Orientation.Horizontal, LineStyle.Single);
         canvas.AddLine (new Point (x, y), length, Orientation.Vertical, LineStyle.Single);
 
-        Assert.Equal (new Rectangle (expectedX, expectedY, expectedWidth, expectedHeight), canvas.Bounds);
+        Assert.Equal (new Rectangle (expectedX, expectedY, expectedWidth, expectedHeight), canvas.Viewport);
     }
 
     [InlineData (
@@ -448,7 +448,7 @@ public class LineCanvasTests
                 )]
     [Theory]
     [SetupFakeDriver]
-    public void Bounds_H_Line (
+    public void Viewport_H_Line (
         int x,
         int y,
         int length,
@@ -461,12 +461,12 @@ public class LineCanvasTests
         var canvas = new LineCanvas ();
         canvas.AddLine (new Point (x, y), length, Orientation.Horizontal, LineStyle.Single);
 
-        Assert.Equal (new Rectangle (expectedX, expectedY, expectedWidth, expectedHeight), canvas.Bounds);
+        Assert.Equal (new Rectangle (expectedX, expectedY, expectedWidth, expectedHeight), canvas.Viewport);
     }
 
     [Fact]
     [SetupFakeDriver]
-    public void Bounds_Specific ()
+    public void Viewport_Specific ()
     {
         // Draw at 1,1 within client area of View (i.e. leave a top and left margin of 1)
         // This proves we aren't drawing excess above
@@ -483,27 +483,27 @@ public class LineCanvasTests
 
         // Add a short horiz line for ╔╡
         lc.AddLine (new Point (x, y), 2, Orientation.Horizontal, LineStyle.Double);
-        Assert.Equal (new Rectangle (x, y, 2, 1), lc.Bounds);
+        Assert.Equal (new Rectangle (x, y, 2, 1), lc.Viewport);
 
         //LHS line down
         lc.AddLine (new Point (x, y), height, Orientation.Vertical, LineStyle.Double);
-        Assert.Equal (new Rectangle (x, y, 2, 2), lc.Bounds);
+        Assert.Equal (new Rectangle (x, y, 2, 2), lc.Viewport);
 
         //Vertical line before Title, results in a ╡
         lc.AddLine (new Point (x + 1, y), 0, Orientation.Vertical, LineStyle.Single);
-        Assert.Equal (new Rectangle (x, y, 2, 2), lc.Bounds);
+        Assert.Equal (new Rectangle (x, y, 2, 2), lc.Viewport);
 
         //Vertical line after Title, results in a ╞
         lc.AddLine (new Point (x + 2, y), 0, Orientation.Vertical, LineStyle.Single);
-        Assert.Equal (new Rectangle (x, y, 3, 2), lc.Bounds);
+        Assert.Equal (new Rectangle (x, y, 3, 2), lc.Viewport);
 
         // remainder of top line
         lc.AddLine (new Point (x + 2, y), width - 1, Orientation.Horizontal, LineStyle.Double);
-        Assert.Equal (new Rectangle (x, y, 4, 2), lc.Bounds);
+        Assert.Equal (new Rectangle (x, y, 4, 2), lc.Viewport);
 
         //RHS line down
         lc.AddLine (new Point (x + width, y), height, Orientation.Vertical, LineStyle.Double);
-        Assert.Equal (new Rectangle (x, y, 4, 2), lc.Bounds);
+        Assert.Equal (new Rectangle (x, y, 4, 2), lc.Viewport);
 
         TestHelpers.AssertEqual (
                                  output,
@@ -516,7 +516,7 @@ public class LineCanvasTests
 
     [Fact]
     [SetupFakeDriver]
-    public void Bounds_Specific_With_Ustring ()
+    public void Viewport_Specific_With_Ustring ()
     {
         // Draw at 1,1 within client area of View (i.e. leave a top and left margin of 1)
         // This proves we aren't drawing excess above
@@ -533,27 +533,27 @@ public class LineCanvasTests
 
         // Add a short horiz line for ╔╡
         lc.AddLine (new Point (x, y), 2, Orientation.Horizontal, LineStyle.Double);
-        Assert.Equal (new Rectangle (x, y, 2, 1), lc.Bounds);
+        Assert.Equal (new Rectangle (x, y, 2, 1), lc.Viewport);
 
         //LHS line down
         lc.AddLine (new Point (x, y), height, Orientation.Vertical, LineStyle.Double);
-        Assert.Equal (new Rectangle (x, y, 2, 2), lc.Bounds);
+        Assert.Equal (new Rectangle (x, y, 2, 2), lc.Viewport);
 
         //Vertical line before Title, results in a ╡
         lc.AddLine (new Point (x + 1, y), 0, Orientation.Vertical, LineStyle.Single);
-        Assert.Equal (new Rectangle (x, y, 2, 2), lc.Bounds);
+        Assert.Equal (new Rectangle (x, y, 2, 2), lc.Viewport);
 
         //Vertical line after Title, results in a ╞
         lc.AddLine (new Point (x + 2, y), 0, Orientation.Vertical, LineStyle.Single);
-        Assert.Equal (new Rectangle (x, y, 3, 2), lc.Bounds);
+        Assert.Equal (new Rectangle (x, y, 3, 2), lc.Viewport);
 
         // remainder of top line
         lc.AddLine (new Point (x + 2, y), width - 1, Orientation.Horizontal, LineStyle.Double);
-        Assert.Equal (new Rectangle (x, y, 4, 2), lc.Bounds);
+        Assert.Equal (new Rectangle (x, y, 4, 2), lc.Viewport);
 
         //RHS line down
         lc.AddLine (new Point (x + width, y), height, Orientation.Vertical, LineStyle.Double);
-        Assert.Equal (new Rectangle (x, y, 4, 2), lc.Bounds);
+        Assert.Equal (new Rectangle (x, y, 4, 2), lc.Viewport);
 
         TestHelpers.AssertEqual (
                                  output,
@@ -570,13 +570,13 @@ public class LineCanvasTests
     {
         var lc = new LineCanvas ();
 
-        Assert.Equal (Rectangle.Empty, lc.Bounds);
+        Assert.Equal (Rectangle.Empty, lc.Viewport);
 
         lc.AddLine (Point.Empty, 2, Orientation.Horizontal, LineStyle.Double);
-        Assert.NotEqual (Rectangle.Empty, lc.Bounds);
+        Assert.NotEqual (Rectangle.Empty, lc.Viewport);
 
         lc.Clear ();
-        Assert.Equal (Rectangle.Empty, lc.Bounds);
+        Assert.Equal (Rectangle.Empty, lc.Viewport);
     }
 
     [InlineData (0, 0, Orientation.Horizontal, "─")]
@@ -873,7 +873,7 @@ public class LineCanvasTests
         //// Left Up
         //canvas.AddLine (new Point (0, 3), -3, Orientation.Vertical, LineStyle.Single);
 
-        Assert.Equal (new Rectangle (0, 0, 2, 2), canvas.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 2, 2), canvas.Viewport);
 
         Dictionary<Point, Rune> map = canvas.GetMap ();
         Assert.Equal (2, map.Count);
@@ -990,7 +990,7 @@ public class LineCanvasTests
         View v = GetCanvas (out LineCanvas lc);
         v.Width = 10;
         v.Height = 10;
-        v.Bounds = new Rectangle (0, 0, 10, 10);
+        v.Viewport = new Rectangle (0, 0, 10, 10);
 
         lc.AddLine (new Point (x1, y1), length, o1, s1);
 
@@ -1304,7 +1304,7 @@ public class LineCanvasTests
     /// <returns></returns>
     private View GetCanvas (out LineCanvas canvas, int offsetX = 0, int offsetY = 0)
     {
-        var v = new View { Width = 10, Height = 5, Bounds = new Rectangle (0, 0, 10, 5) };
+        var v = new View { Width = 10, Height = 5, Viewport = new Rectangle (0, 0, 10, 5) };
         Application.Top.Add (v);
         Application.Begin (Application.Top);
 
@@ -1312,7 +1312,7 @@ public class LineCanvasTests
 
         v.DrawContentComplete += (s, e) =>
                                  {
-                                     v.Clear (v.Bounds);
+                                     v.Clear (v.Viewport);
 
                                      foreach (KeyValuePair<Point, Rune> p in canvasCopy.GetMap ())
                                      {

+ 2 - 2
UnitTests/Drawing/StraightLineTests.cs

@@ -309,7 +309,7 @@ public class StraightLineTests
                 )]
     [Theory]
     [SetupFakeDriver]
-    public void Bounds (
+    public void Viewport (
         Orientation orientation,
         int x,
         int y,
@@ -322,6 +322,6 @@ public class StraightLineTests
     {
         var sl = new StraightLine (new Point (x, y), length, orientation, LineStyle.Single);
 
-        Assert.Equal (new Rectangle (expectedX, expectedY, expectedWidth, expectedHeight), sl.Bounds);
+        Assert.Equal (new Rectangle (expectedX, expectedY, expectedWidth, expectedHeight), sl.Viewport);
     }
 }

+ 1 - 1
UnitTests/UICatalog/ScenarioTests.cs

@@ -254,7 +254,7 @@ public class ScenarioTests
                                                       _hostPane.Remove (_curView);
                                                       _curView.Dispose ();
                                                       _curView = null;
-                                                      _hostPane.Clear (_hostPane.Bounds);
+                                                      _hostPane.Clear (_hostPane.Viewport);
                                                   }
 
                                                   _curView = CreateClass (_viewClasses.Values.ToArray () [_classListView.SelectedItem]);

+ 22 - 22
UnitTests/View/Adornment/AdornmentTests.cs

@@ -7,7 +7,7 @@ public class AdornmentTests (ITestOutputHelper output)
     private readonly ITestOutputHelper _output = output;
 
     [Fact]
-    public void Bounds_Location_Always_Empty_Size_Correct ()
+    public void Viewport_Location_Always_Empty_Size_Correct ()
     {
         var view = new View
         {
@@ -21,28 +21,28 @@ public class AdornmentTests (ITestOutputHelper output)
         view.EndInit ();
 
         Assert.Equal (new (1, 2, 20, 20), view.Frame);
-        Assert.Equal (new (0, 0, 20, 20), view.Bounds);
+        Assert.Equal (new (0, 0, 20, 20), view.Viewport);
 
         var marginThickness = 1;
         view.Margin.Thickness = new  (marginThickness);
-        Assert.Equal (new (0, 0, 18, 18), view.Bounds);
+        Assert.Equal (new (0, 0, 18, 18), view.Viewport);
 
         var borderThickness = 2;
         view.Border.Thickness = new (borderThickness);
-        Assert.Equal (new (0, 0, 14, 14), view.Bounds);
+        Assert.Equal (new (0, 0, 14, 14), view.Viewport);
 
         var paddingThickness = 3;
         view.Padding.Thickness = new Thickness (paddingThickness);
-        Assert.Equal (new (0, 0, 8, 8), view.Bounds);
+        Assert.Equal (new (0, 0, 8, 8), view.Viewport);
 
-        Assert.Equal (new (0, 0, view.Margin.Frame.Width, view.Margin.Frame.Height), view.Margin.Bounds);
+        Assert.Equal (new (0, 0, view.Margin.Frame.Width, view.Margin.Frame.Height), view.Margin.Viewport);
 
-        Assert.Equal (new (0, 0, view.Border.Frame.Width, view.Border.Frame.Height), view.Border.Bounds);
+        Assert.Equal (new (0, 0, view.Border.Frame.Width, view.Border.Frame.Height), view.Border.Viewport);
 
-        Assert.Equal (new (0, 0, view.Padding.Frame.Width , view.Padding.Frame.Height), view.Padding.Bounds);
+        Assert.Equal (new (0, 0, view.Padding.Frame.Width , view.Padding.Frame.Height), view.Padding.Viewport);
     }
 
-    // Test that Adornment.Bounds_get override returns Frame.Size minus Thickness
+    // Test that Adornment.Viewport_get override returns Frame.Size minus Thickness
     [Theory]
     [InlineData (0, 0, 0, 0, 0)]
     [InlineData (0, 0, 0, 1, 1)]
@@ -79,7 +79,7 @@ public class AdornmentTests (ITestOutputHelper output)
     [InlineData (1, 1, 1, 4, 4)]
     [InlineData (1, 1, 1, 4, 0)]
     [InlineData (1, 1, 1, 0, 4)]
-    public void Bounds_Width_Is_Frame_Width (int thickness, int x, int y, int w, int h)
+    public void Viewport_Width_Is_Frame_Width (int thickness, int x, int y, int w, int h)
     {
         var adornment = new Adornment (null);
         adornment.Thickness = new Thickness (thickness);
@@ -87,10 +87,10 @@ public class AdornmentTests (ITestOutputHelper output)
         Assert.Equal (new Rectangle (x, y, w, h), adornment.Frame);
 
         var expectedBounds = new Rectangle (0, 0, w, h);
-        Assert.Equal (expectedBounds, adornment.Bounds);
+        Assert.Equal (expectedBounds, adornment.Viewport);
     }
 
-    // Test that Adornment.Bounds_get override uses Parent not SuperView
+    // Test that Adornment.Viewport_get override uses Parent not SuperView
     [Fact]
     public void BoundsToScreen_Uses_Parent_Not_SuperView ()
     {
@@ -100,12 +100,12 @@ public class AdornmentTests (ITestOutputHelper output)
         parent.EndInit ();
 
         Assert.Equal (new Rectangle (1, 2, 10, 10), parent.Frame);
-        Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Viewport);
         Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Margin.Frame);
-        Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Margin.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Margin.Viewport);
 
         Assert.Null (parent.Margin.SuperView);
-        Rectangle boundsAsScreen = parent.Margin.BoundsToScreen (new Rectangle (1, 2, 5, 5));
+        Rectangle boundsAsScreen = parent.Margin.ViewportToScreen (new Rectangle (1, 2, 5, 5));
         Assert.Equal (new Rectangle (2, 4, 5, 5), boundsAsScreen);
     }
 
@@ -133,7 +133,7 @@ public class AdornmentTests (ITestOutputHelper output)
         view.EndInit ();
 
         Assert.Equal (new Rectangle (1, 2, 20, 31), view.Frame);
-        Assert.Equal (new Rectangle (0, 0, 8, 19), view.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 8, 19), view.Viewport);
 
         // Margin.Frame is always the same as the view frame
         Assert.Equal (new Rectangle (0, 0, 20, 31), view.Margin.Frame);
@@ -246,9 +246,9 @@ public class AdornmentTests (ITestOutputHelper output)
         parent.EndInit ();
 
         Assert.Equal (new Rectangle (1, 2, 10, 10), parent.Frame);
-        Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Viewport);
         Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Margin.Frame);
-        Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Margin.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Margin.Viewport);
 
         Assert.Null (parent.Margin.SuperView);
         Assert.Equal (new Rectangle (1, 2, 10, 10), parent.Margin.FrameToScreen ());
@@ -281,10 +281,10 @@ public class AdornmentTests (ITestOutputHelper output)
     }
 
     [Fact]
-    public void Setting_Bounds_Throws ()
+    public void Setting_Viewport_Throws ()
     {
         var adornment = new Adornment (null);
-        Assert.Throws<InvalidOperationException> (() => adornment.Bounds = new Rectangle (1, 2, 3, 4));
+        Assert.Throws<InvalidOperationException> (() => adornment.Viewport = new Rectangle (1, 2, 3, 4));
     }
 
     [Fact]
@@ -309,11 +309,11 @@ public class AdornmentTests (ITestOutputHelper output)
         parent.EndInit ();
 
         Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Frame);
-        Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Viewport);
 
         parent.Margin.Thickness = new Thickness (1);
         Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Frame);
-        Assert.Equal (new Rectangle (0, 0, 8, 8), parent.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 8, 8), parent.Viewport);
     }
 
     [Fact]

+ 21 - 21
UnitTests/View/Adornment/ToScreenTests.cs

@@ -3,7 +3,7 @@
 namespace Terminal.Gui.ViewTests;
 
 /// <summary>
-/// Test the <see cref="Adornment.FrameToScreen"/> and <see cref="Adornment.BoundsToScreen"/> methods.
+/// Test the <see cref="Adornment.FrameToScreen"/> and <see cref="View.ViewportToScreen"/> methods.
 /// DOES NOT TEST View.xxxToScreen methods. Those are in ./View/Layout/ToScreenTests.cs
 /// </summary>
 /// <param name="output"></param>
@@ -251,9 +251,9 @@ public class AdornmentToScreenTests (ITestOutputHelper output)
         view.Frame = frame;
 
         // Act
-        var marginScreen = view.Margin.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var borderScreen = view.Border.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var paddingScreen = view.Padding.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var marginScreen = view.Margin.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var borderScreen = view.Border.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var paddingScreen = view.Padding.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, marginScreen.X);
@@ -286,15 +286,15 @@ public class AdornmentToScreenTests (ITestOutputHelper output)
         view.Margin.Thickness = new (1);
         view.Border.Thickness = new (1);
         view.Padding.Thickness = new (1);
-        // Total thickness is 3 (view.Bounds will be Frame.Width - 6)
+        // Total thickness is 3 (view.Viewport will be Frame.Width - 6)
         view.Frame = frame;
 
-        Assert.Equal(4, view.Bounds.Width);
+        Assert.Equal(4, view.Viewport.Width);
 
         // Act
-        var marginScreen = view.Margin.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var borderScreen = view.Border.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var paddingScreen = view.Padding.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var marginScreen = view.Margin.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var borderScreen = view.Border.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var paddingScreen = view.Padding.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, marginScreen.X);
@@ -338,9 +338,9 @@ public class AdornmentToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var marginScreen = view.Margin.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var borderScreen = view.Border.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var paddingScreen = view.Padding.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var marginScreen = view.Margin.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var borderScreen = view.Border.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var paddingScreen = view.Padding.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, marginScreen.X);
@@ -385,9 +385,9 @@ public class AdornmentToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var marginScreen = view.Margin.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var borderScreen = view.Border.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var paddingScreen = view.Padding.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var marginScreen = view.Margin.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var borderScreen = view.Border.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var paddingScreen = view.Padding.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, marginScreen.X);
@@ -441,9 +441,9 @@ public class AdornmentToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var marginScreen = view.Margin.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var borderScreen = view.Border.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var paddingScreen = view.Padding.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var marginScreen = view.Margin.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var borderScreen = view.Border.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var paddingScreen = view.Padding.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, marginScreen.X);
@@ -502,9 +502,9 @@ public class AdornmentToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var marginScreen = view.Margin.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var borderScreen = view.Border.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var paddingScreen = view.Padding.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var marginScreen = view.Margin.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var borderScreen = view.Border.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var paddingScreen = view.Padding.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, marginScreen.X);

+ 172 - 68
UnitTests/View/DrawTests.cs

@@ -4,18 +4,70 @@ using Xunit.Abstractions;
 
 namespace Terminal.Gui.ViewTests;
 
-[Trait("Category","Output")]
-public class DrawTests
+[Trait ("Category", "Output")]
+public class DrawTests (ITestOutputHelper output)
 {
-    private readonly ITestOutputHelper _output;
-    public DrawTests (ITestOutputHelper output) { _output = output; }
+    [Fact]
+    [SetupFakeDriver]
+    public void Move_Is_Constrained_To_Viewport ()
+    {
+        var view = new View
+        {
+            X = 1,
+            Y = 1,
+            Width = 3, Height = 3
+        };
+        view.Margin.Thickness = new Thickness (1);
+
+        // Only valid location w/in Viewport is 0, 0 (view) - 2, 2 (screen)
+
+        view.Move (0, 0);
+        Assert.Equal(new Point(2, 2), new Point (Application.Driver.Col, Application.Driver.Row));
+
+        view.Move (-1, -1);
+        Assert.Equal (new Point (2, 2), new Point (Application.Driver.Col, Application.Driver.Row));
+
+        view.Move (1, 1);
+        Assert.Equal (new Point (2, 2), new Point (Application.Driver.Col, Application.Driver.Row));
+    }
+
+    [Fact]
+    [SetupFakeDriver]
+    public void AddRune_Is_Constrained_To_Viewport ()
+    {
+        var view = new View
+        {
+            X = 1,
+            Y = 1,
+            Width = 3, Height = 3
+        };
+        view.Margin.Thickness = new Thickness (1);
+        View.Diagnostics = ViewDiagnosticFlags.Padding;
+        view.BeginInit();
+        view.EndInit();
+        view.Draw();
+
+        // Only valid location w/in Viewport is 0, 0 (view) - 2, 2 (screen)
+        Assert.Equal ((Rune)' ', Application.Driver.Contents [2, 2].Rune);
+
+        view.AddRune(0, 0, Rune.ReplacementChar);
+        Assert.Equal (Rune.ReplacementChar, Application.Driver.Contents [2, 2].Rune);
+
+        view.AddRune (-1, -1, Rune.ReplacementChar);
+        Assert.Equal ((Rune)'M', Application.Driver.Contents [1, 1].Rune);
+
+        view.AddRune (1, 1, Rune.ReplacementChar);
+        Assert.Equal ((Rune)'M', Application.Driver.Contents [3, 3].Rune);
+
+        View.Diagnostics = ViewDiagnosticFlags.Off;
+    }
 
     [Theory]
     [InlineData (0, 0, 1, 1)]
     [InlineData (0, 0, 2, 2)]
     [InlineData (-1, -1, 2, 2)]
     [SetupFakeDriver]
-    public void Clear_Bounds_Clears_Only_Bounds (int x, int y, int width, int height)
+    public void Clear_Clears_Only_Viewport (int x, int y, int width, int height)
     {
         var superView = new View { Width = Dim.Fill (), Height = Dim.Fill () };
 
@@ -32,28 +84,80 @@ public class DrawTests
         superView.LayoutSubviews ();
 
         superView.Draw ();
+        TestHelpers.AssertDriverContentsWithFrameAre (
+                                                      @"
+ ┌─┐
+ │X│
+ └─┘",
+                                                      output);
 
+        Rectangle toClear = new (x, y, width, height);
+        view.Clear (toClear);
+        TestHelpers.AssertDriverContentsWithFrameAre (
+                                                      @"
+ ┌─┐
+ │ │
+ └─┘",
+                                                      output);
+        // Now try to clear beyond Viewport (invalid)
+        superView.SetNeedsDisplay ();
+        superView.Draw ();
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
  ┌─┐
  │X│
  └─┘",
-                                                      _output);
+                                                      output);
+        toClear = new (-width, -height, width, height);
+        view.Clear (toClear);
+        TestHelpers.AssertDriverContentsWithFrameAre (
+                                                      @"
+ ┌─┐
+ │X│
+ └─┘",
+                                                      output);
 
-        Rectangle boundsToClear = new (x, y, width, height);
-        view.Clear (boundsToClear);
+        // Now try to clear beyond Viewport (valid)
+        superView.SetNeedsDisplay ();
+        superView.Draw ();
+        TestHelpers.AssertDriverContentsWithFrameAre (
+                                                      @"
+ ┌─┐
+ │X│
+ └─┘",
+                                                      output);
+        toClear = new (-1, -1, width + 1, height + 1);
+        view.Clear (toClear);
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
  ┌─┐
  │ │
  └─┘",
-                                                      _output);
+                                                      output);
 
+        // Now clear too much size
+        superView.SetNeedsDisplay ();
+        superView.Draw ();
+        TestHelpers.AssertDriverContentsWithFrameAre (
+                                                      @"
+ ┌─┐
+ │X│
+ └─┘",
+                                                      output);
+        toClear = new (0, 0, width * 2, height * 2);
+        view.Clear (toClear);
+        TestHelpers.AssertDriverContentsWithFrameAre (
+                                                      @"
+ ┌─┐
+ │ │
+ └─┘",
+                                                      output);
     }
 
+
     [Fact]
     [AutoInitShutdown]
-    [Trait("Category","Unicode")]
+    [Trait ("Category", "Unicode")]
     public void CJK_Compatibility_Ideographs_ConsoleWidth_ColumnWidth_Equal_Two ()
     {
         const string us = "\U0000f900";
@@ -83,9 +187,9 @@ public class DrawTests
                                       │豈      │
                                       └────────┘
                                       """;
-        TestHelpers.AssertDriverContentsWithFrameAre (expectedOutput, _output);
+        TestHelpers.AssertDriverContentsWithFrameAre (expectedOutput, output);
 
-        TestHelpers.AssertDriverContentsAre (expectedOutput, _output);
+        TestHelpers.AssertDriverContentsAre (expectedOutput, output);
 
         Attribute [] expectedColors =
         {
@@ -115,7 +219,7 @@ public class DrawTests
     // TODO: Refactor this test to not depend on TextView etc... Make it as primitive as possible
     [Fact]
     [AutoInitShutdown]
-    [Trait("Category","Unicode")]
+    [Trait ("Category", "Unicode")]
     public void Clipping_AddRune_Left_Or_Right_Replace_Previous_Or_Next_Wide_Rune_With_Space ()
     {
         var tv = new TextView
@@ -161,13 +265,13 @@ public class DrawTests
                                       └────────────────────────────┘
                                       """;
 
-        Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre (expectedOutput, _output);
+        Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre (expectedOutput, output);
         Assert.Equal (new Rectangle (0, 0, 30, 10), pos);
     }
 
     [Fact]
     [AutoInitShutdown]
-    [Trait("Category","Output")]
+    [Trait ("Category", "Output")]
     public void Colors_On_TextAlignment_Right_And_Bottom ()
     {
         var viewRight = new View
@@ -206,7 +310,7 @@ public class DrawTests
                                                       s     
                                                       t     
                                                       """,
-                                                      _output
+                                                      output
                                                      );
 
         TestHelpers.AssertDriverAttributesAre (
@@ -227,15 +331,15 @@ public class DrawTests
 
     [Fact]
     [SetupFakeDriver]
-    public void Draw_Minimum_Full_Border_With_Empty_Bounds ()
+    public void Draw_Minimum_Full_Border_With_Empty_Viewport ()
     {
         var view = new View { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
         view.BeginInit ();
         view.EndInit ();
-        view.SetRelativeLayout (Application.Driver.Bounds);
+        view.SetRelativeLayout (Application.Driver.Viewport);
 
-        Assert.Equal (new (0,0,2,2), view.Frame);
-        Assert.Equal (Rectangle.Empty, view.Bounds);
+        Assert.Equal (new (0, 0, 2, 2), view.Frame);
+        Assert.Equal (Rectangle.Empty, view.Viewport);
 
         view.Draw ();
 
@@ -245,40 +349,40 @@ public class DrawTests
                                                       ┌┐
                                                       └┘
                                                       """,
-                                                      _output
+                                                      output
                                                      );
     }
 
     [Fact]
     [SetupFakeDriver]
-    public void Draw_Minimum_Full_Border_With_Empty_Bounds_Without_Bottom ()
+    public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Bottom ()
     {
         var view = new View { Width = 2, Height = 1, BorderStyle = LineStyle.Single };
         view.Border.Thickness = new Thickness (1, 1, 1, 0);
         view.BeginInit ();
         view.EndInit ();
-        view.SetRelativeLayout (Application.Driver.Bounds);
+        view.SetRelativeLayout (Application.Driver.Viewport);
 
-        Assert.Equal (new (0,0,2,1), view.Frame);
-        Assert.Equal (Rectangle.Empty, view.Bounds);
+        Assert.Equal (new (0, 0, 2, 1), view.Frame);
+        Assert.Equal (Rectangle.Empty, view.Viewport);
 
         view.Draw ();
 
-        TestHelpers.AssertDriverContentsWithFrameAre (string.Empty, _output);
+        TestHelpers.AssertDriverContentsWithFrameAre (string.Empty, output);
     }
 
     [Fact]
     [SetupFakeDriver]
-    public void Draw_Minimum_Full_Border_With_Empty_Bounds_Without_Left ()
+    public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Left ()
     {
         var view = new View { Width = 1, Height = 2, BorderStyle = LineStyle.Single };
         view.Border.Thickness = new Thickness (0, 1, 1, 1);
         view.BeginInit ();
         view.EndInit ();
-        view.SetRelativeLayout (Application.Driver.Bounds);
+        view.SetRelativeLayout (Application.Driver.Viewport);
 
-        Assert.Equal (new (0,0,1,2), view.Frame);
-        Assert.Equal (Rectangle.Empty, view.Bounds);
+        Assert.Equal (new (0, 0, 1, 2), view.Frame);
+        Assert.Equal (Rectangle.Empty, view.Viewport);
 
         view.Draw ();
 
@@ -288,22 +392,22 @@ public class DrawTests
                                                       """,
-                                                      _output
+                                                      output
                                                      );
     }
 
     [Fact]
     [SetupFakeDriver]
-    public void Draw_Minimum_Full_Border_With_Empty_Bounds_Without_Right ()
+    public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Right ()
     {
         var view = new View { Width = 1, Height = 2, BorderStyle = LineStyle.Single };
         view.Border.Thickness = new Thickness (1, 1, 0, 1);
         view.BeginInit ();
         view.EndInit ();
-        view.SetRelativeLayout (Application.Driver.Bounds);
+        view.SetRelativeLayout (Application.Driver.Viewport);
 
-        Assert.Equal (new (0,0,1,2), view.Frame);
-        Assert.Equal (Rectangle.Empty, view.Bounds);
+        Assert.Equal (new (0, 0, 1, 2), view.Frame);
+        Assert.Equal (Rectangle.Empty, view.Viewport);
 
         view.Draw ();
 
@@ -313,23 +417,23 @@ public class DrawTests
                                                       """,
-                                                      _output
+                                                      output
                                                      );
     }
 
     [Fact]
     [SetupFakeDriver]
-    public void Draw_Minimum_Full_Border_With_Empty_Bounds_Without_Top ()
+    public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Top ()
     {
         var view = new View { Width = 2, Height = 1, BorderStyle = LineStyle.Single };
         view.Border.Thickness = new Thickness (1, 0, 1, 1);
 
         view.BeginInit ();
         view.EndInit ();
-        view.SetRelativeLayout (Application.Driver.Bounds);
+        view.SetRelativeLayout (Application.Driver.Viewport);
 
-        Assert.Equal (new (0,0,2,1), view.Frame);
-        Assert.Equal (Rectangle.Empty, view.Bounds);
+        Assert.Equal (new (0, 0, 2, 1), view.Frame);
+        Assert.Equal (Rectangle.Empty, view.Viewport);
 
         view.Draw ();
 
@@ -339,13 +443,13 @@ public class DrawTests
 
                                                       ┌┐
                                                       """,
-                                                      _output
+                                                      output
                                                      );
     }
 
     [Fact]
     [AutoInitShutdown]
-    public void Draw_Negative_Bounds_Horizontal_With_New_Lines ()
+    public void Draw_Negative_Viewport_Horizontal_With_New_Lines ()
     {
         var subView = new View
         {
@@ -416,7 +520,7 @@ public class DrawTests
                                                        3V
                                                        4i
                                                       """,
-                                                      _output
+                                                      output
                                                      );
 
         content.X = -1;
@@ -431,12 +535,12 @@ public class DrawTests
                                                        V
                                                        i
                                                       """,
-                                                      _output
+                                                      output
                                                      );
 
         content.X = -2;
         Application.Refresh ();
-        TestHelpers.AssertDriverContentsWithFrameAre (@"", _output);
+        TestHelpers.AssertDriverContentsWithFrameAre (@"", output);
 
         content.X = 0;
         content.Y = -1;
@@ -451,7 +555,7 @@ public class DrawTests
                                                        4i
                                                        5e
                                                       """,
-                                                      _output
+                                                      output
                                                      );
 
         content.Y = -6;
@@ -466,7 +570,7 @@ public class DrawTests
                                                        9 
                                                        0 
                                                       """,
-                                                      _output
+                                                      output
                                                      );
 
         content.Y = -19;
@@ -477,22 +581,22 @@ public class DrawTests
 
                                                        9
                                                       """,
-                                                      _output
+                                                      output
                                                      );
 
         content.Y = -20;
         Application.Refresh ();
-        TestHelpers.AssertDriverContentsWithFrameAre ("", _output);
+        TestHelpers.AssertDriverContentsWithFrameAre ("", output);
 
         content.X = -2;
         content.Y = 0;
         Application.Refresh ();
-        TestHelpers.AssertDriverContentsWithFrameAre ("", _output);
+        TestHelpers.AssertDriverContentsWithFrameAre ("", output);
     }
 
     [Fact]
     [AutoInitShutdown]
-    public void Draw_Negative_Bounds_Horizontal_Without_New_Lines ()
+    public void Draw_Negative_Viewport_Horizontal_Without_New_Lines ()
     {
         // BUGBUG: This previously assumed the default height of a View was 1.
         var subView = new View
@@ -533,7 +637,7 @@ public class DrawTests
                                                        01234
                                                        subVi
                                                       """,
-                                                      _output
+                                                      output
                                                      );
 
         content.X = -1;
@@ -545,7 +649,7 @@ public class DrawTests
                                                        12345
                                                        ubVie
                                                       """,
-                                                      _output
+                                                      output
                                                      );
 
         content.Y = -1;
@@ -556,22 +660,22 @@ public class DrawTests
 
                                                        ubVie
                                                       """,
-                                                      _output
+                                                      output
                                                      );
 
         content.Y = -2;
         Application.Refresh ();
-        TestHelpers.AssertDriverContentsWithFrameAre ("", _output);
+        TestHelpers.AssertDriverContentsWithFrameAre ("", output);
 
         content.X = -20;
         content.Y = 0;
         Application.Refresh ();
-        TestHelpers.AssertDriverContentsWithFrameAre ("", _output);
+        TestHelpers.AssertDriverContentsWithFrameAre ("", output);
     }
 
     [Fact]
     [AutoInitShutdown]
-    public void Draw_Negative_Bounds_Vertical ()
+    public void Draw_Negative_Viewport_Vertical ()
     {
         var subView = new View
         {
@@ -618,7 +722,7 @@ public class DrawTests
                                                        3V
                                                        4i
                                                       """,
-                                                      _output
+                                                      output
                                                      );
 
         content.X = -1;
@@ -633,12 +737,12 @@ public class DrawTests
                                                        V
                                                        i
                                                       """,
-                                                      _output
+                                                      output
                                                      );
 
         content.X = -2;
         Application.Refresh ();
-        TestHelpers.AssertDriverContentsWithFrameAre (@"", _output);
+        TestHelpers.AssertDriverContentsWithFrameAre (@"", output);
 
         content.X = 0;
         content.Y = -1;
@@ -653,7 +757,7 @@ public class DrawTests
                                                        4i
                                                        5e
                                                       """,
-                                                      _output
+                                                      output
                                                      );
 
         content.Y = -6;
@@ -668,7 +772,7 @@ public class DrawTests
                                                        9 
                                                        0 
                                                       """,
-                                                      _output
+                                                      output
                                                      );
 
         content.Y = -19;
@@ -679,17 +783,17 @@ public class DrawTests
 
                                                        9
                                                       """,
-                                                      _output
+                                                      output
                                                      );
 
         content.Y = -20;
         Application.Refresh ();
-        TestHelpers.AssertDriverContentsWithFrameAre ("", _output);
+        TestHelpers.AssertDriverContentsWithFrameAre ("", output);
 
         content.X = -2;
         content.Y = 0;
         Application.Refresh ();
-        TestHelpers.AssertDriverContentsWithFrameAre ("", _output);
+        TestHelpers.AssertDriverContentsWithFrameAre ("", output);
     }
 
     [Theory]
@@ -701,7 +805,7 @@ public class DrawTests
         var view = new View { Width = 10, Height = 1 };
         view.DrawHotString (expected, Attribute.Default, Attribute.Default);
 
-        TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
+        TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
     }
 
     // TODO: The tests below that use Label should use View instead.
@@ -736,9 +840,9 @@ public class DrawTests
             │𝔹       │
             └────────┘
             """;
-        TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
+        TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
 
-        TestHelpers.AssertDriverContentsAre (expected, _output);
+        TestHelpers.AssertDriverContentsAre (expected, output);
 
         Attribute [] expectedColors =
         {

+ 37 - 37
UnitTests/View/Layout/AbsoluteLayoutTests.cs

@@ -31,8 +31,8 @@ public class AbsoluteLayoutTests
 
         Assert.Equal (
                       new Rectangle (0, 0, newFrame.Width, newFrame.Height),
-                      v.Bounds
-                     ); // With Absolute Bounds *is* deterministic before Layout
+                      v.Viewport
+                     ); // With Absolute Viewport *is* deterministic before Layout
         Assert.Equal (Pos.At (1), v.X);
         Assert.Equal (Pos.At (2), v.Y);
         Assert.Equal (Dim.Sized (30), v.Width);
@@ -46,8 +46,8 @@ public class AbsoluteLayoutTests
 
         Assert.Equal (
                       new Rectangle (0, 0, newFrame.Width, newFrame.Height),
-                      v.Bounds
-                     ); // With Absolute Bounds *is* deterministic before Layout
+                      v.Viewport
+                     ); // With Absolute Viewport *is* deterministic before Layout
         Assert.Equal (Pos.At (1), v.X);
         Assert.Equal (Pos.At (2), v.Y);
         Assert.Equal (Dim.Sized (30), v.Width);
@@ -62,8 +62,8 @@ public class AbsoluteLayoutTests
 
         Assert.Equal (
                       new Rectangle (0, 0, newFrame.Width, newFrame.Height),
-                      v.Bounds
-                     ); // With Absolute Bounds *is* deterministic before Layout
+                      v.Viewport
+                     ); // With Absolute Viewport *is* deterministic before Layout
         Assert.Equal (Pos.At (10), v.X);
         Assert.Equal (Pos.At (20), v.Y);
         Assert.Equal (Dim.Sized (30), v.Width);
@@ -77,8 +77,8 @@ public class AbsoluteLayoutTests
 
         Assert.Equal (
                       new Rectangle (0, 0, newFrame.Width, newFrame.Height),
-                      v.Bounds
-                     ); // With Absolute Bounds *is* deterministic before Layout
+                      v.Viewport
+                     ); // With Absolute Viewport *is* deterministic before Layout
         Assert.Equal (Pos.At (10), v.X);
         Assert.Equal (Pos.At (20), v.Y);
         Assert.Equal (Dim.Sized (30), v.Width);
@@ -101,8 +101,8 @@ public class AbsoluteLayoutTests
 
         Assert.Equal (
                       new Rectangle (0, 0, newFrame.Width, newFrame.Height),
-                      v.Bounds
-                     ); // With Absolute Bounds *is* deterministic before Layout
+                      v.Viewport
+                     ); // With Absolute Viewport *is* deterministic before Layout
         Assert.Equal (Pos.At (1), v.X);
         Assert.Equal (Pos.At (2), v.Y);
         Assert.Equal ($"Absolute({newFrame.Height})", v.Height.ToString ());
@@ -136,8 +136,8 @@ public class AbsoluteLayoutTests
 
         Assert.Equal (
                       new Rectangle (0, 0, newFrame.Width, newFrame.Height),
-                      v.Bounds
-                     ); // With Absolute Bounds *is* deterministic before Layout
+                      v.Viewport
+                     ); // With Absolute Viewport *is* deterministic before Layout
         Assert.Equal ($"Absolute({newFrame.X})", v.X.ToString ());
         Assert.Equal ($"Absolute({newFrame.Y})", v.Y.ToString ());
         Assert.Equal (Dim.Sized (3), v.Width);
@@ -250,8 +250,8 @@ public class AbsoluteLayoutTests
 
         Assert.Equal (
                       new Rectangle (0, 0, frame.Width, frame.Height),
-                      v.Bounds
-                     ); // With Absolute Bounds *is* deterministic before Layout
+                      v.Viewport
+                     ); // With Absolute Viewport *is* deterministic before Layout
         Assert.Equal (Pos.At (0), v.X);
         Assert.Equal (Pos.At (0), v.Y);
         Assert.Equal (Dim.Sized (0), v.Width);
@@ -265,8 +265,8 @@ public class AbsoluteLayoutTests
 
         Assert.Equal (
                       new Rectangle (0, 0, frame.Width, frame.Height),
-                      v.Bounds
-                     ); // With Absolute Bounds *is* deterministic before Layout
+                      v.Viewport
+                     ); // With Absolute Viewport *is* deterministic before Layout
         Assert.Equal (Pos.At (1), v.X);
         Assert.Equal (Pos.At (2), v.Y);
         Assert.Equal (Dim.Sized (3), v.Width);
@@ -279,8 +279,8 @@ public class AbsoluteLayoutTests
 
         Assert.Equal (
                       new Rectangle (0, 0, frame.Width, frame.Height),
-                      v.Bounds
-                     ); // With Absolute Bounds *is* deterministic before Layout
+                      v.Viewport
+                     ); // With Absolute Viewport *is* deterministic before Layout
         Assert.Equal (Pos.At (1), v.X);
         Assert.Equal (Pos.At (2), v.Y);
         Assert.Equal (Dim.Sized (3), v.Width);
@@ -294,7 +294,7 @@ public class AbsoluteLayoutTests
         // That is correct it should be 0,0 because AutoSize is false
         // and the size wasn't set on the initializer
         Assert.Equal (new Rectangle (frame.X, frame.Y, 0, 0), v.Frame);
-        Assert.Equal (new Rectangle (0, 0, 0, 0), v.Bounds); // With Absolute Bounds *is* deterministic before Layout
+        Assert.Equal (new Rectangle (0, 0, 0, 0), v.Viewport); // With Absolute Viewport *is* deterministic before Layout
         Assert.Equal (Pos.At (1), v.X);
         Assert.Equal (Pos.At (2), v.Y);
         Assert.Equal (Dim.Sized (0), v.Width);
@@ -304,7 +304,7 @@ public class AbsoluteLayoutTests
         v = new View ();
         Assert.True (v.LayoutStyle == LayoutStyle.Absolute);
         Assert.Equal (new Rectangle (0, 0, 0, 0), v.Frame);
-        Assert.Equal (new Rectangle (0, 0, 0, 0), v.Bounds); // With Absolute Bounds *is* deterministic before Layout
+        Assert.Equal (new Rectangle (0, 0, 0, 0), v.Viewport); // With Absolute Viewport *is* deterministic before Layout
         Assert.Equal (Pos.At (0), v.X);
         Assert.Equal (Pos.At (0), v.Y);
         Assert.Equal (Dim.Sized (0), v.Width);
@@ -314,7 +314,7 @@ public class AbsoluteLayoutTests
         v = new View { X = frame.X, Y = frame.Y, Width = frame.Width, Height = frame.Height };
         Assert.True (v.LayoutStyle == LayoutStyle.Absolute);
         Assert.Equal (new Rectangle (frame.X, frame.Y, 3, 4), v.Frame);
-        Assert.Equal (new Rectangle (0, 0, 3, 4), v.Bounds); // With Absolute Bounds *is* deterministic before Layout
+        Assert.Equal (new Rectangle (0, 0, 3, 4), v.Viewport); // With Absolute Viewport *is* deterministic before Layout
         Assert.Equal (Pos.At (1), v.X);
         Assert.Equal (Pos.At (2), v.Y);
         Assert.Equal (Dim.Sized (3), v.Width);
@@ -346,20 +346,20 @@ public class AbsoluteLayoutTests
     }
 
     [Fact]
-    public void AbsoluteLayout_Setting_Bounds_Location_NotEmpty ()
+    public void AbsoluteLayout_Setting_Viewport_Location_NotEmpty ()
     {
-        // TODO: Should we enforce Bounds.X/Y == 0? The code currently ignores value.X/Y which is
+        // TODO: Should we enforce Viewport.X/Y == 0? The code currently ignores value.X/Y which is
         // TODO: correct behavior, but is silent. Perhaps an exception?
         var frame = new Rectangle (1, 2, 3, 4);
         var newBounds = new Rectangle (10, 20, 30, 40);
         var view = new View { Frame = frame };
-        view.Bounds = newBounds;
-        Assert.Equal (new Rectangle (0, 0, 30, 40), view.Bounds);
+        view.Viewport = newBounds;
+        Assert.Equal (new Rectangle (0, 0, 30, 40), view.Viewport);
         Assert.Equal (new Rectangle (1, 2, 30, 40), view.Frame);
     }
 
     [Fact]
-    public void AbsoluteLayout_Setting_Bounds_Sets_Frame ()
+    public void AbsoluteLayout_Setting_Viewport_Sets_Frame ()
     {
         var frame = new Rectangle (1, 2, 3, 4);
         var newBounds = new Rectangle (0, 0, 30, 40);
@@ -367,21 +367,21 @@ public class AbsoluteLayoutTests
         var v = new View { Frame = frame };
         Assert.True (v.LayoutStyle == LayoutStyle.Absolute);
 
-        v.Bounds = newBounds;
+        v.Viewport = newBounds;
         Assert.True (v.LayoutStyle == LayoutStyle.Absolute);
-        Assert.Equal (newBounds, v.Bounds);
+        Assert.Equal (newBounds, v.Viewport);
         Assert.Equal (new Rectangle (1, 2, newBounds.Width, newBounds.Height), v.Frame);
-        Assert.Equal (new Rectangle (0, 0, newBounds.Width, newBounds.Height), v.Bounds);
+        Assert.Equal (new Rectangle (0, 0, newBounds.Width, newBounds.Height), v.Viewport);
         Assert.Equal (Pos.At (1), v.X);
         Assert.Equal (Pos.At (2), v.Y);
         Assert.Equal (Dim.Sized (30), v.Width);
         Assert.Equal (Dim.Sized (40), v.Height);
 
         newBounds = new Rectangle (0, 0, 3, 4);
-        v.Bounds = newBounds;
-        Assert.Equal (newBounds, v.Bounds);
+        v.Viewport = newBounds;
+        Assert.Equal (newBounds, v.Viewport);
         Assert.Equal (new Rectangle (1, 2, newBounds.Width, newBounds.Height), v.Frame);
-        Assert.Equal (new Rectangle (0, 0, newBounds.Width, newBounds.Height), v.Bounds);
+        Assert.Equal (new Rectangle (0, 0, newBounds.Width, newBounds.Height), v.Viewport);
         Assert.Equal (Pos.At (1), v.X);
         Assert.Equal (Pos.At (2), v.Y);
         Assert.Equal (Dim.Sized (3), v.Width);
@@ -389,8 +389,8 @@ public class AbsoluteLayoutTests
 
         v.BorderStyle = LineStyle.Single;
 
-        // Bounds should shrink
-        Assert.Equal (new Rectangle (0, 0, 1, 2), v.Bounds);
+        // Viewport should shrink
+        Assert.Equal (new Rectangle (0, 0, 1, 2), v.Viewport);
 
         // Frame should not change
         Assert.Equal (new Rectangle (1, 2, 3, 4), v.Frame);
@@ -401,12 +401,12 @@ public class AbsoluteLayoutTests
 
         // Now set bounds bigger as before
         newBounds = new Rectangle (0, 0, 3, 4);
-        v.Bounds = newBounds;
-        Assert.Equal (newBounds, v.Bounds);
+        v.Viewport = newBounds;
+        Assert.Equal (newBounds, v.Viewport);
 
         // Frame grows because there's now a border
         Assert.Equal (new Rectangle (1, 2, 5, 6), v.Frame);
-        Assert.Equal (new Rectangle (0, 0, newBounds.Width, newBounds.Height), v.Bounds);
+        Assert.Equal (new Rectangle (0, 0, newBounds.Width, newBounds.Height), v.Viewport);
         Assert.Equal (Pos.At (1), v.X);
         Assert.Equal (Pos.At (2), v.Y);
         Assert.Equal (Dim.Sized (5), v.Width);

+ 4 - 4
UnitTests/View/Layout/DimTests.cs

@@ -39,7 +39,7 @@ public class DimTests
                              if (k.KeyCode == KeyCode.Enter)
                              {
                                  field.Text = $"Label {count}";
-                                 var label = new Label { X = 0, Y = view.Bounds.Height, /*Width = 20,*/ Text = field.Text };
+                                 var label = new Label { X = 0, Y = view.Viewport.Height, /*Width = 20,*/ Text = field.Text };
                                  view.Add (label);
                                  Assert.Equal ($"Label {count}", label.Text);
                                  Assert.Equal ($"Absolute({count})", label.Y.ToString ());
@@ -112,7 +112,7 @@ public class DimTests
         for (var i = 0; i < count; i++)
         {
             field.Text = $"Label {i}";
-            var label = new Label { X = 0, Y = view.Bounds.Height, /*Width = 20,*/ Text = field.Text };
+            var label = new Label { X = 0, Y = view.Viewport.Height, /*Width = 20,*/ Text = field.Text };
             view.Add (label);
             Assert.Equal ($"Label {i}", label.Text);
             Assert.Equal ($"Absolute({i})", label.Y.ToString ());
@@ -667,9 +667,9 @@ public class DimTests
                        Assert.Equal (50, v4.Frame.Width);
                        Assert.Equal (50, v4.Frame.Height);
                    #if DEBUG
-                       Assert.Equal ($"Combine(View(Width,Button(v1){v1.Frame})-View(Width,Button(v3){v3.Bounds}))", v5.Width.ToString ());
+                       Assert.Equal ($"Combine(View(Width,Button(v1){v1.Frame})-View(Width,Button(v3){v3.Viewport}))", v5.Width.ToString ());
                     #else
-                       Assert.Equal ($"Combine(View(Height,Button(){v1.Frame})-View(Height,Button(){v3.Bounds}))", v5.Height.ToString ( ));
+                       Assert.Equal ($"Combine(View(Height,Button(){v1.Frame})-View(Height,Button(){v3.Viewport}))", v5.Height.ToString ( ));
                    #endif
                        Assert.Equal (38, v5.Frame.Width);  // 47-9=38
                        Assert.Equal (80, v5.Frame.Height); // 89-9=80

+ 5 - 5
UnitTests/View/Layout/PosTests.cs

@@ -116,11 +116,11 @@ public class PosTests
         var b = $"{CM.Glyphs.LeftBracket} Ok {CM.Glyphs.RightBracket}";
 
         var frame = new FrameView { Width = 18, Height = 3 };
-        Assert.Equal (16, frame.Bounds.Width);
+        Assert.Equal (16, frame.Viewport.Width);
 
         Button btn = null;
 
-        int Btn_Width () { return btn?.Bounds.Width ?? 0; }
+        int Btn_Width () { return btn?.Viewport.Width ?? 0; }
 
         btn = new Button { Text = "Ok", X = Pos.AnchorEnd () - Pos.Function (Btn_Width) };
 
@@ -140,13 +140,13 @@ public class PosTests
         frame.EndInit ();
         frame.Draw ();
 
-        Assert.Equal (6, btn.Bounds.Width);
-        Assert.Equal (10, btn.Frame.X); // frame.Bounds.Width (16) - btn.Frame.Width (6) = 10
+        Assert.Equal (6, btn.Viewport.Width);
+        Assert.Equal (10, btn.Frame.X); // frame.Viewport.Width (16) - btn.Frame.Width (6) = 10
         Assert.Equal (0, btn.Frame.Y);
         Assert.Equal (6, btn.Frame.Width);
         Assert.Equal (1, btn.Frame.Height);
 
-        Assert.Equal (9, view.Bounds.Width); // frame.Bounds.Width (16) - Dim.Fill (1) - Dim.Function (6) = 9
+        Assert.Equal (9, view.Viewport.Width); // frame.Viewport.Width (16) - Dim.Fill (1) - Dim.Function (6) = 9
         Assert.Equal (0, view.Frame.X);
         Assert.Equal (0, view.Frame.Y);
         Assert.Equal (9, view.Frame.Width);

+ 7 - 7
UnitTests/View/Layout/ScreenToTests.cs

@@ -21,7 +21,7 @@ public class ScreenToTests
     [InlineData (1, 1, 1, 1, -1, -1)]
     [InlineData (1, 1, 9, 9, 7, 7)]
     [InlineData (1, 1, 11, 11, 9, 9)]
-    public void ScreenToBounds_NoSuper_HasAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY)
+    public void ScreenToViewport_NoSuper_HasAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY)
     {
         var view = new View
         {
@@ -32,7 +32,7 @@ public class ScreenToTests
             BorderStyle = LineStyle.Single
         };
 
-        Point actual = view.ScreenToBounds (x, y);
+        Point actual = view.ScreenToViewport (x, y);
         Assert.Equal (expectedX, actual.X);
         Assert.Equal (expectedY, actual.Y);
     }
@@ -50,11 +50,11 @@ public class ScreenToTests
     [InlineData (1, 1, 1, 1, 0, 0)]
     [InlineData (1, 1, 9, 9, 8, 8)]
     [InlineData (1, 1, 11, 11, 10, 10)] // it's ok for the view to return coordinates outside of its bounds
-    public void ScreenToBounds_NoSuper_NoAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY)
+    public void ScreenToViewport_NoSuper_NoAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY)
     {
         var view = new View { X = viewX, Y = viewY, Width = 10, Height = 10 };
 
-        Point actual = view.ScreenToBounds (x, y);
+        Point actual = view.ScreenToViewport (x, y);
         Assert.Equal (expectedX, actual.X);
         Assert.Equal (expectedY, actual.Y);
     }
@@ -69,7 +69,7 @@ public class ScreenToTests
     [InlineData (1, 1, 1, 1, -1, -1)]
     [InlineData (1, 1, 9, 9, 7, 7)]
     [InlineData (1, 1, 11, 11, 9, 9)] // it's ok for the view to return coordinates outside of its bounds
-    public void ScreenToBounds_SuperHasAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY)
+    public void ScreenToViewport_SuperHasAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY)
     {
         var super = new View
         {
@@ -97,13 +97,13 @@ public class ScreenToTests
     [InlineData (1, 1, 1, 1, 0, 0)]
     [InlineData (1, 1, 9, 9, 8, 8)]
     [InlineData (1, 1, 11, 11, 10, 10)] // it's ok for the view to return coordinates outside of its bounds
-    public void ScreenToBounds_SuperHasNoAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY)
+    public void ScreenToViewport_SuperHasNoAdornments (int viewX, int viewY, int x, int y, int expectedX, int expectedY)
     {
         var super = new View { X = 0, Y = 0, Width = 10, Height = 10 };
         var view = new View { X = viewX, Y = viewY, Width = 5, Height = 5 };
         super.Add (view);
 
-        Point actual = view.ScreenToBounds (x, y);
+        Point actual = view.ScreenToViewport (x, y);
         Assert.Equal (expectedX, actual.X);
         Assert.Equal (expectedY, actual.Y);
     }

+ 8 - 8
UnitTests/View/Layout/SetRelativeLayoutTests.cs

@@ -54,10 +54,10 @@ public class SetRelativeLayoutTests
         Assert.Equal (1, view.Frame.Y);
         Assert.Equal (79, view.Frame.Width);
         Assert.Equal (24, view.Frame.Height);
-        Assert.Equal (0, view.Bounds.X);
-        Assert.Equal (0, view.Bounds.Y);
-        Assert.Equal (79, view.Bounds.Width);
-        Assert.Equal (24, view.Bounds.Height);
+        Assert.Equal (0, view.Viewport.X);
+        Assert.Equal (0, view.Viewport.Y);
+        Assert.Equal (79, view.Viewport.Width);
+        Assert.Equal (24, view.Viewport.Height);
 
         view.X = 0;
         view.Y = 0;
@@ -68,10 +68,10 @@ public class SetRelativeLayoutTests
         Assert.Equal (0, view.Frame.Y);
         Assert.Equal (80, view.Frame.Width);
         Assert.Equal (25, view.Frame.Height);
-        Assert.Equal (0, view.Bounds.X);
-        Assert.Equal (0, view.Bounds.Y);
-        Assert.Equal (80, view.Bounds.Width);
-        Assert.Equal (25, view.Bounds.Height);
+        Assert.Equal (0, view.Viewport.X);
+        Assert.Equal (0, view.Viewport.Y);
+        Assert.Equal (80, view.Viewport.Width);
+        Assert.Equal (25, view.Viewport.Height);
     }
 
     [Fact]

+ 7 - 7
UnitTests/View/Layout/ToScreenTests.cs

@@ -3,7 +3,7 @@
 namespace Terminal.Gui.ViewTests;
 
 /// <summary>
-/// Test the <see cref="View.FrameToScreen"/> and <see cref="View.BoundsToScreen"/> methods.
+/// Test the <see cref="View.FrameToScreen"/> and <see cref="View.ViewportToScreen"/> methods.
 /// DOES NOT TEST Adornment.xxxToScreen methods. Those are in ./Adornment/ToScreenTests.cs
 /// </summary>
 /// <param name="output"></param>
@@ -222,7 +222,7 @@ public class ToScreenTests (ITestOutputHelper output)
         view.Frame = frame;
 
         // Act
-        var screen = view.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var screen = view.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, screen.X);
@@ -254,7 +254,7 @@ public class ToScreenTests (ITestOutputHelper output)
         view.Frame = frame;
 
         // Act
-        var screen = view.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var screen = view.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, screen.X);
@@ -296,7 +296,7 @@ public class ToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var screen = view.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var screen = view.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, screen.X);
@@ -339,7 +339,7 @@ public class ToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var screen = view.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var screen = view.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, screen.X);
@@ -391,7 +391,7 @@ public class ToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var screen = view.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var screen = view.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, screen.X);
@@ -445,7 +445,7 @@ public class ToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var screen = view.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var screen = view.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, screen.X);

+ 9 - 9
UnitTests/View/Layout/BoundsTests.cs → UnitTests/View/Layout/ViewportTests.cs

@@ -3,11 +3,11 @@
 namespace Terminal.Gui.ViewTests;
 
 /// <summary>
-/// Test the <see cref="View.Bounds"/>.
-/// DOES NOT TEST Adornment.Bounds methods. Those are in ./Adornment/BoundsTests.cs
+/// Test the <see cref="View.Viewport"/>.
+/// DOES NOT TEST Adornment.Viewport methods. Those are in ./Adornment/ViewportTests.cs
 /// </summary>
 /// <param name="output"></param>
-public class BoundsTests (ITestOutputHelper output)
+public class ViewportTests (ITestOutputHelper output)
 {
     private readonly ITestOutputHelper _output = output;
 
@@ -16,7 +16,7 @@ public class BoundsTests (ITestOutputHelper output)
     [InlineData (1, 10)]
     [InlineData (-1, 10)]
     [InlineData (11, 10)]
-    public void Get_Bounds_NoSuperView_WithoutAdornments (int x, int expectedW)
+    public void Get_Viewport_NoSuperView_WithoutAdornments (int x, int expectedW)
     {
         // We test with only X because Y is equivalent. Height/Width are irrelevant.
         // Arrange
@@ -28,7 +28,7 @@ public class BoundsTests (ITestOutputHelper output)
         view.EndInit();
 
         // Act
-        var bounds = view.Bounds;
+        var bounds = view.Viewport;
 
         // Assert
         Assert.Equal(expectedW, bounds.Width);
@@ -47,7 +47,7 @@ public class BoundsTests (ITestOutputHelper output)
     [InlineData (10, 1, 0)]
     [InlineData (11, 1, 0)]
 
-    public void Get_Bounds_NestedSuperView_WithAdornments (int frameX, int borderThickness, int expectedW)
+    public void Get_Viewport_NestedSuperView_WithAdornments (int frameX, int borderThickness, int expectedW)
     {
         // We test with only X because Y is equivalent. Height/Width are irrelevant.
         // Arrange
@@ -85,7 +85,7 @@ public class BoundsTests (ITestOutputHelper output)
         superSuperView.LayoutSubviews ();
 
         // Act
-        var bounds = view.Bounds;
+        var bounds = view.Viewport;
 
         // Assert
         Assert.Equal (expectedW, bounds.Width);
@@ -105,7 +105,7 @@ public class BoundsTests (ITestOutputHelper output)
     [InlineData (-1, 1, 5)]
     [InlineData (10, 1, 0)]
     [InlineData (11, 1, 0)]
-    public void Get_Bounds_NestedSuperView_WithAdornments_WithBorder (int frameX, int borderThickness, int expectedW)
+    public void Get_Viewport_NestedSuperView_WithAdornments_WithBorder (int frameX, int borderThickness, int expectedW)
     {
         // We test with only X because Y is equivalent. Height/Width are irrelevant.
         // Arrange
@@ -144,7 +144,7 @@ public class BoundsTests (ITestOutputHelper output)
         superSuperView.LayoutSubviews ();
 
         // Act
-        var bounds = view.Bounds;
+        var bounds = view.Viewport;
 
         // Assert
         Assert.Equal (expectedW, bounds.Width);

+ 34 - 34
UnitTests/View/NavigationTests.cs

@@ -841,19 +841,19 @@ public class NavigationTests
 
         // top
         Assert.Equal (Point.Empty, top.ScreenToFrame (0, 0));
-        Rectangle screen = top.Margin.BoundsToScreen (new (0, 0, 0, 0));
+        Rectangle screen = top.Margin.ViewportToScreen (new (0, 0, 0, 0));
         Assert.Equal (0, screen.X);
         Assert.Equal (0, screen.Y);
-        screen = top.Border.BoundsToScreen (new (0, 0, 0, 0));
+        screen = top.Border.ViewportToScreen (new (0, 0, 0, 0));
         Assert.Equal (0, screen.X);
         Assert.Equal (0, screen.Y);
-        screen = top.Padding.BoundsToScreen (new (0, 0, 0, 0));
+        screen = top.Padding.ViewportToScreen (new (0, 0, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = top.BoundsToScreen (new (0, 0, 0, 0));
+        screen = top.ViewportToScreen (new (0, 0, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = top.BoundsToScreen (new (-1, -1, 0, 0));
+        screen = top.ViewportToScreen (new (-1, -1, 0, 0));
         Assert.Equal (0, screen.X);
         Assert.Equal (0, screen.Y);
         var found = View.FindDeepestView (top, 0, 0);
@@ -862,7 +862,7 @@ public class NavigationTests
         Assert.Equal (0, found.Frame.X);
         Assert.Equal (0, found.Frame.Y);
         Assert.Equal (new Point (3, 2), top.ScreenToFrame (3, 2));
-        screen = top.BoundsToScreen (new (3, 2, 0, 0));
+        screen = top.ViewportToScreen (new (3, 2, 0, 0));
         Assert.Equal (4, screen.X);
         Assert.Equal (3, screen.Y);
         found = View.FindDeepestView (top, screen.X, screen.Y);
@@ -874,14 +874,14 @@ public class NavigationTests
         //Assert.Equal (3, found.FrameToScreen ().X);
         //Assert.Equal (2, found.FrameToScreen ().Y);
         Assert.Equal (new Point (13, 2), top.ScreenToFrame (13, 2));
-        screen = top.BoundsToScreen (new (12, 2, 0, 0));
+        screen = top.ViewportToScreen (new (12, 2, 0, 0));
         Assert.Equal (13, screen.X);
         Assert.Equal (3, screen.Y);
         found = View.FindDeepestView (top, screen.X, screen.Y);
         Assert.Equal (view, found);
         //Assert.Equal (9, found.FrameToScreen ().X);
         //Assert.Equal (0, found.FrameToScreen ().Y);
-        screen = top.BoundsToScreen (new (13, 2, 0, 0));
+        screen = top.ViewportToScreen (new (13, 2, 0, 0));
         Assert.Equal (14, screen.X);
         Assert.Equal (3, screen.Y);
         found = View.FindDeepestView (top, 13, 2);
@@ -889,7 +889,7 @@ public class NavigationTests
         //Assert.Equal (13, found.FrameToScreen ().X);
         //Assert.Equal (2, found.FrameToScreen ().Y);
         Assert.Equal (new Point (14, 3), top.ScreenToFrame (14, 3));
-        screen = top.BoundsToScreen (new (14, 3, 0, 0));
+        screen = top.ViewportToScreen (new (14, 3, 0, 0));
         Assert.Equal (15, screen.X);
         Assert.Equal (4, screen.Y);
         found = View.FindDeepestView (top, 14, 3);
@@ -899,40 +899,40 @@ public class NavigationTests
 
         // view
         Assert.Equal (new Point (-4, -3), view.ScreenToFrame (0, 0));
-        screen = view.Margin.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = view.Margin.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = view.Border.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = view.Border.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = view.Padding.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = view.Padding.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = view.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = view.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = view.BoundsToScreen (new (-4, -3, 0, 0));
+        screen = view.ViewportToScreen (new (-4, -3, 0, 0));
         Assert.Equal (0, screen.X);
         Assert.Equal (0, screen.Y);
         found = View.FindDeepestView (top, 0, 0);
         Assert.Equal (top.Border, found);
 
         Assert.Equal (new Point (-1, -1), view.ScreenToFrame (3, 2));
-        screen = view.BoundsToScreen (new (0, 0, 0, 0));
+        screen = view.ViewportToScreen (new (0, 0, 0, 0));
         Assert.Equal (4, screen.X);
         Assert.Equal (3, screen.Y);
         found = View.FindDeepestView (top, 4, 3);
         Assert.Equal (view, found);
         
         Assert.Equal (new Point (9, -1), view.ScreenToFrame (13, 2));
-        screen = view.BoundsToScreen (new (10, 0, 0, 0));
+        screen = view.ViewportToScreen (new (10, 0, 0, 0));
         Assert.Equal (14, screen.X);
         Assert.Equal (3, screen.Y);
         found = View.FindDeepestView (top, 14, 3);
         Assert.Equal (top, found);
         
         Assert.Equal (new Point (10, 0), view.ScreenToFrame (14, 3));
-        screen = view.BoundsToScreen (new (11, 1, 0, 0));
+        screen = view.ViewportToScreen (new (11, 1, 0, 0));
         Assert.Equal (15, screen.X);
         Assert.Equal (4, screen.Y);
         found = View.FindDeepestView (top, 15, 4);
@@ -995,80 +995,80 @@ public class NavigationTests
 
         // top
         Assert.Equal (new Point (-3, -2), top.ScreenToFrame (0, 0));
-        Rectangle screen = top.Margin.BoundsToScreen (new (-3, -2, 0, 0));
+        Rectangle screen = top.Margin.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (0, screen.X);
         Assert.Equal (0, screen.Y);
-        screen = top.Border.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = top.Border.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (0, screen.X);
         Assert.Equal (0, screen.Y);
-        screen = top.Padding.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = top.Padding.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = top.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = top.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = top.BoundsToScreen (new (-4, -3, 0, 0));
+        screen = top.ViewportToScreen (new (-4, -3, 0, 0));
         Assert.Equal (0, screen.X);
         Assert.Equal (0, screen.Y);
         var found = View.FindDeepestView (top, -4, -3);
         Assert.Null (found);
         Assert.Equal (Point.Empty, top.ScreenToFrame (3, 2));
-        screen = top.BoundsToScreen (new (0, 0, 0, 0));
+        screen = top.ViewportToScreen (new (0, 0, 0, 0));
         Assert.Equal (4, screen.X);
         Assert.Equal (3, screen.Y);
         Assert.Equal (top.Border, View.FindDeepestView (top, 3, 2));
         //Assert.Equal (0, found.FrameToScreen ().X);
         //Assert.Equal (0, found.FrameToScreen ().Y);
         Assert.Equal (new Point (10, 0), top.ScreenToFrame (13, 2));
-        screen = top.BoundsToScreen (new (10, 0, 0, 0));
+        screen = top.ViewportToScreen (new (10, 0, 0, 0));
         Assert.Equal (14, screen.X);
         Assert.Equal (3, screen.Y);
         Assert.Equal (top.Border, View.FindDeepestView (top, 13, 2));
         //Assert.Equal (10, found.FrameToScreen ().X);
         //Assert.Equal (0, found.FrameToScreen ().Y);
         Assert.Equal (new Point (11, 1), top.ScreenToFrame (14, 3));
-        screen = top.BoundsToScreen (new (11, 1, 0, 0));
+        screen = top.ViewportToScreen (new (11, 1, 0, 0));
         Assert.Equal (15, screen.X);
         Assert.Equal (4, screen.Y);
         Assert.Equal (top, View.FindDeepestView (top, 14, 3));
         
         // view
         Assert.Equal (new Point (-7, -5), view.ScreenToFrame (0, 0));
-        screen = view.Margin.BoundsToScreen (new (-6, -4, 0, 0));
+        screen = view.Margin.ViewportToScreen (new (-6, -4, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = view.Border.BoundsToScreen (new (-6, -4, 0, 0));
+        screen = view.Border.ViewportToScreen (new (-6, -4, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = view.Padding.BoundsToScreen (new (-6, -4, 0, 0));
+        screen = view.Padding.ViewportToScreen (new (-6, -4, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = view.BoundsToScreen (new (-6, -4, 0, 0));
+        screen = view.ViewportToScreen (new (-6, -4, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
         Assert.Null (View.FindDeepestView (top, 1, 1));
         Assert.Equal (new Point (-4, -3), view.ScreenToFrame (3, 2));
-        screen = view.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = view.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (4, screen.X);
         Assert.Equal (3, screen.Y);
         Assert.Equal (top, View.FindDeepestView (top, 4, 3));
         Assert.Equal (new Point (-1, -1), view.ScreenToFrame (6, 4));
-        screen = view.BoundsToScreen (new (0, 0, 0, 0));
+        screen = view.ViewportToScreen (new (0, 0, 0, 0));
         Assert.Equal (7, screen.X);
         Assert.Equal (5, screen.Y);
         Assert.Equal (view, View.FindDeepestView (top, 7, 5));
         Assert.Equal (new Point (6, -1), view.ScreenToFrame (13, 4));
-        screen = view.BoundsToScreen (new (7, 0, 0, 0));
+        screen = view.ViewportToScreen (new (7, 0, 0, 0));
         Assert.Equal (14, screen.X);
         Assert.Equal (5, screen.Y);
         Assert.Equal (view, View.FindDeepestView (top, 14, 5));
         Assert.Equal (new Point (7, -2), view.ScreenToFrame (14, 3));
-        screen = view.BoundsToScreen (new (8, -1, 0, 0));
+        screen = view.ViewportToScreen (new (8, -1, 0, 0));
         Assert.Equal (15, screen.X);
         Assert.Equal (4, screen.Y);
         Assert.Equal (top, View.FindDeepestView (top, 15, 4));
         Assert.Equal (new Point (16, -2), view.ScreenToFrame (23, 3));
-        screen = view.BoundsToScreen (new (17, -1, 0, 0));
+        screen = view.ViewportToScreen (new (17, -1, 0, 0));
         Assert.Equal (24, screen.X);
         Assert.Equal (4, screen.Y);
         Assert.Null (View.FindDeepestView (top, 24, 4));

+ 22 - 22
UnitTests/View/SubviewTests.cs

@@ -82,12 +82,12 @@ public class SubviewTests
     {
         Application.Init (new FakeDriver ());
 
-        var top = new Toplevel { Id = "0" }; // Frame: 0, 0, 80, 25; Bounds: 0, 0, 80, 25
+        var top = new Toplevel { Id = "0" }; // Frame: 0, 0, 80, 25; Viewport: 0, 0, 80, 25
 
         var winAddedToTop = new Window
         {
             Id = "t", Width = Dim.Fill (), Height = Dim.Fill ()
-        }; // Frame: 0, 0, 80, 25; Bounds: 0, 0, 78, 23
+        }; // Frame: 0, 0, 80, 25; Viewport: 0, 0, 78, 23
 
         var v1AddedToWin = new View
         {
@@ -151,45 +151,45 @@ public class SubviewTests
         winAddedToTop.Initialized += (s, e) =>
                                      {
                                          wc++;
-                                         Assert.Equal (top.Bounds.Width, winAddedToTop.Frame.Width);
-                                         Assert.Equal (top.Bounds.Height, winAddedToTop.Frame.Height);
+                                         Assert.Equal (top.Viewport.Width, winAddedToTop.Frame.Width);
+                                         Assert.Equal (top.Viewport.Height, winAddedToTop.Frame.Height);
                                      };
 
         v1AddedToWin.Initialized += (s, e) =>
                                     {
                                         v1c++;
 
-                                        // Top.Frame: 0, 0, 80, 25; Top.Bounds: 0, 0, 80, 25
+                                        // Top.Frame: 0, 0, 80, 25; Top.Viewport: 0, 0, 80, 25
                                         // BUGBUG: This is wrong, it should be 78, 23. This test has always been broken.
-                                        // in no way should the v1AddedToWin.Frame be the same as the Top.Frame/Bounds
+                                        // in no way should the v1AddedToWin.Frame be the same as the Top.Frame/Viewport
                                         // as it is a subview of winAddedToTop, which has a border!
-                                        //Assert.Equal (top.Bounds.Width,  v1AddedToWin.Frame.Width);
-                                        //Assert.Equal (top.Bounds.Height, v1AddedToWin.Frame.Height);
+                                        //Assert.Equal (top.Viewport.Width,  v1AddedToWin.Frame.Width);
+                                        //Assert.Equal (top.Viewport.Height, v1AddedToWin.Frame.Height);
                                     };
 
         v2AddedToWin.Initialized += (s, e) =>
                                     {
                                         v2c++;
 
-                                        // Top.Frame: 0, 0, 80, 25; Top.Bounds: 0, 0, 80, 25
+                                        // Top.Frame: 0, 0, 80, 25; Top.Viewport: 0, 0, 80, 25
                                         // BUGBUG: This is wrong, it should be 78, 23. This test has always been broken.
-                                        // in no way should the v2AddedToWin.Frame be the same as the Top.Frame/Bounds
+                                        // in no way should the v2AddedToWin.Frame be the same as the Top.Frame/Viewport
                                         // as it is a subview of winAddedToTop, which has a border!
-                                        //Assert.Equal (top.Bounds.Width,  v2AddedToWin.Frame.Width);
-                                        //Assert.Equal (top.Bounds.Height, v2AddedToWin.Frame.Height);
+                                        //Assert.Equal (top.Viewport.Width,  v2AddedToWin.Frame.Width);
+                                        //Assert.Equal (top.Viewport.Height, v2AddedToWin.Frame.Height);
                                     };
 
         svAddedTov1.Initialized += (s, e) =>
                                    {
                                        sv1c++;
 
-                                       // Top.Frame: 0, 0, 80, 25; Top.Bounds: 0, 0, 80, 25
+                                       // Top.Frame: 0, 0, 80, 25; Top.Viewport: 0, 0, 80, 25
                                        // BUGBUG: This is wrong, it should be 78, 23. This test has always been broken.
-                                       // in no way should the svAddedTov1.Frame be the same as the Top.Frame/Bounds
+                                       // in no way should the svAddedTov1.Frame be the same as the Top.Frame/Viewport
                                        // because sv1AddedTov1 is a subview of v1AddedToWin, which is a subview of
                                        // winAddedToTop, which has a border!
-                                       //Assert.Equal (top.Bounds.Width,  svAddedTov1.Frame.Width);
-                                       //Assert.Equal (top.Bounds.Height, svAddedTov1.Frame.Height);
+                                       //Assert.Equal (top.Viewport.Width,  svAddedTov1.Frame.Width);
+                                       //Assert.Equal (top.Viewport.Height, svAddedTov1.Frame.Height);
                                        Assert.False (svAddedTov1.CanFocus);
                                        Assert.Throws<InvalidOperationException> (() => svAddedTov1.CanFocus = true);
                                        Assert.False (svAddedTov1.CanFocus);
@@ -258,24 +258,24 @@ public class SubviewTests
         w.Initialized += (s, e) =>
                          {
                              wc++;
-                             Assert.Equal (t.Bounds.Width, w.Frame.Width);
-                             Assert.Equal (t.Bounds.Height, w.Frame.Height);
+                             Assert.Equal (t.Viewport.Width, w.Frame.Width);
+                             Assert.Equal (t.Viewport.Height, w.Frame.Height);
                          };
 
         v1.Initialized += (s, e) =>
                           {
                               v1c++;
 
-                              //Assert.Equal (t.Bounds.Width, v1.Frame.Width);
-                              //Assert.Equal (t.Bounds.Height, v1.Frame.Height);
+                              //Assert.Equal (t.Viewport.Width, v1.Frame.Width);
+                              //Assert.Equal (t.Viewport.Height, v1.Frame.Height);
                           };
 
         v2.Initialized += (s, e) =>
                           {
                               v2c++;
 
-                              //Assert.Equal (t.Bounds.Width,  v2.Frame.Width);
-                              //Assert.Equal (t.Bounds.Height, v2.Frame.Height);
+                              //Assert.Equal (t.Viewport.Width,  v2.Frame.Width);
+                              //Assert.Equal (t.Viewport.Height, v2.Frame.Height);
                           };
         w.Add (v1, v2);
         t.Add (w);

+ 3 - 3
UnitTests/View/Text/AutoSizeFalseTests.cs

@@ -145,7 +145,7 @@ public class AutoSizeFalseTests
         Rectangle expectedViewBounds = new (0, 0, 0, 0);
 
         Assert.False (view.AutoSize);
-        Assert.Equal (expectedViewBounds, view.Bounds);
+        Assert.Equal (expectedViewBounds, view.Viewport);
         super.Dispose ();
     }
 
@@ -162,7 +162,7 @@ public class AutoSizeFalseTests
         Rectangle expectedViewBounds = new (0, 0, 30, 80);
 
         Assert.False (view.AutoSize);
-        Assert.Equal (expectedViewBounds, view.Bounds);
+        Assert.Equal (expectedViewBounds, view.Viewport);
         Assert.False (view.IsInitialized);
 
         super.BeginInit ();
@@ -170,7 +170,7 @@ public class AutoSizeFalseTests
 
         Assert.True (view.IsInitialized);
         Assert.False (view.AutoSize);
-        Assert.Equal (expectedViewBounds, view.Bounds);
+        Assert.Equal (expectedViewBounds, view.Viewport);
     }
 
     [Fact]

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

@@ -587,7 +587,7 @@ public class AutoSizeTrueTests
                                      field.Text = $"Label {count}";
 
                                      // Label is AutoSize = true
-                                     var label = new Label { Text = field.Text, X = 0, Y = view.Bounds.Height /*, Width = 10*/ };
+                                     var label = new Label { Text = field.Text, X = 0, Y = view.Viewport.Height /*, Width = 10*/ };
                                      view.Add (label);
                                      Assert.Equal ($"Label {count}", label.Text);
                                      Assert.Equal ($"Absolute({count + 1})", label.Y.ToString ());
@@ -871,7 +871,7 @@ public class AutoSizeTrueTests
 
         Assert.True (label.AutoSize);
         Rectangle expectedLabelBounds = Rectangle.Empty;
-        Assert.Equal (expectedLabelBounds, label.Bounds);
+        Assert.Equal (expectedLabelBounds, label.Viewport);
         Assert.True (label.AutoSize);
 
         label.Text = "First line\nSecond line";
@@ -879,7 +879,7 @@ public class AutoSizeTrueTests
 
         expectedLabelBounds = new (0, 0, 11, 2);
         Assert.True (label.AutoSize);
-        Assert.Equal (expectedLabelBounds, label.Bounds);
+        Assert.Equal (expectedLabelBounds, label.Viewport);
 
         label.AutoSize = false;
         label.Width = Dim.Fill ();
@@ -891,7 +891,7 @@ public class AutoSizeTrueTests
         // Height set to 2.
         expectedLabelBounds = new (0, 0, 28, 2);
         Assert.False (label.AutoSize);
-        Assert.Equal (expectedLabelBounds, label.Bounds);
+        Assert.Equal (expectedLabelBounds, label.Viewport);
 
         label.Text = "First changed line\nSecond changed line\nNew line";
         win.LayoutSubviews ();
@@ -901,7 +901,7 @@ public class AutoSizeTrueTests
         // #3127: After: (0,0,28,2) because setting Text leaves Height set to 2.
         expectedLabelBounds = new (0, 0, 28, 2);
         Assert.False (label.AutoSize);
-        Assert.Equal (expectedLabelBounds, label.Bounds);
+        Assert.Equal (expectedLabelBounds, label.Viewport);
 
         label.AutoSize = true;
 
@@ -911,7 +911,7 @@ public class AutoSizeTrueTests
         // and height 3 because the text has 3 lines
         expectedLabelBounds = new (0, 0, 19, 3);
         Assert.True (label.AutoSize);
-        Assert.Equal (expectedLabelBounds, label.Bounds);
+        Assert.Equal (expectedLabelBounds, label.Viewport);
     }
 
     [Fact]
@@ -1494,7 +1494,7 @@ public class AutoSizeTrueTests
 
         Assert.True (label.AutoSize);
         Rectangle expectedLabelBounds = new (0, 0, 8, 1);
-        Assert.Equal (expectedLabelBounds, label.Bounds);
+        Assert.Equal (expectedLabelBounds, label.Viewport);
         super.Dispose ();
     }
 

+ 40 - 40
UnitTests/View/ViewTests.cs

@@ -11,20 +11,20 @@ public class ViewTests
 
     [Fact]
     [AutoInitShutdown]
-    public void Clear_Bounds_Can_Use_Driver_AddRune_Or_AddStr_Methods ()
+    public void Clear_Viewport_Can_Use_Driver_AddRune_Or_AddStr_Methods ()
     {
         var view = new FrameView { Width = Dim.Fill (), Height = Dim.Fill () };
 
         view.DrawContent += (s, e) =>
                             {
                                 Rectangle savedClip = Application.Driver.Clip;
-                                Application.Driver.Clip = new Rectangle (1, 1, view.Bounds.Width, view.Bounds.Height);
+                                Application.Driver.Clip = new Rectangle (1, 1, view.Viewport.Width, view.Viewport.Height);
 
-                                for (var row = 0; row < view.Bounds.Height; row++)
+                                for (var row = 0; row < view.Viewport.Height; row++)
                                 {
                                     Application.Driver.Move (1, row + 1);
 
-                                    for (var col = 0; col < view.Bounds.Width; col++)
+                                    for (var col = 0; col < view.Viewport.Width; col++)
                                     {
                                         Application.Driver.AddStr ($"{col}");
                                     }
@@ -53,7 +53,7 @@ public class ViewTests
         Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
         Assert.Equal (new Rectangle (0, 0, 20, 10), pos);
 
-        view.Clear (view.Bounds);
+        view.Clear (view.Viewport);
 
         expected = @"
 ┌──────────────────┐
@@ -80,13 +80,13 @@ public class ViewTests
         view.DrawContent += (s, e) =>
                             {
                                 Rectangle savedClip = Application.Driver.Clip;
-                                Application.Driver.Clip = new Rectangle (1, 1, view.Bounds.Width, view.Bounds.Height);
+                                Application.Driver.Clip = new Rectangle (1, 1, view.Viewport.Width, view.Viewport.Height);
 
-                                for (var row = 0; row < view.Bounds.Height; row++)
+                                for (var row = 0; row < view.Viewport.Height; row++)
                                 {
                                     Application.Driver.Move (1, row + 1);
 
-                                    for (var col = 0; col < view.Bounds.Width; col++)
+                                    for (var col = 0; col < view.Viewport.Width; col++)
                                     {
                                         Application.Driver.AddStr ($"{col}");
                                     }
@@ -115,7 +115,7 @@ public class ViewTests
         Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
         Assert.Equal (new Rectangle (0, 0, 20, 10), pos);
 
-        view.Clear (view.Bounds);
+        view.Clear (view.Viewport);
 
         expected = @"
 ┌──────────────────┐
@@ -220,7 +220,7 @@ cccccccccccccccccccc",
 
     [Fact]
     [AutoInitShutdown]
-    public void Correct_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Frame ()
+    public void Correct_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Frame ()
     {
         var label = new Label { Text = "At 0,0" };
 
@@ -248,7 +248,7 @@ At 0,0
         view.Frame = new Rectangle (3, 3, 10, 1);
         Assert.Equal (new Rectangle (3, 3, 10, 1), view.Frame);
         Assert.Equal (LayoutStyle.Absolute, view.LayoutStyle);
-        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Viewport);
         Assert.Equal (new Rectangle (0, 0, 10, 1), view._needsDisplayRect);
         top.Draw ();
 
@@ -265,7 +265,7 @@ At 0,0
 
     [Fact]
     [AutoInitShutdown]
-    public void Correct_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Pos_Dim ()
+    public void Correct_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Pos_Dim ()
     {
         var label = new Label { Text = "At 0,0" };
 
@@ -297,7 +297,7 @@ At 0,0
         view.Width = 10;
         view.Height = 1;
         Assert.Equal (new Rectangle (3, 3, 10, 1), view.Frame);
-        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Viewport);
         Assert.Equal (new Rectangle (0, 0, 30, 2), view._needsDisplayRect);
         top.Draw ();
 
@@ -314,7 +314,7 @@ At 0,0
 
     [Fact]
     [AutoInitShutdown]
-    public void Correct_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Frame ()
+    public void Correct_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Frame ()
     {
         var label = new Label { Text = "At 0,0" };
 
@@ -344,7 +344,7 @@ At 0,0
         view.Frame = new Rectangle (1, 1, 10, 1);
         Assert.Equal (new Rectangle (1, 1, 10, 1), view.Frame);
         Assert.Equal (LayoutStyle.Absolute, view.LayoutStyle);
-        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Viewport);
         Assert.Equal (new Rectangle (0, 0, 10, 1), view._needsDisplayRect);
         top.Draw ();
 
@@ -359,7 +359,7 @@ At 0,0
 
     [Fact]
     [AutoInitShutdown]
-    public void Correct_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Pos_Dim ()
+    public void Correct_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Pos_Dim ()
     {
         var label = new Label { Text = "At 0,0" };
 
@@ -391,7 +391,7 @@ At 0,0
         view.Width = 10;
         view.Height = 1;
         Assert.Equal (new Rectangle (1, 1, 10, 1), view.Frame);
-        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Viewport);
         Assert.Equal (new Rectangle (0, 0, 30, 2), view._needsDisplayRect);
         top.Draw ();
 
@@ -527,7 +527,7 @@ At 0,0
 
     [Fact]
     [AutoInitShutdown]
-    public void Incorrect_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Frame ()
+    public void Incorrect_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Frame ()
     {
         var label = new Label { Text = "At 0,0" };
 
@@ -555,7 +555,7 @@ At 0,0
                                                      );
 
         view.Frame = new Rectangle (3, 3, 10, 1);
-        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Viewport);
         Assert.Equal (new Rectangle (0, 0, 10, 1), view._needsDisplayRect);
         view.Draw ();
 
@@ -572,7 +572,7 @@ At 0,0
 
     [Fact]
     [AutoInitShutdown]
-    public void Incorrect_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Pos_Dim ()
+    public void Incorrect_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Down_Right_Using_Pos_Dim ()
     {
         var label = new Label { Text = "At 0,0" };
 
@@ -604,7 +604,7 @@ At 0,0
         view.Width = 10;
         view.Height = 1;
         Assert.Equal (new Rectangle (3, 3, 10, 1), view.Frame);
-        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Viewport);
         Assert.Equal (new Rectangle (0, 0, 30, 2), view._needsDisplayRect);
         view.Draw ();
 
@@ -621,7 +621,7 @@ At 0,0
 
     [Fact]
     [AutoInitShutdown]
-    public void Incorrect_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Frame ()
+    public void Incorrect_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Frame ()
     {
         var label = new Label { Text = "At 0,0" };
 
@@ -651,7 +651,7 @@ At 0,0
         view.Frame = new Rectangle (1, 1, 10, 1);
         Assert.Equal (new Rectangle (1, 1, 10, 1), view.Frame);
         Assert.Equal (LayoutStyle.Absolute, view.LayoutStyle);
-        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Viewport);
         Assert.Equal (new Rectangle (0, 0, 10, 1), view._needsDisplayRect);
         view.Draw ();
 
@@ -668,7 +668,7 @@ At 0,0
 
     [Fact]
     [AutoInitShutdown]
-    public void Incorrect_Redraw_Bounds_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Pos_Dim ()
+    public void Incorrect_Redraw_Viewport_NeedDisplay_On_Shrink_And_Move_Up_Left_Using_Pos_Dim ()
     {
         var label = new Label { Text = "At 0,0" };
 
@@ -700,7 +700,7 @@ At 0,0
         view.Width = 10;
         view.Height = 1;
         Assert.Equal (new Rectangle (1, 1, 10, 1), view.Frame);
-        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 1), view.Viewport);
         Assert.Equal (new Rectangle (0, 0, 30, 2), view._needsDisplayRect);
         view.Draw ();
 
@@ -748,10 +748,10 @@ At 0,0
         Assert.True (r.Visible);
 
         Assert.Equal (LayoutStyle.Absolute, r.LayoutStyle);
-        Assert.Equal ($"View(){r.Bounds}", r.ToString ());
+        Assert.Equal ($"View(){r.Viewport}", r.ToString ());
         Assert.False (r.CanFocus);
         Assert.False (r.HasFocus);
-        Assert.Equal (new Rectangle (0, 0, 0, 0), r.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 0, 0), r.Viewport);
         Assert.Equal (new Rectangle (0, 0, 0, 0), r.Frame);
         Assert.Null (r.Focused);
         Assert.Null (r.ColorScheme);
@@ -773,10 +773,10 @@ At 0,0
         r = new View { Frame = Rectangle.Empty };
         Assert.NotNull (r);
         Assert.Equal (LayoutStyle.Absolute, r.LayoutStyle);
-        Assert.Equal ($"View(){r.Bounds}", r.ToString ());
+        Assert.Equal ($"View(){r.Viewport}", r.ToString ());
         Assert.False (r.CanFocus);
         Assert.False (r.HasFocus);
-        Assert.Equal (new Rectangle (0, 0, 0, 0), r.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 0, 0), r.Viewport);
         Assert.Equal (new Rectangle (0, 0, 0, 0), r.Frame);
         Assert.Null (r.Focused);
         Assert.Null (r.ColorScheme);
@@ -801,7 +801,7 @@ At 0,0
         Assert.Equal ($"View(){r.Frame}", r.ToString ());
         Assert.False (r.CanFocus);
         Assert.False (r.HasFocus);
-        Assert.Equal (new Rectangle (0, 0, 3, 4), r.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 3, 4), r.Viewport);
         Assert.Equal (new Rectangle (1, 2, 3, 4), r.Frame);
         Assert.Null (r.Focused);
         Assert.Null (r.ColorScheme);
@@ -832,7 +832,7 @@ At 0,0
         r.EndInit ();
         Assert.False (r.CanFocus);
         Assert.False (r.HasFocus);
-        Assert.Equal (new Rectangle (0, 0, 1, 13), r.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 1, 13), r.Viewport);
         Assert.Equal (new Rectangle (0, 0, 1, 13), r.Frame);
         Assert.Null (r.Focused);
         Assert.Null (r.ColorScheme);
@@ -929,8 +929,8 @@ At 0,0
         Assert.Equal (4, view.Height);
         Assert.False (view.Frame.IsEmpty);
         Assert.Equal (new Rectangle (1, 2, 3, 4), view.Frame);
-        Assert.False (view.Bounds.IsEmpty);
-        Assert.Equal (new Rectangle (0, 0, 3, 4), view.Bounds);
+        Assert.False (view.Viewport.IsEmpty);
+        Assert.Equal (new Rectangle (0, 0, 3, 4), view.Viewport);
 
         view.LayoutSubviews ();
 
@@ -939,7 +939,7 @@ At 0,0
         Assert.Equal (3, view.Width);
         Assert.Equal (4, view.Height);
         Assert.False (view.Frame.IsEmpty);
-        Assert.False (view.Bounds.IsEmpty);
+        Assert.False (view.Viewport.IsEmpty);
         super.Dispose ();
 
 #if DEBUG_IDISPOSABLE
@@ -953,7 +953,7 @@ At 0,0
         Assert.Equal (0, view.Width);
         Assert.Equal (0, view.Height);
         Assert.True (view.Frame.IsEmpty);
-        Assert.True (view.Bounds.IsEmpty);
+        Assert.True (view.Viewport.IsEmpty);
         view.Dispose ();
 
         // Object Initializer
@@ -963,7 +963,7 @@ At 0,0
         Assert.Equal (0, view.Width);
         Assert.Equal (0, view.Height);
         Assert.False (view.Frame.IsEmpty);
-        Assert.True (view.Bounds.IsEmpty);
+        Assert.True (view.Viewport.IsEmpty);
         view.Dispose ();
 
         // Default Constructor and post assignment equivalent to Object Initializer
@@ -983,8 +983,8 @@ At 0,0
         Assert.Equal (4, view.Height);
         Assert.False (view.Frame.IsEmpty);
         Assert.Equal (new Rectangle (1, 2, 3, 4), view.Frame);
-        Assert.False (view.Bounds.IsEmpty);
-        Assert.Equal (new Rectangle (0, 0, 3, 4), view.Bounds);
+        Assert.False (view.Viewport.IsEmpty);
+        Assert.Equal (new Rectangle (0, 0, 3, 4), view.Viewport);
         super.Dispose ();
     }
 
@@ -1119,11 +1119,11 @@ At 0,0
         public bool IsKeyUp { get; set; }
         public override string Text { get; set; }
 
-        public override void OnDrawContent (Rectangle contentArea)
+        public override void OnDrawContent (Rectangle viewport)
         {
             var idx = 0;
 
-            // BUGBUG: v2 - this should use Bounds, not Frame
+            // BUGBUG: v2 - this should use Viewport, not Frame
             for (var r = 0; r < Frame.Height; r++)
             {
                 for (var c = 0; c < Frame.Width; c++)

+ 6 - 6
UnitTests/Views/ButtonTests.cs

@@ -432,14 +432,14 @@ public class ButtonTests
         Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
         Assert.Equal ('_', btn.HotKeySpecifier.Value);
         Assert.True (btn.CanFocus);
-        Assert.Equal (new Rectangle (0, 0, 4, 1), btn.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 4, 1), btn.Viewport);
         Assert.Equal (new Rectangle (0, 0, 4, 1), btn.Frame);
         Assert.Equal ($"{CM.Glyphs.LeftBracket}  {CM.Glyphs.RightBracket}", btn.TextFormatter.Text);
         Assert.False (btn.IsDefault);
         Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
         Assert.Equal ('_', btn.HotKeySpecifier.Value);
         Assert.True (btn.CanFocus);
-        Assert.Equal (new Rectangle (0, 0, 4, 1), btn.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 4, 1), btn.Viewport);
         Assert.Equal (new Rectangle (0, 0, 4, 1), btn.Frame);
 
         Assert.Equal (string.Empty, btn.Title);
@@ -478,7 +478,7 @@ public class ButtonTests
         Assert.True (btn.IsDefault);
         Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
         Assert.True (btn.CanFocus);
-        Assert.Equal (new Rectangle (0, 0, 10, 1), btn.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 1), btn.Viewport);
         Assert.Equal (new Rectangle (0, 0, 10, 1), btn.Frame);
         Assert.Equal (KeyCode.T, btn.HotKey);
 
@@ -521,7 +521,7 @@ public class ButtonTests
 ";
         TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 
-        Assert.Equal (new Rectangle (0, 0, 9, 1), btn.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 9, 1), btn.Viewport);
         Assert.Equal (new Rectangle (1, 2, 9, 1), btn.Frame);
     }
 
@@ -762,7 +762,7 @@ public class ButtonTests
         Assert.True (btn.IsInitialized);
         Assert.Equal ("Say Hello 你", btn.Text);
         Assert.Equal ($"{CM.Glyphs.LeftBracket} {btn.Text} {CM.Glyphs.RightBracket}", btn.TextFormatter.Text);
-        Assert.Equal (new Rectangle (0, 0, 16, 1), btn.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 16, 1), btn.Viewport);
         var btnTxt = $"{CM.Glyphs.LeftBracket} {btn.Text} {CM.Glyphs.RightBracket}";
 
         var expected = @$"
@@ -799,7 +799,7 @@ public class ButtonTests
         Assert.True (btn.IsInitialized);
         Assert.Equal ("Say Hello 你", btn.Text);
         Assert.Equal ($"{CM.Glyphs.LeftBracket} {btn.Text} {CM.Glyphs.RightBracket}", btn.TextFormatter.Text);
-        Assert.Equal (new Rectangle (0, 0, 16, 1), btn.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 16, 1), btn.Viewport);
         var btnTxt = $"{CM.Glyphs.LeftBracket} {btn.Text} {CM.Glyphs.RightBracket}";
 
         var expected = @$"

+ 18 - 18
UnitTests/Views/ComboBoxTests.cs

@@ -144,7 +144,7 @@ public class ComboBoxTests
 
         Assert.True (
                      cb.OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
                                    )
                     );
         Assert.Equal ("", selected);
@@ -200,7 +200,7 @@ public class ComboBoxTests
 
         Assert.True (
                      cb.OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
                                    )
                     );
         Assert.Equal ("", selected);
@@ -236,7 +236,7 @@ public class ComboBoxTests
 
         Assert.True (
                      cb.OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
                                    )
                     );
         Assert.Equal ("", selected);
@@ -292,7 +292,7 @@ public class ComboBoxTests
 
         Assert.True (
                      cb.OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
                                    )
                     );
         Assert.Equal ("", selected);
@@ -337,7 +337,7 @@ public class ComboBoxTests
 
         Assert.True (
                      cb.OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
                                    )
                     );
 
@@ -354,7 +354,7 @@ public class ComboBoxTests
 
         Assert.True (
                      cb.OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
                                    )
                     );
         Assert.Equal ("Three", selected);
@@ -392,14 +392,14 @@ public class ComboBoxTests
 
         Assert.True (
                      cb.OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
                                    )
                     );
 
         Assert.True (
                      cb.Subviews [1]
                        .OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Clicked }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Clicked }
                                    )
                     );
         Assert.Equal ("", selected);
@@ -423,7 +423,7 @@ public class ComboBoxTests
         Assert.True (
                      cb.Subviews [1]
                        .OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Clicked }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Clicked }
                                    )
                     );
         Assert.Equal ("", selected);
@@ -447,7 +447,7 @@ public class ComboBoxTests
         Assert.True (
                      cb.Subviews [1]
                        .OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Clicked }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Clicked }
                                    )
                     );
         Assert.Equal ("", selected);
@@ -471,7 +471,7 @@ public class ComboBoxTests
         Assert.True (
                      cb.Subviews [1]
                        .OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Clicked }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Clicked }
                                    )
                     );
         Assert.Equal ("", selected);
@@ -509,7 +509,7 @@ public class ComboBoxTests
 
         Assert.True (
                      cb.OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
                                    )
                     );
         Assert.Equal ("", selected);
@@ -665,7 +665,7 @@ Three ",
 
         Assert.True (
                      cb.OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
                                    )
                     );
         Assert.Equal ("", selected);
@@ -677,7 +677,7 @@ Three ",
 
         Assert.True (
                      cb.OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
                                    )
                     );
         Assert.Equal ("", selected);
@@ -687,7 +687,7 @@ Three ",
 
         Assert.True (
                      cb.OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
                                    )
                     );
         Assert.Equal ("", selected);
@@ -699,7 +699,7 @@ Three ",
 
         Assert.True (
                      cb.OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
                                    )
                     );
         Assert.Equal ("", selected);
@@ -726,7 +726,7 @@ Three ",
 
         Assert.True (
                      cb.OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
                                    )
                     );
         Assert.Equal ("", selected);
@@ -782,7 +782,7 @@ Three ",
 
         Assert.True (
                      cb.OnMouseEvent (
-                                    new MouseEvent { X = cb.Bounds.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
+                                    new MouseEvent { X = cb.Viewport.Right - 1, Y = 0, Flags = MouseFlags.Button1Pressed }
                                    )
                     );
         Assert.Equal ("", selected);

+ 25 - 25
UnitTests/Views/GraphViewTests.cs

@@ -61,7 +61,7 @@ public class GraphViewTests
         gv.EndInit ();
 
         gv.ColorScheme = new ColorScheme ();
-        gv.Bounds = new Rectangle (0, 0, 50, 30);
+        gv.Viewport = new Rectangle (0, 0, 50, 30);
         gv.Series.Add (new ScatterSeries { Points = new List<PointF> { new (1, 1) } });
         gv.CellSize = new PointF (0, 5);
         var ex = Assert.Throws<Exception> (() => gv.Draw ());
@@ -85,7 +85,7 @@ public class GraphViewTests
         gv.ColorScheme = new ColorScheme ();
         gv.MarginBottom = 1;
         gv.MarginLeft = 1;
-        gv.Bounds = new Rectangle (0, 0, 10, 5);
+        gv.Viewport = new Rectangle (0, 0, 10, 5);
 
         return gv;
     }
@@ -128,7 +128,7 @@ public class GraphViewTests
         var gv = new GraphView ();
         gv.BeginInit ();
         gv.EndInit ();
-        gv.Bounds = new Rectangle (0, 0, 50, 30);
+        gv.Viewport = new Rectangle (0, 0, 50, 30);
 
         // How much graph space each cell of the console depicts
         gv.CellSize = new PointF (0.1f, 0.25f);
@@ -141,9 +141,9 @@ public class GraphViewTests
         // Start the graph at 80
         gv.ScrollOffset = new PointF (0, 80);
 
-        for (var x = 0; x < gv.Bounds.Width; x++)
+        for (var x = 0; x < gv.Viewport.Width; x++)
         {
-            for (var y = 0; y < gv.Bounds.Height; y++)
+            for (var y = 0; y < gv.Viewport.Height; y++)
             {
                 RectangleF graphSpace = gv.ScreenToGraphSpace (x, y);
 
@@ -199,7 +199,7 @@ public class GraphViewTests
         gv.BeginInit ();
         gv.EndInit ();
 
-        gv.Bounds = new Rectangle (0, 0, 20, 10);
+        gv.Viewport = new Rectangle (0, 0, 20, 10);
 
         // origin should be bottom left
         RectangleF botLeft = gv.ScreenToGraphSpace (0, 9);
@@ -221,7 +221,7 @@ public class GraphViewTests
         gv.BeginInit ();
         gv.EndInit ();
 
-        gv.Bounds = new Rectangle (0, 0, 20, 10);
+        gv.Viewport = new Rectangle (0, 0, 20, 10);
 
         // origin should be bottom left
         RectangleF botLeft = gv.ScreenToGraphSpace (0, 9);
@@ -261,7 +261,7 @@ public class GraphViewTests
         gv.BeginInit ();
         gv.EndInit ();
 
-        gv.Bounds = new Rectangle (0, 0, 20, 10);
+        gv.Viewport = new Rectangle (0, 0, 20, 10);
 
         // Each cell of screen measures 5 units in graph data model vertically and 1/4 horizontally
         gv.CellSize = new PointF (0.25f, 5);
@@ -293,7 +293,7 @@ public class GraphViewTests
         gv.BeginInit ();
         gv.EndInit ();
 
-        gv.Bounds = new Rectangle (0, 0, 20, 10);
+        gv.Viewport = new Rectangle (0, 0, 20, 10);
 
         // origin should be bottom left
         Point botLeft = gv.GraphSpaceToScreen (new PointF (0, 0));
@@ -313,7 +313,7 @@ public class GraphViewTests
         gv.BeginInit ();
         gv.EndInit ();
 
-        gv.Bounds = new Rectangle (0, 0, 20, 10);
+        gv.Viewport = new Rectangle (0, 0, 20, 10);
 
         // origin should be bottom left
         Point botLeft = gv.GraphSpaceToScreen (new PointF (0, 0));
@@ -343,7 +343,7 @@ public class GraphViewTests
         gv.BeginInit ();
         gv.EndInit ();
 
-        gv.Bounds = new Rectangle (0, 0, 20, 10);
+        gv.Viewport = new Rectangle (0, 0, 20, 10);
 
         //graph is scrolled to present chart space -5 to 5 in both axes
         gv.ScrollOffset = new PointF (-5, -5);
@@ -366,7 +366,7 @@ public class GraphViewTests
         gv.BeginInit ();
         gv.EndInit ();
 
-        gv.Bounds = new Rectangle (0, 0, 20, 10);
+        gv.Viewport = new Rectangle (0, 0, 20, 10);
 
         // Each cell of screen is responsible for rendering 5 units in graph data model
         // vertically and 1/4 horizontally
@@ -407,7 +407,7 @@ public class GraphViewTests
         gv.BeginInit ();
         gv.EndInit ();
 
-        gv.Bounds = new Rectangle (0, 0, 20, 10);
+        gv.Viewport = new Rectangle (0, 0, 20, 10);
 
         // Each cell of screen is responsible for rendering 5 units in graph data model
         // vertically and 1/4 horizontally
@@ -441,7 +441,7 @@ public class GraphViewTests
 public class SeriesTests
 {
     [Fact]
-    public void Series_GetsPassedCorrectBounds_AllAtOnce ()
+    public void Series_GetsPassedCorrectViewport_AllAtOnce ()
     {
         GraphViewTests.InitFakeDriver ();
 
@@ -449,7 +449,7 @@ public class SeriesTests
         gv.BeginInit ();
         gv.EndInit ();
         gv.ColorScheme = new ColorScheme ();
-        gv.Bounds = new Rectangle (0, 0, 50, 30);
+        gv.Viewport = new Rectangle (0, 0, 50, 30);
 
         var fullGraphBounds = RectangleF.Empty;
         var graphScreenBounds = Rectangle.Empty;
@@ -493,7 +493,7 @@ public class SeriesTests
     ///     <see cref="GraphView.CellSize"/> results in multiple units of graph space being condensed into each cell of console
     /// </summary>
     [Fact]
-    public void Series_GetsPassedCorrectBounds_AllAtOnce_LargeCellSize ()
+    public void Series_GetsPassedCorrectViewport_AllAtOnce_LargeCellSize ()
     {
         GraphViewTests.InitFakeDriver ();
 
@@ -501,7 +501,7 @@ public class SeriesTests
         gv.BeginInit ();
         gv.EndInit ();
         gv.ColorScheme = new ColorScheme ();
-        gv.Bounds = new Rectangle (0, 0, 50, 30);
+        gv.Viewport = new Rectangle (0, 0, 50, 30);
 
         // the larger the cell size the more condensed (smaller) the graph space is
         gv.CellSize = new PointF (2, 5);
@@ -641,7 +641,7 @@ public class MultiBarSeriesTests
 
         // y axis goes from 0.1 to 1 across 10 console rows
         // x axis goes from 0 to 20 across 20 console columns
-        gv.Bounds = new Rectangle (0, 0, 20, 10);
+        gv.Viewport = new Rectangle (0, 0, 20, 10);
         gv.CellSize = new PointF (1f, 0.1f);
         gv.MarginBottom = 1;
         gv.MarginLeft = 1;
@@ -873,7 +873,7 @@ public class BarSeriesTests
 
         // y axis goes from 0.1 to 1 across 10 console rows
         // x axis goes from 0 to 10 across 20 console columns
-        gv.Bounds = new Rectangle (0, 0, 20, 10);
+        gv.Viewport = new Rectangle (0, 0, 20, 10);
         gv.CellSize = new PointF (0.5f, 0.1f);
 
         gv.Series.Add (series = new FakeBarSeries ());
@@ -914,7 +914,7 @@ public class AxisTests
 
         var gv = new GraphView ();
         gv.ColorScheme = new ColorScheme ();
-        gv.Bounds = new Rectangle (0, 0, 50, 30);
+        gv.Viewport = new Rectangle (0, 0, 50, 30);
 
         // graph can't be completely empty or it won't draw
         gv.Series.Add (new ScatterSeries ());
@@ -1298,19 +1298,19 @@ public class LegendTests
     public void Constructors_Defaults ()
     {
         var legend = new LegendAnnotation ();
-        Assert.Equal (Rectangle.Empty, legend.Bounds);
+        Assert.Equal (Rectangle.Empty, legend.Viewport);
         Assert.Equal (Rectangle.Empty, legend.Frame);
         Assert.Equal (LineStyle.Single, legend.BorderStyle);
         Assert.False (legend.BeforeSeries);
 
         var bounds = new Rectangle (1, 2, 10, 3);
         legend = new LegendAnnotation (bounds);
-        Assert.Equal (new Rectangle (0, 0, 8, 1), legend.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 8, 1), legend.Viewport);
         Assert.Equal (bounds, legend.Frame);
         Assert.Equal (LineStyle.Single, legend.BorderStyle);
         Assert.False (legend.BeforeSeries);
         legend.BorderStyle = LineStyle.None;
-        Assert.Equal (new Rectangle (0, 0, 10, 3), legend.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 3), legend.Viewport);
         Assert.Equal (bounds, legend.Frame);
     }
 
@@ -1549,7 +1549,7 @@ public class PathAnnotationTests
     public void XAxisLabels_With_MarginLeft ()
     {
         GraphViewTests.InitFakeDriver ();
-        var gv = new GraphView { ColorScheme = new ColorScheme (), Bounds = new Rectangle (0, 0, 10, 7) };
+        var gv = new GraphView { ColorScheme = new ColorScheme (), Viewport = new Rectangle (0, 0, 10, 7) };
 
         gv.CellSize = new PointF (1, 0.5f);
         gv.AxisY.Increment = 1;
@@ -1591,7 +1591,7 @@ public class PathAnnotationTests
     public void YAxisLabels_With_MarginBottom ()
     {
         GraphViewTests.InitFakeDriver ();
-        var gv = new GraphView { ColorScheme = new ColorScheme (), Bounds = new Rectangle (0, 0, 10, 7) };
+        var gv = new GraphView { ColorScheme = new ColorScheme (), Viewport = new Rectangle (0, 0, 10, 7) };
 
         gv.CellSize = new PointF (1, 0.5f);
         gv.AxisY.Increment = 1;

+ 5 - 5
UnitTests/Views/LabelTests.cs

@@ -421,7 +421,7 @@ e
         Assert.True (label.IsInitialized);
         Assert.Equal ("Say Hello 你", label.Text);
         Assert.Equal ("Say Hello 你", label.TextFormatter.Text);
-        Assert.Equal (new Rectangle (0, 0, 12, 1), label.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 12, 1), label.Viewport);
 
         var expected = @"
 ┌────────────────────────────┐
@@ -451,7 +451,7 @@ e
         Assert.True (label.IsInitialized);
         Assert.Equal ("Say Hello 你", label.Text);
         Assert.Equal ("Say Hello 你", label.TextFormatter.Text);
-        Assert.Equal (new Rectangle (0, 0, 12, 1), label.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 12, 1), label.Viewport);
 
         var expected = @"
 ┌────────────────────────────┐
@@ -475,7 +475,7 @@ e
         Application.Begin (Application.Top);
 
         Assert.Equal (new (0, 0, 6, 3), label.Frame);
-        Assert.Equal (new (0, 0, 4, 1), label.Bounds);
+        Assert.Equal (new (0, 0, 4, 1), label.Viewport);
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -497,7 +497,7 @@ e
         Application.Begin (Application.Top);
 
         Assert.Equal (new (0, 0, 6, 3), label.Frame);
-        Assert.Equal (new (0, 0, 4, 1), label.Bounds);
+        Assert.Equal (new (0, 0, 4, 1), label.Viewport);
         Application.Begin (Application.Top);
 
         TestHelpers.AssertDriverContentsWithFrameAre (
@@ -518,7 +518,7 @@ e
         Application.Begin (Application.Top);
 
         Assert.Equal (new (0, 0, 6, 2), label.Frame);
-        Assert.Equal (new (0, 0, 4, 1), label.Bounds);
+        Assert.Equal (new (0, 0, 4, 1), label.Viewport);
         Application.Begin (Application.Top);
 
         TestHelpers.AssertDriverContentsWithFrameAre (

+ 29 - 29
UnitTests/Views/ScrollBarViewTests.cs

@@ -23,13 +23,13 @@ public class ScrollBarViewTests
         Assert.True (_scrollBar.ShowScrollIndicator);
         Assert.True (_scrollBar.Visible);
         Assert.Equal ("Absolute(1)", _scrollBar.Width.ToString ());
-        Assert.Equal (1, _scrollBar.Bounds.Width);
+        Assert.Equal (1, _scrollBar.Viewport.Width);
 
         Assert.Equal (
                       $"Combine(View(Height,HostView(){_hostView.Frame})-Absolute(1))",
                       _scrollBar.Height.ToString ()
                      );
-        Assert.Equal (24, _scrollBar.Bounds.Height);
+        Assert.Equal (24, _scrollBar.Viewport.Height);
         Assert.True (_scrollBar.OtherScrollBarView.ShowScrollIndicator);
         Assert.True (_scrollBar.OtherScrollBarView.Visible);
 
@@ -37,22 +37,22 @@ public class ScrollBarViewTests
                       $"Combine(View(Width,HostView(){_hostView.Frame})-Absolute(1))",
                       _scrollBar.OtherScrollBarView.Width.ToString ()
                      );
-        Assert.Equal (79, _scrollBar.OtherScrollBarView.Bounds.Width);
+        Assert.Equal (79, _scrollBar.OtherScrollBarView.Viewport.Width);
         Assert.Equal ("Absolute(1)", _scrollBar.OtherScrollBarView.Height.ToString ());
-        Assert.Equal (1, _scrollBar.OtherScrollBarView.Bounds.Height);
+        Assert.Equal (1, _scrollBar.OtherScrollBarView.Viewport.Height);
 
         _hostView.Lines = 10;
         _hostView.Draw ();
         Assert.False (_scrollBar.ShowScrollIndicator);
         Assert.False (_scrollBar.Visible);
         Assert.Equal ("Absolute(1)", _scrollBar.Width.ToString ());
-        Assert.Equal (1, _scrollBar.Bounds.Width);
+        Assert.Equal (1, _scrollBar.Viewport.Width);
 
         Assert.Equal (
                       $"Combine(View(Height,HostView(){_hostView.Frame})-Absolute(1))",
                       _scrollBar.Height.ToString ()
                      );
-        Assert.Equal (24, _scrollBar.Bounds.Height);
+        Assert.Equal (24, _scrollBar.Viewport.Height);
         Assert.True (_scrollBar.OtherScrollBarView.ShowScrollIndicator);
         Assert.True (_scrollBar.OtherScrollBarView.Visible);
 
@@ -60,22 +60,22 @@ public class ScrollBarViewTests
                       $"View(Width,HostView(){_hostView.Frame})",
                       _scrollBar.OtherScrollBarView.Width.ToString ()
                      );
-        Assert.Equal (80, _scrollBar.OtherScrollBarView.Bounds.Width);
+        Assert.Equal (80, _scrollBar.OtherScrollBarView.Viewport.Width);
         Assert.Equal ("Absolute(1)", _scrollBar.OtherScrollBarView.Height.ToString ());
-        Assert.Equal (1, _scrollBar.OtherScrollBarView.Bounds.Height);
+        Assert.Equal (1, _scrollBar.OtherScrollBarView.Viewport.Height);
 
         _hostView.Cols = 60;
         _hostView.Draw ();
         Assert.False (_scrollBar.ShowScrollIndicator);
         Assert.False (_scrollBar.Visible);
         Assert.Equal ("Absolute(1)", _scrollBar.Width.ToString ());
-        Assert.Equal (1, _scrollBar.Bounds.Width);
+        Assert.Equal (1, _scrollBar.Viewport.Width);
 
         Assert.Equal (
                       $"Combine(View(Height,HostView(){_hostView.Frame})-Absolute(1))",
                       _scrollBar.Height.ToString ()
                      );
-        Assert.Equal (24, _scrollBar.Bounds.Height);
+        Assert.Equal (24, _scrollBar.Viewport.Height);
         Assert.False (_scrollBar.OtherScrollBarView.ShowScrollIndicator);
         Assert.False (_scrollBar.OtherScrollBarView.Visible);
 
@@ -83,22 +83,22 @@ public class ScrollBarViewTests
                       $"View(Width,HostView(){_hostView.Frame})",
                       _scrollBar.OtherScrollBarView.Width.ToString ()
                      );
-        Assert.Equal (80, _scrollBar.OtherScrollBarView.Bounds.Width);
+        Assert.Equal (80, _scrollBar.OtherScrollBarView.Viewport.Width);
         Assert.Equal ("Absolute(1)", _scrollBar.OtherScrollBarView.Height.ToString ());
-        Assert.Equal (1, _scrollBar.OtherScrollBarView.Bounds.Height);
+        Assert.Equal (1, _scrollBar.OtherScrollBarView.Viewport.Height);
 
         _hostView.Lines = 40;
         _hostView.Draw ();
         Assert.True (_scrollBar.ShowScrollIndicator);
         Assert.True (_scrollBar.Visible);
         Assert.Equal ("Absolute(1)", _scrollBar.Width.ToString ());
-        Assert.Equal (1, _scrollBar.Bounds.Width);
+        Assert.Equal (1, _scrollBar.Viewport.Width);
 
         Assert.Equal (
                       $"View(Height,HostView(){_hostView.Frame})",
                       _scrollBar.Height.ToString ()
                      );
-        Assert.Equal (25, _scrollBar.Bounds.Height);
+        Assert.Equal (25, _scrollBar.Viewport.Height);
         Assert.False (_scrollBar.OtherScrollBarView.ShowScrollIndicator);
         Assert.False (_scrollBar.OtherScrollBarView.Visible);
 
@@ -106,22 +106,22 @@ public class ScrollBarViewTests
                       $"View(Width,HostView(){_hostView.Frame})",
                       _scrollBar.OtherScrollBarView.Width.ToString ()
                      );
-        Assert.Equal (80, _scrollBar.OtherScrollBarView.Bounds.Width);
+        Assert.Equal (80, _scrollBar.OtherScrollBarView.Viewport.Width);
         Assert.Equal ("Absolute(1)", _scrollBar.OtherScrollBarView.Height.ToString ());
-        Assert.Equal (1, _scrollBar.OtherScrollBarView.Bounds.Height);
+        Assert.Equal (1, _scrollBar.OtherScrollBarView.Viewport.Height);
 
         _hostView.Cols = 120;
         _hostView.Draw ();
         Assert.True (_scrollBar.ShowScrollIndicator);
         Assert.True (_scrollBar.Visible);
         Assert.Equal ("Absolute(1)", _scrollBar.Width.ToString ());
-        Assert.Equal (1, _scrollBar.Bounds.Width);
+        Assert.Equal (1, _scrollBar.Viewport.Width);
 
         Assert.Equal (
                       $"Combine(View(Height,HostView(){_hostView.Frame})-Absolute(1))",
                       _scrollBar.Height.ToString ()
                      );
-        Assert.Equal (24, _scrollBar.Bounds.Height);
+        Assert.Equal (24, _scrollBar.Viewport.Height);
         Assert.True (_scrollBar.OtherScrollBarView.ShowScrollIndicator);
         Assert.True (_scrollBar.OtherScrollBarView.Visible);
 
@@ -129,9 +129,9 @@ public class ScrollBarViewTests
                       $"Combine(View(Width,HostView(){_hostView.Frame})-Absolute(1))",
                       _scrollBar.OtherScrollBarView.Width.ToString ()
                      );
-        Assert.Equal (79, _scrollBar.OtherScrollBarView.Bounds.Width);
+        Assert.Equal (79, _scrollBar.OtherScrollBarView.Viewport.Width);
         Assert.Equal ("Absolute(1)", _scrollBar.OtherScrollBarView.Height.ToString ());
-        Assert.Equal (1, _scrollBar.OtherScrollBarView.Bounds.Height);
+        Assert.Equal (1, _scrollBar.OtherScrollBarView.Viewport.Height);
     }
 
     [Fact]
@@ -421,7 +421,7 @@ This is a tes
                      {
                          newScrollBarView.Position = 100;
 
-                         //Assert.Equal (newScrollBarView.Position, newScrollBarView.Size - listView.LeftItem + (listView.LeftItem - listView.Bounds.Width));
+                         //Assert.Equal (newScrollBarView.Position, newScrollBarView.Size - listView.LeftItem + (listView.LeftItem - listView.Viewport.Width));
                          Assert.Equal (newScrollBarView.Position, listView.LeftItem);
 
                          //Assert.Equal (92, newScrollBarView.Position);
@@ -499,7 +499,7 @@ This is a tes
                                                                                    newScrollBarView.Position,
                                                                                    newScrollBarView.Size
                                                                                    - listView.TopItem
-                                                                                   + (listView.TopItem - listView.Bounds.Height)
+                                                                                   + (listView.TopItem - listView.Viewport.Height)
                                                                                   );
                                                                      Assert.Equal (newScrollBarView.Position, listView.TopItem);
                                                                      Assert.Equal (27, newScrollBarView.Position);
@@ -960,7 +960,7 @@ This is a test
     public void Internal_Tests ()
     {
         Toplevel top = Application.Top;
-        Assert.Equal (new Rectangle (0, 0, 80, 25), top.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 80, 25), top.Viewport);
         var view = new View { Width = Dim.Fill (), Height = Dim.Fill () };
         top.Add (view);
         var sbv = new ScrollBarView (view, true);
@@ -1037,10 +1037,10 @@ This is a test
 
         AddHandlers ();
 
-        Assert.Equal (80, _hostView.Bounds.Width);
-        Assert.Equal (25, _hostView.Bounds.Height);
-        Assert.Equal (79, _scrollBar.OtherScrollBarView.Bounds.Width);
-        Assert.Equal (24, _scrollBar.Bounds.Height);
+        Assert.Equal (80, _hostView.Viewport.Width);
+        Assert.Equal (25, _hostView.Viewport.Height);
+        Assert.Equal (79, _scrollBar.OtherScrollBarView.Viewport.Width);
+        Assert.Equal (24, _scrollBar.Viewport.Height);
         Assert.Equal (30, _scrollBar.Size);
         Assert.Equal (100, _scrollBar.OtherScrollBarView.Size);
         Assert.True (_scrollBar.ShowScrollIndicator);
@@ -1049,7 +1049,7 @@ This is a test
         Assert.True (_scrollBar.OtherScrollBarView.Visible);
 
         _scrollBar.Position = 50;
-        Assert.Equal (_scrollBar.Position, _scrollBar.Size - _scrollBar.Bounds.Height);
+        Assert.Equal (_scrollBar.Position, _scrollBar.Size - _scrollBar.Viewport.Height);
         Assert.Equal (_scrollBar.Position, _hostView.Top);
         Assert.Equal (6, _scrollBar.Position);
         Assert.Equal (6, _hostView.Top);
@@ -1062,7 +1062,7 @@ This is a test
 
         Assert.Equal (
                       _scrollBar.OtherScrollBarView.Position,
-                      _scrollBar.OtherScrollBarView.Size - _scrollBar.OtherScrollBarView.Bounds.Width
+                      _scrollBar.OtherScrollBarView.Size - _scrollBar.OtherScrollBarView.Viewport.Width
                      );
         Assert.Equal (_scrollBar.OtherScrollBarView.Position, _hostView.Left);
         Assert.Equal (21, _scrollBar.OtherScrollBarView.Position);

+ 5 - 5
UnitTests/Views/ScrollViewTests.cs

@@ -34,7 +34,7 @@ public class ScrollViewTests
         Application.Top.Add (sv);
         Application.Begin (Application.Top);
 
-        Assert.Equal (new Rectangle (0, 0, 10, 10), sv.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 10), sv.Viewport);
 
         Assert.False (sv.AutoHideScrollBars);
         Assert.True (sv.ShowHorizontalScrollIndicator);
@@ -58,9 +58,9 @@ public class ScrollViewTests
                                             );
 
         sv.ShowHorizontalScrollIndicator = false;
-        Assert.Equal (new Rectangle (0, 0, 10, 10), sv.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 10), sv.Viewport);
         sv.ShowVerticalScrollIndicator = true;
-        Assert.Equal (new Rectangle (0, 0, 10, 10), sv.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 10, 10), sv.Viewport);
 
         Assert.False (sv.AutoHideScrollBars);
         Assert.False (sv.ShowHorizontalScrollIndicator);
@@ -1081,14 +1081,14 @@ public class ScrollViewTests
                                         {
                                             var fillText = new StringBuilder ();
 
-                                            for (var i = 0; i < labelFill.Bounds.Height; i++)
+                                            for (var i = 0; i < labelFill.Viewport.Height; i++)
                                             {
                                                 if (i > 0)
                                                 {
                                                     fillText.AppendLine ("");
                                                 }
 
-                                                for (var j = 0; j < labelFill.Bounds.Width; j++)
+                                                for (var j = 0; j < labelFill.Viewport.Width; j++)
                                                 {
                                                     fillText.Append (fill);
                                                 }

+ 2 - 2
UnitTests/Views/StatusBarTests.cs

@@ -99,7 +99,7 @@ public class StatusBarTests
                                );
         Application.Top.Add (sb);
 
-        sb.OnDrawContent (sb.Bounds);
+        sb.OnDrawContent (sb.Viewport);
 
         var expected = @$"
 ^O Open {
@@ -121,7 +121,7 @@ public class StatusBarTests
                                 }
                                );
         Application.Top.Add (sb);
-        sb.OnDrawContent (sb.Bounds);
+        sb.OnDrawContent (sb.Viewport);
 
         var expected = @$"
 CTRL-O Open {

+ 40 - 40
UnitTests/Views/TableViewTests.cs

@@ -125,7 +125,7 @@ public class TableViewTests
         // create a 4 by 4 table
         var tableView = new TableView
         {
-            Table = BuildTable (4, 4, out DataTable dt), MultiSelect = true, Bounds = new Rectangle (0, 0, 10, 5)
+            Table = BuildTable (4, 4, out DataTable dt), MultiSelect = true, Viewport = new Rectangle (0, 0, 10, 5)
         };
         tableView.BeginInit ();
         tableView.EndInit ();
@@ -152,7 +152,7 @@ public class TableViewTests
         // create a 4 by 4 table
         var tableView = new TableView
         {
-            Table = BuildTable (4, 4, out DataTable dt), MultiSelect = true, Bounds = new Rectangle (0, 0, 10, 5)
+            Table = BuildTable (4, 4, out DataTable dt), MultiSelect = true, Viewport = new Rectangle (0, 0, 10, 5)
         };
         tableView.BeginInit ();
         tableView.EndInit ();
@@ -180,7 +180,7 @@ public class TableViewTests
         var tableView = new TableView ();
         tableView.BeginInit ();
         tableView.EndInit ();
-        tableView.Bounds = new Rectangle (0, 0, 25, 10);
+        tableView.Viewport = new Rectangle (0, 0, 25, 10);
 
         Assert.Equal (0, tableView.RowOffset);
         Assert.Equal (0, tableView.ColumnOffset);
@@ -237,7 +237,7 @@ public class TableViewTests
     {
         var tableView = new TableView
         {
-            Table = BuildTable (3, 3), MultiSelect = multiSelect, Bounds = new Rectangle (0, 0, 10, 5)
+            Table = BuildTable (3, 3), MultiSelect = multiSelect, Viewport = new Rectangle (0, 0, 10, 5)
         };
         tableView.BeginInit ();
         tableView.EndInit ();
@@ -253,7 +253,7 @@ public class TableViewTests
     {
         var tableView = new TableView
         {
-            Table = BuildTable (3, 3), MultiSelect = true, FullRowSelect = true, Bounds = new Rectangle (0, 0, 10, 5)
+            Table = BuildTable (3, 3), MultiSelect = true, FullRowSelect = true, Viewport = new Rectangle (0, 0, 10, 5)
         };
         tableView.BeginInit ();
         tableView.EndInit ();
@@ -280,7 +280,7 @@ public class TableViewTests
     {
         var tableView = new TableView
         {
-            Table = BuildTable (3, 3), MultiSelect = true, Bounds = new Rectangle (0, 0, 10, 5)
+            Table = BuildTable (3, 3), MultiSelect = true, Viewport = new Rectangle (0, 0, 10, 5)
         };
         tableView.BeginInit ();
         tableView.EndInit ();
@@ -305,7 +305,7 @@ public class TableViewTests
     {
         var tableView = new TableView
         {
-            Table = BuildTable (20, 20), MultiSelect = true, Bounds = new Rectangle (0, 0, 10, 5)
+            Table = BuildTable (20, 20), MultiSelect = true, Viewport = new Rectangle (0, 0, 10, 5)
         };
         tableView.BeginInit ();
         tableView.EndInit ();
@@ -423,7 +423,7 @@ public class TableViewTests
         tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
         // 25 characters can be printed into table
-        tableView.Bounds = new Rectangle (0, 0, 25, 5);
+        tableView.Viewport = new Rectangle (0, 0, 25, 5);
         tableView.Style.ShowHorizontalHeaderUnderline = true;
         tableView.Style.ShowHorizontalHeaderOverline = false;
         tableView.Style.AlwaysShowHeaders = true;
@@ -524,7 +524,7 @@ public class TableViewTests
         var driver = (FakeDriver)Application.Driver;
         driver.ClearContents ();
 
-        tableView.Bounds = new Rectangle (0, 0, 9, 5);
+        tableView.Viewport = new Rectangle (0, 0, 9, 5);
         tableView.LayoutSubviews ();
         tableView.Draw ();
 
@@ -541,7 +541,7 @@ public class TableViewTests
         // setting width to 10 leaves just enough space for the column to
         // meet MinAcceptableWidth of 5.  Column width includes terminator line
         // symbol (e.g. ┤ or │)
-        tableView.Bounds = new Rectangle (0, 0, 10, 5);
+        tableView.Viewport = new Rectangle (0, 0, 10, 5);
         tableView.LayoutSubviews ();
         tableView.Draw ();
 
@@ -554,7 +554,7 @@ public class TableViewTests
 ";
         TestHelpers.AssertDriverContentsAre (expected, output);
 
-        tableView.Bounds = new Rectangle (0, 0, 25, 5);
+        tableView.Viewport = new Rectangle (0, 0, 25, 5);
 
         // revert style change
         style.MinAcceptableWidth = TableView.DefaultMinAcceptableWidth;
@@ -601,7 +601,7 @@ public class TableViewTests
     {
         var tableView = new TableView
         {
-            Table = BuildTable (25, 50), MultiSelect = true, Bounds = new Rectangle (0, 0, 10, 5)
+            Table = BuildTable (25, 50), MultiSelect = true, Viewport = new Rectangle (0, 0, 10, 5)
         };
 
         // Header should take up 2 lines
@@ -637,7 +637,7 @@ public class TableViewTests
     {
         var tableView = new TableView ();
         tableView.ColorScheme = new ColorScheme ();
-        tableView.Bounds = new Rectangle (0, 0, 25, 10);
+        tableView.Viewport = new Rectangle (0, 0, 25, 10);
 
         // Set a table with 1 column
         tableView.Table = BuildTable (1, 50, out DataTable dt);
@@ -659,7 +659,7 @@ public class TableViewTests
         tableView.Table = BuildTable (25, 50);
 
         // 1 header + 4 rows visible
-        tableView.Bounds = new Rectangle (0, 0, 25, 5);
+        tableView.Viewport = new Rectangle (0, 0, 25, 5);
         tableView.Style.ShowHorizontalHeaderUnderline = false;
         tableView.Style.ShowHorizontalHeaderOverline = false;
         tableView.Style.AlwaysShowHeaders = true;
@@ -686,7 +686,7 @@ public class TableViewTests
         tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
         // 3 columns are visibile
-        tableView.Bounds = new Rectangle (0, 0, 7, 5);
+        tableView.Viewport = new Rectangle (0, 0, 7, 5);
         tableView.Style.ShowHorizontalHeaderUnderline = true;
         tableView.Style.ShowHorizontalHeaderOverline = false;
         tableView.Style.AlwaysShowHeaders = true;
@@ -764,7 +764,7 @@ public class TableViewTests
         tableView.LayoutSubviews ();
 
         // 3 columns are visibile
-        tableView.Bounds = new Rectangle (0, 0, 7, 5);
+        tableView.Viewport = new Rectangle (0, 0, 7, 5);
         tableView.Style.ShowHorizontalHeaderUnderline = false;
         tableView.Style.ShowHorizontalHeaderOverline = false;
         tableView.Style.AlwaysShowHeaders = true;
@@ -827,7 +827,7 @@ public class TableViewTests
         tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
         // 3 columns are visibile
-        tableView.Bounds = new Rectangle (0, 0, 7, 5);
+        tableView.Viewport = new Rectangle (0, 0, 7, 5);
         tableView.Style.ShowHorizontalHeaderUnderline = false;
         tableView.Style.ShowHorizontalHeaderOverline = false;
         tableView.Style.AlwaysShowHeaders = true;
@@ -944,7 +944,7 @@ public class TableViewTests
         tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
         // 3 columns are visibile
-        tableView.Bounds = new Rectangle (0, 0, 7, 5);
+        tableView.Viewport = new Rectangle (0, 0, 7, 5);
         tableView.Style.ShowHorizontalHeaderUnderline = true;
         tableView.Style.ShowHorizontalHeaderOverline = false;
         tableView.Style.AlwaysShowHeaders = true;
@@ -975,7 +975,7 @@ public class TableViewTests
         tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
         // 3 columns are visibile
-        tableView.Bounds = new Rectangle (0, 0, 7, 5);
+        tableView.Viewport = new Rectangle (0, 0, 7, 5);
         tableView.Style.ShowHorizontalHeaderUnderline = true;
         tableView.Style.ShowHorizontalHeaderOverline = false;
         tableView.Style.AlwaysShowHeaders = true;
@@ -1044,7 +1044,7 @@ public class TableViewTests
         tv.LayoutSubviews ();
 
         // width exactly matches the max col widths
-        tv.Bounds = new Rectangle (0, 0, 5, 4);
+        tv.Viewport = new Rectangle (0, 0, 5, 4);
 
         // Create a style for column B
         ColumnStyle bStyle = tv.Style.GetOrCreateColumnStyle (1);
@@ -1141,7 +1141,7 @@ public class TableViewTests
         tv.LayoutSubviews ();
 
         // width exactly matches the max col widths
-        tv.Bounds = new Rectangle (0, 0, 5, 4);
+        tv.Viewport = new Rectangle (0, 0, 5, 4);
 
         var rowHighlight = new ColorScheme
         {
@@ -1235,7 +1235,7 @@ public class TableViewTests
         tv.LayoutSubviews ();
 
         // width exactly matches the max col widths
-        tv.Bounds = new Rectangle (0, 0, 5, 4);
+        tv.Viewport = new Rectangle (0, 0, 5, 4);
 
         // private method for forcing the view to be focused/not focused
         MethodInfo setFocusMethod =
@@ -1282,7 +1282,7 @@ public class TableViewTests
         tv.LayoutSubviews ();
 
         // width exactly matches the max col widths
-        tv.Bounds = new Rectangle (0, 0, 5, 4);
+        tv.Viewport = new Rectangle (0, 0, 5, 4);
 
         // private method for forcing the view to be focused/not focused
         MethodInfo setFocusMethod =
@@ -1354,7 +1354,7 @@ public class TableViewTests
         tv.Style.ExpandLastColumn = false;
 
         // width exactly matches the max col widths
-        tv.Bounds = new Rectangle (0, 0, 5, 4);
+        tv.Viewport = new Rectangle (0, 0, 5, 4);
 
         tv.Draw ();
 
@@ -1398,7 +1398,7 @@ public class TableViewTests
     public void TableView_ShowHeadersFalse_AllLines ()
     {
         TableView tv = GetABCDEFTableView (out _);
-        tv.Bounds = new Rectangle (0, 0, 5, 5);
+        tv.Viewport = new Rectangle (0, 0, 5, 5);
 
         tv.Style.ShowHeaders = false;
         tv.Style.ShowHorizontalHeaderOverline = true;
@@ -1422,7 +1422,7 @@ public class TableViewTests
     public void TableView_ShowHeadersFalse_AndNoHeaderLines ()
     {
         TableView tv = GetABCDEFTableView (out _);
-        tv.Bounds = new Rectangle (0, 0, 5, 5);
+        tv.Viewport = new Rectangle (0, 0, 5, 5);
 
         tv.Style.ShowHeaders = false;
         tv.Style.ShowHorizontalHeaderOverline = false;
@@ -1441,7 +1441,7 @@ public class TableViewTests
     public void TableView_ShowHeadersFalse_OverlineTrue ()
     {
         TableView tv = GetABCDEFTableView (out _);
-        tv.Bounds = new Rectangle (0, 0, 5, 5);
+        tv.Viewport = new Rectangle (0, 0, 5, 5);
 
         tv.Style.ShowHeaders = false;
         tv.Style.ShowHorizontalHeaderOverline = true;
@@ -1461,7 +1461,7 @@ public class TableViewTests
     public void TableView_ShowHeadersFalse_UnderlineTrue ()
     {
         TableView tv = GetABCDEFTableView (out _);
-        tv.Bounds = new Rectangle (0, 0, 5, 5);
+        tv.Viewport = new Rectangle (0, 0, 5, 5);
 
         tv.Style.ShowHeaders = false;
         tv.Style.ShowHorizontalHeaderOverline = false;
@@ -1588,7 +1588,7 @@ public class TableViewTests
     {
         var tv = new TableView ();
         tv.ColorScheme = Colors.ColorSchemes ["TopLevel"];
-        tv.Bounds = new Rectangle (0, 0, 50, 7);
+        tv.Viewport = new Rectangle (0, 0, 50, 7);
 
         tv.Table = new EnumerableTableSource<string> (
                                                       new [] { "fish", "troll", "trap", "zoo" },
@@ -2219,7 +2219,7 @@ public class TableViewTests
     {
         var tv = new TableView ();
         tv.ColorScheme = Colors.ColorSchemes ["TopLevel"];
-        tv.Bounds = new Rectangle (0, 0, 50, 6);
+        tv.Viewport = new Rectangle (0, 0, 50, 6);
 
         tv.Table = new EnumerableTableSource<Type> (
                                                     new [] { typeof (string), typeof (int), typeof (float) },
@@ -2253,7 +2253,7 @@ public class TableViewTests
         TableView tv = GetTwoRowSixColumnTable (out DataTable dt);
         dt.Rows.Add (1, 2, 3, 4, 5, 6);
 
-        tv.Bounds = new Rectangle (0, 0, 7, 6);
+        tv.Viewport = new Rectangle (0, 0, 7, 6);
         tv.Frame = new Rectangle (0, 0, 7, 6);
         tv.LayoutSubviews ();
 
@@ -2269,7 +2269,7 @@ public class TableViewTests
         // should select that row
         Assert.Equal (2, tv.SelectedRow);
 
-        tv.OnDrawContent (tv.Bounds);
+        tv.OnDrawContent (tv.Viewport);
 
         var expected =
             @"
@@ -2310,7 +2310,7 @@ public class TableViewTests
         dt.Rows.Add (1, 2, 3, 4, 5, 6);
         tv.LayoutSubviews ();
 
-        tv.Bounds = new Rectangle (0, 0, 7, 6);
+        tv.Viewport = new Rectangle (0, 0, 7, 6);
 
         tv.FullRowSelect = true;
         tv.Style.ShowVerticalCellLines = false;
@@ -2362,7 +2362,7 @@ A B C
         TableView tv = GetTwoRowSixColumnTable (out DataTable dt);
         dt.Rows.Add (1, 2, 3, 4, 5, 6);
 
-        tv.Bounds = new Rectangle (0, 0, 7, 6);
+        tv.Viewport = new Rectangle (0, 0, 7, 6);
         tv.Frame = new Rectangle (0, 0, 7, 6);
         tv.LayoutSubviews ();
 
@@ -2377,7 +2377,7 @@ A B C
         // should select that row
         Assert.Equal (2, tv.SelectedRow);
 
-        tv.OnDrawContent (tv.Bounds);
+        tv.OnDrawContent (tv.Viewport);
 
         var expected =
             @"
@@ -2425,7 +2425,7 @@ A B C
 
         //tv.BeginInit (); tv.EndInit ();
         tv.ColorScheme = Colors.ColorSchemes ["TopLevel"];
-        tv.Bounds = new Rectangle (0, 0, 25, 4);
+        tv.Viewport = new Rectangle (0, 0, 25, 4);
 
         tv.Style = new TableStyle
         {
@@ -3194,7 +3194,7 @@ A B C
         tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
         // 3 columns are visible
-        tableView.Bounds = new Rectangle (0, 0, 7, 5);
+        tableView.Viewport = new Rectangle (0, 0, 7, 5);
         tableView.Style.ShowHorizontalHeaderUnderline = false;
         tableView.Style.ShowHorizontalHeaderOverline = false;
         tableView.Style.AlwaysShowHeaders = true;
@@ -3218,7 +3218,7 @@ A B C
     {
         var tv = new TableView ();
         tv.ColorScheme = Colors.ColorSchemes ["TopLevel"];
-        tv.Bounds = new Rectangle (0, 0, 25, 6);
+        tv.Viewport = new Rectangle (0, 0, 25, 6);
 
         List<PickablePet> pets = new ()
         {
@@ -3248,7 +3248,7 @@ A B C
         tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
 
         // 3 columns are visible
-        tableView.Bounds = new Rectangle (0, 0, 7, 5);
+        tableView.Viewport = new Rectangle (0, 0, 7, 5);
         tableView.Style.ShowHorizontalHeaderUnderline = true;
         tableView.Style.ShowHorizontalHeaderOverline = false;
         tableView.Style.AlwaysShowHeaders = true;
@@ -3277,7 +3277,7 @@ A B C
         var tv = new TableView ();
         tv.BeginInit ();
         tv.EndInit ();
-        tv.Bounds = new Rectangle (0, 0, 10, 4);
+        tv.Viewport = new Rectangle (0, 0, 10, 4);
 
         dt = new DataTable ();
         dt.Columns.Add ("A");

+ 1 - 1
UnitTests/Views/TextFieldTests.cs

@@ -177,7 +177,7 @@ public class TextFieldTests
 
     [Fact]
     [AutoInitShutdown]
-    public void CaptionedTextField_DoesNotOverspillBounds_Unicode ()
+    public void CaptionedTextField_DoesNotOverspillViewport_Unicode ()
     {
         string caption = "Mise" + char.ConvertFromUtf32 (int.Parse ("0301", NumberStyles.HexNumber)) + "rables";
 

+ 1 - 1
UnitTests/Views/TextValidateFieldTests.cs

@@ -71,7 +71,7 @@ public class TextValidateField_NET_Provider_Tests
         // A-Alphanumeric, required. a-Alphanumeric, optional.
         var field = new TextValidateField { Provider = new NetMaskedTextProvider ("999 000 LLL >LLL |AAA aaa") };
 
-        Assert.Equal (field.Bounds.Width, field.Provider.DisplayText.Length);
+        Assert.Equal (field.Viewport.Width, field.Provider.DisplayText.Length);
         Assert.NotEqual (field.Provider.DisplayText.Length, field.Provider.Text.Length);
         Assert.Equal (new string (' ', field.Text.Length), field.Provider.Text);
     }

+ 7 - 7
UnitTests/Views/TextViewTests.cs

@@ -63,7 +63,7 @@ public class TextViewTests
 
         Application.Iteration += (s, a) =>
                                  {
-                                     int width = _textView.Bounds.Width - 1;
+                                     int width = _textView.Viewport.Width - 1;
                                      Assert.Equal (30, width + 1);
                                      Assert.Equal (10, _textView.Height);
                                      _textView.Text = "";
@@ -7111,7 +7111,7 @@ This is the second line.
 
         Application.Iteration += (s, a) =>
                                  {
-                                     int width = _textView.Bounds.Width - 1;
+                                     int width = _textView.Viewport.Width - 1;
                                      Assert.Equal (30, width + 1);
                                      Assert.Equal (10, _textView.Height);
                                      _textView.Text = "";
@@ -7152,7 +7152,7 @@ This is the second line.
 
         Application.Iteration += (s, a) =>
                                  {
-                                     int width = _textView.Bounds.Width - 1;
+                                     int width = _textView.Viewport.Width - 1;
                                      Assert.Equal (30, width + 1);
                                      Assert.Equal (10, _textView.Height);
                                      var col = 0;
@@ -7193,7 +7193,7 @@ This is the second line.
 
         Application.Iteration += (s, a) =>
                                  {
-                                     int width = _textView.Bounds.Width - 1;
+                                     int width = _textView.Viewport.Width - 1;
                                      Assert.Equal (30, width + 1);
                                      Assert.Equal (10, _textView.Height);
                                      _textView.Text = "";
@@ -7243,7 +7243,7 @@ This is the second line.
 
         Application.Iteration += (s, a) =>
                                  {
-                                     int width = _textView.Bounds.Width - 1;
+                                     int width = _textView.Viewport.Width - 1;
                                      Assert.Equal (30, width + 1);
                                      Assert.Equal (10, _textView.Height);
                                      Assert.Equal ("TAB to jump between text fields.", _textView.Text);
@@ -7295,7 +7295,7 @@ This is the second line.
 
         Application.Iteration += (s, a) =>
                                  {
-                                     int width = _textView.Bounds.Width - 1;
+                                     int width = _textView.Viewport.Width - 1;
                                      Assert.Equal (30, width + 1);
                                      Assert.Equal (10, _textView.Height);
                                      var col = 0;
@@ -7657,7 +7657,7 @@ This is the second line.
                                                      );
 
         ((FakeDriver)Application.Driver).SetBufferSize (6, 25);
-        tv.SetRelativeLayout (Application.Driver.Bounds);
+        tv.SetRelativeLayout (Application.Driver.Viewport);
         tv.Draw ();
         Assert.Equal (new Point (4, 2), tv.CursorPosition);
         Assert.Equal (new Point (12, 0), cp);

+ 3 - 3
UnitTests/Views/ToplevelTests.cs

@@ -1360,7 +1360,7 @@ public class ToplevelTests
         Assert.Equal (new (1, 3, 10, 5), view.Frame);
         Assert.Equal (new (0, 0, 10, 5), view._needsDisplayRect);
 
-        view.OnDrawContent (view.Bounds);
+        view.OnDrawContent (view.Viewport);
         view.Frame = new (1, 3, 10, 5);
         Assert.Equal (new (1, 3, 10, 5), view.Frame);
         Assert.Equal (new (0, 0, 10, 5), view._needsDisplayRect);
@@ -1512,7 +1512,7 @@ public class ToplevelTests
 
     [Fact]
     [AutoInitShutdown]
-    public void Window_Bounds_Bigger_Than_Driver_Cols_And_Rows_Allow_Drag_Beyond_Left_Right_And_Bottom ()
+    public void Window_Viewport_Bigger_Than_Driver_Cols_And_Rows_Allow_Drag_Beyond_Left_Right_And_Bottom ()
     {
         Toplevel top = Application.Top;
         var window = new Window { Width = 20, Height = 3 };
@@ -1804,7 +1804,7 @@ public class ToplevelTests
 
         btnPopup.Accept += (s, e) =>
                             {
-                                Rectangle viewToScreen = btnPopup.BoundsToScreen (top.Frame);
+                                Rectangle viewToScreen = btnPopup.ViewportToScreen (top.Frame);
 
                                 var viewAddedToTop = new View
                                 {

+ 1 - 1
UnitTests/Views/TreeTableSourceTests.cs

@@ -227,7 +227,7 @@ public class TreeTableSourceTests : IDisposable
         var tableView = new TableView ();
         tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
         tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
-        tableView.Bounds = new Rectangle (0, 0, 40, 6);
+        tableView.Viewport = new Rectangle (0, 0, 40, 6);
 
         tableView.Style.ShowHorizontalHeaderUnderline = true;
         tableView.Style.ShowHorizontalHeaderOverline = false;

+ 3 - 3
UnitTests/Views/TreeViewTests.cs

@@ -30,7 +30,7 @@ public class TreeViewTests
         tree.BeginInit ();
         tree.EndInit ();
 
-        tree.Bounds = new Rectangle (0, 0, 10, 10);
+        tree.Viewport = new Rectangle (0, 0, 10, 10);
 
         InitFakeDriver ();
 
@@ -60,7 +60,7 @@ public class TreeViewTests
         tree.EndInit ();
 
         // control only allows 1 row to be viewed at once
-        tree.Bounds = new Rectangle (0, 0, 20, 1);
+        tree.Viewport = new Rectangle (0, 0, 20, 1);
 
         InitFakeDriver ();
 
@@ -234,7 +234,7 @@ public class TreeViewTests
         tree.EndInit ();
 
         // Make tree bounds 1 in height so that EnsureVisible always requires updating scroll offset
-        tree.Bounds = new Rectangle (0, 0, 50, 1);
+        tree.Viewport = new Rectangle (0, 0, 50, 1);
 
         Assert.Null (tree.SelectedObject);
         Assert.Equal (0, tree.ScrollOffsetVertical);

+ 3 - 3
UnitTests/Views/WindowTests.cs

@@ -135,7 +135,7 @@ public class WindowTests
         Assert.Equal ($"Window(){defaultWindow.Frame}", defaultWindow.ToString ());
         Assert.True (defaultWindow.CanFocus);
         Assert.False (defaultWindow.HasFocus);
-        Assert.Equal (new Rectangle (0, 0, 2147483645, 2147483645), defaultWindow.Bounds);
+        Assert.Equal (new Rectangle (0, 0, 2147483645, 2147483645), defaultWindow.Viewport);
         Assert.Equal (new Rectangle (0, 0, 2147483647, 2147483647), defaultWindow.Frame);
         Assert.Null (defaultWindow.Focused);
         Assert.NotNull (defaultWindow.ColorScheme);
@@ -168,7 +168,7 @@ public class WindowTests
     #endif
         Assert.True (windowWithFrameRectEmpty.CanFocus);
         Assert.False (windowWithFrameRectEmpty.HasFocus);
-        Assert.Equal (Rectangle.Empty, windowWithFrameRectEmpty.Bounds);
+        Assert.Equal (Rectangle.Empty, windowWithFrameRectEmpty.Viewport);
         Assert.Equal (Rectangle.Empty, windowWithFrameRectEmpty.Frame);
         Assert.Null (windowWithFrameRectEmpty.Focused);
         Assert.NotNull (windowWithFrameRectEmpty.ColorScheme);
@@ -201,7 +201,7 @@ public class WindowTests
     #endif
         Assert.True (windowWithFrame1234.CanFocus);
         Assert.False (windowWithFrame1234.HasFocus);
-        Assert.Equal (new (0, 0, 1, 2), windowWithFrame1234.Bounds);
+        Assert.Equal (new (0, 0, 1, 2), windowWithFrame1234.Viewport);
         Assert.Equal (new (1, 2, 3, 4), windowWithFrame1234.Frame);
         Assert.Null (windowWithFrame1234.Focused);
         Assert.NotNull (windowWithFrame1234.ColorScheme);