term: make sure to update 'current row' when restoring saved cursor

This commit is contained in:
Daniel Eklöf 2019-07-23 17:57:07 +02:00
parent f7519b5725
commit f5a6304850
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 20 additions and 3 deletions

View file

@ -267,6 +267,14 @@ term_reverse_index(struct terminal *term)
term_cursor_up(term, 1);
}
void
term_restore_cursor(struct terminal *term)
{
int row = min(term->saved_cursor.row, term->rows - 1);
int col = min(term->saved_cursor.col, term->cols - 1);
term_cursor_to(term, row, col);
}
void
term_focus_in(struct terminal *term)
{