Normally, when i copied text from an terminal window and paste it into an post i will do four spaces before i insert the text. This works for me for a long time.
After i switched to ubuntu & wayland i got the problem with unwanted line feeds.
I do not know what triggers the problem 🤔Solution
I will insert the text and use the code icon to format the text. That worked for me. Hope this helps someone with a similar problem