From f5a6304850fd7344f72355416cfbfd69b76482c4 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 23 Jul 2019 17:57:07 +0200 Subject: term: make sure to update 'current row' when restoring saved cursor --- terminal.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index 84bfcc31..871e6dcb 100644 --- a/terminal.c +++ b/terminal.c @@ -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) { -- cgit v1.3