aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-01-22 20:58:39 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-01-22 20:58:39 +0000
commita5cf99ba0ce655c79f97727aa85c3afd804f98c9 (patch)
treee92a3c2a62fc2c363af2ca9c2aa16c0bcb34c80f /term.c
parentfbfac7f409fc3e746d03f0beb37e36723d353e48 (diff)
downloadmandoc-a5cf99ba0ce655c79f97727aa85c3afd804f98c9.tar.gz
mandoc-a5cf99ba0ce655c79f97727aa85c3afd804f98c9.tar.zst
mandoc-a5cf99ba0ce655c79f97727aa85c3afd804f98c9.zip
Implement the \: (optional line break) escape sequence,
documented in the Ossanna-Kernighan-Ritter troff manual and also supported by groff. Missing feature reported by Steffen Nurpmeso <sdaoden at gmail dot com>.
Diffstat (limited to 'term.c')
-rw-r--r--term.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/term.c b/term.c
index 79a39ff2..0d5eafd8 100644
--- a/term.c
+++ b/term.c
@@ -1,7 +1,7 @@
-/* $Id: term.c,v 1.215 2013/12/31 18:07:42 schwarze Exp $ */
+/* $Id: term.c,v 1.216 2014/01/22 20:58:39 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010, 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -179,7 +179,8 @@ term_flushln(struct termp *p)
/* Regular word. */
/* Break at the hyphen point if we overrun. */
if (vend > vis && vend < bp &&
- ASCII_HYPH == p->buf[j])
+ (ASCII_HYPH == p->buf[j] ||
+ ASCII_BREAK == p->buf[j]))
jhy = j;
vend += (*p->width)(p, p->buf[j]);
@@ -233,6 +234,8 @@ term_flushln(struct termp *p)
vbl += (*p->width)(p, ' ');
continue;
}
+ if (ASCII_BREAK == p->buf[i])
+ continue;
/*
* Now we definitely know there will be
@@ -644,7 +647,8 @@ term_strlen(const struct termp *p, const char *cp)
int ssz, skip, c;
const char *seq, *rhs;
enum mandoc_esc esc;
- static const char rej[] = { '\\', ASCII_HYPH, ASCII_NBRSP, '\0' };
+ static const char rej[] = { '\\', ASCII_NBRSP, ASCII_HYPH,
+ ASCII_BREAK, '\0' };
/*
* Account for escaped sequences within string length
@@ -732,6 +736,8 @@ term_strlen(const struct termp *p, const char *cp)
case (ASCII_HYPH):
sz += cond_width(p, '-', &skip);
cp++;
+ /* FALLTHROUGH */
+ case (ASCII_BREAK):
break;
default:
break;