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
142142
143143 if ( old != _selectedTab )
144144 {
145- if ( _selectedTabHasFocus || ! _containerView . CanFocus )
145+ if ( TabCanSetFocus ( ) )
146146 {
147147 SelectedTab ? . SetFocus ( ) ;
148148 }
@@ -153,6 +153,11 @@ public Tab? SelectedTab
153153 }
154154 }
155155
156+ private bool TabCanSetFocus ( )
157+ {
158+ return IsInitialized && SelectedTab is { } && ( _selectedTabHasFocus || ! _containerView . CanFocus ) ;
159+ }
160+
156161 private void ContainerViewCanFocus ( object sender , EventArgs eventArgs )
157162 {
158163 _containerView . CanFocus = _containerView . Subviews . Count ( v => v . CanFocus ) > 0 ;
@@ -509,7 +514,7 @@ internal IEnumerable<Tab> CalculateViewport (Rectangle bounds)
509514 i += tabTextWidth + 1 ;
510515 }
511516
512- if ( _selectedTabHasFocus )
517+ if ( TabCanSetFocus ( ) )
513518 {
514519 SelectedTab ? . SetFocus ( ) ;
515520 }
You can’t perform that action at this time.
0 commit comments