Strings with CR+LF (\r+\n) were wrongly fixed into \r, which is enough to display them correctly, but the missing \n became important once the text was saved/reloaded.
By removing the \r instead of the \n, then the text is displayed correctly and saved correctly.