anchor.diff:  (defun xterm-esc-dispatch (terminal char)
     (push char (slot-value terminal 'intermediate-characters))
     (let ((intermediates (reverse (slot-value terminal 'intermediate-characters))))
  -    (cond ((equal intermediates '(#\7))
  +    (cond ((equal intermediates '(#\D)) ; Index (IND).
  +           (xterm-execute terminal #\Lf))
  +          ((equal intermediates '(#\E)) ; Next Line (NEL).
  +           (xterm-execute terminal #\Lf)
  +           (xterm-execute terminal #\Cr))
  +          ((equal intermediates '(#\M)) ; Reverse Index (RI).
  +           (cond ((eql (y-pos terminal)
  +                       (or (scroll-start terminal)
  +                           0))
  +                  (scroll-terminal terminal
  +                                   (scroll-start terminal)
  +                                   (or (scroll-end terminal)
  +                                       (terminal-height terminal))
  +                                   -1))
  +                 (t (decf (y-pos terminal)))))
  +          ((equal intermediates '(#\7)) ; Save Cursor (DECSC).
              (save-cursor terminal))
  -          ((equal intermediates '(#\8))
  +          ((equal intermediates '(#\8)) ; Restore Cursor (DECRC).
              (restore-cursor terminal))
             ((equal intermediates '(#\( #\B))
              ;; Set G0 character set.
  
positive.code:                                  (or (scroll-end terminal)
                                       (terminal-height terminal))
                                   (- (or (first params) 1)))))
               (#\M
                ;; Delete Pn lines, starting at the cursor. Lines move up.
                (when (<= (scroll-start terminal)
                          (y-pos terminal)
  
negative.code:          (setf (background-colour terminal) (third attributes)))
          (t (dolist (attr attributes)
               (case attr
                 ((0 nil) ;; Normal (reset to defaults).
                  (setf (bold terminal) nil
                        (inverse terminal) nil
                        (underline terminal) nil
  