https://pastebin.com/Qrj2N9zWI also noticed a small bug as well. I had to reset the Font in the window's contents before every draw to ensure that they wouldn't affect calculating the correct size for the window. For example, I had an event use
bold in the first message and none in the second. The bold flag was still on when it was calculating the text width for the second message, so the resulting window width was
larger than expected.
However, this bug is still present if you abuse any of the commands that affect the shape of the text (bold, italics, changing the font name, maybe shadows?). The resulting window size might be too small. Basically just avoid using those