- len = add_quoted_string(buffer, sizeof(buffer), len, dive->location);
- len = add_quoted_string(buffer, sizeof(buffer), len, dive->notes);
+ /*
+ * Leave an empty line even if no location: otherwise the notes can
+ * overrun the depth/duration information.
+ */
+ if (dive->location)
+ len = add_quoted_string(buffer, sizeof(buffer), len, dive->location);
+ else
+ len = add_char(buffer, sizeof(buffer), len, '\n');
+
+ if (dive->notes) {
+ len = add_char(buffer, sizeof(buffer), len, '\n');
+ len = add_quoted_string(buffer, sizeof(buffer), len, dive->notes);
+ }
+
+ pango_layout_set_justify(layout, 1);
+ pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END);
+ pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
+ pango_layout_set_markup(layout, buffer, len);