summaryrefslogtreecommitdiffstats
path: root/term.c
diff options
context:
space:
mode:
Diffstat (limited to 'term.c')
-rw-r--r--term.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/term.c b/term.c
index 39dbf2e1..a8f2d3f0 100644
--- a/term.c
+++ b/term.c
@@ -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)
{