2
0
Tig 1 жил өмнө
parent
commit
12f88a2044

+ 1 - 1
Terminal.Gui/View/CancelEventArgs.cs

@@ -12,7 +12,7 @@ namespace Terminal.Gui;
 ///     should be set to
 ///     <see langword="true"/> to prevent the state change from occurring.
 /// </remarks>
-public class CancelEventArgs<T> : CancelEventArgs where T : notnull
+public class CancelEventArgs<T> : CancelEventArgs
 {
     /// <summary>Initializes a new instance of the <see cref="CancelEventArgs{T}"/> class.</summary>
     /// <param name="currentValue">The current (old) value of the property.</param>

+ 4 - 5
Terminal.Gui/View/ViewText.cs

@@ -69,18 +69,17 @@ public partial class View
                 Id = _text;
             }
 #endif
-            OnTextChanged (old, Text);
+            OnTextChanged (new CancelEventArgs<string> (old, Text));
         }
     }
 
     /// <summary>
     /// Called when the <see cref="Text"/> has changed. Fires the <see cref="TextChanged"/> event.
     /// </summary>
-    /// <param name="oldValue"></param>
-    /// <param name="newValue"></param>
-    public void OnTextChanged (string oldValue, string newValue)
+    /// <param name="args">The event arguments</param>
+    public void OnTextChanged (CancelEventArgs<string> args)
     {
-        TextChanged?.Invoke (this, new CancelEventArgs<string> (oldValue, newValue));
+        TextChanged?.Invoke (this, args);
     }
 
     /// <summary>

+ 1 - 1
Terminal.Gui/Views/TextField.cs

@@ -563,7 +563,7 @@ public class TextField : View
                                  );
             }
 
-            OnTextChanged (oldText, StringExtensions.ToString (_text));
+            OnTextChanged (new (oldText, StringExtensions.ToString (_text)));
 
             ProcessAutocomplete ();
 

+ 1 - 1
Terminal.Gui/Views/TextView.cs

@@ -2830,7 +2830,7 @@ public class TextView : View
                 _model = _wrapManager.WrapModel (Viewport.Width, out _, out _, out _, out _);
             }
 
-            OnTextChanged (old, Text);
+            OnTextChanged (new (old, Text));
             SetNeedsDisplay ();
 
             _historyText.Clear (Text);