浏览代码

Fixed error in Textformatter

Tig 1 年之前
父节点
当前提交
c6a9021f2e
共有 2 个文件被更改,包括 1 次插入22 次删除
  1. 1 1
      Terminal.Gui/Text/TextFormatter.cs
  2. 0 21
      Terminal.Gui/Views/CheckBox.cs

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

@@ -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>

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

@@ -1,27 +1,6 @@
 #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
-}
-
 /// <summary>Shows a check box that can be toggled.</summary>
 public class CheckBox : View
 {