Prevent qtconsole frontend freeze on lots of output.

The output from the kernel is now clipped to last `buffer_size`
before displaying to prevent freezing the frontend on lots of
output from the kernel.
Test cases:
  In [1]: for i in xrange(1000000): print i
  In [2]: range(100000)

Without this commit the first input causes the qtconsole frontend
to freeze, not even responding to `Ctrl+C`.