Skip to content

Commit d125950

Browse files
committed
chore: fix all build warnings — clean 0 Warning(s)
- NavigationView: remove redundant GotFocus/LostFocus (inherited from BaseControl) - LogExporterControl: pragma suppress unused GotFocus/LostFocus (interface requirement) - Window.Controls.cs: null-safe IsFocused check with pattern match - WindowEventDispatcher: null-safe IsFocused check with pattern match - HorizontalGridControl: remove dead _interactiveContentsDirty and _focusFromBackward fields - ScrollablePanelControl: remove dead _focusFromBackward field
1 parent 25bfffa commit d125950

6 files changed

Lines changed: 4 additions & 17 deletions

File tree

SharpConsoleUI/Controls/HorizontalGridControl/HorizontalGridControl.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ public partial class HorizontalGridControl : BaseControl, IInteractiveControl, I
8080
/// </summary>
8181
public IInteractiveControl? FocusedContent => GetFocusedChildFromCoordinator();
8282
private Dictionary<IInteractiveControl, ColumnContainer> _interactiveContents = new Dictionary<IInteractiveControl, ColumnContainer>();
83-
private bool _interactiveContentsDirty = true;
84-
private bool _focusFromBackward = false;
8583
private bool _isEnabled = true;
8684
private Dictionary<IInteractiveControl, int> _splitterControls = new Dictionary<IInteractiveControl, int>();
8785
private List<SplitterControl> _splitters = new List<SplitterControl>();
@@ -387,7 +385,6 @@ public void AddColumn(ColumnContainer column)
387385
lock (_gridLock)
388386
{
389387
_columns.Add(column);
390-
_interactiveContentsDirty = true;
391388
}
392389

393390
// Force DOM rebuild for runtime addition
@@ -431,7 +428,6 @@ public void AddColumn(ColumnContainer column)
431428
_splitters.Add(splitter);
432429
_splitterControls[splitter] = _columns.Count - 2;
433430

434-
_interactiveContentsDirty = true;
435431
}
436432

437433
// Subscribe to splitter's move event
@@ -473,7 +469,6 @@ public bool AddSplitter(int leftColumnIndex, SplitterControl splitterControl)
473469
_splitters.Add(splitterControl);
474470
_splitterControls[splitterControl] = leftColumnIndex;
475471

476-
_interactiveContentsDirty = true;
477472
}
478473

479474
// Subscribe to splitter's move event
@@ -594,7 +589,6 @@ public void RemoveColumn(ColumnContainer column)
594589

595590
_splitterControls = updatedSplitters;
596591

597-
_interactiveContentsDirty = true;
598592
}
599593

600594
// Unsubscribe events outside lock
@@ -622,7 +616,6 @@ public void ClearColumns()
622616
_splitters.Clear();
623617
_splitterControls.Clear();
624618
_savedColumnWidths.Clear();
625-
_interactiveContentsDirty = true;
626619
}
627620

628621
foreach (var s in splittersSnapshot)

SharpConsoleUI/Controls/NavigationView/NavigationView.Input.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,6 @@ public bool HasFocus
8989
/// <inheritdoc/>
9090
public bool CanReceiveFocus => IsEnabled;
9191

92-
/// <summary>Raised when the control gains focus.</summary>
93-
public event EventHandler? GotFocus;
94-
95-
/// <summary>Raised when the control loses focus.</summary>
96-
public event EventHandler? LostFocus;
97-
9892
/// <inheritdoc/>
9993
public bool ProcessKey(ConsoleKeyInfo key)
10094
{

SharpConsoleUI/Controls/ScrollablePanelControl/ScrollablePanelControl.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public partial class ScrollablePanelControl : BaseControl, IInteractiveControl,
3030
private int _viewportWidth = 0;
3131
private bool _isEnabled = true;
3232
private IInteractiveControl? _lastInternalFocusedChild = null;
33-
private bool _focusFromBackward = false;
3433
// When true, GetInitialFocus returns 'this' so SetFocus(panel) enters scroll mode directly.
3534
private bool _enterScrollModeOnNextInitialFocus = false;
3635

SharpConsoleUI/Plugins/DeveloperTools/LogExporterControl.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,13 @@ public int? Width
162162
/// <inheritdoc/>
163163
public bool CanReceiveFocus => _enabled && _visible;
164164

165+
#pragma warning disable CS0067 // Events required by IFocusableControl but not raised by this legacy control
165166
/// <inheritdoc/>
166167
public event EventHandler? GotFocus;
167168

168169
/// <inheritdoc/>
169170
public event EventHandler? LostFocus;
170-
171+
#pragma warning restore CS0067
171172

172173
/// <inheritdoc/>
173174
public bool WantsMouseEvents => true;

SharpConsoleUI/Window.Controls.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public void RemoveContent(IWindowControl content)
8080
// Handle focus logic before removing
8181
if (content is IInteractiveControl interactiveControl)
8282
{
83-
bool wasFocused = FocusManager.IsFocused(interactiveControl as IFocusableControl);
83+
bool wasFocused = interactiveControl is IFocusableControl fc && FocusManager.IsFocused(fc);
8484

8585
if (wasFocused)
8686
{

SharpConsoleUI/Windows/WindowEventDispatcher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ public bool HasActiveInteractiveContent(out IInteractiveControl? interactiveCont
639639

640640
// Legacy fallback during migration — keep existing logic here unchanged
641641
// First try to find focused control in _interactiveContents (direct children)
642-
interactiveContent = _window._interactiveContents.LastOrDefault(ic => ic.IsEnabled && _window.FocusManager.IsFocused(ic as Controls.IFocusableControl));
642+
interactiveContent = _window._interactiveContents.LastOrDefault(ic => ic.IsEnabled && ic is Controls.IFocusableControl fc && _window.FocusManager.IsFocused(fc));
643643

644644
// Fallback: route keyboard to the control that currently has focus via FocusManager.
645645
// This handles nested controls in containers (e.g. a leaf inside ScrollablePanel).

0 commit comments

Comments
 (0)