summaryrefslogtreecommitdiffstatshomepage
path: root/term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-02-22 15:50:45 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-02-22 15:50:45 +0000
commit9d6cd65d9c0228344fd1848a9f8c9343f5434599 (patch)
tree05750bc4fec861fcaf812647a8bf34faab55eeec /term.c
parent8c0bc76f597bfa8102ebaae346815b1375f941f4 (diff)
downloadmandoc-9d6cd65d9c0228344fd1848a9f8c9343f5434599.tar.gz
mandoc-9d6cd65d9c0228344fd1848a9f8c9343f5434599.tar.zst
mandoc-9d6cd65d9c0228344fd1848a9f8c9343f5434599.zip
Initial block-display support.
Diffstat (limited to 'term.c')
-rw-r--r--term.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/term.c b/term.c
index 1b67bfc9..5b7111dc 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.7 2009/02/22 14:31:08 kristaps Exp $ */
+/* $Id: term.c,v 1.8 2009/02/22 15:50:45 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -82,6 +82,18 @@ flushln(struct termp *p)
for (j = 0; j < p->offset; j++)
putchar(' ');
+ /*
+ * If we're literal, print out verbatim.
+ */
+ if (p->flags & TERMP_LITERAL) {
+ /* FIXME: count non-printing chars. */
+ for (i = 0; i < p->col; i++)
+ putchar(p->buf[i]);
+ putchar('\n');
+ p->col = 0;
+ return;
+ }
+
for (i = 0; i < p->col; i++) {
/*
* Count up visible word characters. Control sequences
@@ -267,9 +279,10 @@ pword(struct termp *p, const char *word, size_t len)
{
size_t i;
- assert(len > 0);
+ /*assert(len > 0);*/ /* Can be, if literal. */
- if ( ! (p->flags & TERMP_NOSPACE))
+ if ( ! (p->flags & TERMP_NOSPACE) &&
+ ! (p->flags & TERMP_LITERAL))
chara(p, ' ');
p->flags &= ~TERMP_NOSPACE;
@@ -298,12 +311,17 @@ word(struct termp *p, const char *word)
{
size_t i, j, len;
- if (mdoc_isdelim(word))
- p->flags |= TERMP_NOSPACE;
+ if (p->flags & TERMP_LITERAL) {
+ pword(p, word, strlen(word));
+ return;
+ }
len = strlen(word);
assert(len > 0);
+ if (mdoc_isdelim(word))
+ p->flags |= TERMP_NOSPACE;
+
/* LINTED */
for (j = i = 0; i < len; i++) {
if ( ! isspace(word[i])) {