1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-26 00:10:27 +00:00

Fix flag check in pretty print.

This commit is contained in:
Calvin Rose 2020-04-28 10:00:24 -05:00
parent 70e1f3ac81
commit 63e9790123
2 changed files with 6 additions and 5 deletions

View File

@ -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"}))

View File

@ -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;