Done, please test.
One thing that I noticed and didn't like is that the arrows keys don't work (to change the insertion position).