]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Don't unconditionally reset scrollback on certain escape sequences.
authorSimon Tatham <anakin@pobox.com>
Sat, 25 Jan 2014 18:38:38 +0000 (18:38 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 25 Jan 2014 18:38:38 +0000 (18:38 +0000)
Handlers for a number of escape sequences, notably including ESC[J and
the sequences that switch to/from the alternate screen, were
unconditionally resetting the scrollback instead of first checking the
'Reset scrollback on display activity' configuration option. I've
added the missing if statements, so now 'Reset scrollback on display
activity' should actually mean what it says.

For example, this would have inconvenienced an mplayer user, who
wouldn't be able to go up and check their scrollback while mplayer was
repeatedly redisplaying its status line, because mplayer uses ESC[J to
erase each version of the status line before printing the next
version.

[originally from svn r10125]

terminal.c

index bd77f2397878d085a6646ca508a80acb1405c448..71b3bec676d59b9afe65d33637ebb7151d568c15 100644 (file)
@@ -2517,7 +2517,8 @@ static void toggle_mode(Terminal *term, int mode, int query, int state)
            compatibility(OTHER);
            deselect(term);
            swap_screen(term, term->no_alt_screen ? 0 : state, FALSE, FALSE);
-           term->disptop = 0;
+            if (term->scroll_on_disp)
+                term->disptop = 0;
            break;
          case 1000:                   /* xterm mouse 1 (normal) */
            term->xterm_mouse = state ? 1 : 0;
@@ -2537,7 +2538,8 @@ static void toggle_mode(Terminal *term, int mode, int query, int state)
            compatibility(OTHER);
            deselect(term);
            swap_screen(term, term->no_alt_screen ? 0 : state, TRUE, TRUE);
-           term->disptop = 0;
+            if (term->scroll_on_disp)
+                term->disptop = 0;
            break;
          case 1048:                   /* save/restore cursor */
            if (!term->no_alt_screen)
@@ -2553,7 +2555,8 @@ static void toggle_mode(Terminal *term, int mode, int query, int state)
            swap_screen(term, term->no_alt_screen ? 0 : state, TRUE, FALSE);
            if (!state && !term->no_alt_screen)
                save_cursor(term, state);
-           term->disptop = 0;
+            if (term->scroll_on_disp)
+                term->disptop = 0;
            break;
          case 2004:                   /* xterm bracketed paste */
            term->bracketed_paste = state ? TRUE : FALSE;
@@ -3015,7 +3018,8 @@ static void term_out(Terminal *term)
                if (has_compat(SCOANSI)) {
                    move(term, 0, 0, 0);
                    erase_lots(term, FALSE, FALSE, TRUE);
-                   term->disptop = 0;
+                    if (term->scroll_on_disp)
+                        term->disptop = 0;
                    term->wrapnext = FALSE;
                    seen_disp_event(term);
                    break;
@@ -3295,7 +3299,8 @@ static void term_out(Terminal *term)
                            request_resize(term->frontend, 80, term->rows);
                        term->reset_132 = 0;
                    }
-                   term->disptop = 0;
+                    if (term->scroll_on_disp)
+                        term->disptop = 0;
                    seen_disp_event(term);
                    break;
                  case 'H':            /* HTS: set a tab */
@@ -3319,7 +3324,8 @@ static void term_out(Terminal *term)
                            }
                            ldata->lattr = LATTR_NORM;
                        }
-                       term->disptop = 0;
+                        if (term->scroll_on_disp)
+                            term->disptop = 0;
                        seen_disp_event(term);
                        scrtop.x = scrtop.y = 0;
                        scrbot.x = 0;
@@ -3517,7 +3523,8 @@ static void term_out(Terminal *term)
                                erase_lots(term, FALSE, !!(i & 2), !!(i & 1));
                            }
                        }
-                       term->disptop = 0;
+                       if (term->scroll_on_disp)
+                            term->disptop = 0;
                        seen_disp_event(term);
                        break;
                      case 'K':       /* EL: erase line or parts of it */
@@ -4424,7 +4431,8 @@ static void term_out(Terminal *term)
                    break;
                  case 'J':
                    erase_lots(term, FALSE, FALSE, TRUE);
-                   term->disptop = 0;
+                    if (term->scroll_on_disp)
+                        term->disptop = 0;
                    break;
                  case 'K':
                    erase_lots(term, TRUE, FALSE, TRUE);
@@ -4479,7 +4487,8 @@ static void term_out(Terminal *term)
                    /* compatibility(ATARI) */
                    move(term, 0, 0, 0);
                    erase_lots(term, FALSE, FALSE, TRUE);
-                   term->disptop = 0;
+                    if (term->scroll_on_disp)
+                        term->disptop = 0;
                    break;
                  case 'L':
                    /* compatibility(ATARI) */
@@ -4502,7 +4511,8 @@ static void term_out(Terminal *term)
                  case 'd':
                    /* compatibility(ATARI) */
                    erase_lots(term, FALSE, TRUE, FALSE);
-                   term->disptop = 0;
+                    if (term->scroll_on_disp)
+                        term->disptop = 0;
                    break;
                  case 'e':
                    /* compatibility(ATARI) */