From 63e9790123ca3d40e7baeb1de7beeb4347f9cd03 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Tue, 28 Apr 2020 10:00:24 -0500 Subject: [PATCH] Fix flag check in pretty print. --- src/boot/boot.janet | 7 ++++--- src/core/pp.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 9dbc9821..f86b2c53 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -2505,7 +2505,6 @@ the repl in." [&opt chunks onsignal env] (default env (make-env)) - (defn repl-wrap [x] (pp x) x) (default chunks (fn [buf p] (getline @@ -2541,14 +2540,16 @@ (fn [f x] (if (= :dead (fiber/status f)) - (put e '_ @{:value x}) + (do + (put e '_ @{:value x}) + (printf (get e :pretty-format "%q") x) + (flush)) (if (e :debug) (enter-debugger f x) (do (debug/stacktrace f x) (eflush)))))) (run-context {:env env :chunks chunks - :expander (fn [x] [repl-wrap x]) :on-status (or onsignal (make-onsignal env 1)) :source "repl"})) diff --git a/src/core/pp.c b/src/core/pp.c index a68b3faf..dc08ee5e 100644 --- a/src/core/pp.c +++ b/src/core/pp.c @@ -527,7 +527,7 @@ static void janet_pretty_one(struct pretty *S, Janet x, int is_dict_value) { if (!isarray && !(S->flags & JANET_PRETTY_ONELINE) && len >= JANET_PRETTY_IND_ONELINE) janet_buffer_push_u8(S->buffer, ' '); if (is_dict_value && len >= JANET_PRETTY_IND_ONELINE) print_newline(S, 0); - if (len > JANET_PRETTY_ARRAY_LIMIT && !(S->flags && JANET_PRETTY_NOTRUNC)) { + if (len > JANET_PRETTY_ARRAY_LIMIT && !(S->flags & JANET_PRETTY_NOTRUNC)) { for (i = 0; i < 3; i++) { if (i) print_newline(S, 0); janet_pretty_one(S, arr[i], 0); @@ -591,7 +591,7 @@ static void janet_pretty_one(struct pretty *S, Janet x, int is_dict_value) { if (is_dict_value && len >= JANET_PRETTY_DICT_ONELINE) print_newline(S, 0); for (i = 0; i < cap; i++) { if (!janet_checktype(kvs[i].key, JANET_NIL)) { - if (counter == JANET_PRETTY_DICT_LIMIT && !(S->flags && JANET_PRETTY_NOTRUNC)) { + if (counter == JANET_PRETTY_DICT_LIMIT && !(S->flags & JANET_PRETTY_NOTRUNC)) { print_newline(S, 0); janet_buffer_push_cstring(S->buffer, "..."); break;