Skip to content

Commit 3f9ba36

Browse files
wip linux
Signed-off-by: Christian Parpart <[email protected]>
1 parent 551eac8 commit 3f9ba36

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

src/libunicode/grapheme_line_segmenter.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ class grapheme_line_segmenter<OptionalEventListener>
717717
// If not, we need to stop processing and return the current line.
718718
// If the input is exhausted, we need to return the current line.
719719
assert(processedTotalWidth < maxWidth);
720-
auto const* start = next();
720+
[[maybe_unused]] auto const* start = next();
721721
auto const chunk = detail::process_only_complex_unicode(
722722
_eventHandler, _complexUnicodeState, _complexUnicodeState.utf8DecodeNext, end(), maxWidth);
723723
assert(_complexUnicodeState.utf8DecodeNext <= chunk.end);

src/libunicode/test_main.cpp

+23-9
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,42 @@
2020
namespace
2121
{
2222

23-
struct SetupTeardown
23+
struct setup_teardown
2424
{
25-
SetupTeardown()
25+
#if defined(_WIN32)
26+
const DWORD stdoutHandle = GetStdHandle(STD_OUTPUT_HANDLE);
27+
const DWORD savedOutputCP = GetConsoleOutputCP();
28+
const DWORD savedOutputMode = []() -> DWORD {
29+
DWORD mode;
30+
GetConsoleMode(stdoutHandle, &mode);
31+
return mode;
32+
}();
33+
#endif
34+
35+
setup_teardown()
2636
{
2737
#if defined(_WIN32)
28-
const auto stdoutHandle = GetStdHandle(STD_OUTPUT_HANDLE);
29-
const auto stdoutCP = GetConsoleOutputCP();
30-
DWORD stdoutMode;
31-
GetConsoleMode(stdoutHandle, &stdoutMode);
32-
SetConsoleMode(stdoutHandle, ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
38+
SetConsoleMode(stdoutHandle,
39+
savedOutputMode | ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT
40+
| ENABLE_VIRTUAL_TERMINAL_PROCESSING);
3341
SetConsoleOutputCP(CP_UTF8);
3442
#endif
3543
}
3644

37-
~SetupTeardown() = default;
45+
~setup_teardown()
46+
{
47+
#if defined(_WIN32)
48+
SetConsoleMode(stdoutHandle, savedOutputMode);
49+
SetConsoleOutputCP(savedOutputCP);
50+
#endif
51+
}
3852
};
3953

4054
} // namespace
4155

4256
int main(int argc, char* argv[])
4357
{
44-
auto const _ = SetupTeardown {};
58+
[[maybe_unused]] auto const _ = setup_teardown {};
4559

4660
int result = Catch::Session().run(argc, argv);
4761

0 commit comments

Comments
 (0)