Fixed nullable warnings

This commit is contained in:
Tig
2024-07-22 16:59:10 -06:00
parent 44ce74a5c0
commit 2e0a9a7c68
6 changed files with 15 additions and 14 deletions

View File

@@ -195,7 +195,7 @@ public static partial class Application // Mouse handling
{
// This occurs when there are multiple overlapped "tops"
// E.g. "Mdi" - in the Background Worker Scenario
View? top = FindDeepestTop (Top, mouseEvent.Position);
View? top = FindDeepestTop (Top!, mouseEvent.Position);
view = View.FindDeepestView (top, mouseEvent.Position);
if (view is { } && view != OverlappedTop && top != Current && top is { })

View File

@@ -19,7 +19,7 @@ namespace Terminal.Gui;
public static partial class Application
{
/// <summary>Gets all cultures supported by the application without the invariant language.</summary>
public static List<CultureInfo> SupportedCultures { get; private set; }
public static List<CultureInfo>? SupportedCultures { get; private set; }
internal static List<CultureInfo> GetSupportedCultures ()
{
@@ -257,7 +257,7 @@ public static partial class Application
foreach (Toplevel? t in savedToplevels)
{
if (!t.Modal && t != Current && t != top && t != savedToplevels [index])
if (!t!.Modal && t != Current && t != top && t != savedToplevels [index])
{
lock (_topLevels)
{

View File

@@ -344,7 +344,7 @@ public partial class View
if (found is { })
{
start = found;
viewportOffset = found.Parent.Frame.Location;
viewportOffset = found.Parent?.Frame.Location ?? Point.Empty;
}
int startOffsetX = currentLocation.X - (start.Frame.X + viewportOffset.X);
@@ -796,7 +796,7 @@ public partial class View
//}
if (dv.Target != this)
{
nEdges.Add ((dv.Target, from));
nEdges.Add ((dv.Target!, from));
}
return;
@@ -819,7 +819,7 @@ public partial class View
//}
if (pv.Target != this)
{
nEdges.Add ((pv.Target, from));
nEdges.Add ((pv.Target!, from));
}
return;

View File

@@ -1,4 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeEditing/GenerateMemberBody/AccessorImplementationKind/@EntryValue">BackingField</s:String>
<s:String x:Key="/Default/CodeEditing/GenerateMemberBody/DocumentationGenerationKind/@EntryValue">Inherit</s:String>
<s:Boolean x:Key="/Default/CodeEditing/GenerateMemberBody/PlaceBackingFieldAboveProperty/@EntryValue">True</s:Boolean>
@@ -390,6 +390,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=53eecf85_002Dd821_002D40e8_002Dac97_002Dfdb734542b84/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Instance fields (not private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=70345118_002D4b40_002D4ece_002D937c_002Dbbeb7a0b2e70/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Static fields (not private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=a0b4bc4d_002Dd13b_002D4a37_002Db37e_002Dc9c6864e4302/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Any" AccessRightKinds="Any" Description="Types and namespaces"&gt;&lt;ElementKinds&gt;&lt;Kind Name="NAMESPACE" /&gt;&lt;Kind Name="CLASS" /&gt;&lt;Kind Name="STRUCT" /&gt;&lt;Kind Name="ENUM" /&gt;&lt;Kind Name="DELEGATE" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"&gt;&lt;ExtraRule Prefix="" Suffix="" Style="AaBb_AaBb" /&gt;&lt;/Policy&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=a4f433b8_002Dabcd_002D4e55_002Da08f_002D82e78cef0f0c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Any" AccessRightKinds="Any" Description="Local constants"&gt;&lt;ElementKinds&gt;&lt;Kind Name="LOCAL_CONSTANT" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=c873eafb_002Dd57f_002D481d_002D8c93_002D77f6863c2f88/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Static readonly fields (not private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=A92AB40A0394A342A0BE0D83FEEA5DBF/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=A92AB40A0394A342A0BE0D83FEEA5DBF/RelativePath/@EntryValue">..\Terminal.sln.ToDo.DotSettings</s:String>

View File

@@ -666,7 +666,7 @@ internal class UICatalogApp
MiIsMouseDisabled!.Checked = Application.IsMouseDisabled;
Application.Top.SetNeedsDisplay ();
Application.Top!.SetNeedsDisplay ();
}
public MenuItem []? CreateThemeMenuItems ()
@@ -835,7 +835,7 @@ internal class UICatalogApp
}
Diagnostics = _diagnosticFlags;
Application.Top.SetNeedsDisplay ();
Application.Top!.SetNeedsDisplay ();
};
menuItems.Add (item);
}
@@ -1061,7 +1061,7 @@ internal class UICatalogApp
ShowStatusBar = StatusBar.Visible;
int height = StatusBar.Visible ? 1 : 0;
CategoryList.Height = Dim.Fill (height);
CategoryList!.Height = Dim.Fill (height);
ScenarioList.Height = Dim.Fill (height);
// ContentPane.Height = Dim.Fill (height);
@@ -1071,7 +1071,7 @@ internal class UICatalogApp
}
Loaded -= LoadedHandler;
CategoryList.EnsureSelectedItemVisible ();
CategoryList!.EnsureSelectedItemVisible ();
ScenarioList.EnsureSelectedCellIsVisible ();
}
@@ -1082,7 +1082,7 @@ internal class UICatalogApp
if (_selectedScenario is null)
{
// Save selected item state
_cachedCategoryIndex = CategoryList.SelectedItem;
_cachedCategoryIndex = CategoryList!.SelectedItem;
_cachedScenarioIndex = ScenarioList.SelectedRow;
// Create new instance of scenario (even though Scenarios contains instances)

View File

@@ -7,12 +7,12 @@ namespace Terminal.Gui.DriverTests;
public class ClipRegionTests
{
private readonly ITestOutputHelper output;
private readonly ITestOutputHelper _output;
public ClipRegionTests (ITestOutputHelper output)
{
ConsoleDriver.RunningUnitTests = true;
this.output = output;
this._output = output;
}
[Theory]