From 7874e45779408174de8e5c8607ed80563819f452 Mon Sep 17 00:00:00 2001 From: Ian Holmes Date: Fri, 26 Jun 2015 14:21:26 -0400 Subject: [PATCH] Fixed output bug where branch length is not printed on branches to leaf nodes --- knhx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/knhx.c b/knhx.c index 8dbd3b6..7448e46 100644 --- a/knhx.c +++ b/knhx.c @@ -133,7 +133,13 @@ static void format_node_recur(const knhx1_t *node, const knhx1_t *p, kstring_t * sprintf(numbuf, ":%g", p->d); kputsn(numbuf, strlen(numbuf), s); } - } else kputsn(p->name, strlen(p->name), s); + } else { + kputsn(p->name, strlen(p->name), s); + if (p->d >= 0) { + sprintf(numbuf, ":%g", p->d); + kputsn(numbuf, strlen(numbuf), s); + } + } } void kn_format(const knhx1_t *node, int root, kstring_t *s) // TODO: get rid of recursion