From: Simon Tatham Date: Sat, 8 Jul 2000 16:09:39 +0000 (+0000) Subject: Silly mistake - restore-cursor-pos doesn't make sure the cursor X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fzlib-dll;p=PuTTY.git 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] --- 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;