From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s1GCXe5I025113 for ; Sun, 16 Feb 2014 07:33:40 -0500 (EST) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id s1GCXelP000827; Sun, 16 Feb 2014 07:33:40 -0500 (EST) Date: Sun, 16 Feb 2014 07:33:40 -0500 (EST) Message-Id: <201402161233.s1GCXelP000827@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: when indenting, extend the right margin accordingly, when X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- when indenting, extend the right margin accordingly, when needed; fixes a crash reported by blambert@ and a few other, similar ones Modified Files: -------------- mdocml: man_term.c mdoc_term.c Revision Data ------------- Index: man_term.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_term.c,v retrieving revision 1.139 retrieving revision 1.140 diff -Lman_term.c -Lman_term.c -u -p -r1.139 -r1.140 --- man_term.c +++ man_term.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons - * Copyright (c) 2010, 2011, 2012, 2013 Ingo Schwarze + * Copyright (c) 2010-2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -658,7 +658,8 @@ pre_IP(DECL_ARGS) return(0); case (MAN_BODY): p->offset = mt->offset + len; - p->rmargin = p->maxrmargin; + p->rmargin = p->maxrmargin > p->offset ? + p->maxrmargin : p->offset; break; default: break; @@ -748,7 +749,8 @@ pre_TP(DECL_ARGS) return(0); case (MAN_BODY): p->offset = mt->offset + len; - p->rmargin = p->maxrmargin; + p->rmargin = p->maxrmargin > p->offset ? + p->maxrmargin : p->offset; p->trailspace = 0; p->flags &= ~TERMP_NOBREAK; break; @@ -909,8 +911,9 @@ pre_RS(DECL_ARGS) sz = (size_t)ival; mt->offset += sz; - p->rmargin = p->maxrmargin; - p->offset = mt->offset < p->rmargin ? mt->offset : p->rmargin; + p->offset = mt->offset; + p->rmargin = p->maxrmargin > p->offset ? + p->maxrmargin : p->offset; if (++mt->lmarginsz < MAXMARGINS) mt->lmargincur = mt->lmarginsz; Index: mdoc_term.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v retrieving revision 1.258 retrieving revision 1.259 diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.258 -r1.259 --- mdoc_term.c +++ mdoc_term.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2010, 2012, 2013 Ingo Schwarze + * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze * Copyright (c) 2013 Franco Fichtner * * Permission to use, copy, modify, and distribute this software for any @@ -873,8 +873,11 @@ termp_it_pre(DECL_ARGS) assert(width); if (MDOC_HEAD == n->type) p->rmargin = p->offset + width; - else + else { p->offset += width; + if (p->rmargin < p->offset) + p->rmargin = p->offset; + } break; case (LIST_column): assert(width); -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv