Skip to content
Closed
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
b0f050f
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Mar 21, 2025
320384e
Merge branch 'v2_release' into v2_develop
tig Mar 21, 2025
4048436
Merge branch 'gui-cs:v2_develop' into v2_develop
tig Mar 29, 2025
3b0311d
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Mar 29, 2025
ae79c48
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Mar 30, 2025
1c39896
Merge branch 'gui-cs:v2_develop' into v2_develop
tig Apr 1, 2025
2cee67f
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Apr 1, 2025
9560cf3
Merge branch 'gui-cs:v2_develop' into v2_develop
tig Apr 2, 2025
0795dd1
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Apr 2, 2025
ca11609
Fixed UICatalog bugs. Added fluent tests.
tig Apr 2, 2025
c761249
marked v1 menu stuff as obsolte
tig Apr 2, 2025
5805515
Tweaks.
tig Apr 2, 2025
a3e823d
fixed unit tests
tig Apr 2, 2025
ba7fb21
general messing around
tig Apr 2, 2025
366cd89
general messing around
tig Apr 2, 2025
5a26e60
Playing with Fluent
tig Apr 2, 2025
4baccd7
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Apr 3, 2025
01b5266
ColorScheme tweaks
tig Apr 3, 2025
52f487d
WIP: ColorScheme tweaks
tig Apr 3, 2025
5986301
Playing with Fluent
tig Apr 3, 2025
dba8049
Merged from laptop
tig Apr 3, 2025
cf9c0d0
Merged from laptop2
tig Apr 3, 2025
60183fa
Hacky-ish fixes to:
tig Apr 3, 2025
869c02a
Fixed Region bug preventing menus without borders from working
tig Apr 3, 2025
57fc308
Tweaks
tig Apr 3, 2025
edd3b5a
Merge branch 'v2_2975-v1Menu-Obsolete' of tig:tig/Terminal.Gui into v…
tig Apr 4, 2025
9a2a7a4
Fixed a bunch of CM issues
tig Apr 4, 2025
9c53486
Fixed OoptionSelector
tig Apr 5, 2025
fd31f49
ip
tig Apr 5, 2025
dd6c6a7
FixedCM issues
tig Apr 5, 2025
aa83191
Fixed CM issues2
tig Apr 5, 2025
7d7ffad
Merge branch 'gui-cs:v2_develop' into v2_develop
tig Apr 5, 2025
c37210a
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Apr 5, 2025
d4c8b87
Revert "FixedCM issues"
tig Apr 5, 2025
bce9c2e
Reverted stuff
tig Apr 5, 2025
7d22a14
Found and fixed bug in AllViews_Center_Properly
tig Apr 5, 2025
5ed311f
Merge branch 'v2_develop' into v2_2975-v1Menu-Obsolete
tig Apr 5, 2025
4c25418
Merge branch 'v2_2975-v1Menu-Obsolete' of tig:tig/Terminal.Gui into v…
tig Apr 5, 2025
2850f83
Fixed CM issues2
tig Apr 5, 2025
c4b14d4
removed menuv2 onapplied.
tig Apr 5, 2025
47ae0e0
changed test time out to see if it helkps with ubuntu fails
tig Apr 5, 2025
e54f610
reset app on fail?
tig Apr 5, 2025
11fb9cc
back to 1500ms
tig Apr 5, 2025
d8ca951
Merge branch 'v2_2975-v1Menu-Obsolete' of tig:tig/Terminal.Gui into v…
tig Apr 6, 2025
d367b18
Made StatusBar nullable.
tig Apr 6, 2025
79f782b
Code Cleanup.
tig Apr 6, 2025
df661ea
HexEditor Code Cleanup.
tig Apr 6, 2025
a7201a7
HexEditor Code Cleanup.
tig Apr 6, 2025
663ee34
Back to 3000ms. Sigh.
tig Apr 6, 2025
2706cff
Merge branch 'v2_2975-v1Menu-Obsolete' of tig:tig/Terminal.Gui into v…
tig Apr 6, 2025
ba59936
Trying different logic
tig Apr 6, 2025
a628349
Trying different logic2
tig Apr 6, 2025
82c89f9
Fixed potential crash in runlop
tig Apr 6, 2025
21039c3
Fixed potential crash in runlop2
tig Apr 6, 2025
b04f638
Tweaked Spinner stuff
tig Apr 6, 2025
6796bb4
Removed TabView from TextEffects scenario. Not needed and possible cu…
tig Apr 6, 2025
9d3a652
back to 2000ms
tig Apr 6, 2025
8c5d7ac
WIP: Revamping menu scenarios
tig Apr 6, 2025
0a4740c
Merge branch 'v2_2975-v1Menu-Obsolete' of tig:tig/Terminal.Gui into v…
tig Apr 7, 2025
114deee
Menu Scenario refinements.
tig Apr 7, 2025
81310ce
fixed unit test
tig Apr 7, 2025
7a39979
Fixed warnings
tig Apr 7, 2025
7f08306
Fixed warnings2
tig Apr 7, 2025
a433f5e
Fixed File.Exit
tig Apr 7, 2025
f759174
Merge branch 'v2_2975-v1Menu-Obsolete' of tig:tig/Terminal.Gui into v…
tig Apr 7, 2025
89a0093
WIP: Dealing with QuitKey struggles
tig Apr 8, 2025
824e4cf
WIP: Dealing with QuitKey struggles 2
tig Apr 11, 2025
cd9339c
Merge branch 'v2_develop' into v2_2975-v1Menu-Obsolete
tig Apr 16, 2025
8e9c8a3
WIP: Dealing with QuitKey struggles 3
tig Apr 16, 2025
2366242
Merge branch 'v2_2975-v1Menu-Obsolete' of tig:tig/Terminal.Gui into v…
tig Apr 16, 2025
680e5ae
Merge branch 'gui-cs:v2_develop' into v2_develop
tig Apr 16, 2025
92aae38
Fixed ListView collection nav bug
tig Apr 16, 2025
f7d498d
Fixed a bunch of menu stuff.
tig Apr 17, 2025
f276514
Lots of refactoring and fixing
tig Apr 18, 2025
af5e739
Lots of unit test issues
tig Apr 18, 2025
801f8de
Merge branch 'v2_2975-v1Menu-Obsolete' of tig:tig/Terminal.Gui into v…
tig Apr 19, 2025
95370e0
Fixed DebugIDisposable issues
tig Apr 19, 2025
4f5a020
Fixed release build issue
tig Apr 19, 2025
4d028eb
Fixed release build issue 2
tig Apr 19, 2025
9f0cf82
DebugIDisposable -> EnableDebugIDisposableAsserts and more
tig Apr 19, 2025
69bed23
DebugIDisposable -> EnableDebugIDisposableAsserts and more 2
tig Apr 19, 2025
198cc37
Fixed Menus scenario - context menu
tig Apr 20, 2025
091e716
Rethinking how submenus should be shown
tig Apr 20, 2025
3789c68
Merge branch 'v2_2975-v1Menu-Obsolete' of tig:tig/Terminal.Gui into v…
tig Apr 20, 2025
dc3dcd4
Refactoring Menuv2 etc... WIP - lots broken.
tig Apr 23, 2025
9f13868
Refactoring Menuv2 etc... WIP - lots broken.
tig Apr 23, 2025
e694b23
Merge branch 'v2_2975-v1Menu-Obsolete' of tig:tig/Terminal.Gui into v…
tig Apr 23, 2025
3cba0a5
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Apr 23, 2025
9bbec08
Merge branch 'gui-cs:v2_develop' into v2_develop
tig Apr 24, 2025
64403fa
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Apr 24, 2025
ac9c7f6
Merge branch 'v2_develop' into v2_2975-v1Menu-Obsolete
tig Apr 24, 2025
3431fe6
Merged. WIP - Very broken
tig Apr 24, 2025
5e1251c
Merge branch 'gui-cs:v2_develop' into v2_develop
tig Apr 24, 2025
49cd335
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Apr 25, 2025
9a8e4e3
Merge branch 'gui-cs:v2_develop' into v2_develop
tig Apr 25, 2025
ef6d193
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Apr 25, 2025
785b266
Merge branch 'v2_develop' into v2_2975-v1Menu-Obsolete
tig Apr 25, 2025
4c0c504
Merge branch 'gui-cs:v2_develop' into v2_develop
tig Apr 25, 2025
4f5fca2
Merge branch 'gui-cs:v2_develop' into v2_develop
tig Apr 28, 2025
f8bfab8
Merge branch 'gui-cs:v2_develop' into v2_develop
tig Apr 28, 2025
898c2de
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Apr 28, 2025
cd10bb3
Merge branch 'gui-cs:v2_develop' into v2_develop
tig May 7, 2025
d412c00
Merge branch 'gui-cs:v2_develop' into v2_develop
tig May 9, 2025
66f2c62
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig May 11, 2025
abfa66a
Merge branch 'gui-cs:v2_develop' into v2_develop
tig May 11, 2025
d9dcca4
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig May 11, 2025
6757e2f
Merge branch 'v2_2975-v1Menu-Obsolete' of tig:tig/Terminal.Gui into v…
tig May 11, 2025
465fa65
Merged v2_develop
tig May 11, 2025
8af6451
tweak
tig May 12, 2025
c533822
Merge branch 'gui-cs:v2_develop' into v2_develop
tig May 12, 2025
924112e
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig May 12, 2025
d14c49a
Merge branch 'gui-cs:v2_develop' into v2_develop
tig May 12, 2025
2d65dde
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig May 14, 2025
b6226d8
Merge branch 'gui-cs:v2_develop' into v2_develop
tig May 14, 2025
3c4aff9
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig May 14, 2025
6bed955
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig May 14, 2025
9222cb8
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig May 31, 2025
5d04184
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Jun 1, 2025
ae2ef09
Fix merge
tig Jun 1, 2025
eb14a04
Merge branch 'v2_develop' into v2_2975-v1Menu-Obsolete
tig Jun 3, 2025
07ab8b4
Merge branch 'v2_develop' into v2_2975-v1Menu-Obsolete
tig Jul 7, 2025
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
5 changes: 5 additions & 0 deletions Terminal.Gui/Application/Application.Run.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ public static RunState Begin (Toplevel toplevel)
toplevel.EndInit (); // Calls Layout
}

// Call ConfigurationManager Apply here to ensure all subscribers to ConfigurationManager.Applied
// can update their state appropriately.
// BUGBUG: DO NOT DO THIS. Leave this commented out until we can figure out how to do this right
//Apply ();
Comment thread
tig marked this conversation as resolved.

// Try to set initial focus to any TabStop
if (!toplevel.HasFocus)
{
Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/Configuration/AttributeJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public override Attribute Read (ref Utf8JsonReader reader, Type typeToConvert, J
}
}

throw new JsonException ();
throw new JsonException ("Attribute");
Comment thread
tig marked this conversation as resolved.
Outdated
}

public override void Write (Utf8JsonWriter writer, Attribute value, JsonSerializerOptions options)
Expand Down
1 change: 1 addition & 0 deletions Terminal.Gui/Configuration/ConfigurationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ public static void Load (bool reset = false)
Settings?.UpdateFromResource (Assembly.GetEntryAssembly ()!, embeddedStylesResourceName!, ConfigLocations.AppResources);
}

// TODO: Determine if Runtime should be applied last.
if (Locations.HasFlag (ConfigLocations.Runtime) && !string.IsNullOrEmpty (RuntimeConfig))
{
Settings?.Update (RuntimeConfig, "ConfigurationManager.RuntimeConfig", ConfigLocations.Runtime);
Expand Down
4 changes: 3 additions & 1 deletion Terminal.Gui/Configuration/ScopeJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public override scopeT Read (ref Utf8JsonReader reader, Type typeToConvert, Json
// Logging.Trace ($"scopeT Read: {ex}");
}
}
Logging.Warning ($"{propertyName} = {scope! [propertyName].PropertyValue}");

}
else
{
Expand Down Expand Up @@ -147,7 +149,7 @@ public override scopeT Read (ref Utf8JsonReader reader, Type typeToConvert, Json
}
}

throw new JsonException ();
throw new JsonException ("ScopeJsonConverter");
Comment thread
tig marked this conversation as resolved.
Outdated
}

public override void Write (Utf8JsonWriter writer, scopeT scope, JsonSerializerOptions options)
Expand Down
5 changes: 5 additions & 0 deletions Terminal.Gui/Drawing/Attribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

namespace Terminal.Gui;


// TODO: Add support for other attributes (bold, underline, etc.) once the platform drivers support them.
// TODO: See https://github.com/gui-cs/Terminal.Gui/issues/457


/// <summary>Attributes represent how text is styled when displayed in the terminal.</summary>
/// <remarks>
/// <see cref="Attribute"/> provides a platform independent representation of colors (and someday other forms of
Expand Down
3 changes: 3 additions & 0 deletions Terminal.Gui/Drawing/Color/ColorScheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Terminal.Gui;

// TODO: Rename "ColorScheme"->"AttributeScheme" given we'll soon have non-color information in Attributes?
// TODO: See https://github.com/gui-cs/Terminal.Gui/issues/457

/// <summary>Defines a standard set of <see cref="Attribute"/>s for common visible elements in a <see cref="View"/>.</summary>
/// <remarks>
/// <para>
Expand Down
118 changes: 84 additions & 34 deletions Terminal.Gui/Drawing/Region.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,72 +556,122 @@ public void Translate (int offsetX, int offsetY)
/// <returns>A list of merged rectangles.</returns>
internal static List<Rectangle> MergeRectangles (List<Rectangle> rectangles, bool minimize)
{
if (rectangles.Count == 0)
if (rectangles.Count <= 1)
{
return [];
return rectangles.ToList ();
}

// Sweep-line algorithm to merge rectangles
List<(int x, bool isStart, int yTop, int yBottom)> events = new (rectangles.Count * 2); // Pre-allocate

// Generate events
List<(int x, bool isStart, int yTop, int yBottom)> events = new (rectangles.Count * 2);
foreach (Rectangle r in rectangles)
{
if (!r.IsEmpty)
{
events.Add ((r.Left, true, r.Top, r.Bottom)); // Start event
events.Add ((r.Right, false, r.Top, r.Bottom)); // End event
events.Add ((r.Left, true, r.Top, r.Bottom));
events.Add ((r.Right, false, r.Top, r.Bottom));
}
}

if (events.Count == 0)
{
return []; // Return empty list if no non-empty rectangles exist
return [];
}

// Sort events:
// 1. Primarily by x-coordinate.
// 2. Secondary: End events before Start events at the same x.
// 3. Tertiary: By yTop coordinate as a tie-breaker.
// 4. Quaternary: By yBottom coordinate as a final tie-breaker.
events.Sort (
(a, b) =>
{
// 1. Sort by X
int cmp = a.x.CompareTo (b.x);
if (cmp != 0) return cmp;

if (cmp != 0)
{
return cmp;
}
// 2. Sort End events before Start events
bool aIsEnd = !a.isStart;
bool bIsEnd = !b.isStart;
cmp = aIsEnd.CompareTo (bIsEnd); // True (End) comes after False (Start)
if (cmp != 0) return -cmp; // Reverse: End (true) should come before Start (false)

return a.isStart.CompareTo (b.isStart); // Start events before end events at same x
// 3. Tie-breaker: Sort by yTop
cmp = a.yTop.CompareTo (b.yTop);
if (cmp != 0) return cmp;

// 4. Final Tie-breaker: Sort by yBottom
return a.yBottom.CompareTo (b.yBottom);
});

List<Rectangle> merged = [];

SortedSet<(int yTop, int yBottom)> active = new (
Comparer<(int yTop, int yBottom)>.Create (
(a, b) =>
{
int cmp = a.yTop.CompareTo (b.yTop);

return cmp != 0 ? cmp : a.yBottom.CompareTo (b.yBottom);
}));
int lastX = events [0].x;

foreach ((int x, bool isStart, int yTop, int yBottom) evt in events)
// Use a dictionary to track active intervals and their overlap counts
Dictionary<(int yTop, int yBottom), int> activeCounts = new ();
// Comparer for sorting intervals when needed
var intervalComparer = Comparer<(int yTop, int yBottom)>.Create (
(a, b) =>
{
int cmp = a.yTop.CompareTo (b.yTop);
return cmp != 0 ? cmp : a.yBottom.CompareTo (b.yBottom);
});

// Helper to get the current active intervals (where count > 0) as a SortedSet
SortedSet<(int yTop, int yBottom)> GetActiveIntervals ()
{
// Output rectangles for the previous segment if there are active rectangles
if (active.Count > 0 && evt.x > lastX)
var set = new SortedSet<(int yTop, int yBottom)> (intervalComparer);
foreach (var kvp in activeCounts)
{
merged.AddRange (MergeVerticalIntervals (active, lastX, evt.x));
if (kvp.Value > 0)
{
set.Add (kvp.Key);
}
}
return set;
}

// Group events by x-coordinate to process all events at a given x together
var groupedEvents = events.GroupBy (e => e.x).OrderBy (g => g.Key);
int lastX = groupedEvents.First ().Key; // Initialize with the first event's x

// Process the event
if (evt.isStart)
foreach (var group in groupedEvents)
{
int currentX = group.Key;
// Get active intervals based on state *before* processing events at currentX
var currentActiveIntervals = GetActiveIntervals ();

// 1. Output rectangles for the segment ending *before* this x coordinate
if (currentX > lastX && currentActiveIntervals.Count > 0)
{
active.Add ((evt.yTop, evt.yBottom));
merged.AddRange (MergeVerticalIntervals (currentActiveIntervals, lastX, currentX));
}
else

// 2. Process all events *at* this x coordinate to update counts
foreach (var evt in group)
{
active.Remove ((evt.yTop, evt.yBottom));
var interval = (evt.yTop, evt.yBottom);
if (evt.isStart)
{
activeCounts.TryGetValue (interval, out int count);
activeCounts [interval] = count + 1;
}
else
{
// Only decrement/remove if the interval exists
if (activeCounts.TryGetValue (interval, out int count))
{
if (count - 1 <= 0)
{
activeCounts.Remove (interval);
}
else
{
activeCounts [interval] = count - 1;
}
}
}
}

lastX = evt.x;
// 3. Update lastX for the next segment
lastX = currentX;
}

return minimize ? MinimizeRectangles (merged) : merged;
Expand Down
5 changes: 4 additions & 1 deletion Terminal.Gui/Resources/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
"MessageBox.DefaultButtonAlignment": "Center",
"MessageBox.DefaultBorderStyle": "Heavy",
"Button.DefaultShadow": "Opaque",
"Menuv2.DefaultBorderStyle": "Single",
"MenuBarv2.DefaultBorderStyle": "None",
"StatusBar.DefaultSeparatorLineStyle": "Single",
"ColorSchemes": [
{
"TopLevel": {
Expand Down Expand Up @@ -316,7 +319,7 @@
"Glyphs.VLineHvDa3": "┇",
"Glyphs.VLineHvDa4": "┋"
}
},
},
{
"Dark": {
"Dialog.DefaultButtonAlignment": "End",
Expand Down
24 changes: 24 additions & 0 deletions Terminal.Gui/Terminal.Gui.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Terminal.Gui", "Terminal.Gui.csproj", "{79692A4F-7704-552C-0EF5-40B81C4F2E81}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{79692A4F-7704-552C-0EF5-40B81C4F2E81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{79692A4F-7704-552C-0EF5-40B81C4F2E81}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79692A4F-7704-552C-0EF5-40B81C4F2E81}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79692A4F-7704-552C-0EF5-40B81C4F2E81}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4B162456-436F-4899-B765-26C9DBD2991D}
EndGlobalSection
EndGlobal
1 change: 1 addition & 0 deletions Terminal.Gui/View/Adornment/Border.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ internal Rectangle GetBorderRectangle ()
);
}

// TODO: Make LineStyle nullable https://github.com/gui-cs/Terminal.Gui/issues/4021
/// <summary>
/// Sets the style of the border by changing the <see cref="Thickness"/>. This is a helper API for setting the
/// <see cref="Thickness"/> to <c>(1,1,1,1)</c> and setting the line style of the views that comprise the border. If
Expand Down
89 changes: 76 additions & 13 deletions Terminal.Gui/View/Adornment/Margin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,86 @@ public override void BeginInit ()
ShadowStyle = base.ShadowStyle;
}

/// <summary>
/// The color scheme for the Margin. If set to <see langword="null"/> (the default), the margin will be transparent.
/// </summary>
public override ColorScheme? ColorScheme
// TODO: We may actualy need this. Not clear what broke, if anything by commenting it out. See https://github.com/gui-cs/Terminal.Gui/issues/4016
Comment thread
tig marked this conversation as resolved.
Outdated
/////// <summary>
/////// The color scheme for the Margin. If set to <see langword="null"/> (the default), the margin will be transparent.
/////// </summary>
//public override ColorScheme? ColorScheme
//{
// get
// {
// //if (base.ColorScheme is { })
// {
// return base.ColorScheme;
// }

// //return (Parent?.SuperView?.ColorScheme ?? Colors.ColorSchemes ["TopLevel"])!;
// }
// set
// {
// base.ColorScheme = value;
// Parent?.SetNeedsDraw ();
// }
//}

/// <inheritdoc />
public override Attribute GetNormalColor ()
{
get
if (_colorScheme is { })
{
if (base.ColorScheme is { })
{
return base.ColorScheme;
}
return _colorScheme.Normal;
}
if (Parent is { })
{
return Parent.GetNormalColor ();
}

return (Parent?.SuperView?.ColorScheme ?? Colors.ColorSchemes ["TopLevel"])!;
return base.GetNormalColor ();
}

/// <inheritdoc />
public override Attribute GetHotNormalColor ()
{
if (Parent is { })
{
return Parent.GetHotNormalColor ();
}
set
return base.GetHotNormalColor ();
}

/// <inheritdoc />
public override Attribute GetFocusColor ()
{
if (Parent is { })
{
base.ColorScheme = value;
Parent?.SetNeedsDraw ();
return Parent.GetFocusColor ();
}
return base.GetFocusColor ();
}

/// <inheritdoc />
public override Attribute GetHotFocusColor ()
{
if (Parent is { })
{
return Parent.GetHotFocusColor ();
}

return base.GetHotFocusColor ();
}

/// <inheritdoc />
protected override bool OnSettingNormalAttribute ()
{
if (Parent is { })
{
SetAttribute (Parent.GetNormalColor ());

return true;
}

return false;

}

/// <inheritdoc/>
Expand All @@ -138,6 +199,8 @@ protected override bool OnClearingViewport ()
// This just draws/clears the thickness, not the insides.
if (Diagnostics.HasFlag (ViewDiagnosticFlags.Thickness) || base.ColorScheme is { })
{
// TODO: This is a hack. See https://github.com/gui-cs/Terminal.Gui/issues/4016
SetAttribute (GetNormalColor ());
Thickness.Draw (screen, Diagnostics, ToString ());
}

Expand Down
1 change: 1 addition & 0 deletions Terminal.Gui/View/Adornment/ShadowView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ protected override bool OnClearingViewport ()
/// <inheritdoc/>
protected override bool OnDrawingContent ()
{
SetAttribute (GetNormalColor ());
switch (ShadowStyle)
{
case ShadowStyle.Opaque:
Expand Down
Loading