Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Terminal.Gui/Core/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1500,8 +1500,11 @@ public virtual void Redraw (Rect bounds)
(GetType ().IsNestedPublic && !IsOverridden (this, "Redraw") || GetType ().Name == "View") &&
(!NeedDisplay.IsEmpty || ChildNeedsDisplay || LayoutNeeded)) {

Clear ();
SetChildNeedsDisplay ();
if (ColorScheme != null) {
Driver.SetAttribute (GetNormalColor ());
Clear ();
SetChildNeedsDisplay ();
}
}

if (!ustring.IsNullOrEmpty (TextFormatter.Text)) {
Expand Down
4 changes: 2 additions & 2 deletions UnitTests/UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="ReportGenerator" Version="5.2.0" />
<PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
18 changes: 18 additions & 0 deletions UnitTests/Views/ViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4563,5 +4563,23 @@ public void Move_And_ViewToScreen_Should_Not_Use_Clipped_Parameter_As_True_By_De
TestHelpers.AssertDriverContentsAre (@"
Label", output);
}

[Fact, AutoInitShutdown]
public void View_Instance_Use_Attribute_Normal_On_Draw ()
{
var view = new View { Id = "view", X = 1, Y = 1, Width = 4, Height = 1, Text = "Test", CanFocus = true };
var root = new View { Id = "root", Width = Dim.Fill (), Height = Dim.Fill () };
root.Add (view);
Application.Top.Add (root);
Application.Begin (Application.Top);

TestHelpers.AssertDriverContentsAre (@"
Test", output);

TestHelpers.AssertDriverColorsAre (@"
000000
011110
000000", new Attribute [] { Colors.TopLevel.Normal, Colors.TopLevel.Focus });
}
}
}