Commit Graph
4 Commits
Author SHA1 Message Date
Vadim Zeitlin 38424e5f7b Add support for wrapping on non-ASCII space characters
Break lines on zero width space and other Unicode characters with the
"white space" property, but not non-breaking ones.

Closes #751.
2025-10-25 15:59:25 +02:00
Vadim Zeitlin f741789a10 Add a pseudo test allowing to test wxTextWrapper interactively
By defining WX_TEST_TEXT_WRAP and WX_TEST_TEXT_WIDTH it's possible to
see how the given text would be wrapped at the given width, which is
useful for testing.
2025-01-20 16:24:21 +01:00
Vadim Zeitlin c056a2f4f8 Fix wxTextWrapper::Wrap() when width is just at the word boundary
Don't move words to the next line if they just fit into the current one.

This requires checking for the space just at the boundary before looking
for the previous or next space and also using the correct predicate with
lower_bound() which uses inexact comparison.
2025-01-20 16:24:21 +01:00
Vadim Zeitlin 5972730200 Fix logic in wxTextWrapper::Wrap()
The existing code behaved completely wrongly whenever a word longer than
the maximal width was present as it just gave up and didn't wrap
anything at all after it -- when it should have just let this word
overflow but still wrap the rest.

Fix this and add a unit test checking that this works correctly now
(several of the tests would have failed before).

Closes #23339.
2025-01-20 16:24:21 +01:00