Multiline codec unexpected line breaks

Hi all,

Using the multiline codec, there appears to be a bug which adds unexpected line breaks to a message when using tcp or stdin as input (possibly other input plugins too)

With the help of some coders on github I was able to confirm the bug and open an issue:

But since I'm not much of a coder myself I was hoping someone over here might have some idea's on how this bug could be solved.