anchor.diff:  ;; deal with utf-16 surrogate pair characters (input)
   (defun get-key (code)
     (when (<= #xd800 code #xdbff)
  -    (charms/ll:timeout 100)
       (let ((c-lead  code)
             (c-trail (getch-pad)))
         (when (<= #xdc00 c-trail #xdfff)
  -        (setf code (+ #x10000 (* (- c-lead #xd800) #x0400) (- c-trail #xdc00))))
  -      (charms/ll:timeout -1)))
  +        (setf code (+ #x10000 (* (- c-lead #xd800) #x0400) (- c-trail #xdc00))))))
     (char-to-key (code-char code)))
   
   ;; enable modifier keys
  
positive.code:              (progn
                 (unless (bt:thread-alive-p editor-thread) (return))
                 (let ((event (get-event)))
                   (if (eq event :abort)
                       (send-abort-event editor-thread nil)
                       (send-event event)))
                 ;; workaround for exit problem
                 (when (<= (console-input-count) 10)
                   (sleep 0.0001)))
             #+sbcl
             (sb-sys:interactive-interrupt (c)
               (declare (ignore c))
               (send-abort-event editor-thread t))))
      (exit-editor (c) (return-from input-loop c))))
  
  ;; workaround for exit problem
  (defmethod lem-if:invoke ((implementation ncurses) function)
    (let ((result nil)
          (input-thread (bt:current-thread)))
      (unwind-protect
           (progn
             (when (lem.term:term-init)
               (let ((editor-thread
                      (funcall function
                               nil
                               (lambda (report)
                                 (bt:interrupt-thread
                                  input-thread
                                  (lambda () (error 'exit-editor :value report)))))))
                 (setf result (input-loop editor-thread))
                 ;; workaround for exit problem
                 ;; (to avoid 'compilation unit aborted caught 1 fatal ERROR condition')
                 (bt:join-thread editor-thread)
                 )))
        (lem.term:term-finalize))
      (when (and (typep result 'exit-editor)
                 (exit-editor-value result))
        (format t "~&~A~%" (exit-editor-value result)))))
  
  ;; workaround for display update problem (incomplete)
  (defun force-refresh-display (width height)
  
negative.code:            ((= code #x210) (setf code #x05c))
             ;; M-[
             ((= code #x1f1)
              (let ((code1 (getch-pad)))
                (cond
  		;; drop mouse escape sequence
  