소스 검색

Start on replacing old StatusBar with new

Tig 1 년 전
부모
커밋
05613bb229

+ 3 - 6
Terminal.Gui/Views/Bar.cs

@@ -9,7 +9,7 @@ namespace Terminal.Gui;
 /// </summary>
 /// <remarks>
 /// </remarks>
-public class Bar : Toplevel
+public class Bar : View
 {
     /// <inheritdoc/>
     public Bar ()
@@ -44,15 +44,12 @@ public class Bar : Toplevel
     /// </summary>
     public Orientation Orientation { get; set; } = Orientation.Horizontal;
 
+
+
     public bool StatusBarStyle { get; set; } = true;
 
     public override void Add (View view)
     {
-        if (Orientation == Orientation.Horizontal)
-        {
-            //view.AutoSize = true;
-        }
-
         base.Add (view);
         AdjustSubviewBorders ();
 

+ 29 - 10
Terminal.Gui/Views/Shortcut.cs

@@ -1,4 +1,6 @@
 using System.ComponentModel;
+using System.Reflection.Metadata;
+using Terminal.Gui.Analyzers.Internal.Attributes;
 
 namespace Terminal.Gui;
 
@@ -6,6 +8,18 @@ namespace Terminal.Gui;
 // TODO: It can mean "Application-scoped key binding" or "A key binding that is displayed in a visual way".
 // TODO: I tried `BarItem` but that's not great either as it implies it can only be used in `Bar`s.
 
+[Flags]
+[GenerateEnumExtensionMethods (FastHasFlags = true)]
+public enum ShortcutStyles
+{
+    None = 0,
+
+    SeparatorBefore = 8,
+
+    SeparatorAfter = 16,
+}
+
+
 /// <summary>
 ///     Displays a command, help text, and a key binding. When the key is pressed, the command will be invoked. Useful for
 ///     displaying a command in <see cref="Bar"/> such as a
@@ -80,7 +94,6 @@ public class Shortcut : View
         KeyView.MouseClick += Shortcut_MouseClick;
 
         LayoutStarted += OnLayoutStarted;
-        DrawContent += Shortcut_DrawContent;
 
         Initialized += OnInitialized;
 
@@ -110,12 +123,6 @@ public class Shortcut : View
         }
     }
 
-    private void Shortcut_DrawContent (object sender, DrawEventArgs e)
-    {
-       //SetColorScheme();
-    }
-
-
     /// <summary>
     ///     Gets or sets the <see cref="Orientation"/> for this <see cref="Shortcut"/>. The default is
     ///     <see cref="Orientation.Horizontal"/>, which is ideal for status bars and toolbars. If set to <see cref="Orientation.Vertical"/>,
@@ -123,6 +130,8 @@ public class Shortcut : View
     /// </summary>
     public Orientation Orientation { get; set; } = Orientation.Horizontal;
 
+    public ShortcutStyles ShortcutStyle { get; set; } = ShortcutStyles.None;
+
     // When one of the subviews is "empty" we don't want to show it. So we
     // Use Add/Remove. We need to be careful to add them in the right order
     // so Pos.Align works correctly.
@@ -622,16 +631,26 @@ public class Shortcut : View
                 break;
         }
 
+        if (AcceptAction is null)
+        {
+            AcceptAction = () =>
+                           {
+                               var args = new HandledEventArgs ();
+                               Accept?.Invoke (this, args);
+                           };
+        }
+
         if (handled == false)
         {
-            var args = new HandledEventArgs ();
-            Accept?.Invoke (this, args);
-            handled = args.Handled;
+            AcceptAction.Invoke();
         }
 
         return true;
     }
 
+    [CanBeNull]
+    public Action AcceptAction { get; set; }
+
     #endregion Accept Handling
 
     #region Focus

+ 29 - 204
Terminal.Gui/Views/StatusBar.cs

@@ -2,242 +2,67 @@ namespace Terminal.Gui;
 
 /// <summary>
 ///     A status bar is a <see cref="View"/> that snaps to the bottom of a <see cref="Toplevel"/> displaying set of
-///     <see cref="StatusItem"/>s. The <see cref="StatusBar"/> should be context sensitive. This means, if the main menu
+///     <see cref="Shortcut"/>s. The <see cref="StatusBar"/> should be context sensitive. This means, if the main menu
 ///     and an open text editor are visible, the items probably shown will be ~F1~ Help ~F2~ Save ~F3~ Load. While a dialog
 ///     to ask a file to load is executed, the remaining commands will probably be ~F1~ Help. So for each context must be a
 ///     new instance of a status bar.
 /// </summary>
-public class StatusBar : View
+public class StatusBar : Bar
 {
-    private static Rune _shortcutDelimiter = (Rune)'=';
 
-    private StatusItem [] _items = [];
-
-    /// <summary>Initializes a new instance of the <see cref="StatusBar"/> class.</summary>
-    public StatusBar () : this (new StatusItem [] { }) { }
-
-    /// <summary>
-    ///     Initializes a new instance of the <see cref="StatusBar"/> class with the specified set of
-    ///     <see cref="StatusItem"/> s. The <see cref="StatusBar"/> will be drawn on the lowest line of the terminal or
-    ///     <see cref="View.SuperView"/> (if not null).
-    /// </summary>
-    /// <param name="items">A list of status bar items.</param>
-    public StatusBar (StatusItem [] items)
+    public StatusBar ()
     {
-        if (items is { })
-        {
-            Items = items;
-        }
-
-        CanFocus = false;
-        ColorScheme = Colors.ColorSchemes ["Menu"];
-        X = 0;
+        Orientation = Orientation.Horizontal;
         Y = Pos.AnchorEnd ();
         Width = Dim.Fill ();
-        Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == GetContentSize ().
-
-        AddCommand (Command.Accept, ctx => InvokeItem ((StatusItem)ctx.KeyBinding?.Context));
     }
 
-    /// <summary>The items that compose the <see cref="StatusBar"/></summary>
-    public StatusItem [] Items
+    /// <inheritdoc />
+    public override void Add (View view)
     {
-        get => _items;
-        set
-        {
-            foreach (StatusItem item in _items)
-            {
-                KeyBindings.Remove (item.Shortcut);
-            }
-
-            _items = value;
-
-            foreach (StatusItem item in _items.Where (i => i.Shortcut != Key.Empty))
-            {
-                KeyBinding keyBinding = new (new [] { Command.Accept }, KeyBindingScope.HotKey, item);
-                KeyBindings.Add (item.Shortcut, keyBinding);
-            }
-        }
-    }
-
-    /// <summary>Gets or sets shortcut delimiter separator. The default is "-".</summary>
-    public static Rune ShortcutDelimiter
-    {
-        get => _shortcutDelimiter;
-        set
-        {
-            if (_shortcutDelimiter != value)
-            {
-                _shortcutDelimiter = value == default (Rune) ? (Rune)'=' : value;
-            }
-        }
+        view.CanFocus = false;
+        base.Add (view);
     }
 
-    /// <summary>Inserts a <see cref="StatusItem"/> in the specified index of <see cref="Items"/>.</summary>
+    /// <summary>Inserts a <see cref="Shortcut"/> in the specified index of <see cref="Items"/>.</summary>
     /// <param name="index">The zero-based index at which item should be inserted.</param>
     /// <param name="item">The item to insert.</param>
-    public void AddItemAt (int index, StatusItem item)
+    public void AddShortcutAt (int index, Shortcut item)
     {
-        List<StatusItem> itemsList = new (Items);
-        itemsList.Insert (index, item);
-        Items = itemsList.ToArray ();
-        SetNeedsDisplay ();
-    }
-
-    ///<inheritdoc/>
-    protected internal override bool OnMouseEvent (MouseEvent me)
-    {
-        if (me.Flags != MouseFlags.Button1Clicked)
+        List<View> savedSubViewList = Subviews.ToList ();
+        int count = savedSubViewList.Count;
+        RemoveAll ();
+        for (int i = 0; i < count; i++)
         {
-            return false;
-        }
-
-        var pos = 1;
-
-        for (var i = 0; i < Items.Length; i++)
-        {
-            if (me.Position.X >= pos && me.Position.X < pos + GetItemTitleLength (Items [i].Title))
+            if (i == index)
             {
-                StatusItem item = Items [i];
-
-                if (item.IsEnabled ())
-                {
-                    Run (item.Action);
-                }
-
-                break;
+                Add (item);
             }
-
-            pos += GetItemTitleLength (Items [i].Title) + 3;
+            Add (savedSubViewList [i]);
         }
-
-        return true;
-    }
-
-    ///<inheritdoc/>
-    public override void OnDrawContent (Rectangle viewport)
-    {
-        Move (0, 0);
-        Driver.SetAttribute (GetNormalColor ());
-
-        for (var i = 0; i < Frame.Width; i++)
-        {
-            Driver.AddRune ((Rune)' ');
-        }
-
-        Move (1, 0);
-        Attribute scheme = GetNormalColor ();
-        Driver.SetAttribute (scheme);
-
-        for (var i = 0; i < Items.Length; i++)
-        {
-            string title = Items [i].Title;
-            Driver.SetAttribute (DetermineColorSchemeFor (Items [i]));
-
-            for (var n = 0; n < Items [i].Title.GetRuneCount (); n++)
-            {
-                if (title [n] == '~')
-                {
-                    if (Items [i].IsEnabled ())
-                    {
-                        scheme = ToggleScheme (scheme);
-                    }
-
-                    continue;
-                }
-
-                Driver.AddRune ((Rune)title [n]);
-            }
-
-            if (i + 1 < Items.Length)
-            {
-                Driver.AddRune ((Rune)' ');
-                Driver.AddRune (Glyphs.VLine);
-                Driver.AddRune ((Rune)' ');
-            }
-        }
-    }
-
-    /// <summary>Removes a <see cref="StatusItem"/> at specified index of <see cref="Items"/>.</summary>
-    /// <param name="index">The zero-based index of the item to remove.</param>
-    /// <returns>The <see cref="StatusItem"/> removed.</returns>
-    public StatusItem RemoveItem (int index)
-    {
-        List<StatusItem> itemsList = new (Items);
-        StatusItem item = itemsList [index];
-        itemsList.RemoveAt (index);
-        Items = itemsList.ToArray ();
         SetNeedsDisplay ();
-
-        return item;
     }
 
-    private Attribute DetermineColorSchemeFor (StatusItem item)
-    {
-        if (item is { })
-        {
-            if (item.IsEnabled ())
-            {
-                return GetNormalColor ();
-            }
-
-            return ColorScheme.Disabled;
-        }
-
-        return GetNormalColor ();
-    }
-
-    private int GetItemTitleLength (string title)
+    /// <summary>Removes a <see cref="Shortcut"/> at specified index of <see cref="Items"/>.</summary>
+    /// <param name="index">The zero-based index of the item to remove.</param>
+    /// <returns>The <see cref="Shortcut"/> removed.</returns>
+    public Shortcut RemoveItem (int index)
     {
-        var len = 0;
-
-        foreach (char ch in title)
+        View toRemove = null;
+        for (int i = 0; i < Subviews.Count; i++)
         {
-            if (ch == '~')
+            if (i == index)
             {
-                continue;
+                toRemove = Subviews [i];
             }
-
-            len++;
-        }
-
-        return len;
-    }
-
-    private bool? InvokeItem (StatusItem itemToInvoke)
-    {
-        if (itemToInvoke is { Action: { } })
-        {
-            itemToInvoke.Action.Invoke ();
-
-            return true;
         }
 
-        return false;
-    }
-
-    private void Run (Action action)
-    {
-        if (action is null)
+        if (toRemove is { })
         {
-            return;
+            Remove (toRemove);
+            SetNeedsDisplay ();
         }
 
-        Application.MainLoop.AddIdle (
-                                      () =>
-                                      {
-                                          action ();
-
-                                          return false;
-                                      }
-                                     );
-    }
-
-    private Attribute ToggleScheme (Attribute scheme)
-    {
-        Attribute result = scheme == ColorScheme.Normal ? ColorScheme.HotNormal : ColorScheme.Normal;
-        Driver.SetAttribute (result);
-
-        return result;
+        return toRemove as Shortcut;
     }
 }

+ 0 - 59
Terminal.Gui/Views/StatusItem.cs

@@ -1,59 +0,0 @@
-namespace Terminal.Gui;
-
-/// <summary>
-///     <see cref="StatusItem"/> objects are contained by <see cref="StatusBar"/> <see cref="View"/>s. Each
-///     <see cref="StatusItem"/> has a title, a shortcut (hotkey), and an <see cref="Command"/> that will be invoked when
-///     the <see cref="StatusItem.Shortcut"/> is pressed. The <see cref="StatusItem.Shortcut"/> will be a global hotkey for
-///     the application in the current context of the screen. The color of the <see cref="StatusItem.Title"/> will be
-///     changed after each ~. A <see cref="StatusItem.Title"/> set to `~F1~ Help` will render as *F1* using
-///     <see cref="ColorScheme.HotNormal"/> and *Help* as <see cref="ColorScheme.HotNormal"/>.
-/// </summary>
-public class StatusItem
-{
-    /// <summary>Initializes a new <see cref="StatusItem"/>.</summary>
-    /// <param name="shortcut">Shortcut to activate the <see cref="StatusItem"/>.</param>
-    /// <param name="title">Title for the <see cref="StatusItem"/>.</param>
-    /// <param name="action">Action to invoke when the <see cref="StatusItem"/> is activated.</param>
-    /// <param name="canExecute">Function to determine if the action can currently be executed.</param>
-    public StatusItem (Key shortcut, string title, Action action, Func<bool> canExecute = null)
-    {
-        Title = title ?? "";
-        Shortcut = shortcut;
-        Action = action;
-        CanExecute = canExecute;
-    }
-
-    /// <summary>Gets or sets the action to be invoked when the <see cref="StatusItem"/> is triggered</summary>
-    /// <value>Action to invoke.</value>
-    public Action Action { get; set; }
-
-    /// <summary>
-    ///     Gets or sets the action to be invoked to determine if the <see cref="StatusItem"/> can be triggered. If
-    ///     <see cref="CanExecute"/> returns <see langword="true"/> the status item will be enabled. Otherwise, it will be
-    ///     disabled.
-    /// </summary>
-    /// <value>Function to determine if the action is can be executed or not.</value>
-    public Func<bool> CanExecute { get; set; }
-
-    /// <summary>Gets or sets arbitrary data for the status item.</summary>
-    /// <remarks>This property is not used internally.</remarks>
-    public object Data { get; set; }
-
-    /// <summary>Gets the global shortcut to invoke the action on the menu.</summary>
-    public Key Shortcut { get; set; }
-
-    /// <summary>Gets or sets the title.</summary>
-    /// <value>The title.</value>
-    /// <remarks>
-    ///     The colour of the <see cref="StatusItem.Title"/> will be changed after each ~. A
-    ///     <see cref="StatusItem.Title"/> set to `~F1~ Help` will render as *F1* using <see cref="ColorScheme.HotNormal"/> and
-    ///     *Help* as <see cref="ColorScheme.HotNormal"/>.
-    /// </remarks>
-    public string Title { get; set; }
-
-    /// <summary>
-    ///     Returns <see langword="true"/> if the status item is enabled. This method is a wrapper around
-    ///     <see cref="CanExecute"/>.
-    /// </summary>
-    public bool IsEnabled () { return CanExecute?.Invoke () ?? true; }
-}

+ 2 - 2
UICatalog/Scenarios/BackgroundWorkerCollection.cs

@@ -88,7 +88,7 @@ public class BackgroundWorkerCollection : Scenario
             ;
             _menu.MenuOpening += Menu_MenuOpening;
             Add (_menu);
-
+#if V2_STATUSBAR
             var statusBar = new StatusBar (
                                            new []
                                            {
@@ -106,7 +106,7 @@ public class BackgroundWorkerCollection : Scenario
                                            }
                                           );
             Add (statusBar);
-
+#endif
             Ready += OverlappedMain_Ready;
             Activate += OverlappedMain_Activate;
             Deactivate += OverlappedMain_Deactivate;

+ 3 - 3
UICatalog/Scenarios/Bars.cs

@@ -339,7 +339,7 @@ public class Bars : Scenario
             Y = 1,
             Orientation = Orientation.Vertical,
             StatusBarStyle = false,
-            Modal = true,
+           // Modal = true,
             Visible = false,
         };
 
@@ -381,7 +381,7 @@ public class Bars : Scenario
                               {
                                   if (fileMenu.Visible)
                                   {
-                                      fileMenu.RequestStop ();
+                                     // fileMenu.RequestStop ();
                                       prevFocus?.SetFocus ();
                                       return;
                                   }
@@ -394,7 +394,7 @@ public class Bars : Scenario
                                   fileMenu.Visible = true;
                                   prevFocus = Application.Top.Focused;
                                   fileMenuBarItem.SetFocus ();
-                                  Application.Run (fileMenu);
+                                  //Application.Run (fileMenu);
                                   fileMenu.Visible = false;
                               };
 

+ 29 - 16
UICatalog/Scenarios/ConfigurationEditor.cs

@@ -22,7 +22,7 @@ public class ConfigurationEditor : Scenario
     };
 
     private static Action _editorColorSchemeChanged;
-    private StatusItem _lenStatusItem;
+    private Shortcut _lenShortcut;
     private TileView _tileView;
 
     [SerializableConfigurationProperty (Scope = typeof (AppScope))]
@@ -48,21 +48,34 @@ public class ConfigurationEditor : Scenario
 
         top.Add (_tileView);
 
-        _lenStatusItem = new StatusItem (KeyCode.CharMask, "Len: ", null);
+        _lenShortcut = new Shortcut ()
+        {
+            Title = "Len: ",
+        };
 
-        var statusBar = new StatusBar (
-                                       new []
-                                       {
-                                           new (
-                                                Application.QuitKey,
-                                                $"{Application.QuitKey} Quit",
-                                                () => Quit ()
-                                               ),
-                                           new (KeyCode.F5, "~F5~ Reload", () => Reload ()),
-                                           new (KeyCode.CtrlMask | KeyCode.S, "~^S~ Save", () => Save ()),
-                                           _lenStatusItem
-                                       }
-                                      );
+        var quitShortcut = new Shortcut ()
+        {
+            Key = Application.QuitKey,
+            Title = $"{Application.QuitKey} Quit",
+            AcceptAction = Quit
+        };
+
+        var reloadShortcut = new Shortcut ()
+        {
+            Key = KeyCode.F5,
+            Title = "Reload",
+            AcceptAction = Reload
+        };
+        var saveShortcut = new Shortcut ()
+        {
+            Key = Key.S.WithCtrl,
+            Title = "Save",
+            AcceptAction = Save
+        };
+
+
+        var statusBar = new StatusBar ();
+        statusBar.Add (quitShortcut, reloadShortcut, saveShortcut, _lenShortcut);
 
         top.Add (statusBar);
 
@@ -120,7 +133,7 @@ public class ConfigurationEditor : Scenario
 
             textView.Read ();
 
-            textView.Enter += (s, e) => { _lenStatusItem.Title = $"Len:{textView.Text.Length}"; };
+            textView.Enter += (s, e) => { _lenShortcut.Title = $"Len:{textView.Text.Length}"; };
         }
 
         Application.Top.LayoutSubviews ();

+ 2 - 0
UICatalog/Scenarios/CsvEditor.cs

@@ -103,6 +103,7 @@ public class CsvEditor : Scenario
         };
         Top.Add (menu);
 
+#if V2_STATUSBAR
         var statusBar = new StatusBar (
                                        new StatusItem []
                                        {
@@ -124,6 +125,7 @@ public class CsvEditor : Scenario
                                        }
                                       );
         Top.Add (statusBar);
+#endif
 
         Win.Add (_tableView);
 

+ 34 - 79
UICatalog/Scenarios/DynamicStatusBar.cs

@@ -8,6 +8,7 @@ using Terminal.Gui;
 
 namespace UICatalog.Scenarios;
 
+#if V2_STATUSBAR
 [ScenarioMetadata ("Dynamic StatusBar", "Demonstrates how to add and remove a StatusBar and change items dynamically.")]
 [ScenarioCategory ("Top Level Windows")]
 public class DynamicStatusBar : Scenario
@@ -90,9 +91,9 @@ public class DynamicStatusBar : Scenario
 
     public class DynamicStatusBarDetails : FrameView
     {
-        private StatusItem _statusItem;
+        private Shortcut _statusItem;
 
-        public DynamicStatusBarDetails (StatusItem statusItem = null) : this ()
+        public DynamicStatusBarDetails (Shortcut statusItem = null) : this ()
         {
             _statusItem = statusItem;
             Title = statusItem == null ? "Adding New StatusBar Item." : "Editing StatusBar Item.";
@@ -155,7 +156,7 @@ public class DynamicStatusBar : Scenario
 
             bool CheckShortcut (KeyCode k, bool pre)
             {
-                StatusItem m = _statusItem != null ? _statusItem : new StatusItem (k, "", null);
+                Shortcut m = _statusItem != null ? _statusItem : new Shortcut (k, "", null);
 
                 if (pre && !ShortcutHelper.PreShortcutValidation (k))
                 {
@@ -166,28 +167,10 @@ public class DynamicStatusBar : Scenario
 
                 if (!pre)
                 {
-                    if (!ShortcutHelper.PostShortcutValidation (
-                                                                ShortcutHelper.GetShortcutFromTag (
-                                                                                                   TextShortcut.Text,
-                                                                                                   StatusBar.ShortcutDelimiter
-                                                                                                  )
-                                                               ))
-                    {
-                        TextShortcut.Text = "";
-
-                        return false;
-                    }
-
                     return true;
                 }
 
-                TextShortcut.Text =
-                    Key.ToString (
-                                  k,
-                                  StatusBar
-                                      .ShortcutDelimiter
-                                 ); //ShortcutHelper.GetShortcutTag (k, StatusBar.ShortcutDelimiter);
-
+                TextShortcut.Text = k.ToString();
                 return true;
             }
 
@@ -213,7 +196,7 @@ public class DynamicStatusBar : Scenario
         public TextField TextTitle { get; }
         public Action CreateAction (DynamicStatusItem item) { return () => MessageBox.ErrorQuery (item.Title, item.Action, "Ok"); }
 
-        public void EditStatusItem (StatusItem statusItem)
+        public void EditStatusItem (Shortcut statusItem)
         {
             if (statusItem == null)
             {
@@ -231,12 +214,7 @@ public class DynamicStatusBar : Scenario
                                   ? GetTargetAction (statusItem.Action)
                                   : string.Empty;
 
-            TextShortcut.Text =
-                Key.ToString (
-                              (KeyCode)statusItem.Shortcut,
-                              StatusBar
-                                  .ShortcutDelimiter
-                             ); //ShortcutHelper.GetShortcutTag (statusItem.Shortcut, StatusBar.ShortcutDelimiter) ?? "";
+            TextShortcut.Text = statusItem.Shortcut;
         }
 
         public DynamicStatusItem EnterStatusItem ()
@@ -334,32 +312,15 @@ public class DynamicStatusBar : Scenario
     public class DynamicStatusBarSample : Window
     {
         private readonly ListView _lstItems;
-        private StatusItem _currentEditStatusItem;
+        private Shortcut _currentEditStatusItem;
         private int _currentSelectedStatusBar = -1;
-        private StatusItem _currentStatusItem;
+        private Shortcut _currentStatusItem;
         private StatusBar _statusBar;
 
         public DynamicStatusBarSample ()
         {
             DataContext = new DynamicStatusItemModel ();
 
-            var _frmDelimiter = new FrameView
-            {
-                X = Pos.Center (),
-                Y = 0,
-                Width = 25,
-                Height = 4,
-                Title = "Shortcut Delimiter:"
-            };
-
-            var _txtDelimiter = new TextField { X = Pos.Center (), Width = 2, Text = $"{StatusBar.ShortcutDelimiter}" };
-
-            _txtDelimiter.TextChanged += (s, _) =>
-                                             StatusBar.ShortcutDelimiter = _txtDelimiter.Text.ToRunes () [0];
-            _frmDelimiter.Add (_txtDelimiter);
-
-            Add (_frmDelimiter);
-
             var _frmStatusBar = new FrameView
             {
                 Y = 5, Width = Dim.Percent (50), Height = Dim.Fill (2), Title = "Items:"
@@ -404,18 +365,18 @@ public class DynamicStatusBar : Scenario
                 Y = Pos.Top (_frmStatusBar),
                 Width = Dim.Fill (),
                 Height = Dim.Fill (4),
-                Title = "StatusBar Item Details:"
+                Title = "Shortcut Details:"
             };
             Add (_frmStatusBarDetails);
 
             _btnUp.Accept += (s, e) =>
                               {
                                   int i = _lstItems.SelectedItem;
-                                  StatusItem statusItem = DataContext.Items.Count > 0 ? DataContext.Items [i].StatusItem : null;
+                                  Shortcut statusItem = DataContext.Items.Count > 0 ? DataContext.Items [i].Shortcut : null;
 
                                   if (statusItem != null)
                                   {
-                                      StatusItem [] items = _statusBar.Items;
+                                      Shortcut [] items = _statusBar.Items;
 
                                       if (i > 0)
                                       {
@@ -434,11 +395,11 @@ public class DynamicStatusBar : Scenario
             _btnDown.Accept += (s, e) =>
                                 {
                                     int i = _lstItems.SelectedItem;
-                                    StatusItem statusItem = DataContext.Items.Count > 0 ? DataContext.Items [i].StatusItem : null;
+                                    Shortcut statusItem = DataContext.Items.Count > 0 ? DataContext.Items [i].Shortcut : null;
 
                                     if (statusItem != null)
                                     {
-                                        StatusItem [] items = _statusBar.Items;
+                                        Shortcut [] items = _statusBar.Items;
 
                                         if (i < items.Length - 1)
                                         {
@@ -511,9 +472,9 @@ public class DynamicStatusBar : Scenario
                                        return;
                                    }
 
-                                   StatusItem newStatusItem = CreateNewStatusBar (item);
+                                   Shortcut newStatusItem = CreateNewStatusBar (item);
                                    _currentSelectedStatusBar++;
-                                   _statusBar.AddItemAt (_currentSelectedStatusBar, newStatusItem);
+                                   _statusBar.AddShortcutAt (_currentSelectedStatusBar, newStatusItem);
                                    DataContext.Items.Add (new DynamicStatusItemList (newStatusItem.Title, newStatusItem));
                                    _lstItems.MoveDown ();
                                    SetFrameDetails ();
@@ -521,8 +482,8 @@ public class DynamicStatusBar : Scenario
 
             _btnRemove.Accept += (s, e) =>
                                   {
-                                      StatusItem statusItem = DataContext.Items.Count > 0
-                                                                  ? DataContext.Items [_lstItems.SelectedItem].StatusItem
+                                      Shortcut statusItem = DataContext.Items.Count > 0
+                                                                  ? DataContext.Items [_lstItems.SelectedItem].Shortcut
                                                                   : null;
 
                                       if (statusItem != null)
@@ -542,8 +503,8 @@ public class DynamicStatusBar : Scenario
 
             _lstItems.Enter += (s, e) =>
                                {
-                                   StatusItem statusItem = DataContext.Items.Count > 0
-                                                               ? DataContext.Items [_lstItems.SelectedItem].StatusItem
+                                   Shortcut statusItem = DataContext.Items.Count > 0
+                                                               ? DataContext.Items [_lstItems.SelectedItem].Shortcut
                                                                : null;
                                    SetFrameDetails (statusItem);
                                };
@@ -582,14 +543,14 @@ public class DynamicStatusBar : Scenario
 
             var lstItems = new Binding (this, "Items", _lstItems, "Source", listWrapperConverter);
 
-            void SetFrameDetails (StatusItem statusItem = null)
+            void SetFrameDetails (Shortcut statusItem = null)
             {
-                StatusItem newStatusItem;
+                Shortcut newStatusItem;
 
                 if (statusItem == null)
                 {
                     newStatusItem = DataContext.Items.Count > 0
-                                        ? DataContext.Items [_lstItems.SelectedItem].StatusItem
+                                        ? DataContext.Items [_lstItems.SelectedItem].Shortcut
                                         : null;
                 }
                 else
@@ -608,10 +569,10 @@ public class DynamicStatusBar : Scenario
                 }
             }
 
-            void SetListViewSource (StatusItem _currentStatusItem, bool fill = false)
+            void SetListViewSource (Shortcut _currentStatusItem, bool fill = false)
             {
                 DataContext.Items = [];
-                StatusItem statusItem = _currentStatusItem;
+                Shortcut statusItem = _currentStatusItem;
 
                 if (!fill)
                 {
@@ -620,29 +581,22 @@ public class DynamicStatusBar : Scenario
 
                 if (statusItem != null)
                 {
-                    foreach (StatusItem si in _statusBar.Items)
+                    foreach (Shortcut si in _statusBar.Items)
                     {
                         DataContext.Items.Add (new DynamicStatusItemList (si.Title, si));
                     }
                 }
             }
 
-            StatusItem CreateNewStatusBar (DynamicStatusItem item)
+            Shortcut CreateNewStatusBar (DynamicStatusItem item)
             {
-                var newStatusItem = new StatusItem (
-                                                    ShortcutHelper.GetShortcutFromTag (
-                                                                                       item.Shortcut,
-                                                                                       StatusBar.ShortcutDelimiter
-                                                                                      ),
-                                                    item.Title,
-                                                    _frmStatusBarDetails.CreateAction (item)
-                                                   );
+                var newStatusItem = new Shortcut (item.Shortcut);
 
                 return newStatusItem;
             }
 
             void UpdateStatusItem (
-                StatusItem _currentEditStatusItem,
+                Shortcut _currentEditStatusItem,
                 DynamicStatusItem statusItem,
                 int index
             )
@@ -702,15 +656,15 @@ public class DynamicStatusBar : Scenario
     {
         public DynamicStatusItemList () { }
 
-        public DynamicStatusItemList (string title, StatusItem statusItem)
+        public DynamicStatusItemList (string title, Shortcut statusItem)
         {
             Title = title;
-            StatusItem = statusItem;
+            Shortcut = statusItem;
         }
 
-        public StatusItem StatusItem { get; set; }
+        public Shortcut Shortcut { get; set; }
         public string Title { get; set; }
-        public override string ToString () { return $"{Title}, {StatusItem}"; }
+        public override string ToString () { return $"{Title}, {Shortcut}"; }
     }
 
     public class DynamicStatusItemModel : INotifyPropertyChanged
@@ -781,3 +735,4 @@ public class DynamicStatusBar : Scenario
         }
     }
 }
+#endif

+ 2 - 0
UICatalog/Scenarios/Editor.cs

@@ -237,6 +237,7 @@ public class Editor : Scenario
         };
 
         _appWindow.Add (menu);
+#if V2_STATUSBAR
 
         var siCursorPosition = new StatusItem (KeyCode.Null, "", null);
 
@@ -266,6 +267,7 @@ public class Editor : Scenario
                                              };
 
         _appWindow.Add (statusBar);
+#endif
 
         _scrollBar = new (_textView, true);
 

+ 2 - 0
UICatalog/Scenarios/GraphViewExample.cs

@@ -165,6 +165,7 @@ public class GraphViewExample : Scenario
         Win.Add (frameRight);
 
         var statusBar = new StatusBar (
+#if V2_STATUSBAR
                                        new StatusItem []
                                        {
                                            new (
@@ -178,6 +179,7 @@ public class GraphViewExample : Scenario
                                                 () => _graphs [_currentGraph++ % _graphs.Length] ()
                                                )
                                        }
+#endif
                                       );
         Top.Add (statusBar);
     }

+ 6 - 1
UICatalog/Scenarios/HexEditor.cs

@@ -16,8 +16,10 @@ public class HexEditor : Scenario
     private HexView _hexView;
     private MenuItem _miAllowEdits;
     private bool _saved = true;
+#if V2_STATUSBAR
     private StatusItem _siPositionChanged;
     private StatusBar _statusBar;
+#endif
 
     public override void Setup ()
     {
@@ -75,7 +77,7 @@ public class HexEditor : Scenario
             ]
         };
         Top.Add (menu);
-
+#if V2_STATUSBAR
         _statusBar = new StatusBar (
                                     new []
                                     {
@@ -102,12 +104,14 @@ public class HexEditor : Scenario
                                     }
                                    );
         Top.Add (_statusBar);
+#endif
     }
 
     private void _hexView_Edited (object sender, HexViewEditEventArgs e) { _saved = false; }
 
     private void _hexView_PositionChanged (object sender, HexViewEventArgs obj)
     {
+#if V2_STATUSBAR
         _siPositionChanged.Title =
             $"Position: {
                 obj.Position
@@ -119,6 +123,7 @@ public class HexEditor : Scenario
                 obj.BytesPerLine
             }";
         _statusBar.SetNeedsDisplay ();
+#endif
     }
 
     private void Copy () { MessageBox.ErrorQuery ("Not Implemented", "Functionality not yet implemented.", "Ok"); }

+ 2 - 1
UICatalog/Scenarios/InteractiveTree.cs

@@ -29,8 +29,8 @@ public class InteractiveTree : Scenario
         _treeView.KeyDown += TreeView_KeyPress;
 
         Win.Add (_treeView);
-
         var statusBar = new StatusBar (
+#if V2_STATUSBAR
                                        new StatusItem []
                                        {
                                            new (
@@ -54,6 +54,7 @@ public class InteractiveTree : Scenario
                                                 RenameNode
                                                )
                                        }
+#endif
                                       );
         Top.Add (statusBar);
     }

+ 2 - 0
UICatalog/Scenarios/LineViewExample.cs

@@ -73,6 +73,7 @@ public class LineViewExample : Scenario
         Win.Add (verticalArrow);
 
         var statusBar = new StatusBar (
+#if V2_STATUSBAR
                                        new StatusItem []
                                        {
                                            new (
@@ -81,6 +82,7 @@ public class LineViewExample : Scenario
                                                 () => Quit ()
                                                )
                                        }
+#endif
                                       );
         Top.Add (statusBar);
     }

+ 2 - 0
UICatalog/Scenarios/ListColumns.cs

@@ -212,6 +212,7 @@ public class ListColumns : Scenario
         Top.Add (menu);
 
         var statusBar = new StatusBar (
+#if V2_STATUSBAR
                                        new StatusItem []
                                        {
                                            new (
@@ -235,6 +236,7 @@ public class ListColumns : Scenario
                                                 () => Quit ()
                                                )
                                        }
+#endif
                                       );
         Top.Add (statusBar);
 

+ 3 - 0
UICatalog/Scenarios/MultiColouredTable.cs

@@ -32,6 +32,8 @@ public class MultiColouredTable : Scenario
         Top.Add (menu);
 
         var statusBar = new StatusBar (
+#if V2_STATUSBAR
+
                                        new StatusItem []
                                        {
                                            new (
@@ -40,6 +42,7 @@ public class MultiColouredTable : Scenario
                                                 () => Quit ()
                                                )
                                        }
+#endif
                                       );
         Top.Add (statusBar);
 

+ 8 - 2
UICatalog/Scenarios/Notepad.cs

@@ -11,7 +11,9 @@ namespace UICatalog.Scenarios;
 public class Notepad : Scenario
 {
     private TabView _focusedTabView;
+#if V2_STATUSBAR
     private StatusItem _lenStatusItem;
+#endif
     private int _numNewTabs = 1;
     private TabView _tabView;
 
@@ -66,7 +68,7 @@ public class Notepad : Scenario
         split.LineStyle = LineStyle.None;
 
         top.Add (split);
-
+#if V2_STATUSBAR
         _lenStatusItem = new (KeyCode.CharMask, "Len: ", null);
 
         var statusBar = new StatusBar (
@@ -87,11 +89,13 @@ public class Notepad : Scenario
                                            _lenStatusItem
                                        }
                                       );
+        top.Add (statusBar);
+#endif
+
         _focusedTabView = _tabView;
         _tabView.SelectedTabChanged += TabView_SelectedTabChanged;
         _tabView.Enter += (s, e) => _focusedTabView = _tabView;
 
-        top.Add (statusBar);
         top.Ready += (s, e) => New ();
 
         Application.Run (top);
@@ -323,7 +327,9 @@ public class Notepad : Scenario
 
     private void TabView_SelectedTabChanged (object sender, TabChangedEventArgs e)
     {
+#if V2_STATUSBAR
         _lenStatusItem.Title = $"Len:{e.NewTab?.View?.Text?.Length ?? 0}";
+#endif
         e.NewTab?.View?.SetFocus ();
     }
 

+ 4 - 0
UICatalog/Scenarios/SingleBackgroundWorker.cs

@@ -62,6 +62,7 @@ public class SingleBackgroundWorker : Scenario
             Add (menu);
 
             var statusBar = new StatusBar (
+#if V2_STATUSBAR
                                            new []
                                            {
                                                new StatusItem (
@@ -75,6 +76,7 @@ public class SingleBackgroundWorker : Scenario
                                                                () => RunWorker ()
                                                               )
                                            }
+#endif
                                           );
             Add (statusBar);
 
@@ -275,6 +277,7 @@ public class SingleBackgroundWorker : Scenario
             _top.Add (menu);
 
             var statusBar = new StatusBar (
+#if V2_STATUSBAR
                                            new []
                                            {
                                                new StatusItem (
@@ -289,6 +292,7 @@ public class SingleBackgroundWorker : Scenario
                                                                }
                                                               )
                                            }
+#endif
                                           );
             _top.Add (statusBar);
 

+ 2 - 0
UICatalog/Scenarios/SyntaxHighlighting.cs

@@ -173,6 +173,7 @@ public class SyntaxHighlighting : Scenario
         Win.Add (_textView);
 
         var statusBar = new StatusBar (
+#if V2_STATUSBAR
                                        new StatusItem []
                                        {
                                            new (
@@ -181,6 +182,7 @@ public class SyntaxHighlighting : Scenario
                                                 () => Quit ()
                                                )
                                        }
+#endif
                                       );
 
         Top.Add (statusBar);

+ 2 - 0
UICatalog/Scenarios/TabViewExample.cs

@@ -172,6 +172,7 @@ public class TabViewExample : Scenario
         Win.Add (frameBelow);
 
         var statusBar = new StatusBar (
+#if V2_STATUSBAR
                                        new StatusItem []
                                        {
                                            new (
@@ -180,6 +181,7 @@ public class TabViewExample : Scenario
                                                 Quit
                                                )
                                        }
+#endif
                                       );
         Top.Add (statusBar);
     }

+ 2 - 0
UICatalog/Scenarios/TableEditor.cs

@@ -672,6 +672,7 @@ public class TableEditor : Scenario
         Top.Add (menu);
 
         var statusBar = new StatusBar (
+#if V2_STATUSBAR
                                        new StatusItem []
                                        {
                                            new (
@@ -695,6 +696,7 @@ public class TableEditor : Scenario
                                                 () => Quit ()
                                                )
                                        }
+#endif
                                       );
         Top.Add (statusBar);
 

+ 17 - 2
UICatalog/Scenarios/TextViewAutocompletePopup.cs

@@ -13,8 +13,10 @@ public class TextViewAutocompletePopup : Scenario
     private int _height = 10;
     private MenuItem _miMultiline;
     private MenuItem _miWrap;
+#if V2_STATUSBAR
     private StatusItem _siMultiline;
     private StatusItem _siWrap;
+#endif
     private TextView _textViewBottomLeft;
     private TextView _textViewBottomRight;
     private TextView _textViewCentered;
@@ -94,6 +96,7 @@ public class TextViewAutocompletePopup : Scenario
         _miWrap.Checked = _textViewTopLeft.WordWrap;
 
         var statusBar = new StatusBar (
+#if V2_STATUSBAR
                                        new []
                                        {
                                            new (
@@ -104,6 +107,7 @@ public class TextViewAutocompletePopup : Scenario
                                            _siMultiline = new StatusItem (KeyCode.Null, "", null),
                                            _siWrap = new StatusItem (KeyCode.Null, "", null)
                                        }
+#endif
                                       );
         Top.Add (statusBar);
 
@@ -132,8 +136,19 @@ public class TextViewAutocompletePopup : Scenario
                                                                                                 .ToList ();
     }
 
-    private void SetMultilineStatusText () { _siMultiline.Title = $"Multiline: {_miMultiline.Checked}"; }
-    private void SetWrapStatusText () { _siWrap.Title = $"WordWrap: {_miWrap.Checked}"; }
+    private void SetMultilineStatusText ()
+    {
+#if V2_STATUSBAR
+        _siMultiline.Title = $"Multiline: {_miMultiline.Checked}";
+#endif
+    }
+
+    private void SetWrapStatusText ()
+    {
+#if V2_STATUSBAR
+        _siWrap.Title = $"WordWrap: {_miWrap.Checked}";
+#endif
+    }
     private void TextViewBottomLeft_DrawContent (object sender, DrawEventArgs e) { SetAllSuggestions (_textViewBottomLeft); }
     private void TextViewBottomRight_DrawContent (object sender, DrawEventArgs e) { SetAllSuggestions (_textViewBottomRight); }
     private void TextViewCentered_DrawContent (object sender, DrawEventArgs e) { SetAllSuggestions (_textViewCentered); }

+ 2 - 0
UICatalog/Scenarios/TreeUseCases.cs

@@ -50,6 +50,7 @@ public class TreeUseCases : Scenario
         Top.Add (menu);
 
         var statusBar = new StatusBar (
+#if V2_STATUSBAR
                                        new StatusItem []
                                        {
                                            new (
@@ -58,6 +59,7 @@ public class TreeUseCases : Scenario
                                                 () => Quit ()
                                                )
                                        }
+#endif
                                       );
 
         Top.Add (statusBar);

+ 2 - 0
UICatalog/Scenarios/Unicode.cs

@@ -63,6 +63,7 @@ public class UnicodeInMenu : Scenario
         Top.Add (menu);
 
         var statusBar = new StatusBar (
+#if V2_STATUSBAR
                                        new StatusItem []
                                        {
                                            new (
@@ -73,6 +74,7 @@ public class UnicodeInMenu : Scenario
                                            new (KeyCode.Null, "~F2~ Создать", null),
                                            new (KeyCode.Null, "~F3~ Со_хранить", null)
                                        }
+#endif
                                       );
         Top.Add (statusBar);
 

+ 0 - 5
UICatalog/UICatalog.cs

@@ -375,7 +375,6 @@ internal class UICatalogApp
         public MenuItem? MiIsMenuBorderDisabled;
         public MenuItem? MiIsMouseDisabled;
         public MenuItem? MiUseSubMenusSingleFrame;
-        public new Bar StatusBar;
         public Shortcut? ShForce16Colors;
         //public Shortcut? ShDiagnostics;
         public Shortcut? ShVersion;
@@ -458,10 +457,6 @@ internal class UICatalogApp
             StatusBar = new ()
             {
                 Visible = ShowStatusBar,
-                Orientation = Orientation.Horizontal,
-                Y = Pos.AnchorEnd (),
-                Width = Dim.Fill (),
-                CanFocus = false,
             };
 
             Shortcut statusBarShortcut = new Shortcut ()

+ 2 - 0
UnitTests/View/NavigationTests.cs

@@ -620,6 +620,7 @@ public class NavigationTests (ITestOutputHelper output)
         top1.Dispose ();
     }
 
+#if V2_STATUSBAR
     [Fact]
     [AutoInitShutdown]
     public void HotKey_Will_Invoke_KeyPressed_Only_For_The_MostFocused_With_Top_KeyPress_Event ()
@@ -747,6 +748,7 @@ public class NavigationTests (ITestOutputHelper output)
 #endif
         top.Dispose ();
     }
+#endif
 
     [Fact]
     [SetupFakeDriver]

+ 4 - 0
UnitTests/Views/ContextMenuTests.cs

@@ -133,10 +133,12 @@ public class ContextMenuTests (ITestOutputHelper output)
         var tf = new TextField { X = Pos.Right (label) + 1, Y = Pos.Top (label), Width = 20, Text = "TextField" };
 
         var statusBar = new StatusBar (
+#if V2_STATUSBAR
                                        [
                                            new StatusItem (KeyCode.F1, "~F1~ Help", null),
                                            new StatusItem (KeyCode.CtrlMask | KeyCode.Q, "~^Q~ Quit", null)
                                        ]
+#endif
                                       );
 
         var top = new Toplevel ();
@@ -200,11 +202,13 @@ public class ContextMenuTests (ITestOutputHelper output)
         win.Add (label, tf);
 
         var statusBar = new StatusBar (
+#if V2_STATUSBAR
                                        new []
                                        {
                                            new StatusItem (KeyCode.F1, "~F1~ Help", null),
                                            new StatusItem (KeyCode.CtrlMask | KeyCode.Q, "~^Q~ Quit", null)
                                        }
+#endif
                                       );
 
         var top = new Toplevel ();

+ 2 - 64
UnitTests/Views/LabelTests.cs

@@ -907,69 +907,6 @@ e
         top.Dispose ();
     }
 
-    [Fact]
-    [AutoInitShutdown]
-    public void AnchorEnd_Better_Than_Bottom_Equal_Inside_Window_With_MenuBar_And_StatusBar_On_Toplevel ()
-    {
-        var win = new Window ();
-
-        // Label is AutoSize == true
-        var label = new Label
-        {
-            Text = "This should be the last line.",
-            ColorScheme = Colors.ColorSchemes ["Menu"],
-
-            X = 0,
-            Y = Pos.AnchorEnd (1)
-        };
-
-        win.Add (label);
-
-        var menu = new MenuBar { Menus = new MenuBarItem [] { new ("Menu", "", null) } };
-        var status = new StatusBar (new StatusItem [] { new (KeyCode.F1, "~F1~ Help", null) });
-        Toplevel top = new ();
-        top.Add (win, menu, status);
-        RunState rs = Application.Begin (top);
-
-        Assert.Equal (new (0, 0, 80, 25), top.Frame);
-        Assert.Equal (new (0, 0, 80, 1), menu.Frame);
-        Assert.Equal (new (0, 24, 80, 1), status.Frame);
-        Assert.Equal (new (0, 1, 80, 23), win.Frame);
-        Assert.Equal (new (0, 20, 29, 1), label.Frame);
-
-        var expected = @"
- Menu                                                                           
-┌──────────────────────────────────────────────────────────────────────────────┐
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│                                                                              │
-│This should be the last line.                                                 │
-└──────────────────────────────────────────────────────────────────────────────┘
- F1 Help                                                                        
-";
-
-        TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
-        Application.End (rs);
-        top.Dispose ();
-    }
-
     // TODO: This is a Label test. Move to label tests if there's not already a test for this.
     [Fact]
     [AutoInitShutdown]
@@ -1018,6 +955,7 @@ e
         top.Dispose ();
     }
 
+#if V2_STATUSBAR
     // TODO: This is a Label test. Move to label tests if there's not already a test for this.
 
     [Fact]
@@ -1083,7 +1021,7 @@ e
         Application.End (rs);
         top.Dispose ();
     }
-
+#endif
     // TODO: This is a Dim test. Move to Dim tests.
 
     [Fact]

+ 3 - 2
UnitTests/Views/StatusBarTests.cs

@@ -1,7 +1,7 @@
 using Xunit.Abstractions;
 
 namespace Terminal.Gui.ViewsTests;
-
+#if V2_STATUSBAR
 public class StatusBarTests (ITestOutputHelper output)
 {
     [Fact]
@@ -16,7 +16,7 @@ public class StatusBarTests (ITestOutputHelper output)
                                 }
                                );
 
-        sb.AddItemAt (2, new (KeyCode.CtrlMask | KeyCode.Q, "~^C~ Close", null));
+        sb.AddShortcutAt (2, new (KeyCode.CtrlMask | KeyCode.Q, "~^C~ Close", null));
 
         Assert.Equal ("~^O~ Open", sb.Items [0].Title);
         Assert.Equal ("~^S~ Save", sb.Items [1].Title);
@@ -205,3 +205,4 @@ CTRL-O Open {
         Application.Shutdown ();
     }
 }
+#endif

+ 9 - 7
UnitTests/Views/WindowTests.cs

@@ -29,6 +29,7 @@ public class WindowTests
         top.Dispose ();
     }
 
+#if V2_STATUSBAR
     [Fact]
     [AutoInitShutdown]
     public void MenuBar_And_StatusBar_Inside_Window ()
@@ -122,6 +123,7 @@ public class WindowTests
                                                      );
         top.Dispose ();
     }
+#endif
 
     [Fact]
     public void New_Initializes ()
@@ -168,9 +170,9 @@ public class WindowTests
         Assert.Equal (0, windowWithFrameRectEmpty.Width);
         Assert.Equal (0, windowWithFrameRectEmpty.Height);
         Assert.False (windowWithFrameRectEmpty.IsCurrentTop);
-    #if DEBUG
+#if DEBUG
         Assert.Equal (windowWithFrameRectEmpty.Title, windowWithFrameRectEmpty.Id);
-    #endif
+#endif
         Assert.False (windowWithFrameRectEmpty.WantContinuousButtonPressed);
         Assert.False (windowWithFrameRectEmpty.WantMousePositionReports);
         Assert.Null (windowWithFrameRectEmpty.SuperView);
@@ -183,11 +185,11 @@ public class WindowTests
         windowWithFrame1234.Title = "title";
         Assert.Equal ("title", windowWithFrame1234.Title);
         Assert.NotNull (windowWithFrame1234);
-    #if DEBUG
+#if DEBUG
         Assert.Equal ($"Window(title){windowWithFrame1234.Frame}", windowWithFrame1234.ToString ());
-    #else
+#else
         Assert.Equal ($"Window(){windowWithFrame1234.Frame}", windowWithFrame1234.ToString ());
-    #endif
+#endif
         Assert.True (windowWithFrame1234.CanFocus);
         Assert.False (windowWithFrame1234.HasFocus);
         Assert.Equal (new (0, 0, 1, 2), windowWithFrame1234.Viewport);
@@ -199,9 +201,9 @@ public class WindowTests
         Assert.Equal (3, windowWithFrame1234.Width);
         Assert.Equal (4, windowWithFrame1234.Height);
         Assert.False (windowWithFrame1234.IsCurrentTop);
-    #if DEBUG
+#if DEBUG
         Assert.Equal (windowWithFrame1234.Title, windowWithFrame1234.Id);
-    #endif
+#endif
         Assert.False (windowWithFrame1234.WantContinuousButtonPressed);
         Assert.False (windowWithFrame1234.WantMousePositionReports);
         Assert.Null (windowWithFrame1234.SuperView);