]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
CSI 3 J now clears the scrollback, as in xterm.
authorJacob Nevins <jacobn@chiark.greenend.org.uk>
Tue, 5 Sep 2006 22:08:00 +0000 (22:08 +0000)
committerJacob Nevins <jacobn@chiark.greenend.org.uk>
Tue, 5 Sep 2006 22:08:00 +0000 (22:08 +0000)
[originally from svn r6847]
[this svn revision also touched putty-wishlist]

terminal.c

index b88fe069a05d27f3d895873e32fd7cdb516a8dcb..f5603a837909797edd1d25a908095bad80d2a11f 100644 (file)
@@ -3346,10 +3346,17 @@ static void term_out(Terminal *term)
                        break;
                      case 'J':       /* ED: erase screen or parts of it */
                        {
-                           unsigned int i = def(term->esc_args[0], 0) + 1;
-                           if (i > 3)
-                               i = 0;
-                           erase_lots(term, FALSE, !!(i & 2), !!(i & 1));
+                           unsigned int i = def(term->esc_args[0], 0);
+                           if (i == 3) {
+                               /* Erase Saved Lines (xterm)
+                                * This follows Thomas Dickey's xterm. */
+                               term_clrsb(term);
+                           } else {
+                               i++;
+                               if (i > 3)
+                                   i = 0;
+                               erase_lots(term, FALSE, !!(i & 2), !!(i & 1));
+                           }
                        }
                        term->disptop = 0;
                        seen_disp_event(term);