Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #3941 - v2win/v2net: UICatalog crash - Fixes warnings #3946

Open
wants to merge 24 commits into
base: v2_develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
dea28ba
Merge branch 'v2_develop' of github.com:gui-cs/Terminal.Gui into v2_d…
tig Feb 19, 2025
8ad1d56
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Feb 25, 2025
f7d9650
Merge branch 'v2_develop' of github.com:gui-cs/Terminal.Gui into v2_d…
tig Feb 25, 2025
9aaaf1e
Merge branch 'gui-cs:v2_develop' into v2_develop
tig Feb 26, 2025
84b3d2a
Merge branch 'v2_develop' of github.com:gui-cs/Terminal.Gui into v2_d…
tig Feb 27, 2025
ebbcaff
Merge branch 'v2_develop' of github.com:gui-cs/Terminal.Gui into v2_d…
tig Feb 27, 2025
9c3be44
Merge branch 'v2_develop' of github.com:gui-cs/Terminal.Gui into v2_d…
tig Feb 27, 2025
8733d9c
Merge branch 'v2_develop' of github.com:gui-cs/Terminal.Gui into v2_d…
tig Feb 27, 2025
8003218
Tons of API doc updates
tig Feb 27, 2025
cd0b68d
merge
tig Feb 28, 2025
61462ff
local_packages
tig Feb 28, 2025
cc749bc
Merge branch 'v2_develop' of tig:gui-cs/Terminal.Gui into v2_develop
tig Mar 1, 2025
8b98256
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
tig Mar 1, 2025
60321a1
Adjust timeout
tig Mar 1, 2025
0453ecd
Code cleanuyp
tig Mar 2, 2025
33206ee
Disabled All_Scenarios_Benchmark
tig Mar 2, 2025
a676fb4
Removed logs
tig Mar 2, 2025
fd5b52f
Merge branch 'gui-cs:v2_develop' into v2_develop
tig Mar 2, 2025
13b9933
Merge branch 'v2_develop' into v2-Sceanario-Benchmark-DemoKeys
tig Mar 2, 2025
2c53fbb
Fixed a bunch of warnings
tig Mar 2, 2025
e411c44
Fixed a bunch of warnings2
tig Mar 2, 2025
0a90e5e
Disabled All_Scenarios_Benchmark again...just to make sure
tig Mar 2, 2025
3dfb2f4
Enabled All_Scenarios_Benchmark again...It is not the culprit
tig Mar 2, 2025
79224c6
Merge branch 'v2_develop' into v2-Sceanario-Benchmark-DemoKeys
tig Mar 2, 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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,11 @@ demo.*
*.dotCover

logs/

BenchmarkDotNet.Artifacts/

*.log

*.log.*


2 changes: 2 additions & 0 deletions Terminal.Gui/Application/Application.Initialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ internal static void InternalInit (
InitializedChanged?.Invoke (null, new (init));
}

[RequiresUnreferencedCode ("AOT")]
[RequiresDynamicCode ("AOT")]
internal static void InitializeConfigurationManagement ()
{
// Start the process of configuration management.
Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/Application/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static string ToString (IConsoleDriver? driver)
{
Rune rune = contents [r, c].Rune;

if (rune.DecodeSurrogatePair (out char [] sp))
if (rune.DecodeSurrogatePair (out char []? sp))
{
sb.Append (sp);
}
Expand Down
7 changes: 5 additions & 2 deletions Terminal.Gui/Configuration/ConfigurationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,17 @@ public static void PrintJsonErrors ()
}


/// <summary>
/// Logs Json deserialization errors that occurred during deserialization.
/// </summary>
public static void LogJsonErrors ()
{
if (_jsonErrors.Length > 0)
{
Logging.Warning (
Logging.Error (
@"Encountered the following errors while deserializing configuration files:"
);
Logging.Warning (_jsonErrors.ToString ());
Logging.Error (_jsonErrors.ToString ());
}
}

Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/Configuration/ScopeJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public override scopeT Read (ref Utf8JsonReader reader, Type typeToConvert, Json
scope! [propertyName].PropertyValue =
JsonSerializer.Deserialize (ref reader, propertyType!, SerializerContext);
}
catch (Exception ex)
catch (Exception)
{
// Logging.Trace ($"scopeT Read: {ex}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public CsiKeyPattern ()
_pattern = new (@$"^\u001b\[(1;(\d+))?([{terms}]|\d+~)$");
}

/// <summary>
/// Called by the base class to determine the key that matches the input.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
protected override Key? GetKeyImpl (string input)
{
Match match = _pattern.Match (input);
Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/ConsoleDrivers/V2/MainLoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ internal void IterationImpl ()

private void SetCursor ()
{
View? mostFocused = Application.Top.MostFocused;
View? mostFocused = Application.Top!.MostFocused;

if (mostFocused == null)
{
Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/ConsoleDrivers/V2/NetInputProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class NetInputProcessor : InputProcessor<ConsoleKeyInfo>
/// </remarks>
/// </summary>
public static bool GenerateTestCasesForKeyPresses = false;
#pragma warning enable CA2211
#pragma warning restore CA2211

/// <inheritdoc/>
public NetInputProcessor (ConcurrentQueue<ConsoleKeyInfo> inputBuffer) : base (inputBuffer, new NetKeyConverter ()) { }
Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/Drawing/Region.cs
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ internal static List<Rectangle> MergeVerticalIntervals (SortedSet<(int yTop, int
}
else
{
result.Add (new (startX, currentTop.Value, endX - startX, currentBottom.Value - currentTop.Value));
result.Add (new (startX, currentTop.Value, endX - startX, currentBottom!.Value - currentTop.Value));
currentTop = yTop;
currentBottom = yBottom;
}
Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/Input/Keyboard/Key.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ public override bool Equals (object? obj)
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public static bool operator != (Key a, Key? b) { return !a!.Equals (b); }
public static bool operator != (Key? a, Key? b) { return !a!.Equals (b); }

/// <summary>Compares two <see cref="Key"/>s for less-than.</summary>
/// <param name="a"></param>
Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/View/DrawContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace Terminal.Gui;

/// <summary>
/// Tracks the region that has been drawn during <see cref="View.Draw"/>. This is primarily
/// Tracks the region that has been drawn during <see cref="View.Draw(DrawContext?)"/>. This is primarily
/// in support of <see cref="ViewportSettings.Transparent"/>.
/// </summary>
public class DrawContext
Expand Down
4 changes: 2 additions & 2 deletions Terminal.Gui/View/DrawEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class DrawEventArgs : CancelEventArgs
/// <see cref="View"/>.
/// </param>
/// <param name="drawContext">
/// Add any regions that have been drawn to during <see cref="View.Draw"/> operations to this context. This is
/// Add any regions that have been drawn to during <see cref="View.Draw(DrawContext?)"/> operations to this context. This is
/// primarily
/// in support of <see cref="ViewportSettings.Transparent"/>.
/// </param>
Expand All @@ -34,7 +34,7 @@ public DrawEventArgs (Rectangle newViewport, Rectangle oldViewport, DrawContext?
public Rectangle NewViewport { get; }

/// <summary>
/// Add any regions that have been drawn to during <see cref="View.Draw"/> operations to this context. This is
/// Add any regions that have been drawn to during <see cref="View.Draw(DrawContext?)"/> operations to this context. This is
/// primarily
/// in support of <see cref="ViewportSettings.Transparent"/>.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/View/View.Content.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public ViewportSettings ViewportSettings
/// </para>
/// <para>
/// Altering the Viewport Size will eventually (when the view is next laid out) cause the
/// <see cref="Layout()"/> and <see cref="OnDrawingContent"/> methods to be called.
/// <see cref="Layout()"/> and <see cref="OnDrawingContent()"/> methods to be called.
/// </para>
/// </remarks>
public virtual Rectangle Viewport
Expand Down
3 changes: 2 additions & 1 deletion Terminal.Gui/View/View.Drawing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ private void DoDrawContent (DrawContext? context = null)
return;
}

// TODO: Upgrade all overrides of OnDrawingContent to use DrawContext and remove this override
if (OnDrawingContent ())
{
return;
Expand All @@ -504,7 +505,7 @@ private void DoDrawContent (DrawContext? context = null)
/// </summary>
/// <param name="context">The draw context to report drawn areas to.</param>
/// <returns><see langword="true"/> to stop further drawing content.</returns>
protected virtual bool OnDrawingContent (DrawContext? context = null) { return false; }
protected virtual bool OnDrawingContent (DrawContext? context) { return false; }

/// <summary>
/// Called when the View's content is to be drawn. The default implementation does nothing.
Expand Down
1 change: 1 addition & 0 deletions Terminal.Gui/View/View.Mouse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ internal bool SetPressedHighlight (HighlightStyle newHighlightStyle)
/// INTERNAL: Gets the Views that are under the mouse at <paramref name="location"/>, including Adornments.
/// </summary>
/// <param name="location"></param>
/// <param name="ignoreTransparent">If <see langword="true"/> any transparent views will be ignored.</param>
/// <returns></returns>
internal static List<View?> GetViewsUnderMouse (in Point location, bool ignoreTransparent = false)
{
Expand Down
2 changes: 2 additions & 0 deletions Terminal.Gui/Views/Bar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ public Orientation Orientation
set => _orientationHelper.Orientation = value;
}

#pragma warning disable CS0067 // The event is never used
/// <inheritdoc/>
public event EventHandler<CancelEventArgs<Orientation>>? OrientationChanging;

/// <inheritdoc/>
public event EventHandler<EventArgs<Orientation>>? OrientationChanged;
#pragma warning restore CS0067 // The event is never used

/// <summary>Called when <see cref="Orientation"/> has changed.</summary>
/// <param name="newOrientation"></param>
Expand Down
2 changes: 2 additions & 0 deletions Terminal.Gui/Views/Line.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ public Orientation Orientation
set => _orientationHelper.Orientation = value;
}

#pragma warning disable CS0067 // The event is never used
/// <inheritdoc/>
public event EventHandler<CancelEventArgs<Orientation>> OrientationChanging;

/// <inheritdoc/>
public event EventHandler<EventArgs<Orientation>> OrientationChanged;
#pragma warning restore CS0067 // The event is never used

/// <summary>Called when <see cref="Orientation"/> has changed.</summary>
/// <param name="newOrientation"></param>
Expand Down
3 changes: 3 additions & 0 deletions Terminal.Gui/Views/RadioGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,15 @@ public Orientation Orientation

private readonly OrientationHelper _orientationHelper;

#pragma warning disable CS0067 // The event is never used
/// <inheritdoc/>
public event EventHandler<CancelEventArgs<Orientation>>? OrientationChanging;

/// <inheritdoc/>
public event EventHandler<EventArgs<Orientation>>? OrientationChanged;

#pragma warning restore CS0067

/// <summary>Called when <see cref="Orientation"/> has changed.</summary>
/// <param name="newOrientation"></param>
public void OnOrientationChanged (Orientation newOrientation)
Expand Down
2 changes: 2 additions & 0 deletions Terminal.Gui/Views/ScrollBar/ScrollBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ public Orientation Orientation
set => _orientationHelper.Orientation = value;
}

#pragma warning disable CS0067 // The event is never used
/// <inheritdoc/>
public event EventHandler<CancelEventArgs<Orientation>>? OrientationChanging;
#pragma warning restore CS0067 // The event is never used

/// <inheritdoc/>
public event EventHandler<EventArgs<Orientation>>? OrientationChanged;
Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/Views/Wizard/WizardStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public override View Add (View? view)
{
_contentView.Add (view);

if (view.CanFocus)
if (view!.CanFocus)
{
CanFocus = true;
}
Expand Down
2 changes: 1 addition & 1 deletion UICatalog/Scenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static ObservableCollection<Scenario> GetScenarios ()
public virtual void Main () { }

private const uint BENCHMARK_MAX_NATURAL_ITERATIONS = 500; // not including needed for demo keys
private const int BENCHMARK_KEY_PACING = 1; // Must be non-zero
private const int BENCHMARK_KEY_PACING = 10; // Must be non-zero

public static uint BenchmarkTimeout { get; set; } = 2500;

Expand Down
Loading
Loading