move \r handling to from TermBuffer to TermWriter