Down arrow dont be weird

This improves the way the down arrows performs after a paste.
It also adds support for control Home (goes to 0,0 on a document) and moves focus
I also re-factored some bits, apologies for the Chrome mess I had to add..  Happy for the try statement to be worked around if someone can find a solid cross platform fix.

Also note I left a lot of console logging in, this is because this can be a pita to debug.