]> git.cameronkatri.com Git - mandoc.git/blobdiff - tree.c
More accurately represent cells containing horizontal lines in -T tree
[mandoc.git] / tree.c
diff --git a/tree.c b/tree.c
index fb9df9d7d66b50f42197f1c756ff2a08d238b79e..7c1c662d234c030a544c80d65134ec544aba691d 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -1,7 +1,7 @@
-/* $Id: tree.c,v 1.89 2020/04/08 11:56:04 schwarze Exp $ */
+/* $Id: tree.c,v 1.92 2022/01/12 04:54:05 schwarze Exp $ */
 /*
- * Copyright (c) 2013-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2013-2015, 2017-2022 Ingo Schwarze <schwarze@openbsd.org>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -471,10 +471,30 @@ print_span(const struct tbl_span *sp, int indent)
                        else {
                                printf("%d", cp->col);
                                print_cellt(dp->layout->pos);
-                               if (cp->flags & TBL_CELL_BOLD)
+                               switch (cp->font) {
+                               case ESCAPE_FONTROMAN:
+                                       break;
+                               case ESCAPE_FONTBOLD:
                                        putchar('b');
-                               if (cp->flags & TBL_CELL_ITALIC)
+                                       break;
+                               case ESCAPE_FONTITALIC:
                                        putchar('i');
+                                       break;
+                               case ESCAPE_FONTBI:
+                                       fputs("bi", stdout);
+                                       break;
+                               case ESCAPE_FONTCR:
+                                       putchar('c');
+                                       break;
+                               case ESCAPE_FONTCB:
+                                       fputs("cb", stdout);
+                                       break;
+                               case ESCAPE_FONTCI:
+                                       fputs("ci", stdout);
+                                       break;
+                               default:
+                                       abort();
+                               }
                                if (cp->flags & TBL_CELL_TALIGN)
                                        putchar('t');
                                if (cp->flags & TBL_CELL_UP)
@@ -489,12 +509,16 @@ print_span(const struct tbl_span *sp, int indent)
                                        putchar('x');
                        }
                        switch (dp->pos) {
-                       case TBL_DATA_HORIZ:
                        case TBL_DATA_NHORIZ:
-                               putchar('-');
+                               putchar('\\');
+                               /* FALLTHROUGH */
+                       case TBL_DATA_HORIZ:
+                               putchar('_');
                                break;
-                       case TBL_DATA_DHORIZ:
                        case TBL_DATA_NDHORIZ:
+                               putchar('\\');
+                               /* FALLTHROUGH */
+                       case TBL_DATA_DHORIZ:
                                putchar('=');
                                break;
                        default: