Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

Commit

Permalink
fix offsetting column
Browse files Browse the repository at this point in the history
  • Loading branch information
rksm committed Mar 29, 2015
1 parent fd949ae commit e547013
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/rksm/cloxp_source_reader/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@
raw-str (purge-string! rdr)
lines (s/split-lines raw-str)
; trim surrounding whitespace and offset line / column accordingly
no-ws-lines (take-while #(re-find #"^\s*(;.*)?$" %) lines)
src-lines (drop (count no-ws-lines) lines)
ws-lines (take-while #(re-find #"^\s*(;.*)?$" %) lines)
src-lines (drop (count ws-lines) lines)
[_ leading-ws first-line-content] (re-matches #"^(\s*)(.*)" (first src-lines))
src-lines (assoc (vec src-lines) 0 first-line-content)
src (s/join "\n" src-lines)
line (+ start-line (count no-ws-lines))
column (+ start-column (count leading-ws))
line (+ start-line (count ws-lines))
column (+ (if (> (count ws-lines) 0) 1 start-column) (count leading-ws))
meta (meta o)
def? (def? o)
name (if def? (name-of-def o))]
Expand Down

0 comments on commit e547013

Please sign in to comment.