From 81b923a824fef6b1e11396dae2f50a7796f673ac Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 8 Jul 2000 16:09:39 +0000 Subject: [PATCH] Silly mistake - restore-cursor-pos doesn't make sure the cursor position is inside the screen (it might not be if the screen has shrunk since the save of cursor position). Thanks to Robert de Bath. [originally from svn r512] --- terminal.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/terminal.c b/terminal.c index 856d5b19..dc9b2b6c 100644 --- a/terminal.c +++ b/terminal.c @@ -495,6 +495,9 @@ static void save_cursor(int save) { } else { curs_x = save_x; curs_y = save_y; + /* Make sure the window hasn't shrunk since the save */ + if (curs_x >= cols) curs_x = cols-1; + if (curs_y >= rows) curs_y = rows-1; curr_attr = save_attr; cset = save_cset; cset_attr[cset] = save_csattr;