source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: tables leak tab settings to subsequent text
@ 2017-06-17 14:56 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-06-17 14:56 UTC (permalink / raw)
  To: source

Log Message:
-----------
tables leak tab settings to subsequent text

Modified Files:
--------------
    mdocml:
        tbl_term.c
        term.h
        term_tab.c
    mdocml/regress/tbl/data:
        block_width.in
        block_width.out_ascii
    mdocml/regress/tbl/layout:
        center.in
        center.out_ascii
        span.in
        span.out_ascii
    mdocml/regress/tbl/mod:
        expand.in
        expand.out_ascii
        font.in
        font.out_ascii
        font.out_lint

Revision Data
-------------
Index: block_width.out_ascii
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/tbl/data/block_width.out_ascii,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/tbl/data/block_width.out_ascii -Lregress/tbl/data/block_width.out_ascii -u -p -r1.1 -r1.2
--- regress/tbl/data/block_width.out_ascii
+++ regress/tbl/data/block_width.out_ascii
@@ -60,4 +60,7 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
      |a | b | c | d | e | f | g | 1234567   |
      |  |   |   |   |   |   |   | 90        |
      +--+---+---+---+---+---+---+-----------+
+     leaked tab settings:
+       b   c   d   e   f   g   h
+
 OpenBSD                          June 15, 2017                         OpenBSD
Index: block_width.in
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/tbl/data/block_width.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/tbl/data/block_width.in -Lregress/tbl/data/block_width.in -u -p -r1.1 -r1.2
--- regress/tbl/data/block_width.in
+++ regress/tbl/data/block_width.in
@@ -100,3 +100,7 @@ a:b:c:d:e:f:g:T{
 1234567 90
 T}
 .TE
+.sp
+leaked tab settings:
+.br
+\&	b	c	d	e	f	g	h
Index: center.in
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/tbl/layout/center.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/tbl/layout/center.in -Lregress/tbl/layout/center.in -u -p -r1.1 -r1.2
--- regress/tbl/layout/center.in
+++ regress/tbl/layout/center.in
@@ -20,3 +20,7 @@ r c l .
 ****:****:****
 *****:*****:*****
 .TE
+.sp
+leaked tab settings:
+.br
+a	b	c	de
Index: span.out_ascii
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/tbl/layout/span.out_ascii,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/tbl/layout/span.out_ascii -Lregress/tbl/layout/span.out_ascii -u -p -r1.2 -r1.3
--- regress/tbl/layout/span.out_ascii
+++ regress/tbl/layout/span.out_ascii
@@ -36,6 +36,9 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
        +--+---+---+---+---+
        |a | b | c | d | e |
        +--+---+---+---+---+
+       leaked tab settings:
+       a b   c   d   e   f
+
 
 
                                                             TBL-LAYOUT-SPAN(1)
Index: span.in
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/tbl/layout/span.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/tbl/layout/span.in -Lregress/tbl/layout/span.in -u -p -r1.2 -r1.3
--- regress/tbl/layout/span.in
+++ regress/tbl/layout/span.in
@@ -48,3 +48,7 @@ a:b:c:d:e
 s1:s2
 a:b:c:d:e
 .TE
+.sp
+leaked tab settings:
+.br
+a	b	c	d	e	f
Index: center.out_ascii
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/tbl/layout/center.out_ascii,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/tbl/layout/center.out_ascii -Lregress/tbl/layout/center.out_ascii -u -p -r1.1 -r1.2
--- regress/tbl/layout/center.out_ascii
+++ regress/tbl/layout/center.out_ascii
@@ -17,6 +17,9 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
         ****   ****    ****
        *****   *****   *****
 
+       leaked tab settings:
+       a    b       c       de
+
 
 
                                                           TBL-LAYOUT-CENTER(1)
Index: term.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/term.h,v
retrieving revision 1.128
retrieving revision 1.129
diff -Lterm.h -Lterm.h -u -p -r1.128 -r1.129
--- term.h
+++ term.h
@@ -146,6 +146,7 @@ size_t		  term_strlen(const struct termp
 size_t		  term_len(const struct termp *, size_t);
 
 void		  term_tab_set(const struct termp *, const char *);
+void		  term_tab_iset(size_t);
 size_t		  term_tab_next(size_t);
 
 void		  term_fontpush(struct termp *, enum termfont);
Index: term_tab.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/term_tab.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lterm_tab.c -Lterm_tab.c -u -p -r1.3 -r1.4
--- term_tab.c
+++ term_tab.c
@@ -88,6 +88,21 @@ term_tab_set(const struct termp *p, cons
 	tl->n++;
 }
 
+/*
+ * Simplified version without a parser,
+ * never incremental, never periodic, for use by tbl(7).
+ */
+void
+term_tab_iset(size_t inc)
+{
+	if (tabs.a.n >= tabs.a.s) {
+		tabs.a.s += 8;
+		tabs.a.t = mandoc_reallocarray(tabs.a.t, tabs.a.s,
+		    sizeof(*tabs.a.t));
+	}
+	tabs.a.t[tabs.a.n++] = inc;
+}
+
 size_t
 term_tab_next(size_t prev)
 {
Index: tbl_term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/tbl_term.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -Ltbl_term.c -Ltbl_term.c -u -p -r1.53 -r1.54
--- tbl_term.c
+++ tbl_term.c
@@ -93,6 +93,17 @@ term_tbl(struct termp *tp, const struct 
 
 		tblcalc(&tp->tbl, sp, tp->tcol->offset, tp->tcol->rmargin);
 
+		/* Tables leak .ta settings to subsequent text. */
+
+		term_tab_set(tp, NULL);
+		coloff = sp->opts->opts & (TBL_OPT_BOX | TBL_OPT_DBOX) ||
+		    sp->opts->lvert;
+		for (ic = 0; ic < sp->opts->cols; ic++) {
+			coloff += tp->tbl.cols[ic].width;
+			term_tab_iset(coloff);
+			coloff += 3;
+		}
+
 		/* Center the table as a whole. */
 
 		offset = tp->tcol->offset;
Index: font.out_ascii
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/tbl/mod/font.out_ascii,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/tbl/mod/font.out_ascii -Lregress/tbl/mod/font.out_ascii -u -p -r1.1 -r1.2
--- regress/tbl/mod/font.out_ascii
+++ regress/tbl/mod/font.out_ascii
@@ -14,6 +14,9 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
        |_\bi_\bt_\ba_\bl_\bi_\bc | roman |  b\bbo\bol\bld\bd  |
        | _\ba_\bn_\bd   |  so   |   o\bon\bn   |
        +-------+-------+--------+
+       leaked tab settings:
+       a      b       c        de
+
 
 
 OpenBSD                        February 10, 2015               TBL-MOD-FONT(1)
Index: font.out_lint
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/tbl/mod/font.out_lint,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/tbl/mod/font.out_lint -Lregress/tbl/mod/font.out_lint -u -p -r1.1 -r1.2
--- regress/tbl/mod/font.out_lint
+++ regress/tbl/mod/font.out_lint
@@ -1 +1,5 @@
 mandoc: font.in:8:6: WARNING: unknown font, skipping request: TS fCW|ci
+mandoc: font.in:18:2: WARNING: tab in filled text
+mandoc: font.in:18:4: WARNING: tab in filled text
+mandoc: font.in:18:6: WARNING: tab in filled text
+mandoc: font.in:18:8: WARNING: tab in filled text
Index: font.in
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/tbl/mod/font.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/tbl/mod/font.in -Lregress/tbl/mod/font.in -u -p -r1.1 -r1.2
--- regress/tbl/mod/font.in
+++ regress/tbl/mod/font.in
@@ -12,3 +12,7 @@ _
 italic:roman:bold
 and:so:on
 .TE
+.sp
+leaked tab settings:
+.br
+a	b	c	d	e
Index: expand.out_ascii
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/tbl/mod/expand.out_ascii,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/tbl/mod/expand.out_ascii -Lregress/tbl/mod/expand.out_ascii -u -p -r1.1 -r1.2
--- regress/tbl/mod/expand.out_ascii
+++ regress/tbl/mod/expand.out_ascii
@@ -96,6 +96,9 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
 
        x    x    x   x    x    123456789012345678901234567890123456789012    x
 
+       leaked tab settings:
+       a b    c   d    e    f                                            g    h
+
 
 
 OpenBSD                        January 27, 2015              TBL-MOD-EXPAND(1)
Index: expand.in
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/tbl/mod/expand.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/tbl/mod/expand.in -Lregress/tbl/mod/expand.in -u -p -r1.1 -r1.2
--- regress/tbl/mod/expand.in
+++ regress/tbl/mod/expand.in
@@ -223,3 +223,9 @@ tab(:);
 lx lx lx lx lx l rx.
 x:x:x:x:x:123456789012345678901234567890123456789012:x
 .TE
+.sp
+.nf
+leaked tab settings:
+.br
+a	b	c	d	e	f	g	h
+.fi
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-17 14:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-17 14:56 mdocml: tables leak tab settings to subsequent text schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).