             (set! (.text command) "")
             (set! (.doit command) false)))
         (set! (.shiftsCaret command) false)
-        (set! (.caretOffset command) (:offset result))))))+        (set! (.caretOffset command) (:offset result))
+        (when-not (zero? (:length result)) 
+          (println (str "result:" result))
+          (.selectAndReveal (-> this .state deref :editor) (:offset result) (:length result)))))))
  [editor preference-store] [[] (ref {:editor editor :prefs-store preference-store})])   

; TODO move this into paredit itself ...
(def *one-char-command* 
  {"(" :paredit-open-round 
   "[" :paredit-open-square
   "{" :paredit-open-curly
   ")" :paredit-close-round
   "]" :paredit-close-square
   "}" :paredit-close-curly
   "\"" :paredit-doublequote
   "\t" :paredit-indent-line
   "\n" :paredit-newline
   })

(defn- call-paredit [command document-text]
  (cond
    (and (zero? (:length command)) ; TODO enhance to also handle the replace of a bunch of text
         (contains? *one-char-command* (:text command)))
      (paredit (get *one-char-command* (:text command))
               {:text (:text document-text) 
                :offset (:offset command) 
                :length 0})
    (and (zero? (-> command #^String (:text) .length))
         (= 1 (:length command)))
      (let [paredit-command (if (= (:offset command) (:caret-offset document-text)) 

  (when (and (paredit-enabled? (-> this .state deref :prefs-store))
             (.doit command))
    (let [signed-selection (bean (-> this .state deref #^ccw.editors.antlrbased.AntlrBasedClojureEditor (:editor) .getSignedSelection))
          _ (println (str "signed-selection:" signed-selection))
          document-text {:text (.get document) 
                         :caret-offset (+ (:offset signed-selection) (:length signed-selection)) 
                         :selection-length (:length signed-selection)}
          par-command {:text (.text command) :offset (.offset command) :length (.length command)}
          _ (println (str "par-command:" par-command))
          result (call-paredit par-command document-text)]
      (when (and result (not= :ko (-> result :parser-state)))
        (if-let [modif (-?> result :modifs first)]
