My project size isn't trivial, and that's why I gave that small example just to illustrate it, hoping someone had seen this before and knows what's going on.
I'm trying to find out if this is happening in any of my smaller projects, but meanwhile I remembered I have an older one, that my current one was based of off, and it was already happening there, and I have it in this repo here. If you test it, just press the Space bar to generate a new map and watch how the output window behaves each time you do that.
By the way, to be clear, that happens in the in-godot output window. The external stdout window shows everything fine (as far as I can tell). Here's a screenshot of my current project's.
(You can see in that screenshot that every time I generate a new map, the output creates an additional one-line output, but it also adds that new one-line output to the previous one-line outputs. Which is quite strange...)
I managed to get a similar effect on another project by having an output overflow on two big nested loops (just by outputing the indices
(i, j)), but then I noticed that in my current project (and the one in that repository) I don't need to do that. Just re-generating a new map does it.