From 609533e88ddddf14efcc6e4ded5dcc6fa317acb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=B6hler?= Date: Tue, 16 Sep 2008 22:59:52 +0000 Subject: [PATCH] When printing negative quotients, use a minus between the integer and fraction part. Previously: print g_n_c(-4, 3) => "-1 + 1/3", now "-1 - 1/3". BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17533 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/app-utils/gnc-ui-util.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app-utils/gnc-ui-util.c b/src/app-utils/gnc-ui-util.c index 283dc4bc29..5d888c0223 100644 --- a/src/app-utils/gnc-ui-util.c +++ b/src/app-utils/gnc-ui-util.c @@ -1260,7 +1260,7 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info) char temp_buf[128]; gnc_numeric whole, rounding; int min_dp, max_dp; - gboolean value_is_decimal; + gboolean value_is_negative, value_is_decimal; g_return_val_if_fail (info != NULL, 0); @@ -1271,7 +1271,8 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info) return 0; } - /* print the absolute value */ + /* Print the absolute value, but remember negativity */ + value_is_negative = gnc_numeric_negative_p (val); val = gnc_numeric_abs (val); /* Try to print as decimal. */ @@ -1400,6 +1401,8 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info) if (whole.num == 0) *buf = '\0'; + else if (value_is_negative) + strcat(buf, " - "); else strcat(buf, " + ");