fix #99 - [Core] Bug in text wrapping at very narrow widths (#163)
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Waiting to run
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Failing after 1m36s
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Failing after 16s

This commit is contained in:
vince 2025-01-05 02:34:36 +01:00 committed by GitHub
parent 723f59dffd
commit 6cb9c7c483
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

1
clay.h
View File

@ -2392,6 +2392,7 @@ void Clay__CalculateFinalLayout(void) {
Clay__WrappedTextLineArray_Add(&Clay__wrappedTextLines, CLAY__INIT(Clay__WrappedTextLine) { { measuredWord->width, lineHeight }, { .length = measuredWord->length, .chars = &textElementData->text.chars[measuredWord->startOffset] } }); Clay__WrappedTextLineArray_Add(&Clay__wrappedTextLines, CLAY__INIT(Clay__WrappedTextLine) { { measuredWord->width, lineHeight }, { .length = measuredWord->length, .chars = &textElementData->text.chars[measuredWord->startOffset] } });
textElementData->wrappedLines.length++; textElementData->wrappedLines.length++;
wordIndex = measuredWord->next; wordIndex = measuredWord->next;
lineStartOffset = measuredWord->startOffset + measuredWord->length;
} }
// measuredWord->length == 0 means a newline character // measuredWord->length == 0 means a newline character
else if (measuredWord->length == 0 || lineWidth + measuredWord->width > containerElement->dimensions.width) { else if (measuredWord->length == 0 || lineWidth + measuredWord->width > containerElement->dimensions.width) {