       (-> 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]

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

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

      (string? (zip/node loc))
        (if (.contains (zip/node loc) "\n")
          (+ col (dec (-> (zip/node loc) (.substring (.lastIndexOf (zip/node loc) "\n")) .length)))
          (recur (zip/prev loc) (+ col (loc-count loc))))
      :else
        (recur (zip/prev loc) col))))
  
(defn loc-parse-node [loc] ; wrong name, and also, will return (foo) if located at ( or at ) ... so definitely wrong name ...
  (if (string? (zip/node loc))
