aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-03-30 21:28:01 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-03-30 21:28:01 +0000
commit75c49a4fece7c409c4b5a3013a40f5f352eced01 (patch)
tree73acbdbfce6225ca87662d738bcca054d597209d /term.c
parentb1938d01834105572311aa9b06d667939309bee7 (diff)
downloadmandoc-75c49a4fece7c409c4b5a3013a40f5f352eced01.tar.gz
mandoc-75c49a4fece7c409c4b5a3013a40f5f352eced01.tar.zst
mandoc-75c49a4fece7c409c4b5a3013a40f5f352eced01.zip
Support relative arguments to .ll (increase or decrease line length).
Diffstat (limited to 'term.c')
-rw-r--r--term.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/term.c b/term.c
index 158b7d14..29c4fcb8 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.218 2014/03/23 11:25:26 schwarze Exp $ */
+/* $Id: term.c,v 1.219 2014/03/30 21:28:01 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -623,6 +623,36 @@ encode(struct termp *p, const char *word, size_t sz)
}
}
+void
+term_setwidth(struct termp *p, const char *wstr)
+{
+ struct roffsu su;
+ size_t width;
+ int iop;
+
+ if (NULL != wstr) {
+ switch (*wstr) {
+ case ('+'):
+ iop = 1;
+ wstr++;
+ break;
+ case ('-'):
+ iop = -1;
+ wstr++;
+ break;
+ default:
+ iop = 0;
+ break;
+ }
+ if ( ! a2roffsu(wstr, &su, SCALE_MAX)) {
+ wstr = NULL;
+ iop = 0;
+ }
+ }
+ width = (NULL != wstr) ? term_hspan(p, &su) : 0;
+ (*p->setwidth)(p, iop, width);
+}
+
size_t
term_len(const struct termp *p, size_t sz)
{