Browse Source

Fixed warnings

Tig 1 year ago
parent
commit
153f1015d7

+ 5 - 5
Terminal.Gui/Text/TextFormatter.cs

@@ -309,7 +309,7 @@ public class TextFormatter
             int start = isVertical ? screen.Top : screen.Left;
             int size = isVertical ? screen.Height : screen.Width;
             int current = start + colOffset;
-            List<Point?> lastZeroWidthPos = null;
+            List<Point?> lastZeroWidthPos = null!;
             Rune rune = default;
             int zeroLengthCount = isVertical ? runes.Sum (r => r.GetColumns () == 0 ? 1 : 0) : 0;
 
@@ -378,12 +378,12 @@ public class TextFormatter
                             {
                                 lastZeroWidthPos [foundIdx] =
                                     new Point (
-                                               lastZeroWidthPos [foundIdx].Value.X + 1,
+                                               lastZeroWidthPos [foundIdx]!.Value.X + 1,
                                                current
                                               );
 
                                 driver?.Move (
-                                              lastZeroWidthPos [foundIdx].Value.X,
+                                              lastZeroWidthPos [foundIdx]!.Value.X,
                                               current
                                              );
                             }
@@ -1758,7 +1758,7 @@ public class TextFormatter
                     return lineResult;
                 }
 
-                string [] lines = null;
+                string []? lines = null;
 
                 if (text.Contains ("\r\n"))
                 {
@@ -1967,7 +1967,7 @@ public class TextFormatter
     /// <returns>The index of the text that fit the width.</returns>
     public static int GetLengthThatFits (string text, int width, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom)
     {
-        return GetLengthThatFits (text?.ToRuneList (), width, tabWidth, textDirection);
+        return GetLengthThatFits (text.ToRuneList (), width, tabWidth, textDirection);
     }
 
     /// <summary>Gets the number of the Runes in a list of Runes that will fit in <paramref name="width"/>.</summary>

+ 11 - 0
Terminal.Gui/Views/CheckBox.cs

@@ -6,8 +6,19 @@ namespace Terminal.Gui;
 /// </summary>
 public enum CheckState
 {
+    /// <summary>
+    ///     Neither checked nor unchecked.
+    /// </summary>
     None,
+
+    /// <summary>
+    ///     Checked.
+    /// </summary>
     Checked,
+
+    /// <summary>
+    ///     Not checked.
+    /// </summary>
     UnChecked
 }
 

+ 23 - 0
Terminal.Gui/Views/CheckState.cs

@@ -0,0 +1,23 @@
+#nullable enable
+namespace Terminal.Gui;
+
+/// <summary>
+///     Represents the state of a <see cref="CheckBox"/>.
+/// </summary>
+public enum CheckState
+{
+    /// <summary>
+    ///     Neither checked nor unchecked.
+    /// </summary>
+    None,
+
+    /// <summary>
+    ///     Checked.
+    /// </summary>
+    Checked,
+
+    /// <summary>
+    ///     Not checked.
+    /// </summary>
+    UnChecked
+}