anchor.diff:      (tagbody :start
          (return-from get-event
            (let ((code (get-ch)))
  -           (cond ((= code -1) (go :start))
  +           (cond ((= code -1)
  +                  ;; retry is necessary to exit lem normally
  +                  ;;(go :start)
  +                  :retry)
                    ((= code resize-code)
                     ;;(setf esc-key nil)
                     ;; for resizing display
  
positive.code:                   (get-key code))))))))
  
  ;; workaround for exit problem
  (defun console-input-count ()
    (let ((hdl (cffi:foreign-funcall "GetStdHandle" :int -10 :int)))
      (cffi:with-foreign-objects ((count :int))
        (if (cffi:foreign-funcall "GetNumberOfConsoleInputEvents"
                                  :int hdl :pointer count :boolean)
            (cffi:mem-ref count :int)
            0))))
  
  ;; workaround for exit problem
  (defun input-loop (editor-thread)
    (handler-case
        (loop
  
negative.code:   (unless *padwin*
      (setf *padwin* (charms/ll:newpad 1 1))
      (charms/ll:keypad *padwin* 1)
      (charms/ll:PDC-save-key-modifiers 1)
      ;; timeout setting is necessary to exit lem normally
      (charms/ll:wtimeout *padwin* 100))
    (charms/ll:wgetch *padwin*))
  
  ;; for resizing display
  