--- rxvt-unicode/src/screen.C 2008/11/04 15:09:51 1.317 +++ rxvt-unicode/src/screen.C 2008/11/04 23:20:17 1.320 @@ -160,12 +160,9 @@ void rxvt_term::scr_reset () { -#if ENABLE_OVERLAY - scr_overlay_off (); -#endif - - rvideo_mode = false; + scr_soft_reset (); view_start = 0; + num_scr = 0; if (ncol == 0) @@ -177,9 +174,6 @@ if (ncol == prev_ncol && nrow == prev_nrow) return; - if (current_screen != PRIMARY) - scr_swap_screen (); - // we need at least two lines for wrapping to work correctly while (nrow + saveLines < 2) { @@ -401,8 +395,6 @@ clamp_it (screen.cur.row, 0, nrow - 1); clamp_it (screen.cur.col, 0, ncol - 1); - - free (tabs); } CLEAR_ALL_SELECTION (); @@ -410,14 +402,6 @@ prev_nrow = nrow; prev_ncol = ncol; - tabs = (char *)rxvt_malloc (ncol); - - for (int col = ncol; --col; ) - tabs [col] = col % TABSIZE == 0; - - if (current_screen != PRIMARY) - scr_swap_screen (); - tt_winch (); HOOK_INVOKE ((this, HOOK_RESET, DT_END)); @@ -438,15 +422,16 @@ free (row_buf); free (swap_buf); free (drawn_buf); - free (tabs); + row_buf = 0; // signal that we freed all the arrays above - row_buf = 0; // signal that we freed all the arrays + free (tabs); + tabs = 0; } } /* ------------------------------------------------------------------------- */ /* - * Hard reset + * Hard/Soft reset */ void rxvt_term::scr_poweron () @@ -459,6 +444,30 @@ scr_refresh (); } +void +rxvt_term::scr_soft_reset () +{ + /* only affects modes, nothing drastic such as clearing the screen */ +#if ENABLE_OVERLAY + scr_overlay_off (); +#endif + + rvideo_mode = false; + + if (current_screen != PRIMARY) + scr_swap_screen (); + + free (tabs); + tabs = (char *)rxvt_malloc (ncol); + + for (int col = ncol; --col; ) + tabs [col] = col % TABSIZE == 0; + + scr_scroll_region (0, MAX_ROWS - 1); + scr_rendition (0, ~RS_None); + scr_insert_mode (0); +} + /* ------------------------------------------------------------------------- * * PROCESS SCREEN COMMANDS * * ------------------------------------------------------------------------- */