anchor.diff:                         (cons (fat-substring str 0 i) acc))))))
       (f str nil)))
   
  +(defun map-wrapping-line (string winwidth fn)
  +  (loop :with start := 0
  +    :for i := (wide-index string (1- winwidth) :start start)
  +    :while i :do
  +    (funcall fn i)
  +    (setq start i)))
  +
  +(defun window-wrapping-offset (window)
  +  (unless (buffer-truncate-lines (window-buffer window))
  +    (return-from window-wrapping-offset 0))
  +  (let ((offset 0))
  +    (labels ((f (string eof-p linum)
  +                (declare (ignore eof-p))
  +                (map-wrapping-line (if (= (window-vtop-linum window) linum)
  +                                       (subseq string (window-vtop-charpos window))
  +                                       string)
  +                                   (window-width window)
  +                                   #'(lambda (arg)
  +                                       (declare (ignore arg))
  +                                       (incf offset)))))
  +      (map-buffer-lines #'f
  +                        (window-buffer window)
  +                        (window-vtop-linum window)
  +                        (1- (window-current-linum window)))
  +      offset)))
  +
   (defvar *wrapping-fatstring* (make-fatstring "!" 0))
   
   (defun window-refresh-line-wrapping (window curx cury y str)
  
positive.code:     (charms/ll:wattroff (window-win window)
                          attr)))
  
  (defun window-wrapping-offset (window)
    (unless (buffer-truncate-lines (window-buffer window))
      (return-from window-wrapping-offset 0))
    (let ((offset 0))
      (labels ((f (string eof-p linum)
                  (declare (ignore eof-p))
                  (map-wrapping-line (if (= (window-vtop-linum window) linum)
                                         (subseq string (window-vtop-charpos window))
                                         string)
                                     (window-width window)
                                     #'(lambda (arg)
                                         (declare (ignore arg))
                                         (incf offset)))))
        (map-buffer-lines #'f
                          (window-buffer window)
                          (window-vtop-linum window)
                          (1- (window-current-linum window)))
        offset)))
  
  (defun window-cursor-y (window)
    (+ (- (window-current-linum window)
          (window-vtop-linum window))
       (if (buffer-truncate-lines (window-buffer window))
           (window-wrapping-offset window)
           0)))
  
  (defun window-print-line (window y str &key (start-x 0) (string-start 0) string-end)
    (check-type str fatstring)
  
negative.code:                  (window-vtop-linum window))
                (< 0 (window-vtop-charpos window)))
           -1)
          ((let ((n (- (window-cursor-y-if-wrapping window)
                       (- (window-height window) 2))))
             (when (< 0 n) n)))
          (t
  