Skip to content

Commit

Permalink
Fix namespaced maps with :indexed-only. Issue #242.
Browse files Browse the repository at this point in the history
  • Loading branch information
kkinnear committed Jun 9, 2022
1 parent f8f8ce7 commit 10fa5e3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ THIS IS AN ALPHA RELEASE, NOT FULLY TESTED. PLEASE DO NOT USE IN PRODUCTION.

### Fixed

* Namespaced maps don't work with `:style :indent-only`. Issue #242.

## 1.2.3 - 2022-04-13

### Added
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:url "https://opensource.org/licenses/MIT",
:key "mit",
:year 2015}
:plugins [[lein-doo "0.1.10"] [lein-codox "0.10.3"] [lein-zprint "1.2.3"]]
:plugins [[lein-doo "0.1.10"] [lein-codox "0.10.3"] [lein-zprint "1.2.4"]]
:profiles {:repl {:dependencies [#_[com.taoensso/tufte "1.1.1"]
[better-cond "1.0.1"]
[olical/cljs-test-runner "3.7.0"]
Expand Down
2 changes: 2 additions & 0 deletions src/zprint/zprint.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -6983,6 +6983,8 @@
(dbg-pr options "fzprint-map* caller:" caller)
(if indent-only?
(let [options (assoc options :map-depth (inc map-depth))
; Put a namespaced map back together
l-str (if ns (str "#" ns l-str) l-str)
l-str-vec [[l-str (zcolor-map options l-str) :left]]
r-str-vec (rstr-vec options ind zloc r-str)]
(if (zero? (zcount zloc))
Expand Down
7 changes: 7 additions & 0 deletions test/zprint/zprint_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -7104,6 +7104,13 @@ i235
"(defrecord ADefrecord [f1 f2 f3]\n AProtocol\n (doit\n ([this that]\n (run! println [1 2 3])\n (let [myfn (fn ([x] (println x)) ([x y] (+ x y)))] (more stuff))\n (println this))\n\n ([this]\n (doit [this nil])))\n\n (dothat [this that])\n\n (domore [this that])\n\n AnotherProtocol\n (xdoit [this])\n\n (xdothat [this that])\n\n (xdomore [this that]))"
(zprint-str i229ua {:parse-string? true :extend {:nl-count 2, :nl-separator? true :indent 0} :fn-type-map {:fn [:none {:list {:option-fn (partial rodfn {:multi-arity-nl? true})} :next-inner {:fn-type-map {:fn nil}}}]}}))

;;
;; Namespaced maps don't work with :indexed-only
;;

(expect "#:a{:b 1}"
(zprint-str "#:a{:b 1}\n" {:parse-string? true, :style :indent-only}))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
Expand Down

0 comments on commit 10fa5e3

Please sign in to comment.