term.js icon indicating copy to clipboard operation
term.js copied to clipboard

Saved cursor should stay on screen.

Open hayeah opened this issue 11 years ago • 0 comments

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:

  1. assume the initial window size is 20
  2. move cursor to the last row (y = 20)
  3. enter into vim (savedY = 20)
  4. resize terminal to 15 (rows = 15)
  5. exit vim, which triggers cursor restore. this.y = this.savedY (y = 20, rows = 15)
  6. terminal crashes when receiving new data

This patch makes sure that saved cursor position will stay on screen (as normal cursors do).

hayeah avatar Jan 09 '14 06:01 hayeah