File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Terminal.Gui/Views/TabView Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ public Tab? SelectedTab
142
142
143
143
if ( old != _selectedTab )
144
144
{
145
- if ( _selectedTabHasFocus || ! _containerView . CanFocus )
145
+ if ( TabCanSetFocus ( ) )
146
146
{
147
147
SelectedTab ? . SetFocus ( ) ;
148
148
}
@@ -153,6 +153,11 @@ public Tab? SelectedTab
153
153
}
154
154
}
155
155
156
+ private bool TabCanSetFocus ( )
157
+ {
158
+ return IsInitialized && SelectedTab is { } && ( _selectedTabHasFocus || ! _containerView . CanFocus ) ;
159
+ }
160
+
156
161
private void ContainerViewCanFocus ( object sender , EventArgs eventArgs )
157
162
{
158
163
_containerView . CanFocus = _containerView . Subviews . Count ( v => v . CanFocus ) > 0 ;
@@ -509,7 +514,7 @@ internal IEnumerable<Tab> CalculateViewport (Rectangle bounds)
509
514
i += tabTextWidth + 1 ;
510
515
}
511
516
512
- if ( _selectedTabHasFocus )
517
+ if ( TabCanSetFocus ( ) )
513
518
{
514
519
SelectedTab ? . SetFocus ( ) ;
515
520
}
You can’t perform that action at this time.
0 commit comments