diff --git a/terminal.c b/terminal.c index c1a12c04..528f8f9b 100644 --- a/terminal.c +++ b/terminal.c @@ -1633,6 +1633,13 @@ void term_clrsb(Terminal *term) for (i = 0; i < term->rows; i++) check_line_size(term, scrlineptr(i)); + /* + * That operation has invalidated the selection, if it overlapped + * the scrollback at all. + */ + if (term->selstate != NO_SELECTION && term->selstart.y < 0) + deselect(term); + /* * There are now no lines of real scrollback which can be pulled * back into the screen by a resize, and no lines of the alternate