           cursor-xy             (atom nil)
 
           key-chan         (async/chan)
-          #_#_on-key-fn        (or on-key-fn
+          on-key-fn        (or on-key-fn
                                (fn default-on-key-fn [k]
                                  (async/put! key-chan k)))
-          #_#_keyListener      (reify KeyListener
-                             (keyPressed [_ e]
-                               ;(println "keyPressed keyCode" (.getKeyCode e) "escape" KeyEvent/VK_ESCAPE "escape?" (= (.getKeyCode e) KeyEvent/VK_ESCAPE))
-                               (convert-key-code e on-key-fn))
-                             (keyReleased [_ _]
-                               nil)
-                             (keyTyped [_ e]
-                               (let [character (.getKeyChar e)
-                                     numpad?   (= (.getKeyLocation e) KeyEvent/KEY_LOCATION_NUMPAD)
-                                     altDown   (not= (bit-and (.getModifiersEx e) InputEvent/ALT_DOWN_MASK) 0)
-                                     ctrlDown  (not= (bit-and (.getModifiersEx e) InputEvent/CTRL_DOWN_MASK) 0)
-                                     #_#_ignore    #{(char 10) (char 33) (char 27)}]
-                                 (when (and (re-matches #"[!-~]" (str character))
-                                            (not (re-matches #"[0-9]" (str character))))
-                                   (if ctrlDown
-                                     (on-key-fn (char (+ (int \a) -1 (int character))))
-                                     (on-key-fn character))))))
           font-metrics  ^FontMetrics (.getFontMetrics (Canvas.) @normal-font)
           char-width                 (.charWidth font-metrics \M)
           char-height                (.getHeight font-metrics)

;; it is not performant to memoize records because hashCode values are not cached and are recalculated
;; each time.

(defrecord GLCharacter [character fg-color bg-color style fx-character fx-fg-color fg-bg-color])
(defn make-terminal-character
  ([character fg-color bg-color style]
   (make-terminal-character character fg-color bg-color style nil nil nil))

  (let [terminal (make-terminal (format "Robinson - %s@%s" "demo" "glterminal")
                                80 24 [255 255 255] [5 5 8] nil
                                "Courier New" "fonts/Boxy/Boxy.ttf" 16 true)
        last-key (atom nil)
          input-chan (go-loop []
                       (reset! last-key (async/<!! (rat/get-key-chan terminal)))
                       (log/info "got key" (or (str @last-key) "nil"))
                       (recur))]
    ;; get key presses in fg thread
    (loop []
      (when (not (Display/isCloseRequested))
        (let [key-in (or @last-key \?)]
          (dosync
            (rat/clear! terminal)
            (put-string terminal 0 0 "Hello world 0 0")
            (put-string terminal 0 1 "abcdefghijklmno")
            (doseq [[i c] (take 23 (map-indexed (fn [i c] [i (char c)]) (range (int \a) (int \z))))]
              (put-string terminal 0 i (str c) [128 (+ i 100) 0] [0 0 50]))
            (put-string terminal 60 0 "Hello world 60 0" [128 0 0] [0 0 128])
            (put-string terminal 0 19 "Hello world 60 19" [0 128 0] [128 0 0])
            (put-string terminal 60 19 "Hello world 0 19" [0 0 128] [0 128 0])
            (put-string terminal 5 10 (str key-in))
            (rat/refresh! terminal)))
        (recur)))
    (locking terminal
      (log/info "shutting down")
      (async/close! input-chan)
      (Display/makeCurrent)
      (Display/destroy)))
  (System/exit 0))