summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/annotate.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/annotate.h b/src/annotate.h
index 878d6148..37ee0685 100644
--- a/src/annotate.h
+++ b/src/annotate.h
@@ -265,9 +265,14 @@ public:
virtual void print(std::ostream& out, bool elide_quotes = false,
bool print_annotations = false) const {
- commodity_t::print(out, elide_quotes);
- if (print_annotations)
- write_annotations(out);
+ if (print_annotations) {
+ std::ostringstream buf;
+ commodity_t::print(buf, elide_quotes);
+ write_annotations(buf);
+ out << buf.str();
+ } else {
+ commodity_t::print(out, elide_quotes);
+ }
}
virtual void write_annotations(std::ostream& out,