Fix window size bugs

When gitsh was started in a terminal emulator window, and that window is resized, then there can be strange problems. Most commonly, when the command reaches the point where it would have needed to wrap to a new line on the original window size, it goes back to the start of the line and starts overwriting the prompt and the start of the command. If you use IRB a lot you might have seen this there too.

It's a little tricky to reproduce, but I'm pretty sure this is the solution.

Fixes #144