Skip to content

Escape sequences are not stripped from the tab title #12206

Closed
@j4james

Description

@j4james

Windows Terminal version

1.12.3472.0

Windows build number

10.0.19041.1415

Other Software

No response

Steps to reproduce

  1. Edit the settings.json file.
  2. Set the default tab title with an escape sequence like this: "tabTitle": "\u001b[41m"
  3. Start a cmd shell

Expected Behavior

The escape character should be stripped from the title.

Actual Behavior

The escape character is left in the title when propagated over conpty, so it ends up being interpreted as a background color change in the terminal.

image

We do already sanitize the title in DoSrvSetConsoleTitleW, which covers title changes via the console API, but in this case the CONSOLE_INFORMATION::SetTitle method is being called directly from the AllocateConsole method on startup:

gci.SetTitle(title);

My suggestion is we move the sanitization from DoSrvSetConsoleTitleW into the CONSOLE_INFORMATION::SetTitle method, so we can be sure it's applied in all cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-ServerDown in the muck of API call servicing, interprocess communication, eventing, etc.Issue-BugIt either shouldn't be doing this or needs an investigation.Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meetingProduct-ConhostFor issues in the Console codebaseResolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions