diff --git a/Terminal.Gui/Core/Border.cs b/Terminal.Gui/Core/Border.cs index fee09be37..3dff2ce7d 100644 --- a/Terminal.Gui/Core/Border.cs +++ b/Terminal.Gui/Core/Border.cs @@ -331,6 +331,7 @@ namespace Terminal.Gui { private Point effect3DOffset = new Point (1, 1); private Attribute? effect3DBrush; private ustring title = ustring.Empty; + private View child; /// /// Specifies the for a view. @@ -650,7 +651,7 @@ namespace Terminal.Gui { Child.Clear (borderRect); } - driver.SetAttribute (savedAttribute); + driver.SetAttribute (new Attribute (BorderBrush, Background)); // Draw margin frame if (DrawMarginFrame) { @@ -674,6 +675,7 @@ namespace Terminal.Gui { driver.DrawWindowFrame (borderRect, 1, 1, 1, 1, BorderStyle != BorderStyle.None, fill: true, this); } } + driver.SetAttribute (savedAttribute); } private void DrawChildBorder (Rect frame, bool fill = true) @@ -786,7 +788,7 @@ namespace Terminal.Gui { } } - driver.SetAttribute (savedAttribute); + driver.SetAttribute (new Attribute (BorderBrush, Background)); // Draw the MarginFrame if (DrawMarginFrame) { @@ -983,7 +985,7 @@ namespace Terminal.Gui { } } - driver.SetAttribute (savedAttribute); + driver.SetAttribute (new Attribute (BorderBrush, Background)); // Draw the MarginFrame if (DrawMarginFrame) { @@ -1077,7 +1079,7 @@ namespace Terminal.Gui { driver.DrawWindowTitle (scrRect, Title, 0, 0, 0, 0); } else { scrRect = view.ViewToScreen (new Rect (0, 0, view.Frame.Width, view.Frame.Height)); - driver.DrawWindowTitle (scrRect, Title, + driver.DrawWindowTitle (scrRect, Parent.Border.Title, padding.Left, padding.Top, padding.Right, padding.Bottom); } } @@ -1093,9 +1095,9 @@ namespace Terminal.Gui { { var driver = Application.Driver; if (DrawMarginFrame) { - driver.SetAttribute (view.GetNormalColor ()); + driver.SetAttribute (new Attribute (BorderBrush, Background)); if (view.HasFocus) { - driver.SetAttribute (view.ColorScheme.HotNormal); + driver.SetAttribute (new Attribute (view.ColorScheme.HotNormal.Foreground, Background)); } var padding = Parent.Border.GetSumThickness (); var scrRect = Parent.ViewToScreen (new Rect (0, 0, rect.Width, rect.Height)); diff --git a/Terminal.Gui/Views/FrameView.cs b/Terminal.Gui/Views/FrameView.cs index 1264d4159..8b1865108 100644 --- a/Terminal.Gui/Views/FrameView.cs +++ b/Terminal.Gui/Views/FrameView.cs @@ -268,12 +268,8 @@ namespace Terminal.Gui { /// public override void Redraw (Rect bounds) { - var padding = Border.GetSumThickness (); - var scrRect = ViewToScreen (new Rect (0, 0, Frame.Width, Frame.Height)); - if (!NeedDisplay.IsEmpty) { Driver.SetAttribute (GetNormalColor ()); - //Driver.DrawWindowFrame (scrRect, padding + 1, padding + 1, padding + 1, padding + 1, border: true, fill: true); Clear (); } @@ -281,6 +277,7 @@ namespace Terminal.Gui { contentView.Redraw (!NeedDisplay.IsEmpty ? contentView.Bounds : bounds); Driver.Clip = savedClip; + ClearLayoutNeeded (); ClearNeedsDisplay (); if (!IgnoreBorderPropertyOnRedraw) { diff --git a/UICatalog/UICatalog.cs b/UICatalog/UICatalog.cs index e7f577eee..49faf0ddd 100644 --- a/UICatalog/UICatalog.cs +++ b/UICatalog/UICatalog.cs @@ -195,9 +195,9 @@ namespace UICatalog { // Run UI Catalog UI. When it exits, if _selectedScenario is != null then // a Scenario was selected. Otherwise, the user wants to exit UI Catalog. Application.Init (); - - //Application.EnableConsoleScrolling = _enableConsoleScrolling; - + + Application.EnableConsoleScrolling = _enableConsoleScrolling; + Application.Run (); Application.Shutdown (); diff --git a/UnitTests/Core/BorderTests.cs b/UnitTests/Core/BorderTests.cs index a23c9a1b6..c59b085ce 100644 --- a/UnitTests/Core/BorderTests.cs +++ b/UnitTests/Core/BorderTests.cs @@ -230,7 +230,7 @@ namespace Terminal.Gui.CoreTests { var rune = (Rune)driver.Contents [r, c, 0]; if (r == frame.Y - drawMarginFrame || r == frame.Bottom + drawMarginFrame - 1 || c == frame.X - drawMarginFrame || c == frame.Right + drawMarginFrame - 1) { - Assert.Equal (Color.Black, color.Background); // because of #2345 - Border: can't change border color in window by Border.BorderBrush. + Assert.Equal (Color.BrightGreen, color.Background); } else { Assert.Equal (Color.Black, color.Background); } @@ -464,7 +464,7 @@ namespace Terminal.Gui.CoreTests { var rune = (Rune)driver.Contents [r, c, 0]; if (r == frame.Y + sumThickness.Top || r == frame.Bottom - sumThickness.Bottom - 1 || c == frame.X + sumThickness.Left || c == frame.Right - sumThickness.Right - 1) { - Assert.Equal (Color.Black, color.Background); // because of #2345 - Border: can't change border color in window by Border.BorderBrush. + Assert.Equal (Color.BrightGreen, color.Background); } else { Assert.Equal (Color.Black, color.Background); }