Add \r at the beginning of each line, not the end

Prevents strange bug on ipython qtconsole