Manual porting of: Issue 6130: Text copied from console has lots of line breaks
Issue 6130: test fixes
More test fixes for issue 6130