anchor.diff:           (pos-x    (if floating 0 start-x))
            (pos-y    (get-pos-y view x y :modeline modeline)))
       (loop :while (< disp-x disp-x0)
  -       :for c-code := (get-charcode-from-scrwin view pos-x pos-y)
  -       :for c := (code-char c-code)
  -       :do (setf disp-x (lem-base:char-width c disp-x))
  +       :for code := (get-charcode-from-scrwin view pos-x pos-y)
  +       :do (setf disp-x (lem-base:char-width (code-char code) disp-x))
            ;; pos-x is incremented only 1 at wide characters
            ;; (except for utf-16 surrogate pair characters)
  -         (setf pos-x (+ pos-x (if (< c-code #x10000) 1 2))))
  +         (setf pos-x (+ pos-x (if (< code #x10000) 1 2))))
       pos-x))
   (defun get-pos-y (view x y &key (modeline nil))
     (+ y (ncurses-view-y view) (if modeline (ncurses-view-height view) 0)))
   
   ;; for mintty and ConEmu
  -;; adjust line width by using zero-width-space characters (#\u200b)
  +;; adjust line width by using zero-width-space character (#\u200b)
   (defun adjust-line (view x y &key (modeline nil))
     (unless (or (eq *windows-term-type* :mintty)
                 (eq *windows-term-type* :conemu))
  
positive.code:                (member *windows-code-page* '(932 936 949 950)))
      (charms/ll:mvwaddstr scrwin y x string)
      (return-from print-sub))
    ;; clear display area
    (let ((disp-width 0))
      (loop :for c :across string
         :for c-code := (char-code c)
         :do (incf disp-width)
           ;; check wide characters (except for cp932 halfwidth katakana)
           (when (and (> c-code #x7f)
                      (not (and (= *windows-code-page* 932)
                                (<= #xff61 c-code #xff9f))))
             (incf disp-width)))
      (charms/ll:mvwaddstr scrwin y x
                           (make-string disp-width :initial-element #\.))
      (charms/ll:refresh))
    ;; display wide characters
    (loop :for c :across string
       :for c-code := (char-code c)
       :with pos-x := x
       :do (charms/ll:mvwaddch scrwin y pos-x c-code)
         (incf pos-x)
         ;; check wide characters (except for cp932 halfwidth katakana)
         (when (and (> c-code #x7f)
                    (not (and (= *windows-code-page* 932)
                              (<= #xff61 c-code #xff9f))))
           (charms/ll:mvwaddch scrwin y pos-x c-code)
           (incf pos-x)
           (charms/ll:refresh))))
  
  
negative.code:   (let ((clist    '())
          (splitted nil))
      (loop :for c :across string
         :for code := (char-code c)
         :do (if (< code #x10000)
                 (push c clist)
                 ;; split to 2 characters
                 (multiple-value-bind (q r) (floor (- code #x10000) #x0400)
                   (push (code-char (+ q #xd800)) clist) ; leading surrogate
                   (push (code-char (+ r #xdc00)) clist) ; trailing surrogate
                   (setf splitted t))))
  