Skip to content

Add support for the XTWINOPS 22/23 title stack - #21015

Open
Darrell Chee (darrellchee) wants to merge 2 commits into
microsoft:mainfrom
darrellchee:fix/issue-14575
Open

Darrell Chee (darrellchee) wants to merge 2 commits into
microsoft:mainfrom
darrellchee:fix/issue-14575

Conversation

@darrellchee

@darrellchee Darrell Chee (darrellchee) commented Dec 3, 2026 •

Copy link
Copy Markdown

Summary of the Pull Request

Adds xterm's title stack: CSI 22 ; Ps t saves the current window title and CSI 23 ; Ps t restores it. Ps 0, 1, 2 and omitted all act on our single title, since OSC 0, 1 and 2 all set it. Other values are ignored. The stack keeps at most 10 entries and drops the oldest, like the XTPUSHSGR stack.

References and Relevant Issues

Closes #14575

Detailed Description of the Pull Request / Additional comments

  • New WindowManipulationType values PushWindowTitle = 22 and PopWindowTitle = 23, handled in AdaptDispatch::WindowManipulation.
  • New ITerminalApi::GetWindowTitle(), so the adapter saves the real current title, including one set through SetConsoleTitle. In Terminal it returns only the app-set title, so popping back to "no app title" restores the profile's starting title.
  • ConPTY needs no change: conhost parses the sequence and also passes it through, so both sides keep matching stacks.
  • Open question: in conhost the stack lives in each screen buffer's AdaptDispatch, like _sgrStack. So buffers made by CreateConsoleScreenBuffer each have their own stack. The alt buffer shares the main one.

Validation Steps Performed

  • New tests: AdapterTest::WindowTitleStackTest, AdapterTest::WindowTitleStackLimitTest, TerminalApiTest::WindowTitleStack, ScreenBufferTests::WindowTitleStack. They fail without the change and pass with it.
  • Full build, unit, feature and local tests, formatting, audit mode and spelling pass on GitHub Actions.

PR Checklist

CSI 22 ; Ps t saves the current window title on a stack and
CSI 23 ; Ps t restores it. Ps 0, 1, 2 and omitted all act on the one
title we have, since OSC 0, 1 and 2 all set it. The stack keeps at
most 10 entries, like the XTPUSHSGR stack.

The adapter reads the title through a new ITerminalApi::GetWindowTitle,
so titles set through the console API or the profile are saved too.

Closes microsoft#14575
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-service microsoft-github-policy-service Bot added Issue-Task It's a feature request, but it doesn't really need a major design. Area-VT Virtual Terminal sequence support Product-Conhost For issues in the Console codebase labels Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-VT Virtual Terminal sequence support Issue-Task It's a feature request, but it doesn't really need a major design. Product-Conhost For issues in the Console codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support control sequences for title stacking

1 participant