anchor.diff:                  (setf cur-x (char-width c 0))))
       (< width (+ cur-x add-x))))
   
  -(defun cursor-end-line-and-width-p (window)
  -  "Check if the cursor is at the end of line and at the end of width."
  -  (unless (variable-value 'truncate-lines :default (window-buffer window))
  -    (return-from cursor-end-line-and-width-p nil))
  -  (let* ((lem-base::*tab-size* (variable-value 'tab-width :default (window-buffer window)))
  -         (point   (window-buffer-point window))
  -         (charpos (point-charpos point))
  -         (line    (line-string point))
  -         (width   (1- (window-width window)))
  -         (cur-x   0)
  -         (add-x   2))
  -    (unless (end-line-p point)
  -      (return-from cursor-end-line-and-width-p nil))
  -    (loop :for i :from 0 :below charpos
  -          :for c := (schar line i)
  -          :do (setf cur-x (char-width c cur-x))
  -              (when (< width cur-x)
  -                (setf cur-x (char-width c 0))))
  -    (< width (+ cur-x add-x))))
  -
   (defun map-wrapping-line (window string fn)
     (let ((lem-base::*tab-size* (variable-value 'tab-width :default (window-buffer window))))
       (loop :with start := 0
  
positive.code:                (setf pos-count pos-size)
                 (incf pos-last)
                 (when (>= pos-last pos-size) (setf pos-last 0)))))
        (loop :do (block outer
                    (pos-ring-push 0)
                    (map-wrapping-line
                     window
                     (line-string point)
                     (lambda (i)
                       (when first-line
                         (when (< (point-charpos point) i)
                           (return-from outer))
                         (setf off-x (- (point-charpos point) i)))
                       (pos-ring-push i))))
                  (when (>= pos-count (1+ n1))
                    (line-offset point 0 (+ (aref pos-ring pos-last) off-x))
                    (return-from move-to-previous-virtual-line-n point))
                  (if (line-offset point -1)
                      (progn
                        (setf first-line nil)
                        (decf n1 pos-count)
                        (setf pos-size  (1+ n1)) ; shrink ring-buffer
                        (setf pos-count 0)
                        (setf pos-next  0)
                        (setf pos-last  0))
                      (return-from move-to-previous-virtual-line-n nil))))))
  
  (defun move-to-next-virtual-line (point &optional n (window (current-window)))
    (unless n (setf n 1))
    (unless (zerop n)
  
      ;; workaround for cursor movement problem
      (when (cursor-end-line-and-width-p window)
        (setf *next-line-prev-column* 0))
  
      (if *use-new-vertical-move-function*
  
negative.code: (defvar *window-id-counter* 0)
  
  (defvar *use-new-vertical-move-function* t)
  (defvar *use-cursor-movement-workaround* t)
  
  (defclass window ()
    ((id
  