Skip to content

Commit 88e9959

Browse files
authored
Merge branch 'main' into dev/lhecker/17179-endsession-persistence
2 parents d42af1f + f769597 commit 88e9959

33 files changed

+419
-102
lines changed

.github/actions/spelling/allow/apis.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ NCHITTEST
144144
NCLBUTTONDBLCLK
145145
NCMOUSELEAVE
146146
NCMOUSEMOVE
147+
NCPOINTERUPDATE
147148
NCRBUTTONDBLCLK
148149
NIF
149150
NIN

src/buffer/out/UTextAdapter.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -400,17 +400,6 @@ Microsoft::Console::ICU::unique_utext Microsoft::Console::ICU::UTextFromTextBuff
400400
return ut;
401401
}
402402

403-
Microsoft::Console::ICU::unique_uregex Microsoft::Console::ICU::CreateRegex(const std::wstring_view& pattern, uint32_t flags, UErrorCode* status) noexcept
404-
{
405-
#pragma warning(suppress : 26490) // Don't use reinterpret_cast (type.1).
406-
const auto re = uregex_open(reinterpret_cast<const char16_t*>(pattern.data()), gsl::narrow_cast<int32_t>(pattern.size()), flags, nullptr, status);
407-
// ICU describes the time unit as being dependent on CPU performance and "typically [in] the order of milliseconds",
408-
// but this claim seems highly outdated already. On my CPU from 2021, a limit of 4096 equals roughly 600ms.
409-
uregex_setTimeLimit(re, 4096, status);
410-
uregex_setStackLimit(re, 4 * 1024 * 1024, status);
411-
return unique_uregex{ re };
412-
}
413-
414403
// Returns a half-open [beg,end) range given a text start and end position.
415404
// This function is designed to be used with uregex_start64/uregex_end64.
416405
til::point_span Microsoft::Console::ICU::BufferRangeFromMatch(UText* ut, URegularExpression* re)

src/buffer/out/UTextAdapter.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ class TextBuffer;
99

1010
namespace Microsoft::Console::ICU
1111
{
12-
using unique_uregex = wistd::unique_ptr<URegularExpression, wil::function_deleter<decltype(&uregex_close), &uregex_close>>;
1312
using unique_utext = wil::unique_struct<UText, decltype(&utext_close), &utext_close>;
1413

1514
unique_utext UTextFromTextBuffer(const TextBuffer& textBuffer, til::CoordType rowBeg, til::CoordType rowEnd) noexcept;
16-
unique_uregex CreateRegex(const std::wstring_view& pattern, uint32_t flags, UErrorCode* status) noexcept;
1715
til::point_span BufferRangeFromMatch(UText* ut, URegularExpression* re);
1816
}

src/buffer/out/textBuffer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "../../types/inc/CodepointWidthDetector.hpp"
1111
#include "../renderer/base/renderer.hpp"
1212
#include "../types/inc/utils.hpp"
13+
#include <til/regex.h>
1314
#include "search.h"
1415

1516
// BODGY: Misdiagnosis in MSVC 17.11: Referencing global constants in the member
@@ -3353,7 +3354,7 @@ std::optional<std::vector<til::point_span>> TextBuffer::SearchText(const std::ws
33533354
}
33543355

33553356
UErrorCode status = U_ZERO_ERROR;
3356-
const auto re = ICU::CreateRegex(needle, icuFlags, &status);
3357+
const auto re = til::ICU::CreateRegex(needle, icuFlags, &status);
33573358
if (status > U_ZERO_ERROR)
33583359
{
33593360
return std::nullopt;

src/cascadia/TerminalApp/IPaneContent.idl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ namespace TerminalApp
88
None,
99
Content,
1010
MovePane,
11-
Persist,
11+
PersistLayout,
12+
PersistAll
1213
};
1314

1415
runtimeclass BellEventArgs

src/cascadia/TerminalApp/Resources/en-US/Resources.resw

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,4 +944,7 @@
944944
<data name="TabMoveRight" xml:space="preserve">
945945
<value>Move right</value>
946946
</data>
947+
<data name="InvalidRegex" xml:space="preserve">
948+
<value>An invalid regex was found.</value>
949+
</data>
947950
</root>

src/cascadia/TerminalApp/TerminalPage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,7 +1953,7 @@ namespace winrt::TerminalApp::implementation
19531953
}
19541954
}
19551955

1956-
void TerminalPage::PersistState()
1956+
void TerminalPage::PersistState(bool serializeBuffer)
19571957
{
19581958
// This method may be called for a window even if it hasn't had a tab yet or lost all of them.
19591959
// We shouldn't persist such windows.
@@ -1968,7 +1968,7 @@ namespace winrt::TerminalApp::implementation
19681968
for (auto tab : _tabs)
19691969
{
19701970
auto t = winrt::get_self<implementation::TabBase>(tab);
1971-
auto tabActions = t->BuildStartupActions(BuildStartupKind::Persist);
1971+
auto tabActions = t->BuildStartupActions(serializeBuffer ? BuildStartupKind::PersistAll : BuildStartupKind::PersistLayout);
19721972
actions.insert(actions.end(), std::make_move_iterator(tabActions.begin()), std::make_move_iterator(tabActions.end()));
19731973
}
19741974

src/cascadia/TerminalApp/TerminalPage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ namespace winrt::TerminalApp::implementation
113113

114114
safe_void_coroutine RequestQuit();
115115
safe_void_coroutine CloseWindow();
116-
void PersistState();
116+
void PersistState(bool serializeBuffer);
117117

118118
void ToggleFocusMode();
119119
void ToggleFullscreen();

src/cascadia/TerminalApp/TerminalPaneContent.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ namespace winrt::TerminalApp::implementation
141141
// "attach existing" rather than a "create"
142142
args.ContentId(_control.ContentId());
143143
break;
144-
case BuildStartupKind::Persist:
144+
case BuildStartupKind::PersistAll:
145145
{
146146
const auto connection = _control.Connection();
147147
const auto id = connection ? connection.SessionId() : winrt::guid{};
@@ -156,6 +156,7 @@ namespace winrt::TerminalApp::implementation
156156
}
157157
break;
158158
}
159+
case BuildStartupKind::PersistLayout:
159160
default:
160161
break;
161162
}

src/cascadia/TerminalApp/TerminalWindow.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ static const std::array settingsLoadWarningsLabels{
5555
USES_RESOURCE(L"UnknownTheme"),
5656
USES_RESOURCE(L"DuplicateRemainingProfilesEntry"),
5757
USES_RESOURCE(L"InvalidUseOfContent"),
58+
USES_RESOURCE(L"InvalidRegex"),
5859
};
5960

6061
static_assert(settingsLoadWarningsLabels.size() == static_cast<size_t>(SettingsLoadWarnings::WARNINGS_SIZE));
@@ -265,11 +266,11 @@ namespace winrt::TerminalApp::implementation
265266
AppLogic::Current()->NotifyRootInitialized();
266267
}
267268

268-
void TerminalWindow::PersistState()
269+
void TerminalWindow::PersistState(bool serializeBuffer)
269270
{
270271
if (_root)
271272
{
272-
_root->PersistState();
273+
_root->PersistState(serializeBuffer);
273274
}
274275
}
275276

0 commit comments

Comments
 (0)