=================================================================== RCS file: /cvs/mandoc/roff.c,v retrieving revision 1.274 retrieving revision 1.275 diff -u -p -r1.274 -r1.275 --- mandoc/roff.c 2015/08/29 21:37:20 1.274 +++ mandoc/roff.c 2015/08/29 23:56:01 1.275 @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.274 2015/08/29 21:37:20 schwarze Exp $ */ +/* $Id: roff.c,v 1.275 2015/08/29 23:56:01 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze @@ -1484,9 +1484,7 @@ roff_res(struct roff *r, struct buf *buf, int ln, int } /* - * Process text streams: - * Convert all breakable hyphens into ASCII_HYPH. - * Decrement and spring input line trap. + * Process text streams. */ static enum rofferr roff_parsetext(struct buf *buf, int pos, int *offs) @@ -1497,6 +1495,22 @@ roff_parsetext(struct buf *buf, int pos, int *offs) int isz; enum mandoc_esc esc; + /* Spring the input line trap. */ + + if (roffit_lines == 1) { + isz = mandoc_asprintf(&p, "%s\n.%s", buf->buf, roffit_macro); + free(buf->buf); + buf->buf = p; + buf->sz = isz + 1; + *offs = 0; + free(roffit_macro); + roffit_lines = 0; + return(ROFF_REPARSE); + } else if (roffit_lines > 1) + --roffit_lines; + + /* Convert all breakable hyphens into ASCII_HYPH. */ + start = p = buf->buf + pos; while (*p != '\0') { @@ -1525,19 +1539,6 @@ roff_parsetext(struct buf *buf, int pos, int *offs) *p = ASCII_HYPH; p++; } - - /* Spring the input line trap. */ - if (roffit_lines == 1) { - isz = mandoc_asprintf(&p, "%s\n.%s", buf->buf, roffit_macro); - free(buf->buf); - buf->buf = p; - buf->sz = isz + 1; - *offs = 0; - free(roffit_macro); - roffit_lines = 0; - return(ROFF_REPARSE); - } else if (roffit_lines > 1) - --roffit_lines; return(ROFF_CONT); }