From b3f0afbc8f8af8f312a5465936b6907104f3c78f Mon Sep 17 00:00:00 2001 From: James Holderness Date: Mon, 26 Aug 2024 13:02:39 +0100 Subject: [PATCH] Make sure a blank title string resets the title (#17802) ## Summary of the Pull Request When a VT title sequence sets the title to a blank string, that is meant to trigger a reset to the default starting value. This used to work in the past because the blank value was dealt with by conhost, so Windows Terminal never received a blank title, but that's no longer the case with the new VT passthrough. This PR fixes the issue by getting Windows Terminal to handle the blank title strings itself. ## References and Relevant Issues VT passthrough was introduced in PR #17510. ## Validation Steps Performed I've manually verified that the `OSC 0`, `OSC 2`, and `DECSWT` sequences now correctly reset the title when passed a blank title string. ## PR Checklist - [x] Closes #17800 (cherry picked from commit 1f71568c2a60fa7ec3549e72bc1c8c47c7033b29) Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgSNvr0 PVTI_lADOAF3p4s4AmhmQzgSOFrc Service-Version: 1.22 --- src/cascadia/TerminalCore/TerminalApi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cascadia/TerminalCore/TerminalApi.cpp b/src/cascadia/TerminalCore/TerminalApi.cpp index 9f51aadf00d..ffd9ec72af0 100644 --- a/src/cascadia/TerminalCore/TerminalApi.cpp +++ b/src/cascadia/TerminalCore/TerminalApi.cpp @@ -86,7 +86,7 @@ void Terminal::SetWindowTitle(const std::wstring_view title) _assertLocked(); if (!_suppressApplicationTitle) { - _title.emplace(title); + _title.emplace(title.empty() ? _startingTitle : title); _pfnTitleChanged(_title.value()); } }