anchor.diff:           (cur-x   0))
       (loop :while (< disp-x disp-x0)
          :for code := (get-charcode-from-scrwin view pos-x pos-y)
  -       :do (incf disp-x (funcall disp-char-width-fn code))
  -           (incf pos-x  (funcall pos-char-width-fn  code))
  -           (incf cur-x  (funcall cur-char-width-fn  code)))
  +       :until (= code charms/ll:ERR)
  +       :do (incf disp-x (disp-char-width *windows-term-setting* code))
  +           (incf pos-x  (pos-char-width  *windows-term-setting* code))
  +           (incf cur-x  (cur-char-width  *windows-term-setting* code)))
       cur-x))
   
   ;; for mintty and ConEmu
   ;; adjust line width by using zero-width-space character (#\u200b)
   (defun adjust-line (view x y &key (modeline nil))
  -  (unless (slot-value *windows-term-setting* 'pos-char-width)
  +  (unless (and (slot-value *windows-term-setting* 'disp-char-width)
  +               (slot-value *windows-term-setting* 'pos-char-width))
       (return-from adjust-line))
     (let* ((start-x    (ncurses-view-x view))
            (disp-width (ncurses-view-width view))
  
positive.code: 
  ;; deal with utf-16 surrogate pair characters (screen memory)
  (defun get-charcode-from-scrwin (view x y)
    (let ((code (logand (charms/ll:mvwinch (ncurses-view-scrwin view) y x)
                        charms/ll:A_CHARTEXT)))
      (when (<= #xd800 code #xdbff)
        (let ((c-lead  code)
              (c-trail (logand (charms/ll:mvwinch (ncurses-view-scrwin view) y (+ x 1))
                               charms/ll:A_CHARTEXT)))
          (when (<= #xdc00 c-trail #xdfff)
            (setf code (+ #x10000 (* (- c-lead #xd800) #x0400) (- c-trail #xdc00))))))
      code))
  
  ;; for mintty and ConEmu
  ;; get pos-x/y for printing wide characters
  (defun get-pos-x (view x y &key (modeline nil))
    (unless (slot-value *windows-term-setting* 'pos-char-width)
      (return-from get-pos-x (+ x (ncurses-view-x view))))
    (let* ((disp-char-width-fn (disp-char-width-func))
           (pos-char-width-fn  (pos-char-width-func))
           (floating (not (ncurses-view-modeline-scrwin view)))
           (start-x  (ncurses-view-x view))
           (disp-x0  (+ x start-x))
           (disp-x   (if floating 0 start-x))
  
negative.code:          (pos-y    (get-pos-y view x y :modeline modeline)))
      (loop :while (< disp-x disp-x0)
         :for code := (get-charcode-from-scrwin view pos-x pos-y)
         :until (= code charms/ll:ERR)
         :do (incf disp-x (disp-char-width *windows-term-setting* code))
             (incf pos-x  (pos-char-width  *windows-term-setting* code)))
      pos-x))
  (defun get-pos-y (view x y &key (modeline nil))
    (+ y (ncurses-view-y view) (if modeline (ncurses-view-height view) 0)))
  