Skip to content

General improvements in preparation for #16598#16601

Merged
lhecker merged 1 commit intomainfrom
dev/lhecker/961-prepare1
Feb 6, 2024
Merged

General improvements in preparation for #16598#16601
lhecker merged 1 commit intomainfrom
dev/lhecker/961-prepare1

Conversation

@lhecker
Copy link
Member

@lhecker lhecker commented Jan 25, 2024

This contains all the parts of #16598 that aren't specific to session
restore, but are required for the code in #16598:

  • Adds new GUID<>String functions that remove the {} brackets.
  • Adds SessionId to the ITerminalConnection interface.
  • Flush the ApplicationState before we terminate the process.
  • Not monitoring state.json for changes is important as it prevents
    disturbing the session state while session persistence is ongoing.
    That's because when ApplicationState flushes to disk, the FS
    monitor will be triggered and reload the ApplicationState again.

@lhecker lhecker added the Product-Terminal The new Windows Terminal. label Jan 25, 2024
@lhecker lhecker force-pushed the dev/lhecker/961-prepare1 branch from 2df1ae8 to 5270766 Compare January 25, 2024 15:35
}

_finalizeSessionPersistence();
TerminateProcess(GetCurrentProcess(), 0);
Copy link
Member

Choose a reason for hiding this comment

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

this conflicts with #16575 right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, this is just a reminder for me for when I resolve the merge conflicts.

// This is just like StringFromGUID2 but with lowercase hexadecimal.
wchar_t buffer[39];
swprintf_s(&buffer[0], 39, L"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
return { &buffer[offset], length };
Copy link
Member

Choose a reason for hiding this comment

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

rofl i love this

return wil::str_printf<std::wstring>(L"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
// This is just like StringFromGUID2 but with lowercase hexadecimal.
wchar_t buffer[39];
swprintf_s(&buffer[0], 39, L"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
Copy link
Member

Choose a reason for hiding this comment

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

if we use fmt with FMT_COMPILE does that get smaller? better? worse?

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

okay so you can't hand-edit state.json and have it hot-reload anymore, but that seems totally reasonable

@lhecker lhecker merged commit 5dda507 into main Feb 6, 2024
@lhecker lhecker deleted the dev/lhecker/961-prepare1 branch February 6, 2024 22:58
@microsoft microsoft deleted a comment Feb 7, 2024
@microsoft microsoft deleted a comment Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants