diff --git a/.github/actions/spelling/expect/expect.txt b/.github/actions/spelling/expect/expect.txt index 36e345cfbbd..775694924d3 100644 --- a/.github/actions/spelling/expect/expect.txt +++ b/.github/actions/spelling/expect/expect.txt @@ -1718,6 +1718,7 @@ sysparams sysparamsext SYSTEMHAND SYSTEMMENU +SYSTEMTIME tabview TAdd taef diff --git a/src/cascadia/TerminalControl/ControlCore.cpp b/src/cascadia/TerminalControl/ControlCore.cpp index cfba0a1d46a..f2ecc0ccaa2 100644 --- a/src/cascadia/TerminalControl/ControlCore.cpp +++ b/src/cascadia/TerminalControl/ControlCore.cpp @@ -1796,6 +1796,38 @@ namespace winrt::Microsoft::Terminal::Control::implementation return; } + FILETIME lastWriteTime; + SYSTEMTIME lastWriteSystemTime; + if (!GetFileTime(file.get(), nullptr, nullptr, &lastWriteTime) || + !FileTimeToSystemTime(&lastWriteTime, &lastWriteSystemTime)) + { + return; + } + + wchar_t dateBuf[256]; + const auto dateLen = GetDateFormatEx(nullptr, 0, &lastWriteSystemTime, nullptr, &dateBuf[0], ARRAYSIZE(dateBuf), nullptr); + wchar_t timeBuf[256]; + const auto timeLen = GetTimeFormatEx(nullptr, 0, &lastWriteSystemTime, nullptr, &timeBuf[0], ARRAYSIZE(timeBuf)); + + std::wstring message; + if (dateLen > 0 && timeLen > 0) + { + const auto msg = RS_(L"SessionRestoreMessage"); + const std::wstring_view date{ &dateBuf[0], gsl::narrow_cast(dateLen) }; + const std::wstring_view time{ &timeBuf[0], gsl::narrow_cast(timeLen) }; + // This escape sequence string + // * sets the color to white on a bright black background ("\x1b[100;37m") + // * prints " [Restored