WIP: Refactoring of printing to re-use more code between IJulia and REPL

Refactors the printing code to hopefully clean it up, simplify it, improve (true) coverage, and make IJulia support consistent.