anchor.diff:                    (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
  
positive.code:     ((uiop:getenv "ConEmuBuild") :conemu)
      (t :cmd.exe)))
  
  ;; windows console code page
  (cffi:load-foreign-library '(:default "User32"))
  (defvar *windows-code-page*
    (cffi:foreign-funcall "GetConsoleOutputCP" :int))
  
  ;; for input
  ;; (we can't use *stdscr* for input because it calls wrefresh implicitly)
  (defvar *padwin* nil)
  (defun getch-pad ()
    (unless *padwin*
  
negative.code:                      (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))
  