X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/a9c0245444b7b67e077826089b026d46297fab64..d48db8b432f25d046b106e41a3ef9869fe9562b8:/terminal.c diff --git a/terminal.c b/terminal.c index ab97e3c4..f238f09e 100644 --- a/terminal.c +++ b/terminal.c @@ -668,6 +668,10 @@ static void scroll(int topline, int botline, int lines, int sb) * of course, if the line _hasn't_ moved into the * scrollback then we don't do this, and cut them off * at the top of the scroll region. + * + * This applies to selstart and selend (for an existing + * selection), and also selanchor (for one being + * selected as we speak). */ seltop = sb ? -savelines : 0; @@ -685,6 +689,13 @@ static void scroll(int topline, int botline, int lines, int sb) selend.x = 0; } } + if (selanchor.y >= seltop && selanchor.y <= botline) { + selanchor.y--; + if (selanchor.y < seltop) { + selanchor.y = seltop; + selanchor.x = 0; + } + } lines--; }