Skip to content

Commit 9c5d881

Browse files
committed
Merge branch 'develop'
2 parents 6c448fe + ed2fcb9 commit 9c5d881

42 files changed

Lines changed: 1398 additions & 617 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.tg-docs/INDEX.md

Lines changed: 16 additions & 16 deletions
Large diffs are not rendered by default.

AGENTS.md

Lines changed: 44 additions & 15 deletions
Large diffs are not rendered by default.

Directory.Packages.props

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
<ItemGroup>
66
<!-- Enable Nuget Source Link for github -->
77
<PackageVersion Include="AnsiConsoleToHtml" Version="0.2.0" />
8-
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
8+
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="5.3.0" />
99
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" />
1010
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.14.0" />
1111
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.14.0" />
12-
<PackageVersion Include="Microsoft.Net.Compilers.Toolset" Version="5.0.0" />
13-
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="10.0.103" />
12+
<PackageVersion Include="Microsoft.Net.Compilers.Toolset" Version="5.3.0" />
13+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="10.0.201" />
1414
<PackageVersion Include="ColorHelper" Version="1.8.1" />
1515
<PackageVersion Include="JetBrains.Annotations" Version="2025.2.4" />
1616
<PackageVersion Include="Microsoft.CodeAnalysis" Version="4.14.0" />
1717
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.14.0" />
18-
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
19-
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.3" />
20-
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.3" />
18+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.3.0" />
19+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.5" />
20+
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.5" />
2121
<PackageVersion Include="System.IO.Abstractions" Version="22.1.0" />
2222
<PackageVersion Include="Wcwidth" Version="4.0.1" />
2323
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
@@ -28,21 +28,21 @@
2828
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.12" />
2929
<PackageVersion Include="CsvHelper" Version="33.1.0" />
3030
<PackageVersion Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
31-
<PackageVersion Include="System.CommandLine" Version="2.0.3" />
31+
<PackageVersion Include="System.CommandLine" Version="2.0.5" />
3232
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
33-
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0" />
34-
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.3" />
35-
<PackageVersion Include="ReactiveUI" Version="23.1.8" />
33+
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.2" />
34+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.5" />
35+
<PackageVersion Include="ReactiveUI" Version="23.2.1" />
3636
<PackageVersion Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.3.1" />
3737
<PackageVersion Include="ReactiveUI.SourceGenerators" Version="2.6.1" />
3838
<PackageVersion Include="Moq" Version="4.20.72" />
39-
<PackageVersion Include="ReportGenerator" Version="5.5.3" />
39+
<PackageVersion Include="ReportGenerator" Version="5.5.4" />
4040
<PackageVersion Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="22.1.0" />
41-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
41+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
4242
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
4343
<PackageVersion Include="xunit.v3" Version="3.2.2" />
4444
<PackageVersion Include="Xunit.Combinatorial" Version="2.0.24" />
45-
<PackageVersion Include="coverlet.collector" Version="8.0.0" />
45+
<PackageVersion Include="coverlet.collector" Version="8.0.1" />
4646
</ItemGroup>
4747
<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
4848
<PackageVersion Include="Terminal.Gui" Version="2.0.0" />

Examples/UICatalog/Scenarios/CharacterMap/CharacterMap.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace UICatalog.Scenarios;
1616
[ScenarioCategory ("Controls")]
1717
[ScenarioCategory ("Layout")]
1818
[ScenarioCategory ("Scrolling")]
19+
[ScenarioCategory ("Unicode")]
1920
public class CharacterMap : Scenario
2021
{
2122
private Label? _errorLabel;

Examples/UICatalog/Scenarios/ChineseUI.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ namespace UICatalog.Scenarios;
33

44
[ScenarioMetadata ("ChineseUI", "Chinese UI")]
55
[ScenarioCategory ("Text and Formatting")]
6+
[ScenarioCategory ("Unicode")]
67
public class ChineseUI : Scenario
78
{
89
public override void Main ()

Examples/UICatalog/Scenarios/CombiningMarks.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ namespace UICatalog.Scenarios;
33

44
[ScenarioMetadata ("Combining Marks", "Illustrates how Unicode Combining Marks work (or don't).")]
55
[ScenarioCategory ("Text and Formatting")]
6+
[ScenarioCategory ("Unicode")]
67
public class CombiningMarks : Scenario
78
{
89
public override void Main ()

Examples/UICatalog/Scenarios/Dialogs.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace UICatalog.Scenarios;
55

66
[ScenarioMetadata ("Dialogs", "Demonstrates how to use the Dialog and Dialog<TResult> classes")]
77
[ScenarioCategory ("Dialogs")]
8+
[ScenarioCategory ("Runnable")]
89
public class Dialogs : Scenario
910
{
1011
private const int WIDE_CODE_POINT = '你';

Examples/UICatalog/Scenarios/LineCanvasExperiment.cs

Lines changed: 0 additions & 143 deletions
This file was deleted.

Examples/UICatalog/Scenarios/RuneWidthGreaterThanOne.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace UICatalog.Scenarios;
66

77
[ScenarioMetadata ("RuneWidthGreaterThanOne", "Test rune width greater than one")]
8-
[ScenarioCategory ("Controls")]
98
[ScenarioCategory ("Text and Formatting")]
109
[ScenarioCategory ("Tests")]
10+
[ScenarioCategory ("Unicode")]
1111
public class RuneWidthGreaterThanOne : Scenario
1212
{
1313
private IApplication? _app;
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
#nullable enable
2+
3+
namespace UICatalog.Scenarios;
4+
5+
/// <summary>
6+
/// Demonstrates the SchemeName fallback chain introduced in v2.
7+
/// When a view's <see cref="View.SchemeName"/> is not found in the active theme, the view no longer
8+
/// throws a <see cref="KeyNotFoundException"/>. Instead, it walks the fallback chain:
9+
/// <list type="number">
10+
/// <item>
11+
/// <description>Named scheme (if found in current theme)</description>
12+
/// </item>
13+
/// <item>
14+
/// <description>SuperView's scheme (recursive)</description>
15+
/// </item>
16+
/// <item>
17+
/// <description>"Base" scheme from the current theme</description>
18+
/// </item>
19+
/// <item>
20+
/// <description>Hard-coded "Base" scheme (always present)</description>
21+
/// </item>
22+
/// </list>
23+
/// </summary>
24+
[ScenarioMetadata ("Theme Fallback", "Demonstrates graceful SchemeName fallback when a named scheme is missing from the active theme.")]
25+
[ScenarioCategory ("Colors")]
26+
[ScenarioCategory ("Configuration")]
27+
public sealed class ThemeFallback : Scenario
28+
{
29+
private const string CUSTOM_SCHEME_NAME = "CustomHighlight";
30+
private const string MISSING_SCHEME_NAME = "NonExistentScheme";
31+
32+
public override void Main ()
33+
{
34+
ConfigurationManager.Enable (ConfigLocations.All);
35+
36+
using IApplication app = Application.Create ();
37+
app.Init ();
38+
39+
// Extend the Default theme with a custom scheme that has TextStyle.Blink
40+
// so it stands out visually. Other built-in themes do NOT contain this scheme,
41+
// so switching themes lets you watch the fallback chain activate in real time.
42+
SchemeManager.AddScheme (CUSTOM_SCHEME_NAME, new () { Normal = new Attribute (Color.BrightYellow, Color.Blue, TextStyle.Blink) });
43+
44+
using Window appWindow = new ();
45+
appWindow.Title = GetQuitKeyAndName ();
46+
47+
// --- Theme selector ---
48+
string [] themeLabels = ThemeManager.GetThemeNames ().Select (n => "_" + n).ToArray ();
49+
50+
OptionSelector themeSelector = new ()
51+
{
52+
Title = "_Theme",
53+
BorderStyle = LineStyle.Rounded,
54+
X = 1,
55+
Y = 1,
56+
Width = Dim.Auto (),
57+
Height = Dim.Auto (),
58+
Labels = themeLabels,
59+
Value = ThemeManager.GetThemeNames ().IndexOf (ThemeManager.Theme)
60+
};
61+
62+
themeSelector.ValueChanged += (sender, args) =>
63+
{
64+
if (sender is not OptionSelector sel)
65+
{
66+
return;
67+
}
68+
69+
string rawLabel = sel.Labels! [(int)args.NewValue!];
70+
71+
// Strip the leading underscore added for keyboard shortcut.
72+
ThemeManager.Theme = rawLabel [1..];
73+
ConfigurationManager.Apply ();
74+
75+
// Re-add the custom scheme to the newly-active theme so the
76+
// "Default" theme always demonstrates the found case.
77+
if (ThemeManager.Theme == ThemeManager.DEFAULT_THEME_NAME)
78+
{
79+
SchemeManager.AddScheme (CUSTOM_SCHEME_NAME,
80+
new () { Normal = new Attribute (Color.BrightYellow, Color.Blue, TextStyle.Blink) });
81+
}
82+
};
83+
84+
// --- Explanation ---
85+
Label intro = new ()
86+
{
87+
X = Pos.Right (themeSelector) + 1,
88+
Y = 1,
89+
Width = Dim.Fill (1),
90+
Text = $"Switch to a non-Default theme to see the fallback activate.\n"
91+
+ $" • \"{CUSTOM_SCHEME_NAME}\" is only in the Default theme.\n"
92+
+ $" • \"{MISSING_SCHEME_NAME}\" is never in any theme.\n"
93+
+ $"In both missing cases the view falls back gracefully instead of throwing."
94+
};
95+
96+
// --- View 1: scheme FOUND in the active theme ---
97+
FrameView foundFrame = new ()
98+
{
99+
Title = $"SchemeName = \"{CUSTOM_SCHEME_NAME}\"",
100+
X = Pos.Right (themeSelector) + 1,
101+
Y = Pos.Bottom (intro) + 1,
102+
Width = Dim.Fill (1),
103+
Height = 5,
104+
SchemeName = CUSTOM_SCHEME_NAME
105+
};
106+
107+
Label foundLabel = new ()
108+
{
109+
X = 1,
110+
Y = 1,
111+
Width = Dim.Fill (2),
112+
Text = $"On the Default theme this scheme exists (BrightYellow/Blue + Blink).\n"
113+
+ $"On any other theme the scheme is missing → fallback chain activates."
114+
};
115+
foundFrame.Add (foundLabel);
116+
117+
// --- View 2: scheme NEVER found — fallback always activates ---
118+
FrameView missingFrame = new ()
119+
{
120+
Title = $"SchemeName = \"{MISSING_SCHEME_NAME}\"",
121+
X = Pos.Right (themeSelector) + 1,
122+
Y = Pos.Bottom (foundFrame) + 1,
123+
Width = Dim.Fill (1),
124+
Height = 5,
125+
SchemeName = MISSING_SCHEME_NAME
126+
};
127+
128+
Label missingLabel = new ()
129+
{
130+
X = 1,
131+
Y = 1,
132+
Width = Dim.Fill (2),
133+
Text = $"This scheme does not exist in any theme.\n"
134+
+ $"The view silently falls back to its SuperView's scheme (no exception).\n"
135+
+ $"A warning is written to the debug log."
136+
};
137+
missingFrame.Add (missingLabel);
138+
139+
appWindow.Add (themeSelector, intro, foundFrame, missingFrame);
140+
141+
app.Run (appWindow);
142+
}
143+
}

0 commit comments

Comments
 (0)