-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the tab's active title for Export Text
#13915
Conversation
Export Text
feature uses tab's title even if it was changedExport Text
@@ -420,7 +420,7 @@ namespace winrt::TerminalApp::implementation | |||
// GH#11356 - we can't use the UWP apis for writing the file, | |||
// because they don't work elevated (shocker) So just use the | |||
// shell32 file picker manually. | |||
path = co_await SaveFilePicker(*_hostingHwnd, [control](auto&& dialog) { | |||
path = co_await SaveFilePicker(*_hostingHwnd, [&tab](auto&& dialog) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may actually want to capture tab
by copy, if we can. It will increment a reference to the underlying smart pointer.
Capturing a reference with &
during a coroutine handoff can in some cases result in the function blowing up later when it refers to the old coroutine's stack location. It can be messy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy constructor for TerminalTab
is implicitly deleted cuz deep down winrt::impl::root_implements
has std::atomic
in it which is not CopyConstructible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't realize it was a type from the implementation
namespace. Sorry!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, since all we need from tab is it's title we can get it outside of coroutine and just pass wstring
by value.
std::wstring filename{ tab.Title() };
filename = til::clean_filename(filename);
path = co_await SaveFilePicker(*_hostingHwnd, [filename](auto&& dialog) {
Will this be fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I love it! You can move the filename into the lambda as well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(noted)
As always, thanks for tackling these things! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for doing this! I appreciate your response to our feedback, even (or especially!) when it is wrong. 😁
Co-authored-by: Dustin L. Howett <dustin@howett.net>
Hello @zadjii-msft! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
🎉 Handy links: |
🎉 Handy links: |
Takes title from the tab instead of the TermControl
Closes #13909