anchor.diff:                 (let ((event (get-event)))
                    (case event
                      ;; retry is necessary to exit lem normally
  -                   (:retry)
  +                   (:retry
  +                    (sleep *input-polling-interval*))
                      (:abort
                       (send-abort-event editor-thread nil))
                      (t
  
positive.code:                     :until (or (= code2 -1)
                                 (= code2 #x04d)	   ; M
                                 (= code2 #x06d)))   ; m
                   (setf code -1)))))
             ))
          ;; normal key workaround
          (t
  
negative.code: 
  ;; load windows dll
  (cffi:load-foreign-library '(:default "kernel32"))
  (cffi:load-foreign-library '(:default "winmm"))
  
  ;; windows console code page
  (defvar *windows-code-page*
    (cffi:foreign-funcall "GetConsoleOutputCP" :int))
  
  ;; input polling interval (sec)
  ;;   (we don't use PDCurses's internal polling timer (0.05 sec interval))
  ;;   (when interval is less than 0.01, high precision timer is used)
  (defvar *input-polling-interval* 0.01)
  (defun get-input-polling-interval ()
    *input-polling-interval*)
  (let ((high-precision nil)
        (exit-hook      nil))
    (defun set-input-polling-interval (v)
      (setf *input-polling-interval* v)
      (cond
        ((< v 0.01)
         (unless high-precision
           (setf high-precision t)
           (cffi:foreign-funcall "timeBeginPeriod" :int 1 :int))
         (unless exit-hook
           (setf exit-hook t)
           (add-hook *exit-editor-hook*
                     (lambda ()
                       (when high-precision
                         (cffi:foreign-funcall "timeEndPeriod" :int 1 :int))))))
        (t
         (when high-precision
           (setf high-precision nil)
           (cffi:foreign-funcall "timeEndPeriod" :int 1 :int)))))
    (set-input-polling-interval *input-polling-interval*))
  
  ;; for input
  ;; (we can't use stdscr for input because it calls wrefresh implicitly)
  