fix multiple bugs in CGUIStaticText::breakText()
3D Engine c++
Brought to you by:
cutealien,
nimphoenix2
Left-to-Right:
\r to prevent out-of-bounds array access.0x00AD) substring logic so the control character is no longer incorrectly prepended to the next line.\0) from being erroneously appended to whitespace strings.Right-to-Left:
size to size - 1.\r\n) and properly adjusted the iterator after Text.erase() to prevent skipping characters.i == 0) was wrongly truncated from the output.isWhitespace variable for consistent logic with LTR path.
Thanks for your patch and sorry I didn't find time&energy so long to apply it. It's now in svn #r6830 with some minor changes : First bounds-check shouldn't be needed as string always has 0 behind size (thought it also wouldn't hurt to test I guess). Not splitting anymore if soft hyphen is first character (would just add empty line). Some variable renaming to avoid confused IDE's
findNextreturns-1on not found, so I guess it should beif (idxHyphen > 0)Ah thanks a lot! Yeah, back to != -1 or > 0 certainly (rewrote it different first, etc... stupid bug, guess I'm still too tired for doing patches).