浏览代码

Removed ScrollView dependency from CharMap to validate new View scrolling fn

Tig 1 年之前
父节点
当前提交
8483e29a9d

+ 1 - 1
Terminal.Gui/Application.cs

@@ -527,7 +527,7 @@ public static partial class Application
         }
 
         //if (Toplevel.LayoutStyle == LayoutStyle.Computed) {
-        toplevel.SetRelativeLayout (Driver.Viewport.Size);
+        toplevel.SetRelativeLayout (Driver.Screen.Size);
 
         //}
 

+ 1 - 1
Terminal.Gui/View/Layout/ViewLayout.cs

@@ -887,7 +887,7 @@ public partial class View
         // Finally, if none of those are valid, use int.MaxValue (for Unit tests).
         Size contentSize = SuperView is { IsInitialized: true } ? SuperView.ContentSize :
                            Application.Top is { } && Application.Top.IsInitialized ? Application.Top.ContentSize :
-                           Application.Driver?.Viewport.Size ?? new (int.MaxValue, int.MaxValue);
+                           Application.Driver?.Screen.Size ?? new (int.MaxValue, int.MaxValue);
         SetRelativeLayout (contentSize);
 
         // TODO: Determine what, if any of the below is actually needed here.

+ 26 - 12
Terminal.Gui/View/ViewScrolling.cs

@@ -176,6 +176,32 @@ public partial class View
         }
         set
         {
+            if (!ScrollSettings.HasFlag (ScrollSettings.NoRestrictVertical))
+            {
+                if (value.Y + Viewport.Height > ContentSize.Height)
+                {
+                    value.Y = ContentSize.Height - Viewport.Height;
+                }
+
+                if (value.Y < 0)
+                {
+                    value.Y = 0;
+                }
+            }
+
+            if (!ScrollSettings.HasFlag (ScrollSettings.NoRestrictHorizontal))
+            {
+                if (value.X + Viewport.Width > ContentSize.Width)
+                {
+                    value.X = ContentSize.Width - Viewport.Width;
+                }
+
+                if (value.X < 0)
+                {
+                    value.X = 0;
+                }
+            }
+            
             _viewportLocation = value.Location;
 
             Thickness thickness = GetAdornmentsThickness ();
@@ -251,12 +277,6 @@ public partial class View
             return false;
         }
 
-        if (!ScrollSettings.HasFlag (ScrollSettings.NoRestrictVertical)
-            && (Viewport.Y + rows > ContentSize.Height - Viewport.Height || Viewport.Y + rows < 0))
-        {
-            return false;
-        }
-
         Viewport = Viewport with { Y = Viewport.Y + rows };
 
         return true;
@@ -278,12 +298,6 @@ public partial class View
             return false;
         }
 
-        if (!ScrollSettings.HasFlag (ScrollSettings.NoRestrictHorizontal)
-            && (Viewport.X + cols > ContentSize.Width - Viewport.Width || Viewport.X + cols < 0))
-        {
-            return false;
-        }
-
         Viewport = Viewport with { X = Viewport.X + cols };
 
         return true;

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

@@ -144,7 +144,7 @@ public sealed class ContextMenu : IDisposable
         _container = Application.Current;
         _container.Closing += Container_Closing;
         _container.Deactivate += Container_Deactivate;
-        Rectangle frame = Application.Driver.Viewport;
+        Rectangle frame = Application.Driver.Screen;
         Point position = Position;
 
         if (Host is { })

+ 2 - 2
Terminal.Gui/Views/Menu/MenuBar.cs

@@ -821,7 +821,7 @@ public class MenuBar : View
             return Point.Empty;
         }
 
-        Rectangle superViewFrame = SuperView is null ? Driver.Viewport : SuperView.Frame;
+        Rectangle superViewFrame = SuperView is null ? Driver.Screen : SuperView.Frame;
         View sv = SuperView is null ? Application.Current : SuperView;
         Point viewportOffset = sv.GetViewportOffsetFromFrame ();
 
@@ -838,7 +838,7 @@ public class MenuBar : View
     /// <returns>The location offset.</returns>
     internal Point GetScreenOffsetFromCurrent ()
     {
-        Rectangle screen = Driver.Viewport;
+        Rectangle screen = Driver.Screen;
         Rectangle currentFrame = Application.Current.Frame;
         Point viewportOffset = Application.Top.GetViewportOffsetFromFrame ();
 

+ 136 - 110
UICatalog/Scenarios/CharacterMap.cs

@@ -42,7 +42,7 @@ public class CharacterMap : Scenario
 
     public override void Setup ()
     {
-        _charMap = new() { X = 0, Y = 1, Height = Dim.Fill () };
+        _charMap = new () { X = 0, Y = 1, Height = Dim.Fill () };
         Top.Add (_charMap);
 
         var jumpLabel = new Label
@@ -60,7 +60,7 @@ public class CharacterMap : Scenario
         };
         Top.Add (jumpEdit);
 
-        _errorLabel = new()
+        _errorLabel = new ()
         {
             X = Pos.Right (jumpEdit) + 1, Y = Pos.Y (_charMap), ColorScheme = Colors.ColorSchemes ["error"], Text = "err"
         };
@@ -79,7 +79,7 @@ public class CharacterMap : Scenario
             e.Cancel = true;
         }
 #endif
-        _categoryList = new() { X = Pos.Right (_charMap), Y = Pos.Bottom (jumpLabel), Height = Dim.Fill () };
+        _categoryList = new () { X = Pos.Right (_charMap), Y = Pos.Bottom (jumpLabel), Height = Dim.Fill () };
 
         _categoryList.FullRowSelect = true;
 
@@ -123,10 +123,10 @@ public class CharacterMap : Scenario
 
         _categoryList.Style.ColumnStyles.Add (
                                               0,
-                                              new() { MaxWidth = longestName, MinWidth = longestName, MinAcceptableWidth = longestName }
+                                              new () { MaxWidth = longestName, MinWidth = longestName, MinAcceptableWidth = longestName }
                                              );
-        _categoryList.Style.ColumnStyles.Add (1, new() { MaxWidth = 1, MinWidth = 6 });
-        _categoryList.Style.ColumnStyles.Add (2, new() { MaxWidth = 1, MinWidth = 6 });
+        _categoryList.Style.ColumnStyles.Add (1, new () { MaxWidth = 1, MinWidth = 6 });
+        _categoryList.Style.ColumnStyles.Add (2, new () { MaxWidth = 1, MinWidth = 6 });
 
         _categoryList.Width = _categoryList.Style.ColumnStyles.Sum (c => c.Value.MinWidth) + 4;
 
@@ -206,7 +206,7 @@ public class CharacterMap : Scenario
 
         return new (
                     sortedRanges,
-                    new()
+                    new ()
                     {
                         { $"Category{categorySort}", s => s.Category },
                         { $"Start{startSort}", s => $"{s.Start:x5}" },
@@ -299,7 +299,7 @@ public class CharacterMap : Scenario
     }
 }
 
-internal class CharMap : ScrollView
+internal class CharMap : View
 {
     private const CursorVisibility _cursor = CursorVisibility.Default;
     private const int COLUMN_WIDTH = 3;
@@ -314,10 +314,7 @@ internal class CharMap : ScrollView
         ColorScheme = Colors.ColorSchemes ["Dialog"];
         CanFocus = true;
 
-        ContentSize = new (
-                           RowWidth,
-                           (MaxCodePoint / 16 + (ShowHorizontalScrollIndicator ? 2 : 1)) * _rowHeight
-                          );
+        ContentSize = new (RowWidth, (MaxCodePoint / 16 + 2) * _rowHeight);
 
         AddCommand (
                     Command.ScrollUp,
@@ -328,6 +325,8 @@ internal class CharMap : ScrollView
                             SelectedCodePoint -= 16;
                         }
 
+                        ScrollVertical (-_rowHeight);
+
                         return true;
                     }
                    );
@@ -336,11 +335,16 @@ internal class CharMap : ScrollView
                     Command.ScrollDown,
                     () =>
                     {
-                        if (SelectedCodePoint < MaxCodePoint - 16)
+                        if (SelectedCodePoint <= MaxCodePoint - 16)
                         {
                             SelectedCodePoint += 16;
                         }
 
+                        if (Cursor.Y >= Viewport.Height)
+                        {
+                            ScrollVertical (_rowHeight);
+                        }
+
                         return true;
                     }
                    );
@@ -354,6 +358,11 @@ internal class CharMap : ScrollView
                             SelectedCodePoint--;
                         }
 
+                        if (Cursor.X > RowLabelWidth + 1)
+                        {
+                            ScrollHorizontal (-COLUMN_WIDTH);
+                        }
+
                         return true;
                     }
                    );
@@ -367,6 +376,10 @@ internal class CharMap : ScrollView
                             SelectedCodePoint++;
                         }
 
+                        if (Cursor.X >= Viewport.Width)
+                        {
+                            ScrollHorizontal (COLUMN_WIDTH);
+                        }
                         return true;
                     }
                    );
@@ -375,8 +388,9 @@ internal class CharMap : ScrollView
                     Command.PageUp,
                     () =>
                     {
-                        int page = (Viewport.Height / _rowHeight - 1) * 16;
+                        int page = (Viewport.Height - 1 / _rowHeight) * 16;
                         SelectedCodePoint -= Math.Min (page, SelectedCodePoint);
+                        Viewport = Viewport with { Y = SelectedCodePoint / 16 * _rowHeight };
 
                         return true;
                     }
@@ -386,8 +400,9 @@ internal class CharMap : ScrollView
                     Command.PageDown,
                     () =>
                     {
-                        int page = (Viewport.Height / _rowHeight - 1) * 16;
+                        int page = (Viewport.Height - 1 / _rowHeight) * 16;
                         SelectedCodePoint += Math.Min (page, MaxCodePoint - SelectedCodePoint);
+                        Viewport = Viewport with { Y = SelectedCodePoint / 16 * _rowHeight };
 
                         return true;
                     }
@@ -408,11 +423,10 @@ internal class CharMap : ScrollView
                     () =>
                     {
                         SelectedCodePoint = MaxCodePoint;
-
+                        Viewport = Viewport with { Y = SelectedCodePoint / 16 * _rowHeight };
                         return true;
                     }
                    );
-        KeyBindings.Add (Key.Enter, Command.Accept);
 
         AddCommand (
                     Command.Accept,
@@ -424,7 +438,48 @@ internal class CharMap : ScrollView
                     }
                    );
 
+        KeyBindings.Add (Key.Enter, Command.Accept);
+        KeyBindings.Add (Key.CursorUp, Command.ScrollUp);
+        KeyBindings.Add (Key.CursorDown, Command.ScrollDown);
+        KeyBindings.Add (Key.CursorLeft, Command.ScrollLeft);
+        KeyBindings.Add (Key.CursorRight, Command.ScrollRight);
+        KeyBindings.Add (Key.PageUp, Command.PageUp);
+        KeyBindings.Add (Key.PageDown, Command.PageDown);
+        KeyBindings.Add (Key.Home, Command.TopHome);
+        KeyBindings.Add (Key.End, Command.BottomEnd);
+
         MouseClick += Handle_MouseClick;
+
+        MouseEvent += Handle_MouseEvent;
+    }
+
+    private void Handle_MouseEvent (object sender, MouseEventEventArgs e)
+    {
+        if (e.MouseEvent.Flags == MouseFlags.WheeledDown)
+        {
+            ScrollVertical (1);
+
+            return;
+        }
+
+        if (e.MouseEvent.Flags == MouseFlags.WheeledUp)
+        {
+            ScrollVertical (-1);
+
+            return;
+        }
+
+        if (e.MouseEvent.Flags == MouseFlags.WheeledRight)
+        {
+            ScrollHorizontal (1);
+
+            return;
+        }
+
+        if (e.MouseEvent.Flags == MouseFlags.WheeledLeft)
+        {
+            ScrollHorizontal (-1);
+        }
     }
 
     /// <summary>Gets the coordinates of the Cursor based on the SelectedCodePoint in screen coordinates</summary>
@@ -432,16 +487,16 @@ internal class CharMap : ScrollView
     {
         get
         {
-            int row = SelectedCodePoint / 16 * _rowHeight + ContentOffset.Y + 1;
+            int row = SelectedCodePoint / 16 * _rowHeight - Viewport.Y + 1;
 
-            int col = SelectedCodePoint % 16 * COLUMN_WIDTH + ContentOffset.X + RowLabelWidth + 1; // + 1 for padding
+            int col = SelectedCodePoint % 16 * COLUMN_WIDTH - Viewport.X + RowLabelWidth + 1; // + 1 for padding between label and first column
 
             return new (col, row);
         }
         set => throw new NotImplementedException ();
     }
 
-    public static int MaxCodePoint => 0x10FFFF;
+    public static int MaxCodePoint = UnicodeRange.Ranges.Max(r => r.End);// 0x10FFFF;
 
     /// <summary>
     ///     Specifies the starting offset for the character map. The default is 0x2500 which is the Box Drawing
@@ -459,36 +514,28 @@ internal class CharMap : ScrollView
                 int row = SelectedCodePoint / 16 * _rowHeight;
                 int col = SelectedCodePoint % 16 * COLUMN_WIDTH;
 
-                int height = Viewport.Height - (ShowHorizontalScrollIndicator ? 2 : 1);
-
-                if (row + ContentOffset.Y < 0)
+                if (row - Viewport.Y < 0)
                 {
                     // Moving up.
-                    ContentOffset = new (ContentOffset.X, row);
+                    Viewport = Viewport with { Y = row };
                 }
-                else if (row + ContentOffset.Y >= height)
+                else if (row - Viewport.Y >= Viewport.Height)
                 {
                     // Moving down.
-                    ContentOffset = new (
-                                         ContentOffset.X,
-                                         Math.Min (row, row - height + _rowHeight)
-                                        );
+                    Viewport = Viewport with { Y = row - Viewport.Height };
                 }
 
-                int width = Viewport.Width / COLUMN_WIDTH * COLUMN_WIDTH - (ShowVerticalScrollIndicator ? RowLabelWidth + 1 : RowLabelWidth);
+                int width = Viewport.Width / COLUMN_WIDTH * COLUMN_WIDTH - RowLabelWidth;
 
-                if (col + ContentOffset.X < 0)
+                if (col - Viewport.X < 0)
                 {
                     // Moving left.
-                    ContentOffset = new (col, ContentOffset.Y);
+                    Viewport = Viewport with { X = col };
                 }
-                else if (col + ContentOffset.X >= width)
+                else if (col - Viewport.X >= width)
                 {
                     // Moving right.
-                    ContentOffset = new (
-                                         Math.Min (col, col - width + COLUMN_WIDTH),
-                                         ContentOffset.Y
-                                        );
+                    Viewport = Viewport with { X = col - width };
                 }
             }
 
@@ -518,6 +565,7 @@ internal class CharMap : ScrollView
         {
             _start = value;
             SelectedCodePoint = value;
+            Viewport = Viewport with { Y = SelectedCodePoint / 16 * _rowHeight };
             SetNeedsDisplay ();
         }
     }
@@ -533,91 +581,66 @@ internal class CharMap : ScrollView
             return;
         }
 
-        // 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 (viewport);
-
-        Rectangle viewportOffset = new (
-                                  ContentOffset,
-                                  new (
-                                       Math.Max (Viewport.Width - (ShowVerticalScrollIndicator ? 1 : 0), 0),
-                                       Math.Max (Viewport.Height - (ShowHorizontalScrollIndicator ? 1 : 0), 0)
-                                      )
-                                 );
+        ClearVisibleContent ();
 
         Rectangle oldClip = ClipToViewport ();
 
-        if (ShowHorizontalScrollIndicator)
-        {
-            // ClipToBounds doesn't know about the scroll indicators, so if off, subtract one from height
-            Driver.Clip = new (Driver.Clip.Location, new (Driver.Clip.Size.Width, Driver.Clip.Size.Height - 1));
-        }
-
-        if (ShowVerticalScrollIndicator)
-        {
-            // ClipToBounds doesn't know about the scroll indicators, so if off, subtract one from width
-            Driver.Clip = new (Driver.Clip.Location, new (Driver.Clip.Size.Width - 1, Driver.Clip.Size.Height));
-        }
-
-        int cursorCol = Cursor.X - ContentOffset.X - RowLabelWidth - 1;
-        int cursorRow = Cursor.Y - ContentOffset.Y - 1;
+        int cursorCol = Cursor.X + Viewport.X - RowLabelWidth - 1;
+        int cursorRow = Cursor.Y + Viewport.Y - 1;
 
         Driver.SetAttribute (GetHotNormalColor ());
         Move (0, 0);
         Driver.AddStr (new (' ', RowLabelWidth + 1));
 
+        int firstColumnX = RowLabelWidth - Viewport.X;
+
+        // Header
         for (var hexDigit = 0; hexDigit < 16; hexDigit++)
         {
-            int x = ContentOffset.X + RowLabelWidth + hexDigit * COLUMN_WIDTH;
+            int x = firstColumnX + hexDigit * COLUMN_WIDTH;
 
             if (x > RowLabelWidth - 2)
             {
                 Move (x, 0);
                 Driver.SetAttribute (GetHotNormalColor ());
                 Driver.AddStr (" ");
-
-                Driver.SetAttribute (
-                                     HasFocus && cursorCol + ContentOffset.X + RowLabelWidth == x
-                                         ? ColorScheme.HotFocus
-                                         : GetHotNormalColor ()
-                                    );
+                Driver.SetAttribute (HasFocus && cursorCol + firstColumnX == x ? ColorScheme.HotFocus : GetHotNormalColor ());
                 Driver.AddStr ($"{hexDigit:x}");
                 Driver.SetAttribute (GetHotNormalColor ());
                 Driver.AddStr (" ");
             }
         }
 
-        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 < Viewport.Height - (ShowHorizontalScrollIndicator ? 1 : 0); y++)
+        for (var y = 1; y < Viewport.Height; y++)
         {
             // What row is this?
-            int row = (y - ContentOffset.Y - 1) / _rowHeight;
+            int row = (y + Viewport.Y - 1) / _rowHeight;
 
             int val = row * 16;
 
             if (val > MaxCodePoint)
             {
-                continue;
+                break;
             }
 
             Move (firstColumnX + COLUMN_WIDTH, y);
             Driver.SetAttribute (GetNormalColor ());
 
-            // Note, this code naïvely draws all columns, even if the viewport is smaller than
-            // the needed width. We rely on Clip to ensure we don't draw past the viewport.
-            // If we were *really* worried about performance, we'd optimize this code to only draw the
-            // parts of the row that are actually visible in the viewport.
             for (var col = 0; col < 16; col++)
             {
                 int x = firstColumnX + COLUMN_WIDTH * col + 1;
 
+                if (x < 0 || x > Viewport.Width - 1)
+                {
+                    continue;
+                }
+
                 Move (x, y);
 
-                if (cursorRow + ContentOffset.Y + 1 == y && cursorCol + ContentOffset.X + firstColumnX + 1 == x && !HasFocus)
+                // If we're at the cursor position, and we don't have focus, invert the colors.
+                if (row == cursorRow && x == cursorCol && !HasFocus)
                 {
                     Driver.SetAttribute (GetFocusColor ());
                 }
@@ -630,11 +653,15 @@ internal class CharMap : ScrollView
                     rune = new (scalar);
                 }
 
+                if (rune == (Rune)'!')
+                {
+
+                }
                 int width = rune.GetColumns ();
 
-                // are we at first row of the row?
-                if (!ShowGlyphWidths || (y - ContentOffset.Y) % _rowHeight > 0)
+                if (!ShowGlyphWidths || (y + Viewport.Y) % _rowHeight > 0)
                 {
+                    // Draw the rune
                     if (width > 0)
                     {
                         Driver.AddRune (rune);
@@ -669,25 +696,24 @@ internal class CharMap : ScrollView
                 }
                 else
                 {
+                    // Draw the width of the rune
                     Driver.SetAttribute (ColorScheme.HotNormal);
                     Driver.AddStr ($"{width}");
                 }
 
-                if (cursorRow + ContentOffset.Y + 1 == y && cursorCol + ContentOffset.X + firstColumnX + 1 == x && !HasFocus)
+                // If we're at the cursor position, and we don't have focus, revert the colors to normal
+                if (row == cursorRow && x == cursorCol && !HasFocus)
                 {
                     Driver.SetAttribute (GetNormalColor ());
                 }
             }
 
+            // Draw row label (U+XXXX_)
             Move (0, y);
 
-            Driver.SetAttribute (
-                                 HasFocus && cursorRow + ContentOffset.Y + 1 == y
-                                     ? ColorScheme.HotFocus
-                                     : ColorScheme.HotNormal
-                                );
+            Driver.SetAttribute (HasFocus && (y + Viewport.Y - 1 == cursorRow) ? ColorScheme.HotFocus : ColorScheme.HotNormal);
 
-            if (!ShowGlyphWidths || (y - ContentOffset.Y) % _rowHeight > 0)
+            if (!ShowGlyphWidths || (y + Viewport.Y) % _rowHeight > 0)
             {
                 Driver.AddStr ($"U+{val / 16:x5}_ ");
             }
@@ -697,7 +723,7 @@ internal class CharMap : ScrollView
             }
         }
 
-        Driver.Clip = oldClip;
+       Driver.Clip = oldClip;
     }
 
     public override bool OnEnter (View view)
@@ -721,9 +747,9 @@ internal class CharMap : ScrollView
     {
         if (HasFocus
             && Cursor.X >= RowLabelWidth
-            && Cursor.X < Viewport.Width - (ShowVerticalScrollIndicator ? 1 : 0)
+            && Cursor.X < Viewport.Width
             && Cursor.Y > 0
-            && Cursor.Y < Viewport.Height - (ShowHorizontalScrollIndicator ? 1 : 0))
+            && Cursor.Y < Viewport.Height)
         {
             Driver.SetCursorVisibility (_cursor);
             Move (Cursor.X, Cursor.Y);
@@ -776,8 +802,8 @@ internal class CharMap : ScrollView
             me.X = Cursor.X;
         }
 
-        int row = (me.Y - 1 - ContentOffset.Y) / _rowHeight; // -1 for header
-        int col = (me.X - RowLabelWidth - ContentOffset.X) / COLUMN_WIDTH;
+        int row = (me.Y - 1 - -Viewport.Y) / _rowHeight; // -1 for header
+        int col = (me.X - RowLabelWidth - -Viewport.X) / COLUMN_WIDTH;
 
         if (col > 15)
         {
@@ -815,7 +841,7 @@ internal class CharMap : ScrollView
         {
             SelectedCodePoint = val;
 
-            _contextMenu = new()
+            _contextMenu = new ()
             {
                 Position = new (me.X + 1, me.Y + 1),
                 MenuItems = new (
@@ -857,7 +883,7 @@ internal class CharMap : ScrollView
             Y = Pos.Center (),
             Height = 7,
             Width = 50,
-            Buttons = [new() { Text = "Cancel" }]
+            Buttons = [new () { Text = "Cancel" }]
         };
 
         var errorLabel = new Label
@@ -953,46 +979,46 @@ internal class CharMap : ScrollView
             var label = new Label { Text = "IsAscii: ", X = 0, Y = 0 };
             dlg.Add (label);
 
-            label = new() { Text = $"{rune.IsAscii}", X = Pos.Right (label), Y = Pos.Top (label) };
+            label = new () { Text = $"{rune.IsAscii}", X = Pos.Right (label), Y = Pos.Top (label) };
             dlg.Add (label);
 
-            label = new() { Text = ", Bmp: ", X = Pos.Right (label), Y = Pos.Top (label) };
+            label = new () { Text = ", Bmp: ", X = Pos.Right (label), Y = Pos.Top (label) };
             dlg.Add (label);
 
-            label = new() { Text = $"{rune.IsBmp}", X = Pos.Right (label), Y = Pos.Top (label) };
+            label = new () { Text = $"{rune.IsBmp}", X = Pos.Right (label), Y = Pos.Top (label) };
             dlg.Add (label);
 
-            label = new() { Text = ", CombiningMark: ", X = Pos.Right (label), Y = Pos.Top (label) };
+            label = new () { Text = ", CombiningMark: ", X = Pos.Right (label), Y = Pos.Top (label) };
             dlg.Add (label);
 
-            label = new() { Text = $"{rune.IsCombiningMark ()}", X = Pos.Right (label), Y = Pos.Top (label) };
+            label = new () { Text = $"{rune.IsCombiningMark ()}", X = Pos.Right (label), Y = Pos.Top (label) };
             dlg.Add (label);
 
-            label = new() { Text = ", SurrogatePair: ", X = Pos.Right (label), Y = Pos.Top (label) };
+            label = new () { Text = ", SurrogatePair: ", X = Pos.Right (label), Y = Pos.Top (label) };
             dlg.Add (label);
 
-            label = new() { Text = $"{rune.IsSurrogatePair ()}", X = Pos.Right (label), Y = Pos.Top (label) };
+            label = new () { Text = $"{rune.IsSurrogatePair ()}", X = Pos.Right (label), Y = Pos.Top (label) };
             dlg.Add (label);
 
-            label = new() { Text = ", Plane: ", X = Pos.Right (label), Y = Pos.Top (label) };
+            label = new () { Text = ", Plane: ", X = Pos.Right (label), Y = Pos.Top (label) };
             dlg.Add (label);
 
-            label = new() { Text = $"{rune.Plane}", X = Pos.Right (label), Y = Pos.Top (label) };
+            label = new () { Text = $"{rune.Plane}", X = Pos.Right (label), Y = Pos.Top (label) };
             dlg.Add (label);
 
-            label = new() { Text = "Columns: ", X = 0, Y = Pos.Bottom (label) };
+            label = new () { Text = "Columns: ", X = 0, Y = Pos.Bottom (label) };
             dlg.Add (label);
 
-            label = new() { Text = $"{rune.GetColumns ()}", X = Pos.Right (label), Y = Pos.Top (label) };
+            label = new () { Text = $"{rune.GetColumns ()}", X = Pos.Right (label), Y = Pos.Top (label) };
             dlg.Add (label);
 
-            label = new() { Text = ", Utf16SequenceLength: ", X = Pos.Right (label), Y = Pos.Top (label) };
+            label = new () { Text = ", Utf16SequenceLength: ", X = Pos.Right (label), Y = Pos.Top (label) };
             dlg.Add (label);
 
-            label = new() { Text = $"{rune.Utf16SequenceLength}", X = Pos.Right (label), Y = Pos.Top (label) };
+            label = new () { Text = $"{rune.Utf16SequenceLength}", X = Pos.Right (label), Y = Pos.Top (label) };
             dlg.Add (label);
 
-            label = new()
+            label = new ()
             {
                 Text =
                     $"Code Point Information from {UcdApiClient.BaseUrl}codepoint/dec/{SelectedCodePoint}:",

+ 5 - 5
UnitTests/View/DrawTests.cs

@@ -340,7 +340,7 @@ public class DrawTests (ITestOutputHelper output)
         var view = new View { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
         view.BeginInit ();
         view.EndInit ();
-        view.SetRelativeLayout (Application.Driver.Viewport.Size);
+        view.SetRelativeLayout (Application.Driver.Screen.Size);
 
         Assert.Equal (new (0, 0, 2, 2), view.Frame);
         Assert.Equal (Rectangle.Empty, view.Viewport);
@@ -365,7 +365,7 @@ public class DrawTests (ITestOutputHelper output)
         view.Border.Thickness = new Thickness (1, 1, 1, 0);
         view.BeginInit ();
         view.EndInit ();
-        view.SetRelativeLayout (Application.Driver.Viewport.Size);
+        view.SetRelativeLayout (Application.Driver.Screen.Size);
 
         Assert.Equal (new (0, 0, 2, 1), view.Frame);
         Assert.Equal (Rectangle.Empty, view.Viewport);
@@ -383,7 +383,7 @@ public class DrawTests (ITestOutputHelper output)
         view.Border.Thickness = new Thickness (0, 1, 1, 1);
         view.BeginInit ();
         view.EndInit ();
-        view.SetRelativeLayout (Application.Driver.Viewport.Size);
+        view.SetRelativeLayout (Application.Driver.Screen.Size);
 
         Assert.Equal (new (0, 0, 1, 2), view.Frame);
         Assert.Equal (Rectangle.Empty, view.Viewport);
@@ -408,7 +408,7 @@ public class DrawTests (ITestOutputHelper output)
         view.Border.Thickness = new Thickness (1, 1, 0, 1);
         view.BeginInit ();
         view.EndInit ();
-        view.SetRelativeLayout (Application.Driver.Viewport.Size);
+        view.SetRelativeLayout (Application.Driver.Screen.Size);
 
         Assert.Equal (new (0, 0, 1, 2), view.Frame);
         Assert.Equal (Rectangle.Empty, view.Viewport);
@@ -434,7 +434,7 @@ public class DrawTests (ITestOutputHelper output)
 
         view.BeginInit ();
         view.EndInit ();
-        view.SetRelativeLayout (Application.Driver.Viewport.Size);
+        view.SetRelativeLayout (Application.Driver.Screen.Size);
 
         Assert.Equal (new (0, 0, 2, 1), view.Frame);
         Assert.Equal (Rectangle.Empty, view.Viewport);

+ 1 - 1
UnitTests/Views/TextViewTests.cs

@@ -7675,7 +7675,7 @@ This is the second line.
                                                      );
 
         ((FakeDriver)Application.Driver).SetBufferSize (6, 25);
-        tv.SetRelativeLayout (Application.Driver.Viewport.Size);
+        tv.SetRelativeLayout (Application.Driver.Screen.Size);
         tv.Draw ();
         Assert.Equal (new Point (4, 2), tv.CursorPosition);
         Assert.Equal (new Point (12, 0), cp);