diff --git a/src/main/shadow/cljs/ui/components/inspect.cljs b/src/main/shadow/cljs/ui/components/inspect.cljs index fecb1f90..5fd33be2 100644 --- a/src/main/shadow/cljs/ui/components/inspect.cljs +++ b/src/main/shadow/cljs/ui/components/inspect.cljs @@ -1,5 +1,6 @@ (ns shadow.cljs.ui.components.inspect (:require + [clojure.string :as str] [goog.math :as math] [shadow.dom :as dom] [shadow.arborist :as sa] @@ -24,11 +25,10 @@ (<< [:svg {:width "24" :height "24" :viewBox "0 0 24 24" :fill "none" :xmlns "http://www.w3.org/2000/svg"} [:path {:d "M15 19L8 12L15 5" :stroke "#4A5568" :stroke-width "2" :stroke-linecap "round" :stroke-linejoin "round"}]])) -(defn render-edn-limit [[limit-reached text]] - (if limit-reached - (str text " ...") - - text)) +(defn render-edn-limit [text] + (if (str/starts-with? text "1,") + (str (subs text 2) " ...") + (subs text 2))) (defc ui-object-as-text [ident attr active?] (bind data diff --git a/src/main/shadow/remote/runtime/obj_support.cljc b/src/main/shadow/remote/runtime/obj_support.cljc index 830fc55e..1f0b73da 100644 --- a/src/main/shadow/remote/runtime/obj_support.cljc +++ b/src/main/shadow/remote/runtime/obj_support.cljc @@ -237,7 +237,7 @@ (str "Execution error:\n" ;; can be any object, really no hope in making this any kind of readable ;; capping it so throwing something large doesn't blow up the REPL - " " (second (lw/pr-str-limit ex 200)) "\n" + " " (subs (lw/pr-str-limit ex 200) 2) "\n" "\n")) :clj diff --git a/src/main/shadow/remote/runtime/writer.clj b/src/main/shadow/remote/runtime/writer.clj index 2fb23937..ad6fa9e7 100644 --- a/src/main/shadow/remote/runtime/writer.clj +++ b/src/main/shadow/remote/runtime/writer.clj @@ -6,9 +6,9 @@ (try (binding [*out* lw] (pr obj)) - [false (.getString lw)] + (str "0," (.getString lw)) (catch LimitWriter$LimitReachedException e - [true (.getString lw)])))) + (str "1," (.getString lw)))))) (defn limit-writer [limit] (LimitWriter. limit)) diff --git a/src/main/shadow/remote/runtime/writer.cljs b/src/main/shadow/remote/runtime/writer.cljs index 1611e7d5..3f566c7f 100644 --- a/src/main/shadow/remote/runtime/writer.cljs +++ b/src/main/shadow/remote/runtime/writer.cljs @@ -18,15 +18,15 @@ writer (LimitWriter. sb limit)] (try (pr-writer obj writer (pr-opts)) - [false (.toString sb)] + (str "0," (.toString sb)) (catch :default e (if-not (keyword-identical? ::limit-reached (:tag (ex-data e))) (throw e) - [true - (let [s (.toString sb)] - (if (> (.-length s) limit) - (subs s 0 limit) - s))]))))) + (str "1," + (let [s (.toString sb)] + (if (> (.-length s) limit) + (subs s 0 limit) + s)))))))) (defn limit-writer [limit] (let [sb (StringBuffer.)]