From c673ff428c75cbd5c602003d2d2b290a8207881e Mon Sep 17 00:00:00 2001 From: rcmerci Date: Sun, 17 May 2026 17:56:23 +0800 Subject: [PATCH] fix(cli): preserve deep preview values --- src/main/logseq/cli/log.cljs | 3 +-- src/test/logseq/cli/log_test.cljs | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/logseq/cli/log.cljs b/src/main/logseq/cli/log.cljs index 654bfba4d2..48a3172fa1 100644 --- a/src/main/logseq/cli/log.cljs +++ b/src/main/logseq/cli/log.cljs @@ -8,8 +8,7 @@ (defn- bounded-pr-str [value limit] - (binding [*print-length* (inc limit) - *print-level* 4] + (binding [*print-length* (inc limit)] (pr-str value))) (defn truncate-preview diff --git a/src/test/logseq/cli/log_test.cljs b/src/test/logseq/cli/log_test.cljs index 12291c4481..5d8190c03b 100644 --- a/src/test/logseq/cli/log_test.cljs +++ b/src/test/logseq/cli/log_test.cljs @@ -31,6 +31,14 @@ (is (= "nil" (:preview result))) (is (false? (:truncated? result))))) + (testing "preserves deep values when the preview limit is large enough" + (let [value {:a {:b {:c {:d {:e 1}}}}} + expected (pr-str value) + result (cli-log/truncate-preview value 1000)] + (is (= expected (:preview result))) + (is (= (count expected) (:length result))) + (is (false? (:truncated? result))))) + (testing "does not realize a full lazy collection for a short preview" (let [realized (atom 0) value (map (fn [n]