aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-02-16 12:33:39 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-02-16 12:33:39 +0000
commit8a0b324b8b94885e022c49afb19b7d3a8bcc6f37 (patch)
treef37d9f3b8dec4e1167a600035dc8bbc4386154fb /mdoc_term.c
parent252902fd24cc5fe83e72673afcc66c140a42de42 (diff)
downloadmandoc-8a0b324b8b94885e022c49afb19b7d3a8bcc6f37.tar.gz
mandoc-8a0b324b8b94885e022c49afb19b7d3a8bcc6f37.tar.zst
mandoc-8a0b324b8b94885e022c49afb19b7d3a8bcc6f37.zip
when indenting, extend the right margin accordingly, when needed;
fixes a crash reported by blambert@ and a few other, similar ones
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 268fcae0..b27dc4ae 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,7 +1,7 @@
-/* $Id: mdoc_term.c,v 1.258 2013/12/25 21:24:12 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.259 2014/02/16 12:33:39 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de>
*
* 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);