Saved cursor should stay on screen.

Term.js will crash by writing past this.lines if you save cursor position with a bigger terminal, then resize it to a smaller one, then try to restore the cursor position. To reproduce the problem:

0. assume the initial window size is 20
1. move cursor to the last row (y = 20)
2. enter into vim (savedY = 20)
3. resize terminal to 15 (rows = 15)
4. exit vim, which triggers cursor restore. this.y = this.savedY (y = 20, rows = 15)
5. terminal crashes when receiving new data

This patch makes sure that saved cursor position will stay on screen (as normal cursors do).