DevConsole does not compute label size correctly for strings with newlines

In the CoreScripts, the code for computing the size of text in the layout is:

-- LogData, Line 34
local dims = TextService:GetTextSize(fmtMessage, FONT_SIZE, FONT,
return {
	Message = fmtMessage,
	CharCount = charCount,
	Type = type,
	Dims = dims,

-- LogOutput, Line 79
local msgDimsY = newestMsg.Dims.Y
-- [...]
if self.state.wordWrap and frameWidth > 0 then
	msgDimsY = newestMsg.Dims.Y * math.ceil(newestMsg.Dims.X / frameWidth)

In LogData, if the text being passed to TextService:GetTextSize() has n newlines in it, then the Dims.Y will end up as something like n*FONT_SIZE.

But the code in LogOutput assumes that Dims.Y == FONT_SIZE when calculating label size, which is not the case if there are any newlines in the string. This means the final label size will be n times larger than what it should be, which can make the output logs pretty sparse and difficult to navigate (since there is tons of whitespace between log messages).

A simple fix would be a one-line change in LogOutput:

msgDimsY = FONT_SIZE * math.ceil(newestMsg.Dims.X / frameWidth)

Maybe you have some internationalization or edge case requirements where FontSize doesn’t accurately represent the pixel size of a single line of output, but it would be nice if we could at least get an option to have label size be computed this way so that the console is usable with logs containing newlines (at least until you implement a real fix).


Thanks for the report! We’ll follow up when we have an update for you’