           (.setCursor cm (.-line cur) (inc (.-ch cur))))
       (.operation cm
                        (fn []
-                           (.replaceRange cm pair cur)
-                           ; CHANGED: use aget instead of -line
-                           (.setCursor cm (aget cur "line") (inc (aget cur "ch")))
-                           (.indentLine cm (aget cur "line")))))))
+                         (.replaceRange cm pair cur)
+                         ; Using aget instead of -line because (.-line cur) was returning nil
+                         (.setCursor cm (aget cur "line") (inc (aget cur "ch")))
+                         (.indentLine cm (aget cur "line")))))))
 
 (defn ^:export forward-delete [cm]
   (if (nothing-selected? cm)

;; operations -- those belong in subpar.paredit.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(enable-console-print!)

(defn get-index [cm]
  (.indexFromPos cm (.getCursor cm)))


(ns subpar.core
  (:use [subpar.paredit :only [parse
                               in-string  ; takes string
                               in-string? ; takes parse output
                               forward-delete-action
