1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Fix a cursor positioning infelicity.

The scenario: I start a small, say 80x24, pterm. I do some work in
it, generating plenty of scrollback, and eventually I `less' a file.
`less' switches to the alt screen. Then I want more vertical space
to look at the file, so I enlarge the window to more like 80x60.
When I quit `less' and switch back to the primary screen, some
scrollback has been pulled down into the screen, as expected - but
the saved _cursor position_ is still at line 24, not at the bottom
of the new terminal where the prompt it goes with has moved to.

Solution: term_size() should adjust the alt-screen saved cursor
positions as well as the normal cursor position.

(Curiously, the problem doesn't happen on my home Debian box, even
without this fix. It happens on my RH9 box at work, though.)

[originally from svn r7911]
This commit is contained in:
Simon Tatham 2008-03-07 18:30:37 +00:00
parent 9503c5e5c3
commit 4aa9b6a0da

View File

@ -1614,6 +1614,8 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines)
addpos234(term->screen, line, 0);
term->curs.y += 1;
term->savecurs.y += 1;
term->alt_y += 1;
term->alt_savecurs.y += 1;
} else {
/* Add a new blank line at the bottom of the screen. */
line = newline(term, newcols, FALSE);
@ -1634,6 +1636,8 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines)
term->tempsblines += 1;
term->curs.y -= 1;
term->savecurs.y -= 1;
term->alt_y -= 1;
term->alt_savecurs.y -= 1;
}
term->rows -= 1;
}
@ -1693,12 +1697,26 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines)
term->savecurs.y = 0;
if (term->savecurs.y >= newrows)
term->savecurs.y = newrows - 1;
if (term->savecurs.x >= newcols)
term->savecurs.x = newcols - 1;
if (term->alt_savecurs.y < 0)
term->alt_savecurs.y = 0;
if (term->alt_savecurs.y >= newrows)
term->alt_savecurs.y = newrows - 1;
if (term->alt_savecurs.x >= newcols)
term->alt_savecurs.x = newcols - 1;
if (term->curs.y < 0)
term->curs.y = 0;
if (term->curs.y >= newrows)
term->curs.y = newrows - 1;
if (term->curs.x >= newcols)
term->curs.x = newcols - 1;
if (term->alt_y < 0)
term->alt_y = 0;
if (term->alt_y >= newrows)
term->alt_y = newrows - 1;
if (term->alt_x >= newcols)
term->alt_x = newcols - 1;
term->alt_x = term->alt_y = 0;
term->wrapnext = term->alt_wnext = FALSE;