Closed Rakaneth closed 6 years ago
Weird stuff, hm... I'll take a look as soon as I can; family is visiting Jan 7 (today in most timezones) but I should be able to take a look after they head home. I wonder what's different between the two wrapping implementations...
This is very odd, but I've narrowed down a possible cause. Still working on a fix. It looks like (when using GDXMarkup to generate IColoredString instances) closing a color tag with []
before a space (but not after a space) causes wrap() to ignore the space, possibly due to the behavior of String.split()
with delimiters at the end of input. You can see on the bottom line here, the first space gets eaten:
This doesn't happen on the line above it because wrap() doesn't need to be called. The markup I'm using looks like this, where the text length is exactly within the line length for the first and one larger than the line length for the second (requiring wrapping):
smb.appendWrappingMessage(GDXMarkup.instance.colorString("[CW Red]alpha[] [CW Apricot]beta [][CW Yellow]gamma [CW Jade]delta [CW Blue]epsilon [CW Purple]zeta[]..."));
smb.appendWrappingMessage(GDXMarkup.instance.colorString("[CW Red]alpha[] [CW Apricot]beta [][CW Yellow]gamma [CW Jade]delta [CW Blue]epsilon [CW Purple]zeta[] eta"));
EDIT: Corrected a typo where "zeta" wasn't correctly colored because "CW" wasn't capitalized correctly. The image should have "zeta" in purple.
This should be fixed now. The current TinyTest code that produced the above screenshot before now looks like:
The issue did turn out to be
String.split()
; we now use StringKit.split()
, which has various subtle differences including preserving trailing spaces (at the very least, it does this when they're the only contents of the String being split up).
SquidMessageBox
seems to be exhibiting some odd behavior when wrappingIColoredString
s - it is eating spaces.This does not seem to occur in![image](https://user-images.githubusercontent.com/19420583/34647669-4c5b04c6-f356-11e7-8af7-d4b73dc6773c.png)
SquidPanel
(here I used a manualIColoredString.wrap()
):The relevant code can be found here, in the
describeCombat
function.