qtconsole: strip newline on text copy (fixes #6234)

IPython's inputsplitter inserts newline at the end of string passed to
it. So, if user didn't select newline before copying, we must strip it.