anchor.diff:           (dims (array-dimensions fb)))
       (setf (slot-value term 'width) (truncate (or width (- (second dims) (x-offset term))) 8)
             (slot-value term 'height) (truncate (or height (- (first dims) (y-offset term))) 16))
  +    (soft-reset term)
       (sys.graphics::bitset (* (terminal-height term) 16) (* (terminal-width term) 8)
                             (true-background-colour term) fb
                             (y-offset term) (x-offset term))))
   
   (defun report-unknown-escape (term)
     (format t "Failed to parse escape sequence ~S in state ~S.~%"
  -          (mapcar 'code-char (nreverse (slot-value term 'escape-sequence)))
  +          (reverse (slot-value term 'escape-sequence))
             (terminal-state term)))
   
   (defun write-terminal (term char)
  
positive.code:         (list (name-char "Left-Arrow")  '(#\Esc #\[ #\D))
          (list (name-char "Home")        '(#\Esc #\[ #\H))
          (list (name-char "End")         '(#\Esc #\[ #\F))
          (list (name-char "KP-Multiply") '(#\*))
          (list (name-char "KP-Divide")   '(#\/))
          (list (name-char "KP-Plus")     '(#\+))
  
negative.code:                 (1 (erase terminal 0 (x-pos terminal))) ; erase to left
                  (2 (erase terminal 0 (terminal-width terminal))) ; erase all
                  (t (report-unknown-escape terminal))))
               (#\L
                ;; Insert Pn lines, starting at the cursor. Lines move down.
                (when (<= (scroll-start terminal)
                          (y-pos terminal)
                          (1- (or (scroll-end terminal)
                                  (terminal-height terminal))))
                  (scroll-terminal terminal
                                   (y-pos terminal)
                                   (or (scroll-end terminal)
                                       (terminal-height terminal))
                                   (- (or (first (slot-value terminal 'parameters)) 1)))))
               (#\M
                ;; Delete Pn lines, starting at the cursor. Lines move up.
                (when (<= (scroll-start terminal)
                          (y-pos terminal)
                          (1- (or (scroll-end terminal)
                                  (terminal-height terminal))))
                    (scroll-terminal terminal
                                     (y-pos terminal)
                                     (or (scroll-end terminal)
                                         (terminal-height terminal))
                                     (or (first (slot-value terminal 'parameters)) 1))))
               (#\d
                (setf (y-pos terminal) (1- (or (first (slot-value terminal 'parameters)) 1))))
               (#\m (set-character-attributes terminal (nreverse (slot-value terminal 'parameters))))
               (#\r ; set scroll region.
                (let ((params (nreverse (slot-value terminal 'parameters))))
                  (setf (scroll-start terminal) (1- (or (first params) 1))
                        (scroll-end terminal) (when (second params)
                                                (1- (second params))))
                  (format t "Scroll region: ~D ~D~%" (scroll-start terminal) (scroll-end terminal))))
               #+nil(#\h) ; set mode **
               #+nil(#\l) ; clear mode **
               (#\!
                (if (or (slot-value terminal 'parameters)
                        (slot-value terminal 'current-number))
                    (report-unknown-escape terminal)
                    (return-from xterm-saw-bracket 'xterm-saw-bracket-exclaim)))
               (#\?
                (if (or (slot-value terminal 'parameters)
                        (slot-value terminal 'current-number))
  