<feed xmlns='http://www.w3.org/2005/Atom'>
<title>catch3/src/catch2/internal/catch_textflow.cpp, branch v3.16.0</title>
<subtitle>Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.</subtitle>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/'/>
<entry>
<title>Avoid a potential underflow when iterating over invalid inputs</title>
<updated>2026-05-14T08:58:09+00:00</updated>
<author>
<name>Dirk Müller</name>
</author>
<published>2026-05-07T07:39:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=69e0473f6e98d47c93518424c08ee69ee632c0f0'/>
<id>69e0473f6e98d47c93518424c08ee69ee632c0f0</id>
<content type='text'>
The forward iteration logic already bounds-check for m_it != m_string-&gt;end(),
do the same for the backward iteration. The issue with the assert is
that the assert() might not be compiled in, and it is happening after
the dereference, so it was too late.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The forward iteration logic already bounds-check for m_it != m_string-&gt;end(),
do the same for the backward iteration. The issue with the assert is
that the assert() might not be compiled in, and it is happening after
the dereference, so it was too late.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix counting of UTF-8 codepoints in TextFlow</title>
<updated>2026-04-01T14:12:08+00:00</updated>
<author>
<name>Jan Niklas Hasse</name>
</author>
<published>2026-03-28T15:02:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=572f96b8febec9dd14ac5284e6a959a7246325c8'/>
<id>572f96b8febec9dd14ac5284e6a959a7246325c8</id>
<content type='text'>
For line-wrapping bytes were counted instead of codepoints. This
resulted in line-breaks being inserted at the wrong position and also
breaking UTF-8 characters.

Fixes #1022.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For line-wrapping bytes were counted instead of codepoints. This
resulted in line-breaks being inserted at the wrong position and also
breaking UTF-8 characters.

Fixes #1022.
</pre>
</div>
</content>
</entry>
<entry>
<title>Handle ANSI escape sequences when performing column wrapping (#2849)</title>
<updated>2024-05-04T21:43:52+00:00</updated>
<author>
<name>Jeremy Rifkin</name>
</author>
<published>2024-05-04T21:43:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=8ce2426e53b2596a9823b4a314f72f1c3b30be82'/>
<id>8ce2426e53b2596a9823b4a314f72f1c3b30be82</id>
<content type='text'>
This PR adds functionality to skip around ANSI escape sequences in catch_textflow so they do not contribute to line length and line wrapping code does not split escape sequences in the middle. I've implemented this by creating a AnsiSkippingString abstraction that has a bidirectional iterator that can skip around escape sequences while iterating. Additionally I refactored Column::const_iterator to be iterator-based rather than index-based so this abstraction is a simple drop-in for std::string.

Currently only color sequences are handled, other escape sequences are left unaffected.

Motivation: Text with ANSI color sequences gets messed up when being output by Catch2 #2833.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR adds functionality to skip around ANSI escape sequences in catch_textflow so they do not contribute to line length and line wrapping code does not split escape sequences in the middle. I've implemented this by creating a AnsiSkippingString abstraction that has a bidirectional iterator that can skip around escape sequences while iterating. Additionally I refactored Column::const_iterator to be iterator-based rather than index-based so this abstraction is a simple drop-in for std::string.

Currently only color sequences are handled, other escape sequences are left unaffected.

Motivation: Text with ANSI color sequences gets messed up when being output by Catch2 #2833.</pre>
</div>
</content>
</entry>
<entry>
<title>Move-enable various parts of TextFlow</title>
<updated>2023-12-27T20:43:49+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2023-12-27T20:43:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=b52d97855d794175e69abc6f0eceee9ec3c1bd0e'/>
<id>b52d97855d794175e69abc6f0eceee9ec3c1bd0e</id>
<content type='text'>
This removes about 200 pointless copies from printing the help
message (the original motivation for the change), and also nicely
improves performance of the various reporters that depend on
TextFlow.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This removes about 200 pointless copies from printing the help
message (the original motivation for the change), and also nicely
improves performance of the various reporters that depend on
TextFlow.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix references to license file</title>
<updated>2022-10-28T09:30:15+00:00</updated>
<author>
<name>Lars Toenning</name>
</author>
<published>2022-10-28T09:22:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=f1084fb30990fe40c8f5b70034970c7eb4e1da72'/>
<id>f1084fb30990fe40c8f5b70034970c7eb4e1da72</id>
<content type='text'>
The license file was renamed with 6a502cc2f5fedd59b3495b58708f0d6d987ed9e1
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The license file was renamed with 6a502cc2f5fedd59b3495b58708f0d6d987ed9e1
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix quadratic runtime when linebreaking strings without newlines</title>
<updated>2021-11-03T23:23:56+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2021-11-03T23:22:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=912df7df354fd6c814b5d7c45ac44f494a5fb5fe'/>
<id>912df7df354fd6c814b5d7c45ac44f494a5fb5fe</id>
<content type='text'>
The problem was that every line would iterate from current line
start position to the end of the string, looking for a newline
to break on, leading to accidentally quadratic runtime. With this
change, the code only ever searches up to the current line's
length and not more.

Credit to @jorgenpt for the fix suggestion.

Closes #2315
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The problem was that every line would iterate from current line
start position to the end of the string, looking for a newline
to break on, leading to accidentally quadratic runtime. With this
change, the code only ever searches up to the current line's
length and not more.

Credit to @jorgenpt for the fix suggestion.

Closes #2315
</pre>
</div>
</content>
</entry>
<entry>
<title>Improve comments and names in TextFlow::Column</title>
<updated>2021-11-01T18:14:37+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2021-11-01T18:14:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=70c4ec78fbbfadb19d520c72b83f33cd0915c078'/>
<id>70c4ec78fbbfadb19d520c72b83f33cd0915c078</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Typedef Column::iterator as Column::const_iterator not vice versa</title>
<updated>2021-10-31T12:01:41+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2021-10-31T12:01:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=455ae0c561b6254e05c5fe619b08968187d28a70'/>
<id>455ae0c561b6254e05c5fe619b08968187d28a70</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add standardized copyright notice + SPDX identifier to source files</title>
<updated>2020-08-30T13:43:45+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2020-08-30T13:43:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=90aeffb97d6942d16f75a56b11e10fc0b010995a'/>
<id>90aeffb97d6942d16f75a56b11e10fc0b010995a</id>
<content type='text'>
This should also be done for test files, but that has lower priority.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This should also be done for test files, but that has lower priority.
</pre>
</div>
</content>
</entry>
<entry>
<title>Split TextFlow out from Clara</title>
<updated>2020-08-03T21:40:14+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2020-08-01T18:32:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=e7aa432850c34557e857d8675bff9b3f03de41b8'/>
<id>e7aa432850c34557e857d8675bff9b3f03de41b8</id>
<content type='text'>
Now that it has its own header, various reporter TUs that want to
format text do not have to also include Clara. Together with
outlining implementations from a header into a separate TU, this
has noticeably improved the compilation times of the testing impl.

As part of this split, I also implemented some improvements to the
TextFlow code in comparison to the upstream code. These are:

* Replaced the `Spacer` type with a free function that constructs
special `Column` that does the same thing.
* Generic performance improvements, such as eliminating needless
allocations, reserving space in needed allocations, and using smarter
algorithms in some places.
* Because `Column` only ever stored 1 string in its vector, it now
holds the string directly instead.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that it has its own header, various reporter TUs that want to
format text do not have to also include Clara. Together with
outlining implementations from a header into a separate TU, this
has noticeably improved the compilation times of the testing impl.

As part of this split, I also implemented some improvements to the
TextFlow code in comparison to the upstream code. These are:

* Replaced the `Spacer` type with a free function that constructs
special `Column` that does the same thing.
* Generic performance improvements, such as eliminating needless
allocations, reserving space in needed allocations, and using smarter
algorithms in some places.
* Because `Column` only ever stored 1 string in its vector, it now
holds the string directly instead.
</pre>
</div>
</content>
</entry>
</feed>
