diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-03-30 21:28:01 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-03-30 21:28:01 +0000 |
commit | 75c49a4fece7c409c4b5a3013a40f5f352eced01 (patch) | |
tree | 73acbdbfce6225ca87662d738bcca054d597209d /term_ascii.c | |
parent | b1938d01834105572311aa9b06d667939309bee7 (diff) | |
download | mandoc-75c49a4fece7c409c4b5a3013a40f5f352eced01.tar.gz mandoc-75c49a4fece7c409c4b5a3013a40f5f352eced01.tar.zst mandoc-75c49a4fece7c409c4b5a3013a40f5f352eced01.zip |
Support relative arguments to .ll (increase or decrease line length).
Diffstat (limited to 'term_ascii.c')
-rw-r--r-- | term_ascii.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/term_ascii.c b/term_ascii.c index 09f052c3..f40b0c2b 100644 --- a/term_ascii.c +++ b/term_ascii.c @@ -1,4 +1,4 @@ -/* $Id: term_ascii.c,v 1.23 2014/03/30 19:47:48 schwarze Exp $ */ +/* $Id: term_ascii.c,v 1.24 2014/03/30 21:28:01 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -58,7 +58,7 @@ static void ascii_begin(struct termp *); static void ascii_end(struct termp *); static void ascii_endline(struct termp *); static void ascii_letter(struct termp *, int); -static void ascii_setwidth(struct termp *, size_t); +static void ascii_setwidth(struct termp *, int, size_t); #ifdef USE_WCHAR static void locale_advance(struct termp *, size_t); @@ -161,14 +161,18 @@ locale_alloc(char *outopts) } static void -ascii_setwidth(struct termp *p, size_t width) +ascii_setwidth(struct termp *p, int iop, size_t width) { - size_t lastwidth; - lastwidth = p->defrmargin; - p->rmargin = p->maxrmargin = p->defrmargin = - width ? width : p->lastrmargin; - p->lastrmargin = lastwidth; + p->rmargin = p->defrmargin; + if (0 < iop) + p->defrmargin += width; + else if (0 > iop) + p->defrmargin -= width; + else + p->defrmargin = width ? width : p->lastrmargin; + p->lastrmargin = p->rmargin; + p->rmargin = p->maxrmargin = p->defrmargin; } /* ARGSUSED */ |