fix tab title propagation issues (#9054)
- Fixes empty app title when `showTerminalTitleInTitlebar` is false - Fixes Tab title propagation to Window title when `showTerminalTitleInTitlebar` is false - Fixes Tab title propagation to Window - title doesn't update when Window is unfocused 1. There were a missing `_settings.GlobalSettings().ShowTitleInTitlebar()` check. Because of this Title update event was being fired even when `showTerminalTitleInTitlebar` is false. This results in empty tab title to propagate to Window title. Also then after switching tabs back and forth, tab title propagates to window title. These shouldn't propagate when `showTerminalTitleInTitlebar` is false. I added the `showTerminalTitleInTitlebar` check in relevant logic to fix the behavior. 2. Code was checking `tab.FocusState() != FocusState::Unfocused` , but when the whole terminal window is not in focus, the active tab is also in Unfocused state. This was preventing tab title to propagate to window title when application is unfocused. I added the logic of checking matching selected tabs' index. This fixes the issue. ## Validation Steps Performed I did the reproduce steps descripted in the issue to reproduce the bugs. After applying the fixes, the bugs don't appear anymore while doing the reproduce steps. Closes #8704
This commit is contained in:
parent
207f15498f
commit
47881a802f
|
@ -1067,8 +1067,7 @@ namespace winrt::TerminalApp::implementation
|
|||
{
|
||||
auto newTabTitle = tab.Title();
|
||||
|
||||
if (_settings.GlobalSettings().ShowTitleInTitlebar() &&
|
||||
tab.FocusState() != FocusState::Unfocused)
|
||||
if (_settings.GlobalSettings().ShowTitleInTitlebar() && tab == _GetFocusedTab())
|
||||
{
|
||||
_titleChangeHandlers(*this, newTabTitle);
|
||||
}
|
||||
|
@ -2254,7 +2253,10 @@ namespace winrt::TerminalApp::implementation
|
|||
tab.TabViewItem().StartBringIntoView();
|
||||
|
||||
// Raise an event that our title changed
|
||||
_titleChangeHandlers(*this, tab.Title());
|
||||
if (_settings.GlobalSettings().ShowTitleInTitlebar())
|
||||
{
|
||||
_titleChangeHandlers(*this, tab.Title());
|
||||
}
|
||||
}
|
||||
CATCH_LOG();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue