DiffEditor: replace carriage return chars with spaces.

Make sure text block is valid before using its layout.

Task-number: QTCREATORBUG-12056
Change-Id: I618edfcf549b675282587aed577810b806692bd4
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>