anchor.diff:      (move win (car pos) (+ (cadr pos) inptr))
       (refresh win)))
   
  -;; is this better than a form-specific method?
  +;; TODO: delete, replaced by (draw win form)
   (defun draw-form (win form)
     "Draw the form by drawing the fields, then moving the cursor to the current field."
     ;; TODO: "current" field or "active" field??
  
positive.code:     ;; this is the only place we set the attribute for the whole field
      (change-attributes win width '(:underline))))
  
  ;; echo a single char to the field instead all these routines
  ;; TODO: we do not have to clear the field completely every time
  ;; we can write the string first, then clear the rest of the field.
  
  (defgeneric draw (window object)
    (:documentation "Draw forms and their elements like fields and buttons."))
  
negative.code: 
         (draw-field win field)) )))
  
  ;; prev-field and next-field are the only two elements where the current-field-number is changed.
  ;; here also current-field has to be set.
  (defun select-prev-field (win event form)
    "Select the previous field in a form's field list."
    ;;(declare (special form))
    (with-accessors ((fields .fields) (current-field-number .current-field-number) (current-field .current-field)) form
      ;; use mod to cycle the field list.
      (setf current-field-number (mod (- current-field-number 1) (length fields)))
      ;; TODO: before we can set the prev current field, we have to setf the first current field.
      (setf current-field (nth current-field-number fields)))
    ;; after we switched the field number, we also have to move the cursor.
    (update-cursor-position win form)
    (refresh win))
  
  (defun select-next-field (win event form)
    "Select the next field in a form's field list."
    ;;(declare (special form))
    (with-accessors ((fields .fields) (current-field-number .current-field-number) (current-field .current-field)) form
      ;; use mod to cycle the field list.
      (setf current-field-number (mod (+ current-field-number 1) (length fields)))
      (setf current-field (nth current-field-number fields)))
    ;; after we switched the field number, we also have to move the cursor.
    (update-cursor-position win form)
    (refresh win))
  
  (defun move-prev-char (win event form)
    "Move the cursor to the previous char in the current field."
    (with-accessors ((current-field .current-field)) form
      (with-accessors ((inptr .fill-pointer)) current-field
        (when (> inptr 0)
          (decf inptr))))
    (update-cursor-position win form)
    (refresh win))
  
  (defun move-next-char (win event form)
    "Move the cursor to the previous char in the current field."
    (with-accessors ((current-field .current-field)) form
      (with-accessors ((inbuf .buffer) (inptr .fill-pointer)) current-field
        (when (< inptr (length inbuf))
          (incf inptr))))
    (update-cursor-position win form)
    (refresh win))
  
  ;; :backspace, delete one char to the left
  (defun delete-prev-char (win event form)
    "Delete the previous char in the current field, moving the cursor to the left."
    (with-accessors ((current-field .current-field)) form
      (with-accessors ((inbuf .buffer) (inptr .fill-pointer)) current-field
        (when (> inptr 0)
          (decf inptr)
          (setf inbuf (remove-nth (- (length inbuf) 1 inptr) inbuf))))
      ;; we dont have to redraw the complete form, just the changed field.
      (draw win current-field))
    (refresh win))
  
  ;; :dc, delete one char to the right
  (defun delete-next-char (win event form)
    "Delete the next char in the current field, not moving the cursor."
    (with-accessors ((current-field .current-field)) form
      (with-accessors ((inbuf .buffer) (inptr .fill-pointer)) current-field
        ;; we can only delete to the right if the inptr is not at the end of the inbuf.
        (when (> (length inbuf) inptr)
          (setf inbuf (remove-nth (- (length inbuf) (1+ inptr)) inbuf))))
      (draw win current-field))
    (refresh win))
  
  ;; TODO: test that char is graphic
  (defun form-add-char (win char form)
    "Add char to the current field of the form."
    (with-accessors ((current-field .current-field)) form
      (with-accessors ((width .width) (inbuf .buffer) (inptr .fill-pointer)) current-field
        (let ((len (length inbuf)))
          ;; only add chars when we haven reached the max width of the field
  