summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-11-08 07:15:53 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-11-08 07:15:53 -0800
commitcc73eb8ce1ce45e248c57003f5bb176c42bf688e (patch)
tree73ec62874e0c530e85ceb343423b3c9a916d4140
parent372315055a4437b02aa4efc3e60c2ac4b1565677 (diff)
downloadtxr-cc73eb8ce1ce45e248c57003f5bb176c42bf688e.tar.gz
txr-cc73eb8ce1ce45e248c57003f5bb176c42bf688e.tar.bz2
txr-cc73eb8ce1ce45e248c57003f5bb176c42bf688e.zip
hash: spurious space in printed representation.
* hash.c (hash_print_op): Only set the need_space flag if some leading item is printed.
-rw-r--r--hash.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/hash.c b/hash.c
index 54ebc9dc..2a85d2f6 100644
--- a/hash.c
+++ b/hash.c
@@ -510,17 +510,21 @@ static void hash_print_op(val hash, val out, val pretty, struct strm_ctx *ctx)
put_char(chr('('), out);
if (opt_compat && opt_compat <= 188) {
- if (h->hops == &hash_eq_ops)
+ if (h->hops == &hash_eq_ops) {
obj_print_impl(eq_based_k, out, pretty, ctx);
- else if (h->hops == &hash_equal_ops)
+ need_space = 1;
+ } else if (h->hops == &hash_equal_ops) {
obj_print_impl(equal_based_k, out, pretty, ctx);
- need_space = 1;
+ need_space = 1;
+ }
} else {
- if (h->hops == &hash_eql_ops)
+ if (h->hops == &hash_eql_ops) {
obj_print_impl(eql_based_k, out, pretty, ctx);
- else if (h->hops == &hash_eq_ops)
+ need_space = 1;
+ } else if (h->hops == &hash_eq_ops) {
obj_print_impl(eq_based_k, out, pretty, ctx);
- need_space = 1;
+ need_space = 1;
+ }
}
if (h->wkopt != hash_weak_none) {