@@ -2218,7 +2218,7 @@ namespace winrt::TerminalApp::implementation
22182218 }
22192219 }
22202220
2221- void TerminalPage::PersistState (bool serializeBuffer )
2221+ void TerminalPage::PersistState ()
22222222 {
22232223 // This method may be called for a window even if it hasn't had a tab yet or lost all of them.
22242224 // We shouldn't persist such windows.
@@ -2233,7 +2233,7 @@ namespace winrt::TerminalApp::implementation
22332233 for (auto tab : _tabs)
22342234 {
22352235 auto t = winrt::get_self<implementation::Tab>(tab);
2236- auto tabActions = t->BuildStartupActions (serializeBuffer ? BuildStartupKind::PersistAll : BuildStartupKind::PersistLayout );
2236+ auto tabActions = t->BuildStartupActions (BuildStartupKind::Persist );
22372237 actions.insert (actions.end (), std::make_move_iterator (tabActions.begin ()), std::make_move_iterator (tabActions.end ()));
22382238 }
22392239
@@ -2319,6 +2319,29 @@ namespace winrt::TerminalApp::implementation
23192319 CloseWindowRequested.raise (*this , nullptr );
23202320 }
23212321
2322+ std::vector<IPaneContent> TerminalPage::Panes () const
2323+ {
2324+ std::vector<IPaneContent> panes;
2325+
2326+ for (const auto tab : _tabs)
2327+ {
2328+ const auto impl = _GetTabImpl (tab);
2329+ if (!impl)
2330+ {
2331+ continue ;
2332+ }
2333+
2334+ impl->GetRootPane ()->WalkTree ([&](auto && pane) {
2335+ if (auto content = pane->GetContent ())
2336+ {
2337+ panes.push_back (std::move (content));
2338+ }
2339+ });
2340+ }
2341+
2342+ return panes;
2343+ }
2344+
23222345 // Method Description:
23232346 // - Move the viewport of the terminal of the currently focused tab up or
23242347 // down a number of lines.
@@ -3527,9 +3550,12 @@ namespace winrt::TerminalApp::implementation
35273550
35283551 if (hasSessionId)
35293552 {
3553+ using namespace std ::string_view_literals;
3554+
35303555 const auto settingsDir = CascadiaSettings::SettingsDirectory ();
3531- const auto idStr = Utils::GuidToPlainString (sessionId);
3532- const auto path = fmt::format (FMT_COMPILE (L" {}\\ buffer_{}.txt" ), settingsDir, idStr);
3556+ const auto admin = IsRunningElevated ();
3557+ const auto filenamePrefix = admin ? L" elevated_" sv : L" buffer_" sv;
3558+ const auto path = fmt::format (FMT_COMPILE (L" {}\\ {}{}.txt" ), settingsDir, filenamePrefix, sessionId);
35333559 control.RestoreFromPath (path);
35343560 }
35353561
0 commit comments