X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=terminal.c;h=ac8f5dff420489f1110f4887f3f13587ae0b5e41;hb=068b67d2f6e9b186b3107ebcb1e88a141b7b5ebc;hp=4a3bb1f8e3992e824efd9535048eda1240f6c388;hpb=271de3e4ec5682e5c2822824769ea91692e6fa0e;p=PuTTY.git diff --git a/terminal.c b/terminal.c index 4a3bb1f8..ac8f5dff 100644 --- a/terminal.c +++ b/terminal.c @@ -1527,12 +1527,44 @@ void term_reconfig(Terminal *term, Conf *conf) void term_clrsb(Terminal *term) { unsigned char *line; + int i; + + /* + * Scroll forward to the current screen, if we were back in the + * scrollback somewhere until now. + */ term->disptop = 0; + + /* + * Clear the actual scrollback. + */ while ((line = delpos234(term->scrollback, 0)) != NULL) { sfree(line); /* this is compressed data, not a termline */ } + + /* + * When clearing the scrollback, we also truncate any termlines on + * the current screen which have remembered data from a previous + * larger window size. Rationale: clearing the scrollback is + * sometimes done to protect privacy, so the user intention is + * specifically that we should not retain evidence of what + * previously happened in the terminal, and that ought to include + * evidence to the right as well as evidence above. + */ + for (i = 0; i < term->rows; i++) + check_line_size(term, scrlineptr(i)); + + /* + * 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 + * screen which should be displayed as if part of the scrollback. + */ term->tempsblines = 0; term->alt_sblines = 0; + + /* + * Update the scrollbar to reflect the new state of the world. + */ update_sbar(term); }