Browse Source

Refactor generic type names and remove unused field

Renamed generic type parameters in `Dim` and `Pos` classes for clarity:
- `T` was renamed to `TDim` in `Dim.Has` method.
- `T` was renamed to `TPos` in `Pos.Has` method.
Updated type casting and pattern matching logic to reflect these changes.

Removed the unused `_stopAfterFirstIteration` field from the `ApplicationImpl` class to clean up the codebase.
Tig 1 month ago
parent
commit
3e22309c7e

+ 0 - 1
Terminal.Gui/App/ApplicationImpl.cs

@@ -66,7 +66,6 @@ public partial class ApplicationImpl : IApplication
     }
 
     private IKeyboard? _keyboard;
-    private bool _stopAfterFirstIteration;
 
     /// <summary>
     ///     Handles keyboard input and key bindings at the Application level

+ 5 - 5
Terminal.Gui/ViewBase/Layout/Dim.cs

@@ -188,18 +188,18 @@ public abstract record Dim : IEqualityOperators<Dim, Dim, bool>
 
 
     /// <summary>
-    ///     Indicates whether the specified type <typeparamref name="T"/> is in the hierarchy of this Dim object.
+    ///     Indicates whether the specified type <typeparamref name="TDim"/> is in the hierarchy of this Dim object.
     /// </summary>
     /// <param name="dim">A reference to this <see cref="Dim"/> instance.</param>
     /// <returns></returns>
-    public bool Has<T> (out T dim) where T : Dim
+    public bool Has<TDim> (out TDim dim) where TDim : Dim
     {
-        dim = (this as T)!;
+        dim = (this as TDim)!;
 
         return this switch
                {
-                   DimCombine combine => combine.Left.Has<T> (out dim) || combine.Right.Has<T> (out dim),
-                   T => true,
+                   DimCombine combine => combine.Left.Has<TDim> (out dim) || combine.Right.Has<TDim> (out dim),
+                   TDim => true,
                    _ => false
                };
     }

+ 5 - 5
Terminal.Gui/ViewBase/Layout/Pos.cs

@@ -334,18 +334,18 @@ public abstract record Pos
     internal virtual bool ReferencesOtherViews () { return false; }
 
     /// <summary>
-    ///     Indicates whether the specified type <typeparamref name="T"/> is in the hierarchy of this Pos object.
+    ///     Indicates whether the specified type <typeparamref name="TPos"/> is in the hierarchy of this Pos object.
     /// </summary>
     /// <param name="pos">A reference to this <see cref="Pos"/> instance.</param>
     /// <returns></returns>
-    public bool Has<T> (out T pos) where T : Pos
+    public bool Has<TPos> (out TPos pos) where TPos : Pos
     {
-        pos = (this as T)!;
+        pos = (this as TPos)!;
 
         return this switch
                {
-                   PosCombine combine => combine.Left.Has<T> (out pos) || combine.Right.Has<T> (out pos),
-                   T => true,
+                   PosCombine combine => combine.Left.Has<TPos> (out pos) || combine.Right.Has<TPos> (out pos),
+                   TPos => true,
                    _ => false
                };
     }