Skip to content

Commit

Permalink
Fix a bug that could cause double newlines in text blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
nicbarker committed Dec 4, 2024
1 parent 9f0cf75 commit efec6ab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion clay.h
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,9 @@ Clay__MeasureTextCacheItem *Clay__MeasureTextCached(Clay_String *text, Clay_Text
previousWord = Clay__AddMeasuredWord(CLAY__INIT(Clay__MeasuredWord) { .startOffset = start, .length = length + 1, .width = dimensions.width, .next = -1 }, previousWord);
}
if (current == '\n') {
previousWord = Clay__AddMeasuredWord(CLAY__INIT(Clay__MeasuredWord) { .startOffset = start, .length = length, .width = dimensions.width, .next = -1 }, previousWord);
if (length > 1) {
previousWord = Clay__AddMeasuredWord(CLAY__INIT(Clay__MeasuredWord) { .startOffset = start, .length = length, .width = dimensions.width, .next = -1 }, previousWord);
}
previousWord = Clay__AddMeasuredWord(CLAY__INIT(Clay__MeasuredWord) { .startOffset = end + 1, .length = 0, .width = 0, .next = -1 }, previousWord);
}
measuredWidth += dimensions.width;
Expand Down

0 comments on commit efec6ab

Please sign in to comment.