   (reify KeyListener
     (keyReleased [this e] nil)
     (keyTyped [this e]
-      (when (and @enable-advanced? (special-codes (.getKeyCode e)))
+      (when (and @enable-advanced?
+                 (get #{"(" ")" "[" "]" "{" "}" "\""}
+                      (str (.getKeyChar e))))
         (.consume e)))
     (keyPressed [this e]
       (when-not (.isConsumed e)
         (let [k (convert-key-event e)
-              p (exec-paredit! k w buffer enable-default? enable-advanced?)]
+              p (exec-paredit k w buffer enable-default? enable-advanced?)]
           (when p (.consume e)))))))
-
-(defn convert-input-method-event
-  [event]
-  ["M" (os-x-charmap (str (.first (.getText event))))])
 
 (defn input-method-event-handler
   [w buffer enable-default? enable-advanced?]
   (reify InputMethodListener
     (inputMethodTextChanged [this e]
       (let [k (convert-input-method-event e)
-            p (exec-paredit! k w buffer enable-default? enable-advanced?)]
+            p (exec-paredit k w buffer enable-default? enable-advanced?)]
         (when p (.consume e))))))
 
 (defn init-paredit!

                           :length (- (.getSelectionEnd widget)
                                      (.getSelectionStart widget))})))

(defn insert-result!
  [w pe]
  (dorun
    (map #(if (= 0 (:length %))

   ["M" "{"] :paredit-open-curly
   ["M" "}"] :paredit-close-curly})

(defn exec-paredit
  [k w buffer enable-default? enable-advanced?]
  (when-let [cmd (or (and enable-default?
                          (default-keymap k))
                     (and @enable-advanced?
                          (or (advanced-keymap k)
                              (foreign-keymap k))))]
    (let [result (exec-command cmd w buffer)]
      (insert-result w result))
    cmd))

(defn convert-input-method-event
  [event]
  ["M" (os-x-charmap (str (.first (.getText event))))])

(defn convert-key-event
  [event]
