From 4a91bb027e8d7bb9ab2dfb3b2516f7a3b15cfdcb Mon Sep 17 00:00:00 2001 From: Andrew Davison Date: Sun, 23 Jul 2023 19:11:02 +1000 Subject: [PATCH] Fix lack of closing brace (was parenthesis instead), re issue #280 --- src/print.c | 6 +++--- tests/tests/test093.expected | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/print.c b/src/print.c index 045a2665e..17da4ea50 100644 --- a/src/print.c +++ b/src/print.c @@ -1056,11 +1056,11 @@ ssize_t print_term_to_buf(query *q, char *dst, size_t dstlen, cell *c, pl_idx c_ q->parens = parens = true; } - if (parens) - dst += snprintf(dst, dstlen, "%s", "("); + if (parens) dst += snprintf(dst, dstlen, "%s", "("); - if (q->max_depth && ((depth+1) >= q->max_depth)) { + if (q->max_depth && ((depth+(braces?0:1)) >= q->max_depth)) { dst += snprintf(dst, dstlen, "..."); + if (parens) dst += snprintf(dst, dstlen, "%s", ")"); dst += snprintf(dst, dstlen, "%s", braces&&!q->ignore_ops?"}":")"); q->last_thing = WAS_OTHER; return dst - save_dst; diff --git a/tests/tests/test093.expected b/tests/tests/test093.expected index 345ddd61f..c182fedc7 100644 --- a/tests/tests/test093.expected +++ b/tests/tests/test093.expected @@ -1,6 +1,6 @@ [[...|[...]]|_5] +_6- +_7 -+_6- +_7- +_8 +... - ... - +_8 (-_9)* -_10 []*[]*[] _6=:= -_7-1