Title event handler attached to control on tab discards title variable #5444

Closed
opened 2026-01-31 00:13:31 +00:00 by claunia · 5 comments
Owner

Originally created by @miniksa on GitHub (Dec 6, 2019).

Originally assigned to: @zadjii-msft on GitHub.

9145903e11/src/cascadia/TerminalApp/Tab.cpp (L320-L328)

I'm trying to make the Telnet and Azure connection types set a title when they start up on the tab.

They're calling the ESC]0;

Originally created by @miniksa on GitHub (Dec 6, 2019). Originally assigned to: @zadjii-msft on GitHub. https://github.com/microsoft/terminal/blob/9145903e118bfa3b48749694689aec3a191bc4ac/src/cascadia/TerminalApp/Tab.cpp#L320-L328 I'm trying to make the Telnet and Azure connection types set a title when they start up on the tab. They're calling the ESC]0;<title>BEL sequence on the output handlers to make it happen. Turns out that title makes it all the way to here and then is completely discarded in favor of whatever's already on the title.
Author
Owner

@miniksa commented on GitHub (Dec 6, 2019):

@zadjii-msft, this is the thing I was talking about.

@miniksa commented on GitHub (Dec 6, 2019): @zadjii-msft, this is the thing I was talking about.
Author
Owner

@DHowett-MSFT commented on GitHub (Dec 6, 2019):

I looked into this. Emitting a title during Start() forces Pane to ask Control for its title before _initializedTerminal is true.

We need to rework the title eventing, and also fix starting titles to actually apply to the terminal instead of letting conhost spout it back at us.

@DHowett-MSFT commented on GitHub (Dec 6, 2019): I looked into this. Emitting a title during Start() forces Pane to ask Control for its title before `_initializedTerminal` is `true`. We need to rework the title eventing, and also fix starting titles to actually apply to the _terminal_ instead of letting conhost spout it back at us.
Author
Owner

@zadjii-msft commented on GitHub (Dec 9, 2019):

For the record, discarding the value of newTitle is intentional here. The Tab doesn't have a TitleChanged event, only the control does. So we hook up a handler to every control's TitleChanged event as a way of getting notified that the Tab's title might have changed.

We maybe should just set the Tab's title to the StartingTitle of the first control added to the tab, if that property is set, rather than waiting for the title to roundtrip through conpty to us.

@zadjii-msft commented on GitHub (Dec 9, 2019): For the record, discarding the value of `newTitle` is intentional here. The `Tab` doesn't have a TitleChanged event, only the control does. So we hook up a handler to every control's `TitleChanged` event as a way of getting notified that the `Tab`'s title _might_ have changed. We maybe should just set the Tab's title to the `StartingTitle` of the first control added to the tab, if that property is set, rather than waiting for the title to roundtrip through conpty to us.
Author
Owner

@zadjii-msft commented on GitHub (Jul 13, 2021):

@miniksa do we think this is still important? At some point, we changed Terminal::GetConsoleTitle to return the _startingTitle if the title isn't set by VT. Looks like that was in #6433, which was roughly the 1.1 timeframe.

You can go ahead and reopen if you want to veto.

@zadjii-msft commented on GitHub (Jul 13, 2021): @miniksa do we think this is still important? At some point, we changed `Terminal::GetConsoleTitle` to return the `_startingTitle` if the title isn't set by VT. Looks like that was in #6433, which was roughly the 1.1 timeframe. You can go ahead and reopen if you want to veto.
Author
Owner

@miniksa commented on GitHub (Jul 13, 2021):

Nah its fine thanks.

@miniksa commented on GitHub (Jul 13, 2021): Nah its fine thanks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5444