@@ -188,6 +188,11 @@ namespace winrt::TerminalApp::implementation
188
188
return nullptr ;
189
189
}
190
190
191
+ IPaneContent TerminalTab::GetActiveContent () const
192
+ {
193
+ return _activePane ? _activePane->GetContent () : nullptr ;
194
+ }
195
+
191
196
// Method Description:
192
197
// - Called after construction of a Tab object to bind event handlers to its
193
198
// associated Pane and TermControl objects
@@ -371,8 +376,8 @@ namespace winrt::TerminalApp::implementation
371
376
{
372
377
return RS_ (L" MultiplePanes" );
373
378
}
374
- const auto lastFocusedControl = GetActiveTerminalControl ();
375
- return lastFocusedControl ? lastFocusedControl .Title () : L" " ;
379
+ const auto activeContent = GetActiveContent ();
380
+ return activeContent ? activeContent .Title () : L" " ;
376
381
}
377
382
378
383
// Method Description:
@@ -1433,7 +1438,12 @@ namespace winrt::TerminalApp::implementation
1433
1438
// GH#10112 - if we're opening the tab renamer, don't
1434
1439
// immediately toss focus to the control. We don't want to steal
1435
1440
// focus from the tab renamer.
1436
- if (!tab->_headerControl .InRename () && !tab->GetActiveTerminalControl ().SearchBoxEditInFocus ())
1441
+ const auto & terminalControl{ tab->GetActiveTerminalControl () }; // maybe null
1442
+ // If we're
1443
+ // * NOT in a rename
1444
+ // * AND (the content isn't a TermControl, OR the term control doesn't have focus in the search box)
1445
+ if (!tab->_headerControl .InRename () &&
1446
+ (terminalControl == nullptr || !terminalControl.SearchBoxEditInFocus ()))
1437
1447
{
1438
1448
tab->_RequestFocusActiveControlHandlers ();
1439
1449
}
0 commit comments