]> git.cameronkatri.com Git - mandoc.git/blobdiff - term.c
Tedu support for the -xsh4.2 argument to the mdoc(7) .St macro
[mandoc.git] / term.c
diff --git a/term.c b/term.c
index 3aa07694ea29ebf2a05a64d36f440470a002779a..70ca20c440c57a0cfac04e7a67c9310c42581dec 100644 (file)
--- a/term.c
+++ b/term.c
@@ -1,7 +1,7 @@
-/* $Id: term.c,v 1.282 2020/09/02 16:40:36 schwarze Exp $ */
+/* $Id: term.c,v 1.285 2022/01/10 18:01:35 schwarze Exp $ */
 /*
+ * Copyright (c) 2010-2022 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010-2020 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
@@ -58,6 +58,7 @@ term_setcol(struct termp *p, size_t maxtcol)
 void
 term_free(struct termp *p)
 {
+       term_tab_free();
        for (p->tcol = p->tcols; p->tcol < p->tcols + p->maxtcol; p->tcol++)
                free(p->tcol->buf);
        free(p->tcols);
@@ -589,16 +590,18 @@ term_word(struct termp *p, const char *word)
                        uc = *seq;
                        break;
                case ESCAPE_FONTBOLD:
+               case ESCAPE_FONTCB:
                        term_fontrepl(p, TERMFONT_BOLD);
                        continue;
                case ESCAPE_FONTITALIC:
+               case ESCAPE_FONTCI:
                        term_fontrepl(p, TERMFONT_UNDER);
                        continue;
                case ESCAPE_FONTBI:
                        term_fontrepl(p, TERMFONT_BI);
                        continue;
                case ESCAPE_FONT:
-               case ESCAPE_FONTCW:
+               case ESCAPE_FONTCR:
                case ESCAPE_FONTROMAN:
                        term_fontrepl(p, TERMFONT_NONE);
                        continue;
@@ -633,12 +636,14 @@ term_word(struct termp *p, const char *word)
                        if (a2roffsu(seq, &su, SCALE_EM) == NULL)
                                continue;
                        uc += term_hen(p, &su);
-                       if (uc > 0)
-                               while (uc-- > 0)
+                       if (uc > 0) {
+                               while (uc > 0) {
                                        bufferc(p, ASCII_NBRSP);
-                       else if (p->col > (size_t)(-uc))
+                                       uc -= term_len(p, 1);
+                               }
+                       } else if (p->col > (size_t)(-uc)) {
                                p->col += uc;
-                       else {
+                       else {
                                uc += p->col;
                                p->col = 0;
                                if (p->tcol->offset > (size_t)(-uc)) {