       (-> loc zip/node :offset)))
 
 (defn end-offset [loc]
-  (+ (start-offset loc) (.length ^String (loc-text loc))))
+  (+ (start-offset loc) (loc-count loc)))
 
 (defn loc-col [loc]
   (loop [loc (zip/prev loc) col 0]

  [loc]
  (and loc (remove zip/branch? (take-while (complement nil?) (iterate zip/prev (zip/prev loc))))))

(defn loc-text [loc]
  (apply str (map zip/node 
               (filter (comp string? zip/node) (zf/descendants loc)))))

(declare end-offset)

(defn start-offset [loc]
  (cond
    (nil? loc) 0
    (string? (zip/node loc))

(ns paredit.loc-utils
  (:require [clojure.zip :as zip])
  (:require [clojure.contrib.zip-filter :as zf]))

(defn loc-text [loc]
  (apply str (map zip/node 
               (filter (comp string? zip/node) (zf/descendants loc)))))

(defn loc-count [loc]
  (.length ^String (loc-text loc)))

(defn ^String loc-tag [loc]
  (and loc 
