Skip to content

Commit

Permalink
Restore ability to set window title from commandline (#3695)
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft authored and DHowett committed Nov 25, 2019
1 parent e22487d commit 983f9b5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ namespace winrt::TerminalApp::implementation
// handle. This includes:
// * the Copy and Paste events, for setting and retrieving clipboard data
// on the right thread
// * the TitleChanged event, for changing the text of the tab
// Arguments:
// - term: The newly created TermControl to connect the events for
// - hostingTab: The Tab that's hosting this TermControl instance
Expand All @@ -748,6 +749,21 @@ namespace winrt::TerminalApp::implementation

// Add an event handler when the terminal wants to paste data from the Clipboard.
term.PasteFromClipboard({ this, &TerminalPage::_PasteFromClipboardHandler });

// Don't capture a strong ref to the tab. If the tab is removed as this
// is called, we don't really care anymore about handling the event.
std::weak_ptr<Tab> weakTabPtr = hostingTab;
term.TitleChanged([this, weakTabPtr](auto newTitle) {
auto tab = weakTabPtr.lock();
if (!tab)
{
return;
}
// The title of the control changed, but not necessarily the title
// of the tab. Get the title of the focused pane of the tab, and set
// the tab's text to the focused panes' text.
_UpdateTitle(tab);
});
}

// Method Description:
Expand Down

1 comment on commit 983f9b5

@aborruso
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In QWERTY italian keyboard, it's Alt+Shift++ to split vertically and not =

Please sign in to comment.